mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
KVM: arm64: Fix FEAT_MTE in pKVM
Make sure we do not trap access to Allocation Tags.
Fixes: b56680de9c ("KVM: arm64: Initialize trap register values in hyp in pKVM")
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Reviewed-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20250106112421.65355-1-vladimir.murzin@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
parent
aac64ad369
commit
b7f345fbc3
|
|
@ -47,6 +47,9 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu)
|
||||||
|
|
||||||
if (vcpu_has_ptrauth(vcpu))
|
if (vcpu_has_ptrauth(vcpu))
|
||||||
vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK);
|
vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK);
|
||||||
|
|
||||||
|
if (kvm_has_mte(vcpu->kvm))
|
||||||
|
vcpu->arch.hcr_el2 |= HCR_ATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu)
|
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
|
||||||
unsigned long host_arch_flags = READ_ONCE(host_kvm->arch.flags);
|
unsigned long host_arch_flags = READ_ONCE(host_kvm->arch.flags);
|
||||||
DECLARE_BITMAP(allowed_features, KVM_VCPU_MAX_FEATURES);
|
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. */
|
/* No restrictions for non-protected VMs. */
|
||||||
if (!kvm_vm_is_protected(kvm)) {
|
if (!kvm_vm_is_protected(kvm)) {
|
||||||
hyp_vm->kvm.arch.flags = host_arch_flags;
|
hyp_vm->kvm.arch.flags = host_arch_flags;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user