Skip to content

Commit b7f345f

Browse files
murzinvMarc Zyngier
authored andcommitted
KVM: arm64: Fix FEAT_MTE in pKVM
Make sure we do not trap access to Allocation Tags. Fixes: b56680d ("KVM: arm64: Initialize trap register values in hyp in pKVM") Signed-off-by: Vladimir Murzin <[email protected]> Reviewed-by: Oliver Upton <[email protected]> Reviewed-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent aac64ad commit b7f345f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

arch/arm64/kvm/hyp/nvhe/pkvm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu)
4747

4848
if (vcpu_has_ptrauth(vcpu))
4949
vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK);
50+
51+
if (kvm_has_mte(vcpu->kvm))
52+
vcpu->arch.hcr_el2 |= HCR_ATA;
5053
}
5154

5255
static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu)
@@ -251,6 +254,9 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const struc
251254
unsigned long host_arch_flags = READ_ONCE(host_kvm->arch.flags);
252255
DECLARE_BITMAP(allowed_features, KVM_VCPU_MAX_FEATURES);
253256

257+
if (test_bit(KVM_ARCH_FLAG_MTE_ENABLED, &host_kvm->arch.flags))
258+
set_bit(KVM_ARCH_FLAG_MTE_ENABLED, &kvm->arch.flags);
259+
254260
/* No restrictions for non-protected VMs. */
255261
if (!kvm_vm_is_protected(kvm)) {
256262
hyp_vm->kvm.arch.flags = host_arch_flags;

0 commit comments

Comments
 (0)