summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/pmu-emul.c
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2022-03-11 17:39:47 +0000
committerMarc Zyngier <maz@kernel.org>2022-03-18 14:02:33 +0000
commit06394531b425794dc56f3d525b7994d25b8072f7 (patch)
tree8476992b49f955ad0693faa13db536bfbaa11f41 /arch/arm64/kvm/pmu-emul.c
parent9872e6bc08d6ef6de79717ff6bbff0f297c134ef (diff)
downloadlinux-06394531b425794dc56f3d525b7994d25b8072f7.tar.bz2
KVM: arm64: Generalise VM features into a set of flags
We currently deal with a set of booleans for VM features, while they could be better represented as set of flags contained in an unsigned long, similarily to what we are doing on the CPU side. Signed-off-by: Marc Zyngier <maz@kernel.org> [Oliver: Flag-ify the 'ran_once' boolean] Signed-off-by: Oliver Upton <oupton@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220311174001.605719-2-oupton@google.com
Diffstat (limited to 'arch/arm64/kvm/pmu-emul.c')
-rw-r--r--arch/arm64/kvm/pmu-emul.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
index 4526a5824dac..78fdc443adc7 100644
--- a/arch/arm64/kvm/pmu-emul.c
+++ b/arch/arm64/kvm/pmu-emul.c
@@ -961,7 +961,7 @@ static int kvm_arm_pmu_v3_set_pmu(struct kvm_vcpu *vcpu, int pmu_id)
list_for_each_entry(entry, &arm_pmus, entry) {
arm_pmu = entry->arm_pmu;
if (arm_pmu->pmu.type == pmu_id) {
- if (kvm->arch.ran_once ||
+ if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags) ||
(kvm->arch.pmu_filter && kvm->arch.arm_pmu != arm_pmu)) {
ret = -EBUSY;
break;
@@ -1044,7 +1044,7 @@ int kvm_arm_pmu_v3_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr)
mutex_lock(&kvm->lock);
- if (kvm->arch.ran_once) {
+ if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags)) {
mutex_unlock(&kvm->lock);
return -EBUSY;
}