[PATCH v12 1/4] arm64: KVM: export the capability to set guest SError syndrome

2018-05-15 Thread Dongjiu Geng
to user space, otherwise returns false. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Reviewed-by: James Morse <james.mo...@arm.com> Change from V11: 1. Change the commit message 2. Update the Documentation/virtual/kvm/api.tx --- Documentation/virtual/kvm/api.txt | 11 +++

[PATCH v12 4/4] arm64: handle NOTIFY_SEI notification by the APEI driver

2018-05-15 Thread Dongjiu Geng
Add a helper to handle the NOTIFY_SEI notification, when kernel gets the NOTIFY_SEI notification, call this helper and let APEI driver to handle this notification. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/t

[PATCH v12 2/4] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS

2018-05-15 Thread Dongjiu Geng
, user space can get/set the SError exception state to do migrate/snapshot/suspend. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Change since V11: Address James's comments, thanks James 1. Align the struct of kvm_vcpu_events to 64 bytes 2. Avoid exposing the stale ESR

[PATCH v12 0/4] set VSESR_EL2 by user space and support NOTIFY_SEI notification

2018-05-15 Thread Dongjiu Geng
that padding transferred to user-space doesn't contain kernel stack. Dongjiu Geng (4): arm64: KVM: export the capability to set guest SError syndrome arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS ACPI / APEI: Add SEI notification type support for ARMv8 arm64: handle NOTIFY_SEI

[PATCH v12 3/4] ACPI / APEI: Add SEI notification type support for ARMv8

2018-05-15 Thread Dongjiu Geng
ACPI 6.x adds support for NOTIFY_SEI as a GHES notification mechanism, so add new GHES notification handling functions. Expose API ghes_notify_sei() to arch code, arch code will call this API when it gets this NOTIFY_SEI. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Note: Fi

[PATCH v11 0/4] set VSESR_EL2 by user space and support NOTIFY_SEI notification

2018-04-09 Thread Dongjiu Geng
kvm_vcpu_events struct align to 4 bytes 4. Add something check in the kvm_arm_vcpu_set_events() 5. Check kvm_arm_vcpu_get/set_events()'s return value. 6. Initialise kvm_vcpu_events to 0 so that padding transferred to user-space doesn't contain kernel stack. Dongjiu Geng (4): arm64: KVM: export

[PATCH v11 4/4] arm64: handle NOTIFY_SEI notification by the APEI driver

2018-04-09 Thread Dongjiu Geng
Add a helper to handle the NOTIFY_SEI notification, when kernel gets the NOTIFY_SEI notification, call this helper and let APEI driver to handle this notification. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/t

[PATCH v11 2/4] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS

2018-04-09 Thread Dongjiu Geng
This new IOCTL exports user-invisible states related to SError. Together with appropriate user space changes, it can inject SError with specified syndrome to guest by setup kvm_vcpu_events value. Also it can support live migration. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com>

[PATCH v11 3/4] ACPI / APEI: Add SEI notification type support for ARMv8

2018-04-09 Thread Dongjiu Geng
ACPI 6.x adds support for NOTIFY_SEI as a GHES notification mechanism, so add new GHES notification handling functions. Expose API ghes_notify_sei() to arch code, arch code will call this API when it gets this NOTIFY_SEI. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- drivers/acp

[PATCH v11 1/4] arm64: KVM: export the capability to set guest SError syndrome

2018-04-09 Thread Dongjiu Geng
Before user space injects a SError, it needs to know whether it can specify the guest Exception Syndrome, so KVM should tell user space whether it has such capability. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm

[PATCH v10 1/5] arm64: KVM: Prepare set virtual SEI syndrome value

2018-03-03 Thread Dongjiu Geng
Export one API to specify virtual SEI syndrome value for guest, and add a helper to get the VSESR_EL2 value. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/kvm_emulate.h | 5 + arch/arm64/include/asm/kvm_host.h| 2 ++ arch/arm64/kvm/inject_f

