KVM: arm64: Fix FEAT_MTE in pKVM
PATCH 1/1 KVM: arm64: Fix FEAT_MTE in pKVM
Make sure we do not trap access to Allocation Tags.
Fixes b56680de9c64 ("KVM: arm64: Initialize trap register values in hyp in pKVM")
Signed-off-by Vladimir Murzin <[email protected]>
--- arch/arm64/kvm/hyp/nvhe/pkvm.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/kvm/hyp/nvhe/pkvm.c +6 -0
@@ -229,6 +229,9 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu)if (vcpu_has_ptrauth (vcpu)) vcpu->arch.hcr_el2 |= (HCR_API |HCR_APK ); + +if (kvm_has_mte (vcpu->kvm)) + vcpu->arch.hcr_el2 |=HCR_ATA ; }/*
@@ -332,6 +335,9 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const strucstruct kvm *kvm = &hyp_vm->kvm;DECLARE_BITMAP (allowed_features,KVM_VCPU_MAX_FEATURES ); +if (test_bit (KVM_ARCH_FLAG_MTE_ENABLED , &host_kvm->arch.flags)) +set_bit (KVM_ARCH_FLAG_MTE_ENABLED , &kvm->arch.flags); +/* No restrictions for non-protected VMs. */ if (!kvm_vm_is_protected (kvm)) { bitmap_copy(kvm->arch.vcpu_features,
Signature · 1 line
2.24.0
Hi Vladimir,
Quoted 5 lines · Vladimir Murzin
Make sure we do not trap access to Allocation Tags.
Fixes b56680de9c64 ("KVM: arm64: Initialize trap register values in hyp in pKVM")Signed-off-by Vladimir Murzin <[email protected]>
Reviewed-by Fuad Tabba <[email protected]>
Cheers,
/fuad
Quoted 31 lines
--- arch/arm64/kvm/hyp/nvhe/pkvm.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/kvm/hyp/nvhe/pkvm.c +6
-1@@ -229,6 +229,9 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu)if (vcpu_has_ptrauth (vcpu)) vcpu->arch.hcr_el2 |= (HCR_API |HCR_APK ); + +if (kvm_has_mte (vcpu->kvm)) + vcpu->arch.hcr_el2 |=HCR_ATA ; }/* @@ -332,6 +335,9 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const strucstruct kvm *kvm = &hyp_vm->kvm;DECLARE_BITMAP (allowed_features,KVM_VCPU_MAX_FEATURES ); +if (test_bit (KVM_ARCH_FLAG_MTE_ENABLED , &host_kvm->arch.flags)) +set_bit (KVM_ARCH_FLAG_MTE_ENABLED , &kvm->arch.flags); +/* No restrictions for non-protected VMs. */ if (!kvm_vm_is_protected (kvm)) { bitmap_copy(kvm->arch.vcpu_features, --2.24.0
Quoted 4 lines · Vladimir Murzin
Make sure we do not trap access to Allocation Tags.
Fixes b56680de9c64 ("KVM: arm64: Initialize trap register values in hyp in pKVM")Signed-off-by Vladimir Murzin <[email protected]>
I imagine Marc will pick this up for 6.14, so:
Reviewed-by Oliver Upton <[email protected]>
Signature · 2 lines
Thanks, Oliver
Quoted 3 lines · Vladimir Murzin
Make sure we do not trap access to Allocation Tags.
Applied to next, thanks!
[1/1] KVM: arm64: Fix FEAT_MTE in pKVM
commit: b7f345fbc32afab0f0b03c71c7eaf48b9a0ad7ed
Cheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.