[PATCH 12/18] arm64: implement spinlocks

2015-02-01 Thread Andrew Jones
We put this off, as it wasn't necessary without smp. Now it is. Only need to do this for arm64, as we've already done it already for arm. Signed-off-by: Andrew Jones drjo...@redhat.com --- config/config-arm64.mak | 1 + lib/arm64/asm/spinlock.h | 8 ++-- lib/arm64/spinlock.c | 43

[PATCH 17/18] arm/arm64: add smp_boot_secondary

2015-02-01 Thread Andrew Jones
Add a common entry point, present/online cpu masks, and smp_boot_secondary() to support booting secondary cpus. Adds a bit more PSCI API that we need too. We also adjust THREAD_START_SP for arm to make some room for exception stacks. Signed-off-by: Andrew Jones drjo...@redhat.com ---

[PATCH 04/18] arm64: fixup: use id_aa64mmfr0_el1 to set tcr

2015-02-01 Thread Andrew Jones
We shouldn't assume we can set tcr_el1.ips to 42 bits. Set it based on what we read from id_aa64mmfr0_el1. Didn't see a problem, but might as well be correct. Signed-off-by: Andrew Jones drjo...@redhat.com --- arm/cstart64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 18/18] arm/arm64: Add smp selftest

2015-02-01 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- arm/selftest.c| 60 +++ arm/unittests.cfg | 11 -- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/arm/selftest.c b/arm/selftest.c index d77495747b08a..fc9ec609d875e

[PATCH 08/18] arm/arm64: add per thread user_mode flag

2015-02-01 Thread Andrew Jones
While current_mode() == USR_MODE works on armv7 from PL0 to check if we're in user mode, current_mode() would require reading a privileged register on armv8. To work around this, on arm64 we introduced a 'user_mode' variable. This variable needs to be per thread now. Rather than starting to

[PATCH 11/18] arm/arm64: make mmu_on per cpu

