ANDROID: KVM: arm64: Flush the vcpu iflags for non-protected VMs

The iflags are meant as input flags to the hypervisor, and will
be used in future patches by calls to functions that sync debug
and pmu state. Ensure that the hyp_vcpu copy is up-to-date with
the host's on entry.

Bug: 228011917
Signed-off-by: Fuad Tabba <tabba@google.com>
Change-Id: Id04d65ee084c3745ddc283ff5e30348511a4a1d2
This commit is contained in:
Fuad Tabba
2022-11-08 09:56:37 +00:00
parent c0a19273f4
commit 6b3ffa563e

View File

@@ -509,6 +509,7 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu)
if (vcpu_get_flag(host_vcpu, PKVM_HOST_STATE_DIRTY))
__flush_hyp_vcpu(hyp_vcpu);
hyp_vcpu->vcpu.arch.iflags = READ_ONCE(host_vcpu->arch.iflags);
hyp_vcpu->vcpu.arch.hcr_el2 = HCR_GUEST_FLAGS & ~(HCR_RW | HCR_TWI | HCR_TWE);
hyp_vcpu->vcpu.arch.hcr_el2 |= READ_ONCE(host_vcpu->arch.hcr_el2);