[PATCH v10 5/5] arm64: handle NOTIFY_SEI notification by the APEI driver

2018-03-03 Thread Dongjiu Geng
Add a helper to handle the NOTIFY_SEI notification, when kernel gets the NOTIFY_SEI notification, call this helper and let APEI driver to handle this notification. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/t

[PATCH v10 2/5] arm64: KVM: export the capability to set guest SError syndrome

2018-03-03 Thread Dongjiu Geng
Before user space injects a SError, it needs to know whether it can specify the guest Exception Syndrome, so KVM should tell user space whether it has such capability. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm

[PATCH v10 4/5] ACPI / APEI: Add SEI notification type support for ARMv8

2018-03-03 Thread Dongjiu Geng
ACPI 6.x adds support for NOTIFY_SEI as a GHES notification mechanism, so add new GHES notification handling functions. Expose API ghes_notify_sei() to arch code, arch code will call this API when it gets this NOTIFY_SEI. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- drivers/acp

[PATCH v10 0/5] set VSESR_EL2 by user space and support NOTIFY_SEI notification

2018-03-03 Thread Dongjiu Geng
this notification in software, KVM or kernel ARCH code call handle_guest_sei() to let ACP driver to handle this notification. Dongjiu Geng (5): arm64: KVM: Prepare set virtual SEI syndrome value arm64: KVM: export the capability to set guest SError syndrome arm/arm64: KVM: Introduce set and get per-vcpu

[PATCH v10 3/5] arm/arm64: KVM: Introduce set and get per-vcpu event

2018-03-03 Thread Dongjiu Geng
-by: Dongjiu Geng <gengdong...@huawei.com> --- Documentation/virtual/kvm/api.txt | 26 -- arch/arm/include/asm/kvm_host.h | 6 ++ arch/arm/kvm/guest.c | 12 arch/arm64/include/asm/kvm_host.h | 5 + arch/arm64/include/uapi/asm/kvm.

[PATCH v9 1/7] arm64: cpufeature: Detect CPU RAS Extentions

2018-01-06 Thread Dongjiu Geng
onfig option, reworded commit message] Signed-off-by: James Morse <james.mo...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/Kconfig | 16 arch/arm64/include/asm/

[PATCH v9 6/7] arm64: kvm: Set Virtual SError Exception Syndrome for guest

2018-01-06 Thread Dongjiu Geng
, restore this value to VSESR_EL2 only when HCR_EL2.VSE is set. This value no need to be saved because it is stale vale when guest exit. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> [Set an impdef ESR for Virtual-SError] Signed-off-by: James Morse <james.mo...@arm.com> ---

[PATCH v9 3/7] acpi: apei: Add SEI notification type support for ARMv8

2018-01-06 Thread Dongjiu Geng
users. External modules can call this exposed API to parse APEI table and handle the SEI notification. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- drivers/acpi/apei/Kconfig | 15 ++ drivers/acpi/apei/ghes.c | 53 +++ includ

[PATCH v9 5/7] arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl

2018-01-05 Thread Dongjiu Geng
, If has, will set it. Otherwise, nothing to do. For this ESR specifying, Only support for AArch64, not support AArch32. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- change the name to KVM_CAP_ARM_INJECT_SERROR_ESR instead of X_ARM_RAS_EXTENSION, suggested here

[PATCH v9 4/7] KVM: arm64: Trap RAS error registers and set HCR_EL2's TERR & TEA

