[PATCH v4 04/25] KVM: arm64: Refactor kvm_arm_num_regs() for easier maintenance

2019-01-17 Thread Dave Martin
term one per line, for maximum readability. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/kvm/guest.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 46eb867..65f4338 100644 --- a/arch/arm64

[PATCH v4 08/25] arm64/sve: Enable SVE state tracking for non-task contexts

2019-01-17 Thread Dave Martin
vcpu context bind time, the specified vector length will not be used for anything yet. In later patches TIF_SVE will be set here as appropriate, and the appropriate maximum vector length for the vcpu will be passed when binding. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- Changes

[PATCH v4 09/25] KVM: arm64: Add a vcpu flag to control SVE visibility for the guest

2019-01-17 Thread Dave Martin
Since SVE will be enabled or disabled on a per-vcpu basis, a flag is needed in order to track which vcpus have it enabled. This patch adds a suitable flag and a helper for checking it. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/include/asm/kvm_host.h | 4 1 file

[PATCH v4 11/25] KVM: arm64: Extend reset_unknown() to handle mixed RES0/UNKNOWN registers

2019-01-17 Thread Dave Martin
, this patch makes no functional change for currently defined registers. Future patches will make use of non-zero val. Signed-off-by: Dave Martin --- arch/arm64/kvm/sys_regs.h | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm

[PATCH v4 14/25] KVM: arm64/sve: Context switch the SVE registers

2019-01-17 Thread Dave Martin
f non-SVE-capable hardware (as was done unconditionally prior to this patch). No SVE handling is added on non-VHE-only paths, since VHE is an architectural and Kconfig prerequisite of SVE. Signed-off-by: Dave Martin --- Changes since RFC v3: * Ensure guest_has_sve is initialised befor

[PATCH v4 12/25] KVM: arm64: Support runtime sysreg filtering for KVM_GET_REG_LIST

2019-01-17 Thread Dave Martin
abstracting other parts of the code to handle conditionally-present sysregs, if required. Signed-off-by: Dave Martin --- arch/arm64/kvm/sys_regs.c | 10 +++--- arch/arm64/kvm/sys_regs.h | 4 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm

[PATCH v4 13/25] KVM: arm64/sve: System register context switch and access support

2019-01-17 Thread Dave Martin
merated at all for KVM_GET_REG_LIST in this case. For consistency we also reject ioctl access to the register. This ensures that a non-SVE-enabled guest looks the same to userspace, irrespective of whether the kernel KVM implementation supports SVE. Signed-off-by: Dave Martin --- arch/arm64/i

[PATCH v4 10/25] KVM: arm64: Propagate vcpu into read_id_reg()

2019-01-17 Thread Dave Martin
for example. This patch propagates vcpu into read_id_reg() so that future patches can add run-time checks on the guest configuration here. For now, there is no functional change. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/kvm/sys_regs.c | 23 +-- 1

[PATCH v4 15/25] KVM: Allow 2048-bit register access via ioctl interface

2019-01-17 Thread Dave Martin
s not enumerate any 2048-bit register unless userspace explicitly opts in to the relevant architecture-specific features. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b/include/uapi/

[PATCH v4 17/25] KVM: arm64/sve: Add SVE support to register access ioctl interface

2019-01-17 Thread Dave Martin
avoids some complex and pointless emluation in the kernel. Signed-off-by: Dave Martin --- arch/arm64/include/uapi/asm/kvm.h | 10 +++ arch/arm64/kvm/guest.c| 131 ++ 2 files changed, 129 insertions(+), 12 deletions(-) diff --git a/arch/arm64

[PATCH v4 18/25] KVM: arm64: Enumerate SVE register indices for KVM_GET_REG_LIST

2019-01-17 Thread Dave Martin
access their context. For the variably- sized SVE registers, the appropriate set of slice IDs are enumerated, depending on the maximum vector length for the vcpu. Signed-off-by: Dave Martin --- Changes since RFC v3: * Don't enumerate FPSIMD V-regs for SVE vcpus. --- arch/arm64/kvm/gu

[PATCH v4 19/25] arm64/sve: In-kernel vector length availability query interface

2019-01-17 Thread Dave Martin
these functions. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/include/asm/fpsimd.h | 29 + arch/arm64/kernel/fpsimd.c | 35 --- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/arch/arm64/include

[PATCH v4 21/25] KVM: arm64/sve: Add pseudo-register for the guest's vector lengths

2019-01-17 Thread Dave Martin
, we cannot allow the vector length set to be changed any more. For this reason, this patch adds support to track vcpu finalization explicitly. The new pseudo-register is not exposed yet. Subsequent patches will allow SVE to be turned on for guest vcpus, making it visible. Signed-off-by: Dave

[PATCH v4 16/25] KVM: arm64: Reject ioctl access to FPSIMD V-regs on SVE vcpus

2019-01-17 Thread Dave Martin
feature for userspace, this will not affect existing users. Signed-off-by: Dave Martin --- arch/arm64/kvm/guest.c | 38 +++--- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 65f4338..ffa38d4 100644

