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=1796058321; b=HNhFA7XoYbnAXcHHamWi6m/OxH0AqkwGvR83FVH/cwJIAC+b/OB0aUzv77NIbe46l1bR 8SlYnceS9X1xPr+UrwPsXKaXj9QYhmcnET5dpBw2/fvBIyEfHsYKngH9Iy5iCzGrqro3R JLeStFJ+iHMz9E8twF94xL4YnVH/Ua9EtO1Z1fSMInU+WzyHNYWU/7cQH++uwnCRD5Kms nT6lQnCTY2lRlLDtUFjDFfQ5tH9BqRGxNreEnbHYh0MPCs+ilk2p6S5LYCoP6OHsR1yoZ G/fhowJ8V/0dmyRHKEyZuj7/1b5SlXcZAsTmVz0kAtyuTh/F2QFntNxUKEvvHCPci0g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796058321; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5uNYqywDrNQ/tGIZ16eUDJ3VguWn4rvM8PZwvda2/jA=; b=tmjeyc1HS4HrLI38ckPsHNpmvEJQuKmLTil58ke5yzzIXPxQh+sAWUVZ3qS+GG9Wf5YE TTLxXI5p0egLyey+aKplQU/obLNMm0sFVCY3cn8CgFFb2mPhBFupSNU5fxcjzOBWKzHMp ITtLB4csSCR+RMolzirI6HszyF/nBF9vJtQtLMRq1CZmhREiPktZMP3pKDKANupyJtbzc ea110VvjW1DvhQEzdF++pLD1kem5x0jL0ewwAHWGJWtOV1xTHA/DqqCcfCb7iVvbxdKQY WoUcsOGz4tCKeRYZUNh/sy4ALepBRPN1kMatU1TTj7Omwfmb4namHSe76yN1SbPAWsg== 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=MmrJTkk1; 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 4380C606A31C for ; Mon, 30 Nov 2026 17:05:21 +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=MmrJTkk1 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A8191F000C1; Mon, 30 Nov 2026 17:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796058320; bh=5uNYqywDrNQ/tGIZ16eUDJ3VguWn4rvM8PZwvda2/jA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=MmrJTkk1hkg3gL/hjWN41KxNDMhQ1InCqyUcMlhlFN1IKiGKeK6KNkOq+ZjGqTX/p YHHSIVSRpBE7Mx+8Du5fgOZMf/qjI09xUXNK5N+HaSrNTssv3x7TCw8gPCJzI0RUD5 QGezpwXQItQ4zaXbisxlGTU+04WsfFjhqhhKU5tbcWj5a/g3oEvwVbZ0fKWROLDoOH oDGiOVwIN1fhHRChPQCaC78vXZIFkUJ8P32fcu9JSkrPlyfs3mfYNsQO5TY2RE3Vca gzXkuu/2JLagCmpT6nRKAVSiUqfczGXzL6fklf9QOC810+pxwSPKgi0uEU+m1JL26D EICIoMZqD/Rwg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v22 07/16] KVM: arm64: Forward GCS exceptions to nested guests Reply-To: sashiko-reviews@lists.linux.dev To: "Mark Brown" Cc: kvmarm@lists.linux.dev, "Oliver Upton" , "Marc Zyngier" In-Reply-To: <20261130-arm64-gcs-v22-7-80454edf47ea@kernel.org> References: <20261130-arm64-gcs-v22-0-80454edf47ea@kernel.org> <20261130-arm64-gcs-v22-7-80454edf47ea@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Nov 2026 17:05:19 +0000 X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] KVM: arm64: question on ESR_ELx_EC_GCS trap conditions in kvm_handle_gcs() -- commit 63d9782733faf57fed4105f2f5d68c07cc781c5c Author: Mark Brown KVM: arm64: Forward GCS exceptions to nested guests This commit forwards ESR_ELx_EC_GCS exits to virtual EL2 via kvm_inject_nested_sync() when nested virtualization is enabled on a vCPU with FEAT_GCS. > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > index 9931192735d46..acd97a4359102 100644 > --- a/arch/arm64/kvm/handle_exit.c > +++ b/arch/arm64/kvm/handle_exit.c > @@ -304,12 +304,24 @@ static int handle_svc(struct kvm_vcpu *vcpu) > return 1; > } > =20 > +/* > + * We might get GCS exceptions that need to be forwarded to the > + * hypervisor when a nested guest has HFGITR_EL2.nGCSSTR_EL1 clear, or > + * for a GCS data check exception for a L2 guest. > + */ > static int kvm_handle_gcs(struct kvm_vcpu *vcpu) > { > - /* We don't expect GCS, so treat it with contempt */ > - if (kvm_has_feat(vcpu->kvm, ID_AA64PFR1_EL1, GCS, IMP)) > - WARN_ON_ONCE(1); > + if (!kvm_has_gcs(vcpu->kvm)) { > + kvm_inject_undefined(vcpu); > + return 1; > + } > =20 > + if (vcpu_has_nv(vcpu)) { > + kvm_inject_nested_sync(vcpu, kvm_vcpu_get_esr(vcpu)); > + return 1; > + } > + > + WARN_ON_ONCE(1); > kvm_inject_undefined(vcpu); > return 1; > } [Severity: Low] This question rests on an ARM architecture detail that could not be confirmed from the kernel source: when physical HCR_EL2.TGE is 0 and physical HCRX_EL2.GCSEn is 1, can an ESR_ELx_EC_GCS exception trap to physical EL2 only from a nested guest context (is_nested_ctxt(vcpu)) when virtual EL2 is the architectural target, or can a GCS data check exception in an L2 guest also trap to physical EL2 when virtual EL1 is the intended target? In __compute_fgt() and __activate_traps_common(), physical HFGITR_EL2.nGCSSTR_EL1 and physical HCRX_EL2.GCSEn are both set to 1 while is_hyp_ctxt(vcpu) is true, and are only cleared in is_nested_ctxt(vcpu) when the L1 guest hypervisor clears them. If valid traps to physical EL2 can only occur in is_nested_ctxt(vcpu), gating on vcpu_has_nv(vcpu) forwards an unexpected trap in is_hyp_ctxt(vcpu) into virtual EL2 instead of hitting WARN_ON_ONCE(1) and injecting UNDEFINED; if an L2 GCS data check exception can trap to physical EL2 when L2 virtual EL1 is the target, kvm_inject_nested_sync() delivers it to L1 virtual EL2 instead of L2 virtual EL1. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261130-arm64-gcs-= v22-0-80454edf47ea@kernel.org?part=3D7