Received: by 10.223.164.202 with SMTP id h10csp131239wrb; Fri, 10 Nov 2017 03:53:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ2UfBX0GHRS0XGn+Beqg/Vj1udMi4VamkqLHivrqD5eykUyRJbzFleXb8nzOI9kvkPClQf X-Received: by 10.98.133.28 with SMTP id u28mr42514pfd.241.1510314781558; Fri, 10 Nov 2017 03:53:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510314781; cv=none; d=google.com; s=arc-20160816; b=q1dEtpHGLxc6JB3/EE5NtFjYz1JsnBqzFmRLQRA77OucyI+125cLBf0WYb+zJEA9RI b0UaruJm0HRZcECyTa3bgIxUO6x1tq0GfLi9VTxt5NPfJHjKxp+EvKV7C/oeV+OmPraC RnYK95Z2gCow8ejWQZO/B1+GHWhs59ZYH4yUJf9Tq/yKC+A7XZ5zTgIVQM9/1ntUUb+J wJS28ZXqq7U+1KmtHBwCWuCb2pcOXQaEuWyfEaBBS/MhyYI1CCFL14tWby/lbvgf7J6T wUE6tJtpJFPpExkDMGl83IiHDqV8DdbjSTlAx4ikssjpeNgG13hIj9Mpwk+CeQ3WekKz DfKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:arc-authentication-results; bh=vE5ZW+Gf9qJX4oH2J84z5jCT2uLWAkI8h/82yIIqC8c=; b=TLCHw5ZAS8Ew62ANZT8C/fy/eQcV3O6hTNvPpRSxJ6nBAgkTNTZwgNjuPAnoxekVYK bHzisHgRHXhp3qA5SeGkbI9HYRs65FV4ylozgNJScfnnWtJjOUP0gonJd0IlAypxiDZH ZTWeSaDzDmCqCdy7pL1ipnltlEzIf9XLFyswthJDq6iSRbuGOcHnIGkKY0rA6a5YOUgW zQbhCgU1v/g++cZAtUoCmoTvQ0affnWxfmsjcDKO1Dl0/gRVqqgdOy5cJ4M+XpKVNIAN L8VgizdIEfGQ25PpFvvzxJC89de9l+rbj0LouzSmkmWSIq9mtXuvYJd9d+J8SraBeftL 1IbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si6680037pgt.614.2017.11.10.03.52.50; Fri, 10 Nov 2017 03:53:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753013AbdKJLvG (ORCPT + 82 others); Fri, 10 Nov 2017 06:51:06 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:10447 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753256AbdKJLtb (ORCPT ); Fri, 10 Nov 2017 06:49:31 -0500 Received: from 172.30.72.58 (EHLO DGGEMS401-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DKO50292; Fri, 10 Nov 2017 19:49:25 +0800 (CST) Received: from localhost.localdomain (10.143.28.90) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.361.1; Fri, 10 Nov 2017 19:48:19 +0800 From: Dongjiu Geng To: , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v8 2/7] KVM: arm64: Save ESR_EL2 on guest SError Date: Sat, 11 Nov 2017 03:54:05 +0800 Message-ID: <1510343650-23659-3-git-send-email-gengdongjiu@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510343650-23659-1-git-send-email-gengdongjiu@huawei.com> References: <1510343650-23659-1-git-send-email-gengdongjiu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.143.28.90] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5A059246.0017,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: 49563397c1a4734b27e60060d6aee391 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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..c6f17c7 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) { -- 1.9.1 From 1585261673607606804@xxx Mon Nov 27 22:55:42 +0000 2017 X-GM-THRID: 1585260579261178255 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread