* [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM
@ 2025-01-06 11:24 Vladimir Murzin
2025-01-06 15:20 ` Fuad Tabba
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Murzin @ 2025-01-06 11:24 UTC (permalink / raw)
To: kvmarm; +Cc: oliver.upton, maz, tabba
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 <vladimir.murzin@arm.com>
---
arch/arm64/kvm/hyp/nvhe/pkvm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
index 071993c16d..dd55bff6a6 100644
--- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
+++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
@@ -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 struc
struct 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM
2025-01-06 11:24 [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM Vladimir Murzin
@ 2025-01-06 15:20 ` Fuad Tabba
2025-01-06 23:23 ` Oliver Upton
2025-01-08 10:25 ` Marc Zyngier
2 siblings, 0 replies; 4+ messages in thread
From: Fuad Tabba @ 2025-01-06 15:20 UTC (permalink / raw)
To: Vladimir Murzin; +Cc: kvmarm, oliver.upton, maz
Hi Vladimir,
On Mon, 6 Jan 2025 at 11:24, Vladimir Murzin <vladimir.murzin@arm.com> wrote:
>
> 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 <vladimir.murzin@arm.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Cheers,
/fuad
> ---
> arch/arm64/kvm/hyp/nvhe/pkvm.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> index 071993c16d..dd55bff6a6 100644
> --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
> +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> @@ -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 struc
> struct 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM
2025-01-06 11:24 [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM Vladimir Murzin
2025-01-06 15:20 ` Fuad Tabba
@ 2025-01-06 23:23 ` Oliver Upton
2025-01-08 10:25 ` Marc Zyngier
2 siblings, 0 replies; 4+ messages in thread
From: Oliver Upton @ 2025-01-06 23:23 UTC (permalink / raw)
To: Vladimir Murzin; +Cc: kvmarm, maz, tabba
On Mon, Jan 06, 2025 at 11:24:21AM +0000, Vladimir Murzin wrote:
> 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 <vladimir.murzin@arm.com>
I imagine Marc will pick this up for 6.14, so:
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM
2025-01-06 11:24 [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM Vladimir Murzin
2025-01-06 15:20 ` Fuad Tabba
2025-01-06 23:23 ` Oliver Upton
@ 2025-01-08 10:25 ` Marc Zyngier
2 siblings, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2025-01-08 10:25 UTC (permalink / raw)
To: kvmarm, Vladimir Murzin; +Cc: oliver.upton, tabba
On Mon, 06 Jan 2025 11:24:21 +0000, Vladimir Murzin wrote:
> 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.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-08 10:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-06 11:24 [PATCH] KVM: arm64: Fix FEAT_MTE in pKVM Vladimir Murzin
2025-01-06 15:20 ` Fuad Tabba
2025-01-06 23:23 ` Oliver Upton
2025-01-08 10:25 ` Marc Zyngier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.