Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796297225; b=oMc+oJ5+jAT2v4pUD0nBjo8JuBpQV8KD95vnWRBaeD9oY5tL1JTYNbKiLFibbHsjfPiM PWl2fMDZE3RLUzPq0aqTpoxxjpIk6AugOKkP90osXKwL7fyKSZ5rc3eDjSIq1XmB9mh7i Mg0JgnX3Ui9SpH9++tIpA5wGUZ9ziIySskqkBZY0E4FyNirg5WCmLI5My1e2vzbJxwFjS i2lOCVYPBM8CrZ2raY/26SLgz3h1Cl9IaSBwjggMAwax3P5RdLEF3FuefLLeBOoeUFyZv DUoSvlYzBrw3w5qoTcnNduv3JDzOOlTbmFs6QqwqKaP6jKd3qsHtMjARRVSLl4MlJ9A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796297225; h=Received:DKIM-Signature:Received:Received:X-ME-Sender: X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:X-Mailer: MIME-Version:X-ThreadId:Date:From:To:Cc:Message-Id:In-Reply-To: References:Subject:Content-Type:Content-Transfer-Encoding; bh=rFfrjvqmEtRzP2eIrLWHf+uEOtjJ7y8m4/OicQvUtlU=; b=4uZGhHJ7IdwcDbqxd6rwRiF3Dekw7bjqTY7IiG0JkM0xPiFngWCRsfNmvXxrjJ/ihWaQ U2Ud5hzd5Jho45Cn3EaY9y54CvRZb+t0MD1OwZoGN9RH0hJ6kcv+LqKn1E3PJOGlQDqLC wBBRVXbJDgVD1YTms2TPUQuCHE04vxNH1KPWshUT4Hxix/XvG5m7qxfrwHzI++o0HyFb2 9WvtJuSCrXnejc8HYY8QMWy6kZoepeDT9qkwsyW/W1TIbahnmAGk4PZxK3gAbLiKmN0ym ZJD0rBO0LoLij2SP9imoZsrC1I+CB0nAGgSYpj1CP4trrTcmzoNUTWN4Q2JjepNJ1rA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qzc8a87e; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5E2D606A330 for ; Thu, 3 Dec 2026 11:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qzc8a87e Received: by smtp.kernel.org (Postfix) with ESMTPSA id 178ED1F000C1; Thu, 3 Dec 2026 11:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796297225; bh=rFfrjvqmEtRzP2eIrLWHf+uEOtjJ7y8m4/OicQvUtlU=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=Qzc8a87eZIyHsraFfPLdhn8xsiSr3G5Hd1+s7+WLkYeePgJoZFUpj8GPkDI7vKNZo 8r1KXlptD0v9d+V3UTi0Mc8uEJGAEk1/xs8zhryx4wrzOZDOxYUSfvARre9QuNGaA/ YSWKpF8ONmSQlgwhfTfcWdd/554gL0NxSRbC7I89k61fLfJmdDgJKxVqZrlh2kF9oi Pm9HRIy3je7X2UnM1Fu0b3/DLyumoHH08ijlvHKNuuAAec8LxmgQWEMlsyfV9zYMTc P5K6OOFczZlP3+SQGQVU7/E8y1+pTJW5P1bRdB6xhf9VNkvla22+9D3oNsnkr11p9l ywcubpeYgZO7Q== Received: from ams-compute-02.internal (ams-compute-02.internal [10.64.2.62]) by mailfauth.ams.internal (Postfix) with ESMTP id 6E303198003A; Thu, 3 Dec 2026 06:27:03 -0500 (EST) Received: from ams-imap-03 ([10.64.2.23]) by ams-compute-02.internal (MEProxy); Thu, 03 Dec 2026 06:27:03 -0500 X-ME-Sender: X-ME-Proxy-Cause: dmFkZTGu3hDYohZYaJpXsw5stBr/lyAwXTJ5jkN9r1Vw0ZhT8gMqGw0l1nTKpw55bCMlQb wkIF62C2X3GQShcERqO2VdhynrLOBOCBK5VdoMkDrbZNlbhRO2vp3yKbA0//s6uvp/ltHD Z3o7aQqaft0YlatQmChU6pzX75syYfUXuH7rOY7GSRvpaU0CnK06hZ5zYQNfTwAOxBZQoD 0WtLe9CFWycfa//VV+/YKcT+F5rIap46+8TO4oSuNsIkdN/XNbW3KdMw7otmEWJc2IZG9U FwBEsBudjxZO6sHK+WSURc7ANEsdl2aVo7Ipc2uGOFhe8CJfByfXkm9cSoTIjnmNEItzro La6P59PzJbNLmC/SmaFriqzv1Jtsd0Qdesr6iZHiB+gUF+uXIengw1KaYG3kbzNoiAz6ac Jqz+tMckMIOxZD+xrnzJU3R+J0vP49bkfGyfEstvdtfhwOf/sN6xSXW16EUrMy9Sts4wTX TdN9rliNCH8fPT25rLZtBqIYel3k9+/VaxXXEpnxQyQBPxGdKNVC6O++55Q34wgP19Ik2D Wt8wUCGF9V82GxWs4cjqwSlQAumsGQ5H2/9xpVyDbtKZNlQofcycdKkI0Cid6BLzAyYjB6 XwsRqsiC8l2lkDRI4JQoJOG4CAmtcaq9MO70Zl0Htdm58B2hhO+mxCRWYy9w X-ME-Proxy: Feedback-ID: i36794607:Fastmail Received: by mailuser.ams.internal (Postfix, from userid 501) id 4CB1332A0099; Thu, 3 Dec 2026 06:27:02 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-ThreadId: Az1U5Vn87iuN Date: Thu, 03 Dec 2026 12:26:22 +0100 From: "Arnd Bergmann" To: sashiko-reviews@lists.linux.dev Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, "Oliver Upton" , "Marc Zyngier" Message-Id: In-Reply-To: References: <20261203095703.655796-1-arnd@kernel.org> <20261203095703.655796-2-arnd@kernel.org> Subject: Re: [PATCH v3 1/4] arm64: kvm: save and restore ACCDATA_EL1 if used by host Content-Type: text/plain Content-Transfer-Encoding: 7bit On Thu, Dec 3, 2026, at 11:16, sashiko-bot@kernel.org wrote: >> @@ -143,10 +143,14 @@ static inline bool ctxt_has_accdata(struct kvm_cpu_context *ctxt) >> { >> struct kvm_vcpu *vcpu; >> >> - /* The host never uses ACCDATA_EL1 */ >> - if (!cpus_have_final_cap(ARM64_HAS_LS64_ACCDATA) || !ctxt_is_guest(ctxt)) >> + /* The hardware does not support ACCDATA_EL1 */ >> + if (!cpus_have_final_cap(ARM64_HAS_LS64_ACCDATA)) >> return false; >> >> + /* host only cares if SVA is enabled */ >> + if (!ctxt_is_guest(ctxt)) >> + return IS_ENABLED(CONFIG_ARM64_LS64_ACCDATA); > > [Severity: Low] > Should this fall through to the guest kvm_has_feat() check instead of > returning early for the host context? > > When running a guest without FEAT_LS64_ACCDATA (such as a pKVM protected > VM), guest ACCDATA_EL1 accesses are trapped and HCRX_EL2_EnAS0 is clear. > Returning early causes KVM to save and restore the unchanged host > SYS_ACCDATA_EL1 on every nVHE/pKVM world switch and VHE vCPU load/put. > > Returning false only when !ctxt_is_guest(ctxt) && > !IS_ENABLED(CONFIG_ARM64_LS64_ACCDATA) and falling through to > kvm_has_feat() would avoid those accesses and match the sibling > ctxt_has_*() helpers in this header. Right, makes sense. We already rely on the FGT for the reason below, so I've changed it the same way now here. >> vcpu = ctxt_to_vcpu(ctxt); >> return kvm_has_feat(kern_hyp_va(vcpu->kvm), ID_AA64ISAR1_EL1, LS64, LS64_ACCDATA); >> } > > [Severity: Low] > Can a CPU implement FEAT_LS64_ACCDATA without implementing FEAT_FGT or > FEAT_HCX? This question rests on an ARM64 architecture detail that could > not be confirmed from the kernel source. FEAT_LS64_ACCDATA requires ARMv8.7 or higher, while FEAT_FGT is mandatory from ARMv8.6 if EL2 is implemented, so I think this is always safe. Arnd