diff mbox

[v2] arm64: kvm: route synchronous external abort exceptions to el2

Message ID 1498306822-2924-1-git-send-email-gengdongjiu@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dongjiu Geng June 24, 2017, 12:20 p.m. UTC
In the firmware-first RAS solution, guest OS receives an synchronous
external abort, then trapped to EL3 by SCR_EL3.EA. Firmware inspects
the HCR_EL2.TEA and chooses the target to send APEI's SEA notification.
If the SCR_EL3.EA is set, delegates the error exception to the hypervisor,
otherwise it delegates to the guest OS kernel

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
---
 arch/arm64/include/asm/kvm_arm.h     | 2 ++
 arch/arm64/include/asm/kvm_emulate.h | 7 +++++++
 2 files changed, 9 insertions(+)

Comments

kernel test robot June 26, 2017, 1:03 a.m. UTC | #1
Hi Dongjiu,

[auto build test ERROR on kvm/linux-next]
[also build test ERROR on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dongjiu-Geng/arm64-kvm-route-synchronous-external-abort-exceptions-to-el2/20170626-051545
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   In file included from arch/arm64/kvm/../../../virt/kvm/arm/arm.c:45:0:
   arch/arm64/include/asm/kvm_emulate.h: In function 'vcpu_reset_hcr':
>> arch/arm64/include/asm/kvm_emulate.h:50:26: error: 'ARM64_HAS_RAS_EXTN' undeclared (first use in this function)
     if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN)) {
                             ^~~~~~~~~~~~~~~~~~
   arch/arm64/include/asm/kvm_emulate.h:50:26: note: each undeclared identifier is reported only once for each function it appears in

vim +/ARM64_HAS_RAS_EXTN +50 arch/arm64/include/asm/kvm_emulate.h

    44	
    45	static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
    46	{
    47		vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
    48		if (is_kernel_in_hyp_mode())
    49			vcpu->arch.hcr_el2 |= HCR_E2H;
  > 50		if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN)) {
    51			/* route synchronous external abort exceptions to EL2 */
    52			vcpu->arch.hcr_el2 |= HCR_TEA;
    53			/* trap error record accesses */

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 61d694c..1188272 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -23,6 +23,8 @@ 
 #include <asm/types.h>
 
 /* Hyp Configuration Register (HCR) bits */
+#define HCR_TEA		(UL(1) << 37)
+#define HCR_TERR	(UL(1) << 36)
 #define HCR_E2H		(UL(1) << 34)
 #define HCR_ID		(UL(1) << 33)
 #define HCR_CD		(UL(1) << 32)
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index a3259a9..93dc3d1 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -47,6 +47,13 @@  static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
 	vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
 	if (is_kernel_in_hyp_mode())
 		vcpu->arch.hcr_el2 |= HCR_E2H;
+	if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN)) {
+		/* route synchronous external abort exceptions to EL2 */
+		vcpu->arch.hcr_el2 |= HCR_TEA;
+		/* trap error record accesses */
+		vcpu->arch.hcr_el2 |= HCR_TERR;
+	}
+
 	if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features))
 		vcpu->arch.hcr_el2 &= ~HCR_RW;
 }