[PATCH v4 20/25] KVM: arm/arm64: Add hook to finalize the vcpu configuration

2019-01-17 Thread Dave Martin
alize() is currently a no-op, but future patches will amend this to handle SVE on arm64. Signed-off-by: Dave Martin --- arch/arm/include/asm/kvm_host.h | 4 arch/arm64/include/asm/kvm_host.h | 4 virt/kvm/arm/arm.c| 8 3 files changed, 16 insertions(+) diff

[PATCH v4 22/25] KVM: arm64/sve: Allow userspace to enable SVE for vcpus

2019-01-17 Thread Dave Martin
changing the vector lengths of an existing vcpu across reset. Signed-off-by: Dave Martin --- arch/arm64/include/asm/kvm_host.h | 2 +- arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/reset.c| 78 ++- 3 files changed, 79 insertions(+), 2

[PATCH v4 24/25] KVM: Document errors for KVM_GET_ONE_REG and KVM_SET_ONE_REG

2019-01-17 Thread Dave Martin
KVM_GET_ONE_REG and KVM_SET_ONE_REG return some error codes that are not documented (but hopefully not surprising either). To give an indication of what these may mean, this patch adds brief documentation. Signed-off-by: Dave Martin --- Documentation/virtual/kvm/api.txt | 6 ++ 1 file

[PATCH v4 25/25] KVM: arm64/sve: Document KVM API extensions for SVE

2019-01-17 Thread Dave Martin
This patch adds sections to the KVM API documentation describing the extensions for supporting the Scalable Vector Extension (SVE) in guests. Signed-off-by: Dave Martin --- Changes since RFC v3: * Rewrote the bulk of the documentation to document the new vector length set control

[PATCH v4 23/25] KVM: arm64: Add a capabillity to advertise SVE support

2019-01-17 Thread Dave Martin
To provide a uniform way to check for KVM SVE support amongst other features, this patch adds a suitable capability KVM_CAP_ARM_SVE, and reports it as present when SVE is available. Signed-off-by: Dave Martin --- arch/arm64/kvm/reset.c | 8 include/uapi/linux/kvm.h | 1 + 2 files

[RFC PATCH 00/12] arm64: SVE guest support test hacks

2019-01-18 Thread Dave Martin
[PATCH v4 00/25] KVM: arm64: SVE guest support https://lists.cs.columbia.edu/pipermail/kvmarm/2019-January/034134.html git://linux-arm.org/linux-dm.git sve-kvm/v4/head http://linux-arm.org/git?p=linux-dm.git;a=shortlog;h=refs/heads/sve-kvm/v4/head Dave Martin (12): guest: Add generated file gue

[RFC PATCH 01/12] guest: Add generated file guest/guest_init.c to .gitignore

2019-01-18 Thread Dave Martin
guest/guest_init.c is a generated file, but git doesn't currently ignore it. This can be annoying when running git status etc. This patch adds a suitable .gitignore entry for this file. Signed-off-by: Dave Martin --- guest/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 1

[RFC PATCH 07/12] arm64: [HACK] Add option to show the kernel's KVM register ID list

2019-01-18 Thread Dave Martin
: Dave Martin --- arm/aarch64/include/kvm/kvm-config-arch.h | 2 ++ arm/include/arm-common/kvm-config-arch.h | 1 + arm/kvm-cpu.c | 50 +++ 3 files changed, 53 insertions(+) diff --git a/arm/aarch64/include/kvm/kvm-config-arch.h b/arm

