@@ -881,6 +881,24 @@ static bool fixed_ctr_is_allowed(uint8_t idx, uint32_t action, uint32_t bitmap)
(action == KVM_PMU_EVENT_DENY && !(bitmap & BIT_ULL(idx)));
}
+struct incompatible_pmu_event_filter {
+ __u32 action;
+ __u32 nevents;
+ __u32 fixed_counter_bitmap;
+};
+
+static uint64_t test_incompatible_filter(struct kvm_vcpu *vcpu, uint32_t action,
+ uint32_t bitmap)
+{
+ struct incompatible_pmu_event_filter err_f;
+
+ err_f.action = action;
+ err_f.fixed_counter_bitmap = bitmap;
+ ioctl((vcpu->vm)->fd, KVM_SET_PMU_EVENT_FILTER, &err_f.action);
+
+ return run_vcpu_to_sync(vcpu);
+}
+
static void test_fixed_ctr_action_and_bitmap(struct kvm_vcpu *vcpu,
uint8_t fixed_ctr_idx,
uint8_t max_fixed_num)
@@ -918,6 +936,11 @@ static void test_fixed_ctr_action_and_bitmap(struct kvm_vcpu *vcpu,
TEST_ASSERT(expected == !!count,
"Fixed event filter does not work as expected.");
+
+ /* Test incompatible event filter works as expected. */
+ count = test_incompatible_filter(vcpu, actions[i], bitmap);
+ TEST_ASSERT(expected == !!count,
+ "Incompatible filter does not work as expected.");
}
}
}