2018-01-05 Thread Dongjiu Geng
raps attempts to access the physical error registers. ERRIDR_EL1 advertises the number of error records, we return zero meaning we can treat all the other registers as RAZ/WI too. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> [removed specific emulation, use trap_raz_wi() directly for

[PATCH v9 2/7] KVM: arm64: Save ESR_EL2 on guest SError

2018-01-05 Thread Dongjiu Geng
From: James Morse When we exit a guest due to an SError the vcpu fault info isn't updated with the ESR. Today this is only done for traps. The v8.2 RAS Extensions define ISS values for SError. Update the vcpu's fault_info with the ESR on SError so that handle_exit() can

[PATCH v9 7/7] arm64: kvm: handle guest SError Interrupt by categorization

2018-01-05 Thread Dongjiu Geng
and has not (yet) been architecturally consumed by the PE, the exception is precise. In order to make it simple, we temporarily shut down the VM to isolate the error. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- change since v8: 1. Check handle_guest_sei()'s return value 2. Tempo

[PATCH v9 0/7] Handle guest RAS Error in KVM and kernel

2018-01-05 Thread Dongjiu Geng
for recoverable error (UER) 4. update some patch's commit messages and clean some patches Dongjiu Geng (5): acpi: apei: Add SEI notification type support for ARMv8 KVM: arm64: Trap RAS error registers and set HCR_EL2's TERR & TEA arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl arm64: kvm:

[PATCH v3] arm64: v8.4: Support for new floating point multiplication instructions

2017-12-12 Thread Dongjiu Geng
detects this feature and let the userspace know about it via a HWCAP bit and MRS emulation. Cc: Dave Martin <dave.mar...@arm.com> Cc: Suzuki K Poulose <suzuki.poul...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Reviewed-by: Dave Martin <dave.mar...@arm.com>

[PATCH v2] arm64: v8.4: Support for new floating point multiplication instructions

2017-12-11 Thread Dongjiu Geng
detects this feature and let the userspace know about it via a HWCAP bit and MRS emulation. Cc: Dave Martin <dave.mar...@arm.com> Cc: Suzuki K Poulose <suzuki.poul...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- Change since v1: 1. Address Dave and Suzuki's

[RESEND PATCH] arm64: v8.4: Support for new floating point multiplication variant

2017-12-08 Thread Dongjiu Geng
ARM v8.4 extensions include support for new floating point multiplication variant instructions to the AArch64 SIMD instructions set. Let the userspace know about it via a HWCAP bit and MRS emulation. Cc: Suzuki K Poulose <suzuki.poul...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@h

[PATCH v8 2/7] KVM: arm64: Save ESR_EL2 on guest SError

2017-11-10 Thread Dongjiu Geng
() can determine if this was a RAS SError and decode its severity. Signed-off-by: James Morse <james.mo...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/kvm/hyp/switch.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/

[PATCH v8 0/7] Support RAS virtualization in KVM

2017-11-10 Thread Dongjiu Geng
', so set this ESR to IMPLEMENTATION DEFINED by default if user space does not specify it. Dongjiu Geng (5): acpi: apei: Add SEI notification type support for ARMv8 KVM: arm64: Trap RAS error registers and set HCR_EL2's TERR & TEA arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl a

[PATCH v8 4/7] KVM: arm64: Trap RAS error registers and set HCR_EL2's TERR & TEA

2017-11-10 Thread Dongjiu Geng
raps attempts to access the physical error registers. ERRIDR_EL1 advertises the number of error records, we return zero meaning we can treat all the other registers as RAZ/WI too. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> [removed specific emulation, use trap_raz_wi() directly for

[PATCH v8 3/7] acpi: apei: Add SEI notification type support for ARMv8

2017-11-10 Thread Dongjiu Geng
users. External modules can call this exposed API to parse APEI table and handle the SEI notification. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- drivers/acpi/apei/Kconfig | 15 ++ drivers/acpi/apei/ghes.c | 53 +++ includ

[PATCH v8 1/7] arm64: cpufeature: Detect CPU RAS Extentions

2017-11-10 Thread Dongjiu Geng
b and config option, reworded commit message] Signed-off-by: James Morse <james.mo...@arm.com> Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/Kconfig | 16 arch/arm64/incl

[PATCH v8 6/7] arm64: kvm: Set Virtual SError Exception Syndrome for guest

2017-11-10 Thread Dongjiu Geng
switch, restore this value to VSESR_EL2 only when HCR_EL2.VSE is set. This value no need to be saved because it is stale vale when guest exit. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> [Set an impdef ESR for Virtual-SError

[PATCH v8 5/7] arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl

2017-11-10 Thread Dongjiu Geng
, If has, will set it. Otherwise, nothing to do. For this ESR specifying, Only support for AArch64, not support AArch32. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> change the name to KVM_CAP_ARM_INJECT_SERROR

[PATCH v8 7/7] arm64: kvm: handle SError Interrupt by categorization

2017-11-10 Thread Dongjiu Geng
a valid ESR and inject virtual SError, guest can just kill the current application if the non-consumed error coming from guest application. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> --- arch/arm64/include/asm/esr.h

[PATCH v7 3/4] arm64: kvm: Set Virtual SError Exception Syndrome for guest

2017-10-17 Thread Dongjiu Geng
switch, restore this value to VSESR_EL2 only when HCR_EL2.VSE is set. This value no need to be saved because it is stale vale when guest exit. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> [Set an impdef ESR for Virtual-SError

[PATCH v7 4/4] arm64: kvm: handle SEI notification for guest

2017-10-17 Thread Dongjiu Geng
the address recorded by APEI table is not accurate, so can not identify the address to hwpoison memory and can not notify guest to do the recovery, so at the same time, let user space specify a valid ESR and inject virtual SError. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Sign

[PATCH v7 0/4] Add RAS virtualization support

2017-10-17 Thread Dongjiu Geng
to software on taking a virtual SError interrupt exception. By default specify this syndrome value to IMPLEMENTATION DEFINED, because all-zero means 'RAS error: Uncategorized' instead of 'no valid ISS'. Dongjiu Geng (4): arm64: kvm: route synchronous external abort exceptions to EL2 arm64: kvm

[PATCH v7 2/4] arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl

2017-10-17 Thread Dongjiu Geng
for a generic API for all KVM architectures that will allow us to do something like this. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm/include/asm/kvm_host.h | 1

[PATCH v7 1/4] arm64: kvm: route synchronous external abort exceptions to EL2

2017-10-17 Thread Dongjiu Geng
_EL1 and ERRSELR_EL1 are zero. Then, the others ERX* registers are RAZ/WI. Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/kvm_arm.h | 2 ++ arch/arm64/include/asm/kvm_emulate.h | 7 +++ arch/arm64/include/asm/kvm_host.h| 2 ++ arch/arm64/i

[PATCH v4 3/3] arm64: kvm: inject SError with user space specified syndrome

2017-06-26 Thread Dongjiu Geng
no one cares the old VSESR_EL2 value (3) Add a new KVM_ARM_SEI ioctl to set the VSESR_EL2 value and pend a virtual system error Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> --- Documentation/virtual/kvm/api.txt| 10

[PATCH v4 1/3] arm64: kvm: support user space to detect RAS extension feature

2017-06-26 Thread Dongjiu Geng
Handle userspace's detection for RAS extension, because sometimes the userspace needs to know the CPU's capacity Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/kvm/reset.c | 11 +++ include/uapi/linux/kvm.h | 1 + 2 files changed, 12 insertions(+) diff

[PATCH v4 2/3] arm64: kvm: route synchronous external abort exceptions to el2

2017-06-26 Thread Dongjiu Geng
it delegates to the guest OS kernel Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> --- arch/arm64/include/asm/kvm_arm.h | 2 ++ arch/arm64/include/asm/kvm_emulate.h | 7 +++ 2 files changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/inclu

[PATCH v4] arm64: kvm: inject SError with user space specified syndrome

2017-06-26 Thread Dongjiu Geng
no one cares the old VSESR_EL2 value (3) Add a new KVM_ARM_SEI ioctl to set the VSESR_EL2 value and pend a virtual system error Signed-off-by: Dongjiu Geng <gengdong...@huawei.com> Signed-off-by: Quanming Wu <wuquanm...@huawei.com> --- Documentation/virtual/kvm/api.txt| 10