2015-02-01 Thread Andrew Jones
We introduced a variable called mmu_on to the mmu implementation because unit tests may want to run with the mmu off, yet still call into common code that could lead to {Load,Store}-Exclusive instructions - which is illegal. So, the mmu_on variable was added and made query-able (through

[PATCH 07/18] arm/arm64: introduce thread_info

2015-02-01 Thread Andrew Jones
For smp we need a way to maintain thread local state. The bottom of the thread stack is a good place, and is where Linux puts it. So we just steal the concept of the thread_info structure that lives at the bottom of the stack in Linux, and introduce it to kvm-unit-tests/arm[64]. For starters we

[PATCH 16/18] arm: clarify comment about exception stack use

2015-02-01 Thread Andrew Jones
Each mode has its own stack, but we only use it as a base pointer to a private memory region. That region, which has a size of sizeof(struct pt_regs), is used to store some registers during the switch to svc mode - which will use the normal svc stack. The switch to svc mode is done because we

[PATCH 13/18] arm/arm64: import include/uapi/linux/psci.h

2015-02-01 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/arm/asm/uapi-psci.h | 73 +++ lib/arm64/asm/uapi-psci.h | 1 + 2 files changed, 74 insertions(+) create mode 100644 lib/arm/asm/uapi-psci.h create mode 100644 lib/arm64/asm/uapi-psci.h diff

[PATCH 14/18] arm/arm64: add some PSCI API

2015-02-01 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- config/config-arm-common.mak | 1 + lib/arm/asm/psci.h | 13 + lib/arm/psci.c | 30 ++ lib/arm64/asm/psci.h | 13 + 4 files changed, 57 insertions(+) create

[PATCH 02/18] lib/report: guard access to counters

2015-02-01 Thread Andrew Jones
Use a lock to avoid exposing the counters, and any other global data, to potential races. Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/report.c | 16 1 file changed, 16 insertions(+) diff --git a/lib/report.c b/lib/report.c index dc30250c676d3..35e664108a921 100644

[PATCH 15/18] arm/arm64: add cpu_relax() and friends

2015-02-01 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/arm/asm/barrier.h | 5 + lib/arm64/asm/barrier.h | 5 + 2 files changed, 10 insertions(+) diff --git a/lib/arm/asm/barrier.h b/lib/arm/asm/barrier.h index acaeab5123431..394a4a2da26f1 100644 --- a/lib/arm/asm/barrier.h +++

[PATCH 05/18] arm/arm64: processor.[ch] cleanups

2015-02-01 Thread Andrew Jones
Add 'const' to a few global arrays that are constant. Also, no need for default_vector_handler to be static. unittests may want to reset vector handlers to it. Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/arm/processor.c | 2 +- lib/arm64/asm/processor.h | 2 ++

[PATCH 06/18] arm/arm64: get rid of get_sp()

2015-02-01 Thread Andrew Jones
get_sp() only worked by accident, because gcc inlined calls to it. It should have always been explicitly inlined. It was also only added for debugging, and not in any use now. Furthermore, while we will have need for a get_sp, we'll add it back with a new name, current_stack_pointer, in order to

[PATCH 09/18] arm/arm64: maintain per thread exception handlers

2015-02-01 Thread Andrew Jones
Add exception handlers to thread info. And, since we allow threads running in user mode to install exception handlers too (a convenience for unit test developers), check for handlers on the user mode stack thread info too. But, unit test developers will likely also expect the installation of

[PATCH 03/18] arm: fixups: add barriers, actually set MAIR

2015-02-01 Thread Andrew Jones
Sprinkle in some more isbs after context-changing operations, as the ARM ARM states we should. I haven't seen any problems without them, but we should do it right. Also, *actually* set the MAIR in asm_mmu_enable. We were reading, not writing... Luckily this was just spotted while adding the isbs,

[PATCH 10/18] arm/arm64: add simple cpumask API

2015-02-01 Thread Andrew Jones
On smp, cpumasks become quite useful. Add a simple implementation, along with implementations of bitops it needs. Signed-off-by: Andrew Jones drjo...@redhat.com --- config/config-arm-common.mak | 1 + lib/arm/asm/bitops.h | 53 +++ lib/arm/asm/cpumask.h| 118

[kvm-unit-tests PATCH 00/18] arm/arm64: add smp support

2015-02-01 Thread Andrew Jones
This series extends the kvm-unit-tests/arm[64] framework to support smp. A break down of the patches is as follows 01-02: prepare general framework for smp use 03-06: arm/arm64 fixups not 100% related to this series, but need to post some time... 07-09: add thread_info (for per-thread

[PATCH 01/18] x86: expose spin_lock/unlock to lib code

2015-02-01 Thread Andrew Jones
Move the spin_lock/unlock declarations to lib/x86/asm/spinlock.h, allowing lib code, e.g. lib/report.c, to use spinlocks. Signed-off-by: Andrew Jones drjo...@redhat.com --- lib/x86/asm/spinlock.h | 11 +++ lib/x86/smp.h | 7 +-- 2 files changed, 12 insertions(+), 6

RE: [v3 21/26] x86, irq: Define a global vector for VT-d Posted-Interrupts

2015-02-01 Thread Wu, Feng
-Original Message- From: H. Peter Anvin [mailto:h...@zytor.com] Sent: Saturday, January 31, 2015 2:19 AM To: Wu, Feng; t...@linutronix.de; mi...@redhat.com; x...@kernel.org; g...@kernel.org; pbonz...@redhat.com; dw...@infradead.org; j...@8bytes.org; alex.william...@redhat.com;

[PATCH] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-02-01 Thread David Gibson
On POWER, storage caching is usually configured via the MMU - attributes such as cache-inhibited are stored in the TLB and the hashed page table. This makes correctly performing cache inhibited IO accesses awkward when the MMU is turned off (real mode). Some CPU models provide special registers

[PATCH] kvmppc: Implement H_LOGICAL_CI_{LOAD,STORE} in KVM

2015-02-01 Thread David Gibson
On POWER, storage caching is usually configured via the MMU - attributes such as cache-inhibited are stored in the TLB and the hashed page table. This makes correctly performing cache inhibited IO accesses awkward when the MMU is turned off (real mode). Some CPU models provide special registers

Re: [PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Al Viro
On Mon, Feb 02, 2015 at 04:06:24AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also returns the next current iovec pointer

Re: [PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Al Viro
On Mon, Feb 02, 2015 at 04:44:12AM +, Al Viro wrote: On Mon, Feb 02, 2015 at 04:06:24AM +, Nicholas A. Bellinger wrote: From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following

[PATCH target] vhost/scsi: vhost_skip_iovec_bytes() can be static

2015-02-01 Thread kbuild test robot
drivers/vhost/scsi.c:1081:5: sparse: symbol 'vhost_skip_iovec_bytes' was not declared. Should it be static? Signed-off-by: Fengguang Wu fengguang...@intel.com --- scsi.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index

Re: [PATCH 1/4] stubs for xsavec support

2015-02-01 Thread Jan Kiszka
On 2015-01-08 11:32, Paolo Bonzini wrote: These are needed for KVM changes in 3.18. Recent kernels added a separate feature word for XSAVE features, and KVM's CPUID code is relying on the new definition. Except for cpu_has_xsaves, it's never accessing the feature itself: wrap cpu_has_xsaves

[PATCH-v2 06/11] vhost/scsi: Add ANY_LAYOUT vhost_skip_iovec_bytes helper

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a vhost_skip_iovec_bytes() helper for skipping ahead a number of bytes into the passed *iov_in + off_in, saving the current **iov_out + off_out so it may be used by the caller. This is useful for virtio-scsi READs when needing to skip

[PATCH-v2 11/11] vhost/scsi: Global tcm_vhost - vhost_scsi rename

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org There is a large amount of code that still references the original 'tcm_vhost' naming conventions, instead of modern 'vhost_scsi'. Go ahead and do a global rename to make the usage consistent. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini

[PATCH-v2 08/11] vhost/scsi: Set VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Signal support of VIRTIO_F_ANY_LAYOUT + VIRTIO_F_VERSION_1 feature bits required for virtio-scsi 1.0 spec layout requirements. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com Signed-off-by: Nicholas Bellinger

[PATCH-v2 07/11] vhost/scsi: Add ANY_LAYOUT vhost_virtqueue callback

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT support with a new vqs[].vq.handle_kick() callback in vhost_scsi_handle_vqal(). It calculates data_direction + exp_data_len for the new tcm_vhost_cmd descriptor by walking both outgoing + incoming iovecs, assuming the

[PATCH-v2 04/11] vhost/scsi: Change vhost_scsi_map_to_sgl to accept iov ptr + len

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch changes vhost_scsi_map_to_sgl() parameters to accept virtio iovec ptr + len when determing pages_nr. This is currently done with iov_num_pages() - PAGE_ALIGN, so allow the same parameters as well. Cc: Michael S. Tsirkin m...@redhat.com

[PATCH-v2 03/11] vhost/scsi: Fix incorrect early vhost_scsi_handle_vq failures

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch fixes vhost_scsi_handle_vq() failure cases that result in BUG_ON() getting triggered when vhost_scsi_free_cmd() is called, and -tvc_se_cmd has not been initialized by target_submit_cmd_map_sgls(). It changes tcm_vhost_release_cmd() to use

[PATCH-v2 00/11] vhost/scsi: Add ANY_LAYOUT + VERSION_1 support

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Hi MST, Paolo, Co, This -v2 series adds vhost/scsi ANY_LAYOUT + VERSION_1 host feature bit support. It adds a new vhost_virtqueue -handle_kick() callback to determine the start of protection and data payloads iovecs past starting virtio-scsi

[PATCH-v2 01/11] lib/iovec: Add memcpy_fromiovec_out library function

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds a new memcpy_fromiovec_out() library function which modifies the passed *iov following memcpy_fromiovec(), but also returns the next current iovec pointer via **iov_out. This is useful for vhost ANY_LAYOUT support when guests are

[PATCH-v2 10/11] vhost/scsi: Drop left-over scsi_tcq.h include

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the recent removal of MSG_*_TAG defines in commit 68d81f40, vhost-scsi is now using TCM_*_TAG and doesn't depend upon host side scsi_tcq.h definitions anymore. Cc: Michael S. Tsirkin m...@redhat.com Cc: Paolo Bonzini pbonz...@redhat.com

[PATCH-v2 05/11] vhost/scsi: Add ANY_LAYOUT iov - sgl mapping prerequisites

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org This patch adds ANY_LAYOUT prerequisites logic for accepting a set of protection + data payloads via iovec + offset. Also includes helpers for calcuating SGLs + invoking vhost_scsi_map_to_sgl() with a known number of iovecs. Required by ANY_LAYOUT

[PATCH-v2 02/11] vhost/scsi: Convert completion path to use memcpy_toiovecend

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org Required for ANY_LAYOUT support when the incoming virtio-scsi response header + fixed size sense buffer payload may span more than a single iovec entry. This changes existing code to save cmd-tvc_resp_iod instead of the first single iovec base

[PATCH-v2 09/11] vhost/scsi: Drop legacy pre virtio v1.0 !ANY_LAYOUT logic

2015-02-01 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org With the new ANY_LAYOUT logic in place for vhost_scsi_handle_vqal(), there is no longer a reason to keep around the legacy code with !ANY_LAYOUT assumptions. Go ahead and drop the pre virtio 1.0 logic in vhost_scsi_handle_vq() and associated helpers.

[target:for-next 16/21] drivers/vhost/scsi.c:1081:5: sparse: symbol 'vhost_skip_iovec_bytes' was not declared. Should it be static?

2015-02-01 Thread kbuild test robot
tree: git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git for-next head: 2936f1d4f3e8247bd519feba7892371d5e4c6603 commit: 105acf608f25d5e0d9fef669299a5438b7b114ee [16/21] vhost/scsi: Add ANY_LAYOUT vhost_skip_iovec_bytes helper reproduce: # apt-get install sparse git

Re: [PATCH target] vhost/scsi: vhost_skip_iovec_bytes() can be static

2015-02-01 Thread Fam Zheng
On Mon, 02/02 14:25, kbuild test robot wrote: drivers/vhost/scsi.c:1081:5: sparse: symbol 'vhost_skip_iovec_bytes' was not declared. Should it be static? Signed-off-by: Fengguang Wu fengguang...@intel.com --- scsi.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git