diff options
author | Oliver Upton <oliver.upton@linux.dev> | 2023-10-04 23:49:47 +0000 |
---|---|---|
committer | Oliver Upton <oliver.upton@linux.dev> | 2023-10-05 09:33:15 +0000 |
commit | 4202bcac5e65de2d7193b7e27984b810ba33aada (patch) | |
tree | d8bdecdcd6ff755decaac31c9f3795a8f5d75ed9 /arch/arm64/kvm | |
parent | d34b76489ea0c6168d230d4f9ad065422ba5f6d6 (diff) |
KVM: arm64: Use mtree_empty() to determine if SMCCC filter configured
The smccc_filter maple tree is only populated if userspace attempted to
configure it. Use the state of the maple tree to determine if the filter
has been configured, eliminating the VM flag.
Reviewed-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231004234947.207507-4-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r-- | arch/arm64/kvm/hypercalls.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/arch/arm64/kvm/hypercalls.c b/arch/arm64/kvm/hypercalls.c index 20a878c64ba7..a61213786e5f 100644 --- a/arch/arm64/kvm/hypercalls.c +++ b/arch/arm64/kvm/hypercalls.c @@ -164,7 +164,7 @@ out_destroy: static bool kvm_smccc_filter_configured(struct kvm *kvm) { - return test_bit(KVM_ARCH_FLAT_SMCCC_FILTER_CONFIGURED, &kvm->arch.flags); + return !mtree_empty(&kvm->arch.smccc_filter); } static int kvm_smccc_set_filter(struct kvm *kvm, struct kvm_smccc_filter __user *uaddr) @@ -201,11 +201,6 @@ static int kvm_smccc_set_filter(struct kvm *kvm, struct kvm_smccc_filter __user r = mtree_insert_range(&kvm->arch.smccc_filter, start, end, xa_mk_value(filter.action), GFP_KERNEL_ACCOUNT); - if (r) - goto out_unlock; - - set_bit(KVM_ARCH_FLAG_SMCCC_FILTER_CONFIGURED, &kvm->arch.flags); - out_unlock: mutex_unlock(&kvm->arch.config_lock); return r; |