[PATCH] KVM: handle the right RAS SEA(Synchronous External Abort) type

2020-04-11 Thread Dongjiu Geng
to let the guest recover as much as possible. CC: Xiang Zheng CC: Xiaofei Tan CC: James Morse Signed-off-by: Dongjiu Geng --- Abort DFSC of ESR_EL2, below web site[1] has clarified: "When the RAS Extension is implemented, 0b011000, 0b011100, 0b011101, 0b00, and 0b01, are reserved.

[RFC PATCH V2] kvm: arm64: export memory error recovery capability to user space

2019-05-12 Thread Dongjiu Geng
When user space do memory recovery, it will check whether KVM and guest support the error recovery, only when both of them support, user space will do the error recovery. This patch exports this capability of KVM to user space. Cc: Peter Maydell Signed-off-by: Dongjiu Geng --- v1->v2: 1. ch

[PATCH] KVM: arm/arm64: inject an async abort to host if SEA handling failed

2019-04-23 Thread Dongjiu Geng
If host failed to handle the SEA, KVM should inject an async abort to guest for both SEA data and instruction abort, but it currently only handles the data abort, so correct it. Cc: James Morse Cc: Xiang Zheng Signed-off-by: Dongjiu Geng --- virt/kvm/arm/mmu.c | 11 +-- 1 file changed

