Received: by 10.223.176.46 with SMTP id f43csp4574057wra; Tue, 23 Jan 2018 11:11:20 -0800 (PST) X-Google-Smtp-Source: AH8x224mlJTNMr2YnnvXGROX/OV+fABs/uepXpavccwyfaxZGJ3YegGyLh4+l+KB6fy0EftOUdTo X-Received: by 10.107.183.196 with SMTP id h187mr5536488iof.241.1516734680729; Tue, 23 Jan 2018 11:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516734680; cv=none; d=google.com; s=arc-20160816; b=0oiWU8zPV8CLegDMk8AUwErfawzHboizsZ12A9aORzsPMqAb7JfIqB1BCqxtHELJvM KxDt7KOJ6K+fY+Z0Z/ocsyr7jN5itm6Oio9aB1AXHCBd24jCIo2/vLWzFzBelo5MpGhJ pvp7fONwQrtwLK1LpjOkYquek6JmOY0sbtjXsU5tmbiE2CMhQXIKDAff1HYn2xk0c7GD 63utyI2fKiSDE1AYUzi+Bh3CcneGVB8/1L8wFNtErto6I5nRc7whgeRT9mLrTrtF1rs9 66zrs1yOoTiRHf10XXuctxgKifw2ZHhYFYZH/Lm2O8Y66hl1OgjS91mHhGAdKslO7wJi mA9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id:arc-authentication-results; bh=88DE2B/KVnBBb+zWefmp+3acqMYjTux43RZgVsoxkm4=; b=MurEm3fqQLOS//0jFfv9ItHSw7cDVWGCBCnCnrlb6t2q3q9N6jDn/x1Eub8I/cGHwo RcNndqM2/B9ZwLpZg+9f6MecryEmEFdslqsX4MIxb/cHXtDpE9KMcyaES7fGsEWqsCrL Jgj+//Fn+hmqcpn+D9XaDBRZMOOA2TINqMpAkROrZbBVhN2TGWEoGRyW5qZZ0V/sPBps fDojTTpbEbl4xNHeRA0eFPOii4l1EUPsyMZOqRkUdEWocuCULpBz+Gzj4Dlflp4x/8Xk yWKxZp4Nqk2ODNpBFt66MlX4cw4IJdGYOeVLQa20m81GD36wRRVXSiJp/3vPlFXAVKA+ O4sQ== 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 g12si9771937itg.2.2018.01.23.11.11.07; Tue, 23 Jan 2018 11:11:20 -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 S1752006AbeAWTKQ (ORCPT + 99 others); Tue, 23 Jan 2018 14:10:16 -0500 Received: from foss.arm.com ([217.140.101.70]:45784 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751819AbeAWTKP (ORCPT ); Tue, 23 Jan 2018 14:10:15 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC4CA80D; Tue, 23 Jan 2018 11:10:14 -0800 (PST) Received: from [10.1.207.55] (melchizedek.cambridge.arm.com [10.1.207.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 00C2C3F53D; Tue, 23 Jan 2018 11:10:09 -0800 (PST) Message-ID: <5A678806.8030108@arm.com> Date: Tue, 23 Jan 2018 19:07:50 +0000 From: James Morse User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: Dongjiu Geng CC: christoffer.dall@linaro.org, marc.zyngier@arm.com, linux@armlinux.org.uk, catalin.marinas@arm.com, rjw@rjwysocki.net, bp@alien8.de, robert.moore@intel.com, lv.zheng@intel.com, corbet@lwn.net, will.deacon@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-acpi@vger.kernel.org, devel@acpica.org, huangshaoyu@huawei.com Subject: Re: [PATCH v9 6/7] arm64: kvm: Set Virtual SError Exception Syndrome for guest References: <1515254577-6460-1-git-send-email-gengdongjiu@huawei.com> <1515254577-6460-7-git-send-email-gengdongjiu@huawei.com> In-Reply-To: <1515254577-6460-7-git-send-email-gengdongjiu@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dongjiu Geng, On 06/01/18 16:02, Dongjiu Geng wrote: > RAS Extension add a VSESR_EL2 register which can provide > the syndrome value reported to software on taking a virtual > SError interrupt exception. This patch supports to specify > this Syndrome. > > In the RAS Extensions we can not set all-zero syndrome value > for SError, which means 'RAS error: Uncategorized' instead of > 'no valid ISS'. So set it to IMPLEMENTATION DEFINED syndrome > by default. > > We also need to support userspace to specify a valid syndrome > value, Because in some case, the recovery is driven by userspace. > This patch can support that userspace specify it. > > In 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. A version of this patch has been queued by Catalin. Now that the cpufeature bits are queued, I think this can be split up into two separate series for v4.16-rc1, one to tackle NOTIFY_SEI and the associated plumbing. The second for the KVM 'make SError pending' API. > Signed-off-by: Dongjiu Geng > [Set an impdef ESR for Virtual-SError] > Signed-off-by: James Morse I didn't sign-off this patch. If you pick some bits from another version and want to credit someone else you can 'CC:' them or just mention it in the commit-message. > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 47b967d..3b035cc 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -86,6 +86,9 @@ > #define REG_PSTATE_PAN_IMM sys_reg(0, 0, 4, 0, 4) > #define REG_PSTATE_UAO_IMM sys_reg(0, 0, 4, 0, 3) > > +/* virtual SError exception syndrome register */ > +#define REG_VSESR_EL2 sys_reg(3, 4, 5, 2, 3) Irrelevant-Nit: sys-regs usually have a 'SYS_' prefix, and are in instruction encoding order lower down the file. (These PSTATE PAN things are a bit odd as they were used to generate and instruction before the fancy {read,write}_sysreg() helpers were added). > #define SET_PSTATE_PAN(x) __emit_inst(0xd5000000 | REG_PSTATE_PAN_IMM | \ > (!!x)<<8 | 0x1f) > #define SET_PSTATE_UAO(x) __emit_inst(0xd5000000 | REG_PSTATE_UAO_IMM | \ > diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c > index 738ae90..ffad42b 100644 > --- a/arch/arm64/kvm/guest.c > +++ b/arch/arm64/kvm/guest.c > @@ -279,7 +279,16 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, > > int kvm_arm_set_sei_esr(struct kvm_vcpu *vcpu, u32 *syndrome) Bits of this are spread between patches 5 and 6. If you put them in the other order this wouldn't happen. (but after a rebase most of this patch should disappear) > { > - return -EINVAL; > + u64 reg = *syndrome; > + > + /* inject virtual system Error or asynchronous abort */ > + kvm_inject_vabt(vcpu); So this writes an impdef ESR, because its the existing code-path in KVM. > + if (reg) > + /* set vsesr_el2[24:0] with value that user space specified */ > + kvm_vcpu_set_vsesr(vcpu, reg & ESR_ELx_ISS_MASK); And then you overwrite it. Which is a bit odd as there is a helper to do both in one go: > + > + return 0; > } > int __attribute_const__ kvm_target_cpu(void) > diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c > index 3556715..fb94b5e 100644 > --- a/arch/arm64/kvm/inject_fault.c > +++ b/arch/arm64/kvm/inject_fault.c > @@ -246,14 +246,25 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) > inject_undef64(vcpu); > } > > +static void pend_guest_serror(struct kvm_vcpu *vcpu, u64 esr) > +{ > + kvm_vcpu_set_vsesr(vcpu, esr); > + vcpu_set_hcr(vcpu, vcpu_get_hcr(vcpu) | HCR_VSE); > +} How come you don't use this in kvm_arm_set_sei_esr()? Thanks, James