[RFC PATCH 03/12] Makefile: [HACK] Work around GCC 8 warnings :(

2019-01-18 Thread Dave Martin
Some of these are relatively harmless lazy coding issues; others are overzealousness on the part of the compiler (in some cases, the code is provably safe, yet GCC warns anyway). Turning the warnings off locally is not nice, but better than turning them off globally. Signed-off-by: Dave Martin

[RFC PATCH 04/12] Makefile: [HACK] Pass relevant flags when checking for libfdt

2019-01-18 Thread Dave Martin
CPPFLAGS and LDFLAGS may be telling us where libdft.h and -lfdt are to be found, so don't ignore them when looking for libfdt. Signed-off-by: Dave Martin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e8e9376..d6bcce7 100644

[RFC PATCH 11/12] arm64: [HACK] FPSIMD/SVE register dumping for lkvm debug

2019-01-18 Thread Dave Martin
case rather abusing the guest socket. If we want to do something like this for real, some more careful thought about how to optimise the protocol is needed. Signed-off-by: Dave Martin --- arm/aarch64/kvm-cpu.c | 186 ++ 1 file changed, 186 inser

[RFC PATCH 08/12] arm64: [HACK] Basic SVE support

2019-01-18 Thread Dave Martin
-enabled and non-SVE-enabled vcpus. This functionality could be added later if desired. Signed-off-by: Dave Martin --- arm/aarch64/include/kvm/kvm-config-arch.h | 2 ++ arm/aarch64/include/kvm/kvm-cpu-arch.h| 3 ++- arm/include/arm-common/kvm-config-arch.h | 1 + 3 files changed, 5 insertions

[RFC PATCH 06/12] arm64: [HACK] Pull in kvm UAPI header updates from SVE development branch

2019-01-18 Thread Dave Martin
This patch pulls in SVE-related declarations from my kernel SVE development branch, so that kvmtool can make use of them. Signed-off-by: Dave Martin --- arm/aarch64/include/asm/kvm.h | 13 + include/linux/kvm.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/arm

[RFC PATCH 10/12] arm64: [HACK] Allow configuration of the guest's set of SVE vector lengths

2019-01-18 Thread Dave Martin
s no means to request such a configuration for now. Support could be added later, if desired. Signed-off-by: Dave Martin --- arm/aarch64/include/kvm/kvm-config-arch.h | 5 ++ arm/kvm-cpu.c | 80 +++ 2 files changed, 85 insertions(+) diff -

[RFC PATCH 02/12] update_headers: Sync kvm UAPI headers with linux v5.0-rc2

2019-01-18 Thread Dave Martin
The local copies of the kvm user API headers are getting stale. In preparation for some arch-specific updated, this patch reflects a re-run of util/update_headers.sh to pull in upstream updates from linux v5.0-rc2. Signed-off-by: Dave Martin --- arm/aarch32/include/asm/kvm.h | 55

[RFC PATCH 05/12] arm64: Correct ARM64_CORE_REG() size encodings for all core registers

2019-01-18 Thread Dave Martin
registers), this patch extends the macro to encode the correct size for each class of register in KVM_REG_ARM_CORE. The approach is crude, but because the KVM_REG_ARM_CORE ID arrangement is ABI, it's not expected to evolve. Signed-off-by: Dave Martin --- arm/aarch64/kvm-cpu.c

[RFC PATCH 09/12] arm64: [HACK] Show extra info about SVE with --show-reg-list

2019-01-18 Thread Dave Martin
This patch prints out some information about the SVE configuration when --show-reg=list is passed. This is development hack only (as well as being an abuse of the purpose of that option). Signed-off-by: Dave Martin --- arm/kvm-cpu.c | 111

[RFC PATCH 12/12] arm64: [HACK] Check that out-of-range SVE register IDs can't be dumped

2019-01-18 Thread Dave Martin
ister encoding, so there is nothing to test for that case. Signed-off-by: Dave Martin --- arm/aarch64/kvm-cpu.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arm/aarch64/kvm-cpu.c b/arm/aarch64/kvm-cpu.c index 28c5010..6b1580c 100644 --- a/arm/aarch64/kvm-cpu.c

Re: [PATCH 0/2] KVM: arm/arm64: Add VCPU workarounds firmware register

2019-01-22 Thread Dave Martin
On Mon, Jan 07, 2019 at 12:05:35PM +, Andre Przywara wrote: > Workarounds for Spectre variant 2 or 4 vulnerabilities require some help > from the firmware, so KVM implements an interface to provide that for > guests. When such a guest is migrated, we want to make sure we don't > loose the prote

Re: [PATCH 0/2] KVM: arm/arm64: Add VCPU workarounds firmware register

2019-01-22 Thread Dave Martin
On Tue, Jan 22, 2019 at 11:11:09AM +, Marc Zyngier wrote: > On Tue, 22 Jan 2019 10:17:00 +, > Dave Martin wrote: > > > > On Mon, Jan 07, 2019 at 12:05:35PM +, Andre Przywara wrote: > > > Workarounds for Spectre variant 2 or 4 vulnerabilities require some h

Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-01-22 Thread Dave Martin
On Mon, Jan 07, 2019 at 12:05:36PM +, Andre Przywara wrote: > KVM implements the firmware interface for mitigating cache speculation > vulnerabilities. Guests may use this interface to ensure mitigation is > active. > If we want to migrate such a guest to a host with a different support > level

Re: [PATCH 0/2] KVM: arm/arm64: Add VCPU workarounds firmware register

2019-01-22 Thread Dave Martin
On Tue, Jan 22, 2019 at 02:51:11PM +, Marc Zyngier wrote: > On Tue, 22 Jan 2019 13:56:34 +, > Dave Martin wrote: > > > > On Tue, Jan 22, 2019 at 11:11:09AM +, Marc Zyngier wrote: > > > On Tue, 22 Jan 2019 10:17:00 +, > > > Dave Martin wrote: &

Re: [PATCH v4 13/25] KVM: arm64/sve: System register context switch and access support

2019-01-22 Thread Dave Martin
On Fri, Jan 18, 2019 at 04:42:07PM +, Marc Zyngier wrote: > On 17/01/2019 20:33, Dave Martin wrote: > > This patch adds the necessary support for context switching ZCR_EL1 > > for each vcpu. > > > > ZCR_EL1 is trapped alongside the FPSIMD/SVE registers, so it m