[PATCH v4 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-10-12 Thread Dongjiu Geng
Rename kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension(), because it does not have any relationship with device. Renaming this function can make code readable. Cc: James Morse Reviewed-by: Suzuki K Poulose Signed-off-by: Dongjiu Geng --- I remeber James also

[PATCH v4 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-12 Thread Dongjiu Geng
ension Cc: James Morse Reviewed-by : Suzuki K Poulose Signed-off-by: Dongjiu Geng Acked-by: James Morse --- For the 32 bits kvm migration, it needs to enable the vcpu events, this patch will enable it. The user space QEMU patch is here: https://patchwork.ozlabs.org/patch/975615/ --- arch/arm64/k

[PATCH v4 0/2] rename function name and enable 32bit vcpu events

2018-10-12 Thread Dongjiu Geng
omments to update the patch commit messages change since v1: 1. Update patch commit messages. Dongjiu Geng (2): arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension() arm/arm64: KVM: enable 32 bits kvm vcpu events support arch/arm/include/asm/kvm_host.h | 2 +- arch/arm64/i

[PATCH v3 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-10-11 Thread Dongjiu Geng
Rename kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension(), because it does not have any relationship with device. Renaming this function can make code readable. Cc: James Morse Reviewed-by: Suzuki K Poulose Signed-off-by: Dongjiu Geng --- I remeber James also

[PATCH v3 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-11 Thread Dongjiu Geng
ports vcpu events by checking the KVM_CAP_VCPU_EVENTS extension Cc: James Morse Reviewed-by : Suzuki K Poulose Signed-off-by: Dongjiu Geng --- For the 32 bits kvm migration, it needs to enable the vcpu events, this patch will enable it. The user space QEMU patch is here: https://patchwork.ozlabs

[PATCH v3 0/2] rename function name and enable 32bit vcpu events

2018-10-11 Thread Dongjiu Geng
sages. Dongjiu Geng (2): arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension() arm/arm64: KVM: enable 32 bits kvm vcpu events support arch/arm/include/asm/kvm_host.h | 2 +- arch/arm64/include/asm/kvm_host.h | 2 +- arch/arm64/kvm/reset.c| 5 ++--- virt/kvm/arm/

[PATCH v2 2/2] arm/arm64: KVM: enable 32 bits kvm vcpu events support

2018-10-07 Thread Dongjiu Geng
ports vcpu events through KVM_CAP_VCPU_EVENTS IOCTL. Cc: James Morse Signed-off-by: Dongjiu Geng --- For the 32 bits kvm migration, it needs to enable the vcpu events, this patch will enable it. The user space QEMU patch is here: https://patchwork.ozlabs.org/patch/975615/ --- arch/arm64/kvm/r

[PATCH v2 0/2] rename function name and enable 32bit vcpu events

2018-10-07 Thread Dongjiu Geng
Rename the kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension, because the name is not reasonable; Enable the 32 bit vcpu events support. change since v1: 1. Update patch commit messages. Dongjiu Geng (2): arm/arm64: KVM: rename function

[PATCH v2 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-10-07 Thread Dongjiu Geng
Rename kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension(), because it does not have any relationship with device. Renaming this function can make code readable. Cc: James Morse Signed-off-by: Dongjiu Geng --- I remeber James also mentioned that rename this function

[PATCH 0/2] rename function name and enable 32bit vcpu events

2018-09-24 Thread Dongjiu Geng
Rename the kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension, because the name is not reasonable; Enable the 32 bit vcpu events support. Dongjiu Geng (2): arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension() arm/arm64: KVM: share the check for vcpu

[PATCH 1/2] arm/arm64: KVM: rename function kvm_arch_dev_ioctl_check_extension()

2018-09-24 Thread Dongjiu Geng
Rename kvm_arch_dev_ioctl_check_extension() to kvm_arch_vm_ioctl_check_extension(), because it does not have any relationship with device. Cc: James Morse Signed-off-by: Dongjiu Geng --- I remeber James also mentioned that rename this function. --- arch/arm/include/asm/kvm_host.h | 2

[PATCH 2/2] arm/arm64: KVM: share the check for vcpu events capability

2018-09-24 Thread Dongjiu Geng
ENTS IOCTL. Signed-off-by: Dongjiu Geng --- For the 32 bit guest migration, it needs to enable the vcpu events --- arch/arm64/kvm/reset.c | 1 - virt/kvm/arm/arm.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index fd37c5

[PATCH] KVM: Documentation: rename the capability of KVM_CAP_ARM_SET_SERROR_ESR

2018-08-20 Thread Dongjiu Geng
In the documentation description, this capability's name is KVM_CAP_ARM_SET_SERROR_ESR, but in the header file this capability's name is KVM_CAP_ARM_INJECT_SERROR_ESR, so change the documentation description to make it same. Signed-off-by: Dongjiu Geng --- In the Documentation/v

[PATCH] arm64: KVM: rename the capability to set guest SError syndrome

2018-08-20 Thread Dongjiu Geng
In the documentation description, this capability's name is KVM_CAP_ARM_SET_SERROR_ESR, but in the header file this capability's name is KVM_CAP_ARM_INJECT_SERROR_ESR, so it is better to use a same name. Signed-off-by: Dongjiu Geng --- In the Documentation/virtual/kvm/api.t

[PATCH RESEND v6 0/2] support exception state migration and set VSESR_EL2 by user space

2018-07-02 Thread Dongjiu Geng
patch is here: https://www.mail-archive.com/qemu-devel@nongnu.org/msg539534.html BTW: The user space patch is needed to rebase Dongjiu Geng (2): arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS arm64: KVM: export the capability to set guest SError syndrome Documentation/virtual/kvm/api.txt| 44

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

2018-07-02 Thread Dongjiu Geng
user space, otherwise returns false. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse --- change since v5: 1. Rebase this patch to v4.18-rc3 --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm64/kvm/reset.c| 3 +++ include/uapi/linux/kvm.h | 1 + 3 files

[PATCH RESEND v6 1/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS

2018-07-02 Thread Dongjiu Geng
, user space can get/set the SError exception state to do migrate/snapshot/suspend. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse --- change since v5: Address James's comments, thanks James's review 1. Check check against the top bits of ESR change since v4: Address Christoffer&

[PATCH v6 1/2] arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS

2018-07-02 Thread Dongjiu Geng
, user space can get/set the SError exception state to do migrate/snapshot/suspend. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse --- change since v5: Address James's comments, thanks James's review 1. Check check against the top bits of ESR change since v4: Address Christoffer&

[PATCH v6 0/2] support exception state migration and set VSESR_EL2 by user space

2018-07-02 Thread Dongjiu Geng
patch is here: https://www.mail-archive.com/qemu-devel@nongnu.org/msg539534.html BTW: The user space patch is needed to rebase Dongjiu Geng (2): arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS arm64: KVM: export the capability to set guest SError syndrome Documentation/virtual/kvm/api.txt| 44

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

2018-07-02 Thread Dongjiu Geng
user space, otherwise returns false. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse --- change since v5: 1. Rebase this patch to v4.18-rc3 --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm64/kvm/reset.c| 3 +++ include/uapi/linux/kvm.h | 1 + 3 files

[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 Note: Firmware will follow the SError mask

[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 --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/traps.c| 4 arch

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

2018-05-15 Thread Dongjiu Geng
Initialise kvm_vcpu_events to 0 so 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 supp

[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 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 value in the kvm_arm_vcpu_get_events() 3. C

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

2018-05-15 Thread Dongjiu Geng
user space, otherwise returns false. Signed-off-by: Dongjiu Geng Reviewed-by: James Morse Change from V11: 1. Change the commit message 2. Update the Documentation/virtual/kvm/api.tx --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm64/kvm/reset.c| 3 +++ include

[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 --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm64/kvm/reset.c| 3

[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 Change since V10: Address James&#

[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 --- drivers/acpi/apei/Kconfig | 15

[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 --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/traps.c| 4 arch

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

2018-04-09 Thread Dongjiu Geng
Make 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:

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

2018-03-03 Thread Dongjiu Geng
: Dongjiu Geng --- 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.h | 10 ++ arch/arm64/kvm

[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 --- Documentation/virtual/kvm/api.txt | 11 +++ arch/arm64/kvm/reset.c| 3

[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 --- arch/arm64/include/asm/kvm_emulate.h | 5 + arch/arm64/include/asm/kvm_host.h| 2 ++ arch/arm64/kvm/inject_fault.c| 5 + 3 files

[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 --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/traps.c| 4 arch

[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 --- drivers/acpi/apei/Kconfig | 15

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

2018-03-03 Thread Dongjiu Geng
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] arm64: rename the function arm64_is_ras_serror() to avoid confusion

2018-02-22 Thread Dongjiu Geng
(), this function is used to judge whether it is categorized RAS Serror. Change some code notes, unrecoverable RAS errors is imprecise, but Recoverable RAS errors is precise. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/traps.h | 20 arch/arm64/kernel/traps.c | 9

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

2018-01-05 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 --- drivers/acpi/apei/Kconfig | 15 ++ drivers/acpi/apei/ghes.c | 53 +++ include/acpi/ghes.h | 1 + 3

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

2018-01-05 Thread Dongjiu Geng
has, will set it. Otherwise, nothing to do. For this ESR specifying, Only support for AArch64, not support AArch32. Signed-off-by: Dongjiu Geng --- change the name to KVM_CAP_ARM_INJECT_SERROR_ESR instead of X_ARM_RAS_EXTENSION, suggested here https://patchwork.kernel.org/patch/9925203

[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 [removed specific emulation, use trap_raz_wi() directly for everything, rephrased parts of

[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 determine if this was a R

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

2018-01-05 Thread Dongjiu Geng
st/host world 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 [Set an impdef ESR for Virtual-SError] Signed-off-by: James Morse --- arch/arm64/include/asm/kvm_emulate.h |

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

2018-01-05 Thread Dongjiu Geng
to isolate the error 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

[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 --- change since v8: 1. Check handle_guest_sei()'s return value 2. Temporarily shut down the

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

2018-01-05 Thread Dongjiu Geng
ned-off-by: James Morse Signed-off-by: Dongjiu Geng Reviewed-by: Catalin Marinas --- arch/arm64/Kconfig | 16 arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/include/asm/sysreg.h | 2 ++ arch/arm64/kernel/cpufeature.c | 13 + 4 files changed, 33

[PATCH] KVM: arm64: handle the translation table walk RAS error

2017-11-29 Thread Dongjiu Geng
guest handle it, for example, kill the guest application or panic guest OS. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/kvm_arm.h | 2 ++ virt/kvm/arm/mmu.c | 14 -- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm

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

2017-11-10 Thread Dongjiu Geng
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 Signed-off-by: Quanming Wu --- arch/arm64/include/asm/esr.h | 15 arch/arm64/include/asm/kvm_asm.h | 3

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

2017-11-10 Thread Dongjiu Geng
27;no valid ISS', 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

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

2017-11-10 Thread Dongjiu Geng
the guest/host world 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 Signed-off-by: Quanming Wu [Set an impdef ESR for Virtual-SError] Signed-off-by: James Morse --- ar

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

2017-11-10 Thread Dongjiu Geng
has, will set it. Otherwise, nothing to do. For this ESR specifying, Only support for AArch64, not support AArch32. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu change the name to KVM_CAP_ARM_INJECT_SERROR_ESR instead of X_ARM_RAS_EXTENSION, suggested here https

[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 [removed specific emulation, use trap_raz_wi() directly for everything, rephrased parts of

[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 --- drivers/acpi/apei/Kconfig | 15 ++ drivers/acpi/apei/ghes.c | 53 +++ include/acpi/ghes.h | 1 + 3

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

2017-11-10 Thread Dongjiu Geng
Signed-off-by: James Morse Signed-off-by: Dongjiu Geng Reviewed-by: Catalin Marinas --- arch/arm64/Kconfig | 16 arch/arm64/include/asm/barrier.h | 1 + arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/include/asm/sysreg.h | 2 ++ arch/arm64/kernel/cp

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

2017-11-10 Thread Dongjiu Geng
this was a RAS SError and decode its severity. Signed-off-by: James Morse Signed-off-by: Dongjiu Geng --- arch/arm64/kvm/hyp/switch.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index 945e79c..c6f1

[PATCH v1 0/3] manually add Error Synchronization Barrier at exception handler entry and exit

2017-11-01 Thread Dongjiu Geng
for firmware first support". In Huawei's platform, we do not support IESB, so software needs to insert that. Dongjiu Geng (3): arm64: add a macro for SError synchronization arm64: add error synchronization barrier in kernel_entry/kernel_exit KVM: arm64: add ESB in exception handler ent

[PATCH v1 1/3] arm64: add a macro for SError synchronization

2017-11-01 Thread Dongjiu Geng
Barrier(ESB) operations. In this macros, if system supports RAS Extensdddon instead of IESB, it will insert an ESB instruction. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/assembler.h | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm64/include/asm/assembler.h b

[PATCH v1 3/3] KVM: arm64: add ESB in exception handler entry and exit.

2017-11-01 Thread Dongjiu Geng
synchronization operation. Only add the ESB in the important exception handler path to reduce the impact on performance. Signed-off-by: Dongjiu Geng --- arch/arm64/kvm/hyp/entry.S | 2 ++ arch/arm64/kvm/hyp/hyp-entry.S | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/arm64/kvm/hyp

[PATCH v1 2/3] arm64: add error synchronization barrier in kernel_entry/kernel_exit

2017-11-01 Thread Dongjiu Geng
will immediately trap to EL3 firmware. Signed-off-by: Dongjiu Geng --- arch/arm64/kernel/entry.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index e147c1d..6dde644 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S

[PATCH v4] KVM: arm/arm64: fix the incompatible matching for external abort

2017-10-29 Thread Dongjiu Geng
same value. Using kvm_vcpu_trap_get_fault() instead fixes it for good. Signed-off-by: Dongjiu Geng Acked-by: Marc Zyngier --- arch/arm/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_emulate.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/includ

[PATCH v3] KVM: arm/arm64: fix the incompatible matching for external abort

2017-10-27 Thread Dongjiu Geng
For this matching, switch expression uses fault type which is not {I,D}FSC value, but the case expression uses {I,D}FSC, they are incompatible. So change the switch expression to use {I,D}FSC. Signed-off-by: Dongjiu Geng --- arch/arm/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm

[PATCH v2] KVM: arm/arm64: Fix external abort type matching

2017-10-26 Thread Dongjiu Geng
FSC_SEA_TTW2 FSC_SEA_TTW3 0x18FSC_SECC 0x1cFSC_SECC_TTW0 FSC_SECC_TTW1 FSC_SECC_TTW2 FSC_SECC_TTW3 CC: James Morse CC: Tyler Baicar Signed-off-by: Dongjiu Geng --- As shown below code: The kvm_vcpu_trap_get_fault_type() only return {I,D}FSC bit[5]:bit[2], not the whole {I,D}FSC, but

[PATCH RESEND v2] arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort

2017-10-17 Thread Dongjiu Geng
: A32 T32 Undefined Instruction +4+2 Prefetch Abort +4+4 Data Abort +8+8 IRQ or FIQ +4+4 Signed-off-by: Dongjiu Geng Tested-by: Haibin Zhang --- Have tested in both

[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 --- 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/include/asm/sysreg.h

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

2017-10-17 Thread Dongjiu Geng
the guest/host world 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 Signed-off-by: Quanming Wu [Set an impdef ESR for Virtual-SError] Signed-off-by: James Morse --- ar

[PATCH v7 0/4] Add RAS virtualization support

2017-10-17 Thread Dongjiu Geng
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

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

2017-10-17 Thread Dongjiu Geng
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 Signed-off-by: Quanming Wu --- arch/arm64

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

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

[PATCH v2] arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort

2017-10-16 Thread Dongjiu Geng
: A32 T32 Undefined Instruction +4+2 Prefetch Abort +4+4 Data Abort +8+8 IRQ or FIQ +4+4 Signed-off-by: Dongjiu Geng Tested-by: Haibin Zhang --- Note: now only test

[PATCH] arm64: KVM: set right LR register value for 32 bit guest when inject abort

2017-10-12 Thread Dongjiu Geng
Instruction +4+2 Prefetch Abort +4+4 Data Abort +8+8 IRQ or FIQ +4+4 Signed-off-by: Dongjiu Geng Signed-off-by: Haibin Zhang --- For example, to the undefined instruction injection: 1. Guest OS call

[PATCH] arm64: KVM: VHE: reset PSTATE.UAO when switch to host

2017-09-06 Thread Dongjiu Geng
host will use the incorrect PSTATE.UAO. So check and reset the PSTATE.UAO when switching to host. Move the reset PSTATE.PAN on entry to EL2 together with PSTATE.UAO reset. Signed-off-by: Dongjiu Geng Signed-off-by: Haibin Zhang Tested-by: Dongjiu Geng --- arch/arm64/kvm/hyp/entry.S | 2 --

[PATCH v6 7/7] arm64: kvm: handle SEI notification and pass the virtual syndrome

2017-08-28 Thread Dongjiu Geng
software on taking a virtual SError interrupt exception. change since v5: 1. not call the memory_failure() to handle the SEI error 2. kvm classify the SError and decide how to do. 3. add code to deliver signal compatible to Non-KVM user. 4. correct some typo errors Signed-off-by: Dongjiu Geng

[PATCH v6 0/7] Add RAS virtualization support for SEA/SEI notification type in KVM

2017-08-28 Thread Dongjiu Geng
SError. This syndrome value is set to the VSESR_EL2. VSESR_EL2 is a new ARMv8.2 RAS extensions register which provides the syndrome value reported to software on taking a virtual SError interrupt exception. Dongjiu Geng (5): acpi: apei: remove the unused code arm64: kvm: support user space to

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

2017-08-28 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 determine if this was a R

[PATCH v6 5/7] arm64: kvm: route synchronous external abort exceptions to el2

2017-08-28 Thread Dongjiu Geng
t is generated in the guest OS, it will trap to EL3 firmware, EL3 firmware will check the HCR_EL2.TEA value to decide to jump to hypervisor or host OS. Enabling HCR_EL2.TERR makes error record access from guest trap to EL2. change since v5: 1. modify some patch description Signed-off-by: Dongjiu

[PATCH v6 4/7] arm64: kvm: support user space to query RAS extension feature

2017-08-28 Thread Dongjiu Geng
patch adds support for querying the availability of this extension. change since v5: 1. modify some patch description Signed-off-by: Dongjiu Geng --- arch/arm64/kvm/reset.c | 3 +++ include/uapi/linux/kvm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/arm64/kvm/reset.c b/arch/arm64

[PATCH v6 3/7] acpi: apei: remove the unused code

2017-08-28 Thread Dongjiu Geng
: 1. remove the SEI notification type handling, because the SEI is asynchronous exception and the address is not accurate. so not call memory_failure() to handle it. Signed-off-by: Dongjiu Geng --- drivers/acpi/apei/ghes.c | 14 -- 1 file changed, 14 deletions(-) diff --git a

[PATCH v6 6/7] KVM: arm64: allow get exception information from userspace

2017-08-28 Thread Dongjiu Geng
injection logic to userspace, when userspace injects the SEA exception to guest OS, it needs to specify the far_el1 value, so this patch gives the exception virtual address to userspace. change since v5: 1. modify some patch description Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu

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

2017-08-28 Thread Dongjiu Geng
From: Xie XiuQi ARM's v8.2 Extentions add support for Reliability, Availability and Serviceability (RAS). On CPUs with these extensions system software can use additional barriers to isolate errors and determine if faults are pending. Add cpufeature detection and a barrier in the context-switch

[PATCH v11 2/6] ACPI: Add APEI GHES Table Generation support

2017-08-18 Thread Dongjiu Geng
must acknowledges the error via Read Ack register. so user space must check the ack value to avoid read-write race condition. Signed-off-by: Dongjiu Geng --- hw/acpi/aml-build.c | 2 + hw/acpi/hest_ghes.c | 345 hw/arm/virt-acpi-bui

[PATCH v11 5/6] target-arm: kvm64: handle SIGBUS signal for synchronous External Abort

2017-08-18 Thread Dongjiu Geng
, PSTATE, far_elx, elr_elx etc, when switch to guest OS, it will jump to the synchronous external abort vector table entry. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu --- include/sysemu/kvm.h | 2 +- linux-headers/asm-arm64/kvm.h | 5 ++ target/arm/internals.h| 13

[PATCH v11 0/6] Add RAS virtualization support for armv8 SEA and SEI

2017-08-18 Thread Dongjiu Geng
cknowledges the error, check the ACK value */ (qemu) xp /1 0x785D0098 785d00f0: 0x /* After OSPM acknowledges the error, check the ACK value */ (qemu) xp /1 0x785D0098 785d00f0: 0x0001 Dongjiu Geng (6): ACPI: add APEI/HEST/CPER structu

[PATCH v11 3/6] ACPI: build and enable APEI GHES in the Makefile and configuration

2017-08-18 Thread Dongjiu Geng
Add CONFIG_ACPI_APEI configuration in the Makefile and enable it in the arm-softmmu.mak Signed-off-by: Dongjiu Geng --- default-configs/arm-softmmu.mak | 1 + hw/acpi/Makefile.objs | 1 + 2 files changed, 2 insertions(+) diff --git a/default-configs/arm-softmmu.mak b/default-configs

[PATCH v11 4/6] target-arm: kvm64: detect guest RAS EXTENSION feature

2017-08-18 Thread Dongjiu Geng
check if kvm supports guest RAS EXTENSION. if so, set corresponding feature bit for vcpu. Signed-off-by: Dongjiu Geng --- linux-headers/linux/kvm.h | 1 + target/arm/cpu.h | 3 +++ target/arm/kvm64.c| 8 3 files changed, 12 insertions(+) diff --git a/linux-headers

[PATCH v11 1/6] ACPI: add APEI/HEST/CPER structures and macros

2017-08-18 Thread Dongjiu Geng
(1) Add related APEI/HEST table structures and macros, these definition refer to ACPI 6.1 and UEFI 2.6 spec. (2) Add generic error status block and CPER memory section definition, user space only handle memory section errors. Signed-off-by: Dongjiu Geng --- include/hw/acpi/acpi-defs.h

[PATCH v11 6/6] target-arm: kvm64: Handle SError interrupt for the guest OS

2017-08-18 Thread Dongjiu Geng
host VA to guest OS PA and record this error PA to HEST table. 2. set specified virtual SError syndrome and pass the value to KVM. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu --- linux-headers/linux/kvm.h | 1 + target/arm/internals.h| 1 + target/arm/kvm64.c| 28

[PATCH v5 4/7] support user space to query RAS extension feature

2017-08-18 Thread Dongjiu Geng
support Signed-off-by: Dongjiu Geng --- arch/arm64/kvm/reset.c | 3 +++ include/uapi/linux/kvm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index 3256b9228e75..b7313ee028e9 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm

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

2017-08-18 Thread Dongjiu Geng
CONFIG_ACPI_APEI_SEI do not defined. Expose one API ghes_notify_sex() to external, external modules can call this exposed APIs to parse and handling the SEA/SEI. Signed-off-by: Dongjiu Geng --- arch/arm64/mm/fault.c | 21 +++-- drivers/acpi/apei/Kconfig | 15

[PATCH v5 7/7] arm64: kvm: handle SEI notification and inject virtual SError

2017-08-18 Thread Dongjiu Geng
. VSESR_EL2 is a new RAS extensions register which provides the syndrome value reported to software on taking a virtual SError interrupt exception. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu --- arch/arm/include/asm/kvm_host.h | 2 ++ arch/arm/kvm/guest.c | 5

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

2017-08-18 Thread Dongjiu Geng
From: Xie XiuQi ARM's v8.2 Extentions add support for Reliability, Availability and Serviceability (RAS). On CPUs with these extensions system software can use additional barriers to isolate errors and determine if faults are pending. Add cpufeature detection and a barrier in the context-switch

[PATCH v5 5/7] arm64: kvm: route synchronous external abort exceptions to el2

2017-08-18 Thread Dongjiu Geng
t is generated in the guest OS, it will trap to EL3 firmware, firmware will be according to the HCR_EL2.TEA to decide to jump to hypervisor or host OS. In the guest OS, RAS error record access will trap to EL2. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/kvm_arm.h | 2 ++ arch/a

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

2017-08-18 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 determine if this was a R

[PATCH v5 6/7] KVM: arm64: Allow get exception information from userspace

2017-08-18 Thread Dongjiu Geng
injection logic to userspace, when userspace injects the SEA exception to guest OS, it needs to specify the far_el1 value, so this patch give the exception virtual address to user space. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu --- arch/arm64/include/uapi/asm/kvm.h | 5

[PATCH v5 0/7] Add RAS virtualization support to SEA/SEI notification type

2017-08-18 Thread Dongjiu Geng
. Dongjiu Geng (5): acpi: apei: Add SEI notification type support for ARMv8 support user space to query RAS extension feature arm64: kvm: route synchronous external abort exceptions to el2 KVM: arm/arm64: Allow get exception syndrome and arm64: kvm: handle SEI notification and inject

[PATCH v2] KVM: arm64: pass vcpu esr_el2 and far_el2 sysre to user space

2017-08-07 Thread Dongjiu Geng
For the firmware-first RAS solution, SEA and SEI is injected by the user space, user space needs to know the vcpu's esr_el2 and far_el2 value, so add them to sysreg. user space uses the IOCTL KVM_GET_ONE_REG can get their value. Signed-off-by: Dongjiu Geng --- arch/arm64/include/asm/kvm_h

[PATCH] KVM: arm64: add esr_el2 and far_el2 to sysreg

2017-08-07 Thread Dongjiu Geng
For the firmware-first RAS solution, SEA and SEI is injected by the user space, user space needs to know the esr_el2 and far_el2's value, so add them to sysreg. user space uses the IOCTL KVM_GET_ONE_REG can get their value. Signed-off-by: Dongjiu Geng Signed-off-by: Quanming Wu --- arch/

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

2017-06-26 Thread Dongjiu Geng
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 Signed-off-by: Quanming Wu --- Documentation/virtual/kvm/api.txt| 10 ++ arch/arm/include/asm/kvm_host.h | 1 + arch

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

2017-06-26 Thread Dongjiu Geng
se it delegates to the guest OS kernel Signed-off-by: Dongjiu Geng --- 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/include/asm/kvm_arm.h index 61d694c..11

  1   2   >