From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32EA8C88E4C for ; Fri, 11 Sep 2026 10:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zgrgHWkbghvtXVmKqrcuJ1jtMiEH9W3TAIXM+fsJHUE=; b=Z7uTiS3sIrxJ0atmggVIwoNFaH uI7gvFYkmV5h1ovSl7YtyGWJkyy10uyb1AgSq6KVnaUAf8u0K6o9n6fAFpecYrbQPV3Mo98vK2ZMT NX81YJHojDK0bLZn8OPhp5qN9gTTd90OYoDu7UqPbLQmCcNPYEH7HGkfEgtguH84EMeiQpgBvQhM8 8Xx+uv3JkQsg4zpKU1nht5S16sonIL3Ue2t2rADQgN5aYCtSaUoKJCqYMOyVGJzqOayiV7RDYW1UH ca3fqo+HR7sSdtiUfV2zsDHuPBClj7WBjthKLCgGBpusdZ5EtZzsQCJnuZBFjHwzipBtwNqocxl5J 4UesQS1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x4yVn-0000000GOAA-3eWw; Fri, 11 Sep 2026 10:29:39 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x4yVk-0000000GO9b-1bh4 for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2026 10:29:36 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A651060239; Fri, 11 Sep 2026 10:29:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593DD1F000FF; Fri, 11 Sep 2026 10:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789122575; bh=zgrgHWkbghvtXVmKqrcuJ1jtMiEH9W3TAIXM+fsJHUE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=YhPY37kQjJGboClQmFaCa1XK2HqrJ1BZkJOazTQo2ObSkPGIobJW+yH/X83wxxDbK /ZrccE2VFUSyirDjvkQWn11WfyL5TebzMHySQxUEaJcBhS2xs/UmfKLTP5Jmearp/k H15S4cQcEelcSEpRD70TmpT+5PnGdoaYAkRbiPEeOip4dgEZaJ7lcNiMHUqat4J9kj eQM6BEKANywzCOIl6n8Rd/b8Ytg17qquy1+88P8YzJjz2G/yU/lAzF8ghnh+/E4L9u +Ma5FTh6ZPOEIE0Q8CC5qfUVBOEeRj4MetSbrjfDYwVUMBBV5UZLDsEf9nXUcH62jL LhuOJKY6ZeXEw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x4yVh-00000007hk0-0QFw; Fri, 11 Sep 2026 10:29:33 +0000 Date: Fri, 11 Sep 2026 11:29:32 +0100 Message-ID: <86ld986pyr.wl-maz@kernel.org> From: Marc Zyngier To: Fuad Tabba Cc: Oliver Upton , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Vincent Donnefort , Quentin Perret , Fuad Tabba Subject: Re: [PATCH v2 13/17] KVM: arm64: Pend a protected guest's SError with HCR_EL2.VSE only In-Reply-To: <20260907070002.3333525-14-fuad.tabba@linux.dev> References: <20260907070002.3333525-1-fuad.tabba@linux.dev> <20260907070002.3333525-14-fuad.tabba@linux.dev> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: fuad.tabba@linux.dev, oupton@kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, joey.gouly@arm.com, seiden@linux.ibm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, vdonnefort@google.com, qperret@google.com, tabba@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 07 Sep 2026 07:59:58 +0100, Fuad Tabba wrote: > > kvm_inject_serror_esr() emulates the exception entry when > serror_is_masked() reads PSTATE.A clear, but the host has no view of a > protected guest's PSTATE.A, and an emulated entry never reaches the > guest: the SError is lost. Set VSE instead and let the guest's own > PSTATE.A mask it. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/kvm/inject_fault.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c > index d6c4fc16f8795..b88098a7e756c 100644 > --- a/arch/arm64/kvm/inject_fault.c > +++ b/arch/arm64/kvm/inject_fault.c > @@ -378,8 +378,11 @@ int kvm_inject_serror_esr(struct kvm_vcpu *vcpu, u64 esr) > * > * As we're emulating the SError injection we need to explicitly populate > * ESR_ELx.EC because hardware will not do it on our behalf. > + * > + * The host does not see a protected guest's PSTATE.A: leave the > + * vSError to HCR_EL2.VSE below, which the guest masks itself. > */ > - if (!serror_is_masked(vcpu)) { > + if (!vcpu_is_protected(vcpu) && !serror_is_masked(vcpu)) { > pend_serror_exception(vcpu); > esr |= FIELD_PREP(ESR_ELx_EC_MASK, ESR_ELx_EC_SERROR) | ESR_ELx_IL; > vcpu_write_sys_reg(vcpu, esr, exception_esr_elx(vcpu)); I can't say I like this very much. The fundamental premise is that as far as the host is concerned, PSTATE.A is always set. So why can't we give the illusion of this at all times? That'd be a much cleaner approach. Thanks, M. -- Without deviation from the norm, progress is not possible.