From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@pereq.eu>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 1/3] KVM: arm64: nv: Fix AT emulation for TCR2_EL1
Date: Fri, 27 Nov 2026 16:01:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-237810@kernel.org> (raw)
In-Reply-To: <20261127-nv-tcr2-v3-v1-1-9c15c1cabe01@pereq.eu>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] KVM: arm64: nv: missing mmu->last_vcpu_ran check in
__kvm_at_s1e01_fast() [1]
--
commit f484417c3817214769a2572e772a7f25d111b06a
Author: Dan Carpenter <dan@pereq.eu>
KVM: arm64: nv: Fix AT emulation for TCR2_EL1
This commit masks disabled PIE and POE bits in effective_tcr2() and loads
and restores the guest's TCR2 and POR_EL0 registers during fast-path AT
emulation when the host CPU supports those features.
> diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c
> index 30d8f062b2c29..893bf88f2f750 100644
> --- a/arch/arm64/kvm/at.c
> +++ b/arch/arm64/kvm/at.c
[ ... ]
> @@ -1437,8 +1463,9 @@ static u64 __kvm_at_s1e01_fast(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
> write_sysreg_el1(vcpu_read_sys_reg(vcpu, TTBR1_EL1), SYS_TTBR1);
> write_sysreg_el1(vcpu_read_sys_reg(vcpu, TCR_EL1), SYS_TCR);
> write_sysreg_el1(vcpu_read_sys_reg(vcpu, MAIR_EL1), SYS_MAIR);
> + if (cpus_have_final_cap(ARM64_HAS_TCR2))
> + write_sysreg_el1(effective_tcr2(vcpu, TR_EL10), SYS_TCR2);
> if (kvm_has_tcr2(vcpu->kvm)) {
> - write_sysreg_el1(vcpu_read_sys_reg(vcpu, TCR2_EL1), SYS_TCR2);
> if (kvm_has_s1pie(vcpu->kvm)) {
> write_sysreg_el1(vcpu_read_sys_reg(vcpu, PIR_EL1), SYS_PIR);
> write_sysreg_el1(vcpu_read_sys_reg(vcpu, PIRE0_EL1), SYS_PIRE0);
> @@ -1452,6 +1479,17 @@ static u64 __kvm_at_s1e01_fast(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
> __load_stage2(mmu);
[Severity: High]
This problem wasn't introduced by this patch, but when __kvm_at_s1e01_fast()
switches to the shadow stage-2 MMU here [1], does it need to call
kvm_arm_vmid_update(&mmu->vmid) and check and update mmu->last_vcpu_ran
the way vcpu_prepare_mmu() does?
When trapping from vEL2 with HCR_EL2.{E2H,TGE} != {1,1}, vcpu_prepare_mmu()
only checked the L1 vcpu->arch.hw_mmu, not the nested shadow stage-2 MMU
returned by lookup_s2_mmu(). If another vCPU sharing that shadow stage-2
MMU previously ran on the same physical CPU, the hardware AT instruction
can hit its stale stage-1 TLB entries and return a wrong translation in
PAR_EL1, or leave stage-1 TLB entries tagged with mmu->vmid that
vcpu_prepare_mmu() will not flush when the previous vCPU runs again on
this CPU. Skipping kvm_arm_vmid_update() can also program a stale VMID
into VTTBR_EL2 after a VMID rollover.
[1] https://sashiko.dev/#/bug/linux-43f4f36e-e7bb-4c4f-85b2-b2a827b9cf32
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-nv-tcr2-v3-v1-0-9c15c1cabe01@pereq.eu?part=1
next prev parent reply other threads:[~2026-11-27 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:31 [PATCH 0/3] KVM: arm64: nv: Fix AT emulation for nested virtualization Dan Carpenter
2026-11-27 15:31 ` [PATCH 1/3] KVM: arm64: nv: Fix AT emulation for TCR2_EL1 Dan Carpenter
2026-11-27 16:01 ` sashiko-bot [this message]
2026-11-28 9:28 ` Dan Carpenter
2026-11-27 15:31 ` [PATCH 2/3] KVM: arm64: Load no-access permissions when S1PIE or S1POE is hidden Dan Carpenter
2026-11-27 15:31 ` [PATCH 3/3] KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-237810@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dan@pereq.eu \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.