Re: [PATCH v4 14/25] KVM: arm64/sve: Context switch the SVE registers

2019-01-22 Thread Dave Martin
On Fri, Jan 18, 2019 at 05:15:07PM +, Marc Zyngier wrote: > On 17/01/2019 20:33, Dave Martin wrote: > > In order to give each vcpu its own view of the SVE registers, this > > patch adds context storage via a new sve_state pointer in struct > > vcpu_arch. An additional

Re: [PATCH v4 17/25] KVM: arm64/sve: Add SVE support to register access ioctl interface

2019-01-22 Thread Dave Martin
On Fri, Jan 18, 2019 at 05:58:33PM +, Marc Zyngier wrote: > On 17/01/2019 20:33, Dave Martin wrote: > > This patch adds the following registers for access via the > > KVM_{GET,SET}_ONE_REG interface: > > > > * KVM_REG_ARM64_SVE_ZREG(n, i) (n =

Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-01-29 Thread Dave Martin
On Fri, Jan 25, 2019 at 02:46:57PM +, Andre Przywara wrote: > On Tue, 22 Jan 2019 15:17:14 + > Dave Martin wrote: > > Hi Dave, > > thanks for having a look! > > > On Mon, Jan 07, 2019 at 12:05:36PM +, Andre Przywara wrote: > > > KVM implements t

Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-01-30 Thread Dave Martin
On Wed, Jan 30, 2019 at 11:39:00AM +, Andre Przywara wrote: > On Tue, 29 Jan 2019 21:32:23 + > Dave Martin wrote: > > Hi Dave, > > > On Fri, Jan 25, 2019 at 02:46:57PM +, Andre Przywara wrote: [...] > > > What I like about the signedness is th

Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-02-15 Thread Dave Martin
On Fri, Feb 15, 2019 at 11:42:27AM +, Marc Zyngier wrote: > On Fri, 15 Feb 2019 09:58:57 +, > Andre Przywara wrote: > > > > On Wed, 30 Jan 2019 11:39:00 + > > Andre Przywara wrote: > > > > Peter, Marc, Christoffer, > > > > can we have an opinion on whether it's useful to introduce

Re: [PATCH 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-02-18 Thread Dave Martin
On Mon, Feb 18, 2019 at 09:07:31AM +, Marc Zyngier wrote: > On Fri, 15 Feb 2019 17:26:02 + > Dave Martin wrote: > > > On Fri, Feb 15, 2019 at 11:42:27AM +, Marc Zyngier wrote: > > > On Fri, 15 Feb 2019 09:58:57 +, > > > Andre Przywara wrote:

[PATCH v5 01/26] KVM: Documentation: Document arm64 core registers in detail

2019-02-18 Thread Dave Martin
Since the the sizes of individual members of the core arm64 registers vary, the list of register encodings that make sense is not a simple linear sequence. To clarify which encodings to use, this patch adds a brief list to the documentation. Signed-off-by: Dave Martin --- Documentation/virtual

[PATCH v5 04/26] KVM: arm64: Refactor kvm_arm_num_regs() for easier maintenance

2019-02-18 Thread Dave Martin
term one per line, for maximum readability. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/kvm/guest.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 46eb867..65f4338 100644 --- a/arch/arm64

[PATCH v5 13/26] KVM: arm64/sve: System register context switch and access support

2019-02-18 Thread Dave Martin
merated at all for KVM_GET_REG_LIST in this case. For consistency we also reject ioctl access to the register. This ensures that a non-SVE-enabled guest looks the same to userspace, irrespective of whether the kernel KVM implementation supports SVE. Signed-off-by: Dave Martin --- Change

[PATCH v5 07/26] arm64/sve: Clarify role of the VQ map maintenance functions

2019-02-18 Thread Dave Martin
adds comments to make the functions' roles clearer. No functional change. Signed-off-by: Dave Martin --- arch/arm64/kernel/fpsimd.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 64729e2..92c2331 1

[PATCH v5 14/26] KVM: arm64/sve: Context switch the SVE registers

2019-02-18 Thread Dave Martin
f non-SVE-capable hardware (as was done unconditionally prior to this patch). No SVE handling is added on non-VHE-only paths, since VHE is an architectural and Kconfig prerequisite of SVE. Signed-off-by: Dave Martin --- Changes since v4: * Remove if_sve() helper in favour of open-coded stati

[PATCH v5 16/26] KVM: arm64: Add missing #include of in guest.c

2019-02-18 Thread Dave Martin
arch/arm64/kvm/guest.c uses the string functions, but the corresponding header is not included. We seem to get away with this for now, but for completeness this patch adds the #include, in preparation for adding yet more memset() calls. Signed-off-by: Dave Martin --- arch/arm64/kvm/guest.c | 1

[PATCH v5 15/26] KVM: Allow 2048-bit register access via ioctl interface

2019-02-18 Thread Dave Martin
s not enumerate any 2048-bit register unless userspace explicitly opts in to the relevant architecture-specific features. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b/include/uapi/

[PATCH v5 08/26] arm64/sve: Enable SVE state tracking for non-task contexts

2019-02-18 Thread Dave Martin
vcpu context bind time, the specified vector length will not be used for anything yet. In later patches TIF_SVE will be set here as appropriate, and the appropriate maximum vector length for the vcpu will be passed when binding. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64

[PATCH v5 12/26] KVM: arm64: Support runtime sysreg visibility filtering

2019-02-18 Thread Dave Martin
userspace, and REG_NO_GUEST to inhibit runtime access by the guest using MSR/MRS. This allows a conditionally modified view of individual system registers such as the CPU ID registers, in addition to completely hiding register where appropriate. Signed-off-by: Dave Martin --- Changes since v4

[PATCH v5 26/26] KVM: arm64/sve: Document KVM API extensions for SVE

2019-02-18 Thread Dave Martin
This patch adds sections to the KVM API documentation describing the extensions for supporting the Scalable Vector Extension (SVE) in guests. Signed-off-by: Dave Martin --- Changes since v4: * Add note about which SVE register slices are visible, and the behaviour of non-visible slices

[PATCH v5 10/26] KVM: arm64: Propagate vcpu into read_id_reg()

2019-02-18 Thread Dave Martin
for example. This patch propagates vcpu into read_id_reg() so that future patches can add run-time checks on the guest configuration here. For now, there is no functional change. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/kvm/sys_regs.c | 23 +-- 1

[PATCH v5 25/26] KVM: Document errors for KVM_GET_ONE_REG and KVM_SET_ONE_REG

2019-02-18 Thread Dave Martin
KVM_GET_ONE_REG and KVM_SET_ONE_REG return some error codes that are not documented (but hopefully not surprising either). To give an indication of what these may mean, this patch adds brief documentation. Signed-off-by: Dave Martin --- Documentation/virtual/kvm/api.txt | 6 ++ 1 file

[PATCH v5 06/26] arm64/sve: Check SVE virtualisability

2019-02-18 Thread Dave Martin
analyses the extent to which SVE can be virtualised safely without interfering with migration of vcpus between physical CPUs, and rejects late secondary CPUs that would erode the situation further. It is left up to KVM to decide what to do with this information. Signed-off-by: Dave Martin --- arch

[PATCH v5 21/26] KVM: arm/arm64: Add hook to finalize the vcpu configuration

2019-02-18 Thread Dave Martin
alize() is currently a no-op, but future patches will amend this to handle SVE on arm64. Signed-off-by: Dave Martin --- arch/arm/include/asm/kvm_host.h | 4 arch/arm64/include/asm/kvm_host.h | 4 virt/kvm/arm/arm.c| 8 3 files changed, 16 insertions(+) diff

[PATCH v5 05/26] KVM: arm64: Add missing #include of to kvm_host.h

2019-02-18 Thread Dave Martin
kvm_host.h uses DECLARE_BITMAP() to declare the features member of struct vcpu_arch, but the corresponding #include for this is missing. This patch adds a suitable #include for . Although the header builds without it today, this should help to avoid future surprises. Signed-off-by: Dave Martin

[PATCH v5 23/26] KVM: arm64/sve: Allow userspace to enable SVE for vcpus

2019-02-18 Thread Dave Martin
changing the vector lengths of an existing vcpu across reset. Signed-off-by: Dave Martin --- Changes since v4: * Pull out vcpu_sve_state_size(), for use earlier in the series. * Remove unnecessary vcpu->arch.sve_vqs[], and clamp maximum guest vector length to 256 bytes for forwa

[PATCH v5 24/26] KVM: arm64: Add a capabillity to advertise SVE support

2019-02-18 Thread Dave Martin
To provide a uniform way to check for KVM SVE support amongst other features, this patch adds a suitable capability KVM_CAP_ARM_SVE, and reports it as present when SVE is available. Signed-off-by: Dave Martin --- arch/arm64/kvm/reset.c | 8 include/uapi/linux/kvm.h | 1 + 2 files

[PATCH v5 11/26] KVM: arm64: Extend reset_unknown() to handle mixed RES0/UNKNOWN registers

2019-02-18 Thread Dave Martin
, this patch makes no functional change for currently defined registers. Future patches will make use of non-zero val. Signed-off-by: Dave Martin --- arch/arm64/kvm/sys_regs.h | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm

[PATCH v5 19/26] KVM: arm64: Enumerate SVE register indices for KVM_GET_REG_LIST

2019-02-18 Thread Dave Martin
access their context. For the variably-sized SVE registers, the appropriate set of slice IDs are enumerated, depending on the maximum vector length for the vcpu. Signed-off-by: Dave Martin --- Changes since v4: * Drop KVM_SVE_SLICES(), which is no longer used due to the dropping of

[PATCH v5 20/26] arm64/sve: In-kernel vector length availability query interface

2019-02-18 Thread Dave Martin
these functions. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/include/asm/fpsimd.h | 29 + arch/arm64/kernel/fpsimd.c | 35 --- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/arch/arm64/include

[PATCH v5 22/26] KVM: arm64/sve: Add pseudo-register for the guest's vector lengths

2019-02-18 Thread Dave Martin
sequencing of ioctls. The new pseudo-register is not exposed yet. Subsequent patches will allow SVE to be turned on for guest vcpus, making it visible. Signed-off-by: Dave Martin --- Changes since v4: * Add a UAPI header comment indicating the pseudo-register status of KVM_REG_ARM64_SVE_VLS

[PATCH v5 03/26] KVM: arm64: Delete orphaned declaration for __fpsimd_enabled()

2019-02-18 Thread Dave Martin
__fpsimd_enabled() no longer exists, but a dangling declaration has survived in kvm_hyp.h. This patch gets rid of it. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/include/asm/kvm_hyp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_hyp.h b

[PATCH v5 09/26] KVM: arm64: Add a vcpu flag to control SVE visibility for the guest

2019-02-18 Thread Dave Martin
Since SVE will be enabled or disabled on a per-vcpu basis, a flag is needed in order to track which vcpus have it enabled. This patch adds a suitable flag and a helper for checking it. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/include/asm/kvm_host.h | 4 1 file

[PATCH v5 17/26] KVM: arm64: Reject ioctl access to FPSIMD V-regs on SVE vcpus

2019-02-18 Thread Dave Martin
feature for userspace, this will not affect existing users. Signed-off-by: Dave Martin --- arch/arm64/kvm/guest.c | 38 +++--- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index f83fe22..f491456 100644

[PATCH v5 02/26] arm64: fpsimd: Always set TIF_FOREIGN_FPSTATE on task state flush

2019-02-18 Thread Dave Martin
_bh_disable() anyway. Signed-off-by: Dave Martin Reviewed-by: Alex Bennée --- arch/arm64/kernel/fpsimd.c | 25 +++-- arch/arm64/kernel/signal.c | 5 - 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c in

[PATCH v5 18/26] KVM: arm64/sve: Add SVE support to register access ioctl interface

2019-02-18 Thread Dave Martin
state. This avoids some complex and pointless emulation in the kernel to convert between the two views of these aliased registers. Signed-off-by: Dave Martin --- Changes since v4: * Add "BASE" #defines for the Z-reg and P-reg ranges in the KVM register ID space, to make the 0

[PATCH v5 00/26] KVM: arm64: SVE guest support

2019-02-18 Thread Dave Martin
pport test hacks https://lists.cs.columbia.edu/pipermail/kvmarm/2019-January/034162.html Dave Martin (26): KVM: Documentation: Document arm64 core registers in detail arm64: fpsimd: Always set TIF_FOREIGN_FPSTATE on task state flush KVM: arm64: Delete orphaned declaration for __fpsimd_enabl

Re: [PATCH v5 00/26] KVM: arm64: SVE guest support

2019-02-20 Thread Dave Martin
On Mon, Feb 18, 2019 at 07:52:13PM +, Dave Martin wrote: [...] > AArch32 host testing is pending. I will ping this series with a reply > to the cover letter when that testing has been completed. AArch32 host testing now done on Arm TC2: 15 guests were able to boot and execute

Re: [PATCH 1/5] KVM: arm/arm64: Reset the VCPU without preemption and vcpu state loaded

2019-02-20 Thread Dave Martin
On Fri, Jan 25, 2019 at 10:46:52AM +0100, Christoffer Dall wrote: > Resetting the VCPU state modifies the system register state in memory, > but this may interact with vcpu_load/vcpu_put if running with preemption > disabled, which in turn may lead to corrupted system register state. Should this b

[PATCH] KVM: arm64: Fix architecturally invalid reset value for FPEXC32_EL2

2019-02-21 Thread Dave Martin
Zyngier Cc: Christoffer Dall Fixes: 62a89c44954f ("arm64: KVM: 32bit handling of coprocessor traps") Signed-off-by: Dave Martin --- For AArch32 the situation is more complicated. FPEXC[29:0] is subarchitecture-defined, so the reset value may need to be per-CPU- implementation. The mac

Re: [PATCH v6 1/6] arm64/kvm: preserve host HCR_EL2 value

2019-02-21 Thread Dave Martin
On Tue, Feb 19, 2019 at 02:54:26PM +0530, Amit Daniel Kachhap wrote: > From: Mark Rutland > > When restoring HCR_EL2 for the host, KVM uses HCR_HOST_VHE_FLAGS, which > is a constant value. This works today, as the host HCR_EL2 value is > always the same, but this will get in the way of supporting

Re: [PATCH v6 2/6] arm64/kvm: preserve host MDCR_EL2 value

2019-02-21 Thread Dave Martin
On Tue, Feb 19, 2019 at 02:54:27PM +0530, Amit Daniel Kachhap wrote: > Save host MDCR_EL2 value during kvm HYP initialisation and restore > after every switch from host to guest. There should not be any > change in functionality due to this. > > The value of mdcr_el2 is now stored in struct kvm_cp

Re: [PATCH v6 3/6] arm64/kvm: context-switch ptrauth registers

2019-02-21 Thread Dave Martin
On Thu, Feb 21, 2019 at 12:29:42PM +, Mark Rutland wrote: > On Tue, Feb 19, 2019 at 02:54:28PM +0530, Amit Daniel Kachhap wrote: > > From: Mark Rutland > > > > When pointer authentication is supported, a guest may wish to use it. > > This patch adds the necessary KVM infrastructure for this t

Re: [PATCH v6 4/6] arm64/kvm: add a userspace option to enable pointer authentication

2019-02-21 Thread Dave Martin
On Tue, Feb 19, 2019 at 02:54:29PM +0530, Amit Daniel Kachhap wrote: > This feature will allow the KVM guest to allow the handling of > pointer authentication instructions or to treat them as undefined > if not set. It uses the existing vcpu API KVM_ARM_VCPU_INIT to > supply this parameter instead

Re: [kvmtool PATCH v6 6/6] arm/kvm: arm64: Add a vcpu feature for pointer authentication

2019-02-21 Thread Dave Martin
On Tue, Feb 19, 2019 at 02:54:31PM +0530, Amit Daniel Kachhap wrote: > This is a runtime capabality for KVM tool to enable Armv8.3 Pointer > Authentication in guest kernel. A command line option --ptrauth is > required for this. > > Signed-off-by: Amit Daniel Kachhap > --- > arm/aarch32/include/

Re: [PATCH v6 3/6] arm64/kvm: context-switch ptrauth registers

2019-02-21 Thread Dave Martin
On Tue, Feb 19, 2019 at 02:54:28PM +0530, Amit Daniel Kachhap wrote: > From: Mark Rutland > > When pointer authentication is supported, a guest may wish to use it. > This patch adds the necessary KVM infrastructure for this to work, with > a semi-lazy context switch of the pointer auth state. >

Re: [PATCH v6 5/6] arm64/kvm: control accessibility of ptrauth key registers

2019-02-21 Thread Dave Martin
ters to default values but they are > left like that as they are conditionally accessible (set/get). > > Signed-off-by: Amit Daniel Kachhap > Cc: Mark Rutland > Cc: Marc Zyngier > Cc: Christoffer Dall > Cc: kvmarm@lists.cs.columbia.edu > --- > This patch needs patch [1]

Re: [PATCH] KVM: arm64: Fix architecturally invalid reset value for FPEXC32_EL2

2019-02-22 Thread Dave Martin
On Fri, Feb 22, 2019 at 10:01:03AM +, Marc Zyngier wrote: > On Thu, 21 Feb 2019 11:42:32 + > Dave Martin wrote: > > > Due to what looks like a typo dating back to the original addition > > of FPEXC32_EL2 handling, KVM currently initialises this register to > >

Re: [PATCH v3 1/2] KVM: arm/arm64: Add save/restore support for firmware workaround state

2019-02-22 Thread Dave Martin
On Fri, Feb 22, 2019 at 12:18:17PM +, Andre Przywara wrote: > KVM implements the firmware interface for mitigating cache speculation > vulnerabilities. Guests may use this interface to ensure mitigation is > active. > If we want to migrate such a guest to a host with a different support > level

Re: [PATCH v3 2/2] KVM: doc: add API documentation on the KVM_REG_ARM_WORKAROUNDS register

2019-02-22 Thread Dave Martin
On Fri, Feb 22, 2019 at 12:18:18PM +, Andre Przywara wrote: > Add documentation for the newly defined firmware registers to save and > restore any vulnerability migitation status. > > Signed-off-by: Andre Przywara > --- > Documentation/virtual/kvm/arm/psci.txt | 24 >

Re: [PATCH v5 01/26] KVM: Documentation: Document arm64 core registers in detail

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 11:48:30AM +, Julien Grall wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > >Since the the sizes of individual members of the core arm64 > >registers vary, the list of register encodings that make sense is > >not a simple

Re: [PATCH v5 02/26] arm64: fpsimd: Always set TIF_FOREIGN_FPSTATE on task state flush

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 12:39:39PM +, Julien Grall wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > >This patch updates fpsimd_flush_task_state() to mirror the new > >semantics of fpsimd_flush_cpu_state() introduced by commit > >d8ad71

Re: [PATCH v5 05/26] KVM: arm64: Add missing #include of to kvm_host.h

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 03:23:50PM +, Mark Rutland wrote: > On Mon, Feb 18, 2019 at 07:52:18PM +0000, Dave Martin wrote: > > kvm_host.h uses DECLARE_BITMAP() to declare the features member of > > struct vcpu_arch, but the corresponding #include for this is > > missing. >

Re: [PATCH v5 06/26] arm64/sve: Check SVE virtualisability

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 11:12:49AM +, Julien Thierry wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > > Due to the way the effective SVE vector length is controlled and > > trapped at different exception levels, certain mismatches in the > > sets of

Re: [PATCH v5 07/26] arm64/sve: Clarify role of the VQ map maintenance functions

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 01:46:46PM +, Julien Grall wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > >The roles of sve_init_vq_map(), sve_update_vq_map() and > >sve_verify_vq_map() are highly non-obvious to anyone who has not dug > >through cpufeature

Re: [PATCH v5 08/26] arm64/sve: Enable SVE state tracking for non-task contexts

2019-02-26 Thread Dave Martin
On Fri, Feb 22, 2019 at 03:26:51PM +, Julien Grall wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > >The current FPSIMD/SVE context handling support for non-task (i.e., > >KVM vcpu) contexts does not take SVE into account. This means that > > NIT

Re: [PATCH v5 06/26] arm64/sve: Check SVE virtualisability

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 01:36:26PM +, Julien Grall wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > >+/* > >+ * Mismatches above sve_max_virtualisable_vl are fine, since > >+ * no guest is allowed to configure ZCR_EL2.LEN to exceed t

Re: [PATCH v5 07/26] arm64/sve: Clarify role of the VQ map maintenance functions

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 11:43:24AM +, Julien Thierry wrote: > > > On 18/02/2019 19:52, Dave Martin wrote: > > The roles of sve_init_vq_map(), sve_update_vq_map() and > > sve_verify_vq_map() are highly non-obvious to anyone who has not dug > > through cpufeatures.

Re: [PATCH v5 11/26] KVM: arm64: Extend reset_unknown() to handle mixed RES0/UNKNOWN registers

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 01:33:28PM +, Julien Thierry wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > > The reset_unknown() system register helper initialises a guest > > register to a distinctive junk value on vcpu reset, to help expose > > a

Re: [PATCH v5 12/26] KVM: arm64: Support runtime sysreg visibility filtering

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 02:33:44PM +, Julien Thierry wrote: > > > On 18/02/2019 19:52, Dave Martin wrote: > > Some optional features of the Arm architecture add new system > > registers that are not present in the base architecture. > > > > Where these fe

Re: [PATCH v5 12/26] KVM: arm64: Support runtime sysreg visibility filtering

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 03:37:26PM +, Mark Rutland wrote: > On Mon, Feb 18, 2019 at 07:52:25PM +0000, Dave Martin wrote: > > Some optional features of the Arm architecture add new system > > registers that are not present in the base architecture. > > > > Where thes

Re: [PATCH v5 14/26] KVM: arm64/sve: Context switch the SVE registers

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 04:19:18PM +, Mark Rutland wrote: > On Mon, Feb 18, 2019 at 07:52:27PM +0000, Dave Martin wrote: > > -static bool __hyp_text __hyp_switch_fpsimd(struct kvm_vcpu *vcpu) > > +/* Check for an FPSIMD/SVE trap and handle as appropriate */ > > +s

Re: [PATCH v5 14/26] KVM: arm64/sve: Context switch the SVE registers

2019-02-26 Thread Dave Martin
On Wed, Feb 20, 2019 at 04:46:57PM +, Julien Thierry wrote: > > > On 18/02/2019 19:52, Dave Martin wrote: > > In order to give each vcpu its own view of the SVE registers, this > > patch adds context storage via a new sve_state pointer in struct > > vcpu_

Re: [PATCH v5 18/26] KVM: arm64/sve: Add SVE support to register access ioctl interface

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 03:23:37PM +, Julien Thierry wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > > This patch adds the following registers for access via the > > KVM_{GET,SET}_ONE_REG interface: > > > > * KVM_REG_ARM64_SVE_ZREG(n, i

Re: [PATCH v5 22/26] KVM: arm64/sve: Add pseudo-register for the guest's vector lengths

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 05:48:59PM +, Julien Thierry wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > > This patch adds a new pseudo-register KVM_REG_ARM64_SVE_VLS to > > allow userspace to set and query the set of vector lengths visible > &g

Re: [PATCH v5 23/26] KVM: arm64/sve: Allow userspace to enable SVE for vcpus

2019-02-26 Thread Dave Martin
On Fri, Feb 22, 2019 at 09:05:16AM +, Julien Thierry wrote: > Hi Dave, > > On 18/02/2019 19:52, Dave Martin wrote: > > Now that all the pieces are in place, this patch offers a new flag > > KVM_ARM_VCPU_SVE that userspace can pass to KVM_ARM_VCPU_INIT to > > turn

Re: [PATCH v5 17/26] KVM: arm64: Reject ioctl access to FPSIMD V-regs on SVE vcpus

2019-02-26 Thread Dave Martin
On Thu, Feb 21, 2019 at 12:06:23PM +, Julien Thierry wrote: > > > On 18/02/2019 19:52, Dave Martin wrote: > > In order to avoid the pointless complexity of maintaining two ioctl > > register access views of the same data, this patch blocks ioctl > > access to the

<    1   2   3   4   5   6   7   8   9   10   >