Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887AbdF0MQp (ORCPT ); Tue, 27 Jun 2017 08:16:45 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:9307 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751453AbdF0MQn (ORCPT ); Tue, 27 Jun 2017 08:16:43 -0400 Subject: Re: [PATCH v4 2/3] arm64: kvm: route synchronous external abort exceptions to el2 To: , , , , , , , , , , , , , , , References: <1498481156-23572-1-git-send-email-gengdongjiu@huawei.com> From: gengdongjiu Message-ID: <3862ccaf-a669-17b0-4cfb-ce15fce361a1@huawei.com> Date: Tue, 27 Jun 2017 20:15:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1498481156-23572-1-git-send-email-gengdongjiu@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090206.59524C85.0067,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 86f60c56ebc337a7fa9cd6bf20d1b3ea Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2148 Lines: 54 correct the commit message: In the firmware-first RAS solution, 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 host OS kernel On 2017/6/26 20:45, Dongjiu Geng wrote: > 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 > --- > 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..1188272 100644 > --- a/arch/arm64/include/asm/kvm_arm.h > +++ b/arch/arm64/include/asm/kvm_arm.h > @@ -23,6 +23,8 @@ > #include > > /* 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 f5ea0ba..5f64ab2 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; > } >