[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1503065517-7920-3-git-send-email-gengdongjiu@huawei.com>
Date: Fri, 18 Aug 2017 22:11:52 +0800
From: Dongjiu Geng <gengdongjiu@...wei.com>
To: <christoffer.dall@...aro.org>, <marc.zyngier@....com>,
<rkrcmar@...hat.com>, <linux@...linux.org.uk>,
<catalin.marinas@....com>, <will.deacon@....com>,
<lenb@...nel.org>, <robert.moore@...el.com>, <lv.zheng@...el.com>,
<mark.rutland@....com>, <james.morse@....com>,
<xiexiuqi@...wei.com>, <cov@...eaurora.org>,
<david.daney@...ium.com>, <suzuki.poulose@....com>,
<stefan@...lo-penguin.com>, <Dave.Martin@....com>,
<kristina.martsenko@....com>, <wangkefeng.wang@...wei.com>,
<tbaicar@...eaurora.org>, <ard.biesheuvel@...aro.org>,
<mingo@...nel.org>, <bp@...e.de>, <shiju.jose@...wei.com>,
<zjzhang@...eaurora.org>, <linux-arm-kernel@...ts.infradead.org>,
<kvmarm@...ts.cs.columbia.edu>, <kvm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
<devel@...ica.org>, <mst@...hat.com>, <john.garry@...wei.com>,
<jonathan.cameron@...wei.com>,
<shameerali.kolothum.thodi@...wei.com>, <huangdaode@...ilicon.com>,
<wangzhou1@...ilicon.com>
CC: <huangshaoyu@...wei.com>, <wuquanming@...wei.com>,
<linuxarm@...wei.com>, <gengdongjiu@...wei.com>,
<zhengqiang10@...wei.com>
Subject: [PATCH v5 2/7] KVM: arm64: Save ESR_EL2 on guest SError
From: James Morse <james.morse@....com>
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 RAS SError and decode its severity.
Signed-off-by: James Morse <james.morse@....com>
---
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 945e79c641c4..c6f17c7675ad 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -226,13 +226,20 @@ static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar)
return true;
}
+static void __hyp_text __populate_fault_info_esr(struct kvm_vcpu *vcpu)
+{
+ vcpu->arch.fault.esr_el2 = read_sysreg_el2(esr);
+}
+
static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu)
{
- u64 esr = read_sysreg_el2(esr);
- u8 ec = ESR_ELx_EC(esr);
+ u8 ec;
+ u64 esr;
u64 hpfar, far;
- vcpu->arch.fault.esr_el2 = esr;
+ __populate_fault_info_esr(vcpu);
+ esr = vcpu->arch.fault.esr_el2;
+ ec = ESR_ELx_EC(esr);
if (ec != ESR_ELx_EC_DABT_LOW && ec != ESR_ELx_EC_IABT_LOW)
return true;
@@ -321,6 +328,8 @@ int __hyp_text __kvm_vcpu_run(struct kvm_vcpu *vcpu)
*/
if (exit_code == ARM_EXCEPTION_TRAP && !__populate_fault_info(vcpu))
goto again;
+ else if (ARM_EXCEPTION_CODE(exit_code) == ARM_EXCEPTION_EL1_SERROR)
+ __populate_fault_info_esr(vcpu);
if (static_branch_unlikely(&vgic_v2_cpuif_trap) &&
exit_code == ARM_EXCEPTION_TRAP) {
--
2.14.0
Powered by blists - more mailing lists