Skip to contentSkip to conversation

KVM: arm64: Skip instruction after emulating write to TCR_EL1

PATCH Applied Oliver Upton 2 participants 4 messages Jul 28, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: arm64: Skip instruction after emulating write to TCR_EL1

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")
---
 arch/arm64/kvm/hyp/include/hyp/switch.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kvm/hyp/include/hyp/switch.h +1 -0
index 4bddb8541bec..34f222af6165 100644
@@ -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

Signature · 1 line
2.41.0.487.g6d72f3e995-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · 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.

Quoted 5 lines

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")

Oh hum... I think it is high time for a new PR to Paolo!

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#2 lore raw
Quoted 10 lines · Marc Zyngier
Quoted 8 lines · 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.

Quoted 7 lines
Quoted 5 lines

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")

Oh hum... I think it is high time for a new PR to Paolo!

Definitely, now let's sweep this mess under the rug :)

Quoted 1 line

Appreciated!

Signature · 2 lines
Thanks,
Oliver
author Applied
#3 lore raw
In reply to Oliver Upton
Quoted 8 lines · 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.

[...]

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