* [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1
@ 2023-07-28 0:08 Oliver Upton
2023-07-28 8:14 ` Marc Zyngier
2023-07-28 17:11 ` Oliver Upton
0 siblings, 2 replies; 4+ messages in thread
From: Oliver Upton @ 2023-07-28 0:08 UTC (permalink / raw)
To: kvmarm
Cc: Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
Oliver Upton
Whelp, this is embarrassing. Since commit 082fdfd13841 ("KVM: arm64:
Prevent guests from enabling HA/HD on Ampere1") KVM traps writes to
TCR_EL1 on AmpereOne to work around an erratum in the unadvertised
HAFDBS implementation, preventing the guest from enabling the feature.
Unfortunately, I failed virtualization 101 when working on that change,
and forgot to advance PC after instruction emulation.
Do the right thing and skip the MSR instruction after emulating the
write.
Fixes: 082fdfd13841 ("KVM: arm64: Prevent guests from enabling HA/HD on Ampere1")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
arch/arm64/kvm/hyp/include/hyp/switch.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
index 4bddb8541bec..34f222af6165 100644
--- a/arch/arm64/kvm/hyp/include/hyp/switch.h
+++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
@@ -457,6 +457,7 @@ static bool handle_ampere1_tcr(struct kvm_vcpu *vcpu)
*/
val &= ~(TCR_HD | TCR_HA);
write_sysreg_el1(val, SYS_TCR);
+ __kvm_skip_instr(vcpu);
return true;
}
base-commit: 01b94b0f3922039f7d3e0d1eeb33b8891746b65f
--
2.41.0.487.g6d72f3e995-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1
2023-07-28 0:08 [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1 Oliver Upton
@ 2023-07-28 8:14 ` Marc Zyngier
2023-07-28 17:10 ` Oliver Upton
2023-07-28 17:11 ` Oliver Upton
1 sibling, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2023-07-28 8:14 UTC (permalink / raw)
To: Oliver Upton; +Cc: kvmarm, James Morse, Suzuki K Poulose, Zenghui Yu
On Fri, 28 Jul 2023 01:08:24 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Whelp, this is embarrassing. Since commit 082fdfd13841 ("KVM: arm64:
> Prevent guests from enabling HA/HD on Ampere1") KVM traps writes to
> TCR_EL1 on AmpereOne to work around an erratum in the unadvertised
> HAFDBS implementation, preventing the guest from enabling the feature.
> Unfortunately, I failed virtualization 101 when working on that change,
> and forgot to advance PC after instruction emulation.
>
> Do the right thing and skip the MSR instruction after emulating the
> write.
>
> Fixes: 082fdfd13841 ("KVM: arm64: Prevent guests from enabling HA/HD on Ampere1")
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Oh hum... I think it is high time for a new PR to Paolo!
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1
2023-07-28 8:14 ` Marc Zyngier
@ 2023-07-28 17:10 ` Oliver Upton
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Upton @ 2023-07-28 17:10 UTC (permalink / raw)
To: Marc Zyngier; +Cc: kvmarm, James Morse, Suzuki K Poulose, Zenghui Yu
On Fri, Jul 28, 2023 at 09:14:14AM +0100, Marc Zyngier wrote:
> On Fri, 28 Jul 2023 01:08:24 +0100,
> Oliver Upton <oliver.upton@linux.dev> wrote:
> >
> > Whelp, this is embarrassing. Since commit 082fdfd13841 ("KVM: arm64:
> > Prevent guests from enabling HA/HD on Ampere1") KVM traps writes to
> > TCR_EL1 on AmpereOne to work around an erratum in the unadvertised
> > HAFDBS implementation, preventing the guest from enabling the feature.
> > Unfortunately, I failed virtualization 101 when working on that change,
> > and forgot to advance PC after instruction emulation.
> >
> > Do the right thing and skip the MSR instruction after emulating the
> > write.
> >
> > Fixes: 082fdfd13841 ("KVM: arm64: Prevent guests from enabling HA/HD on Ampere1")
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
>
> Oh hum... I think it is high time for a new PR to Paolo!
Definitely, now let's sweep this mess under the rug :)
> Acked-by: Marc Zyngier <maz@kernel.org>
Appreciated!
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1
2023-07-28 0:08 [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1 Oliver Upton
2023-07-28 8:14 ` Marc Zyngier
@ 2023-07-28 17:11 ` Oliver Upton
1 sibling, 0 replies; 4+ messages in thread
From: Oliver Upton @ 2023-07-28 17:11 UTC (permalink / raw)
To: Oliver Upton, kvmarm
Cc: Zenghui Yu, James Morse, Suzuki K Poulose, Marc Zyngier
On Fri, 28 Jul 2023 00:08:24 +0000, Oliver Upton wrote:
> Whelp, this is embarrassing. Since commit 082fdfd13841 ("KVM: arm64:
> Prevent guests from enabling HA/HD on Ampere1") KVM traps writes to
> TCR_EL1 on AmpereOne to work around an erratum in the unadvertised
> HAFDBS implementation, preventing the guest from enabling the feature.
> Unfortunately, I failed virtualization 101 when working on that change,
> and forgot to advance PC after instruction emulation.
>
> [...]
Applied to kvmarm/fixes, thanks!
[1/1] KVM: arm64: Skip instruction after emulating write to TCR_EL1
https://git.kernel.org/kvmarm/kvmarm/c/74158a8cad79
--
Best,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-28 17:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28 0:08 [PATCH] KVM: arm64: Skip instruction after emulating write to TCR_EL1 Oliver Upton
2023-07-28 8:14 ` Marc Zyngier
2023-07-28 17:10 ` Oliver Upton
2023-07-28 17:11 ` Oliver Upton
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.