From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9F5F38A700; Fri, 11 Sep 2026 10:29:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789122576; cv=none; b=V6hkd5dzZX20UOzWNFtsrjp2Qq4KoEgUwCmSbGo0yZVk4Ri34u+O1Dsbx5tl/3vE/tR44KU0EA3Lqah5vihNRSWhw2bg5tondhnVSDmRWhHXZMwoz3V55KfcrF1hYxUvjcrvLxAmjjgFIVGy/EQwZe9b+WGykAq12eXOeKH9Rmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789122576; c=relaxed/simple; bh=ajLUYzbkjP1Vley/6OHu1jmeMXhG5hSn5M6le1CX1sQ=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=ZwnssH6P/Zl3THMz3/C4nw7WX9O5qOWwQ8keCO4BlYJSe6THkzQbV8r+IGCuJwnA8E8bZsR6j11ZlQ/ai9RHXLZpS/Nk1FloTcMZb4wQAMZpiAX8wSRMFWShCB9f4fiuqkQi8a86IY/dd1Iou90BMOAlZbI88Akw/4bBm1JqH1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YhPY37kQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YhPY37kQ" 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) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.