소스 검색

tests/arm-cpu-features: Do not assume PMU availability

Asahi Linux supports KVM but lacks PMU support.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20240716-pmu-v3-1-8c7c1858a227@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Akihiko Odaki 1 년 전
부모
커밋
71328d8289
1개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 8 5
      tests/qtest/arm-cpu-features.c

+ 8 - 5
tests/qtest/arm-cpu-features.c

@@ -509,6 +509,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
     assert_set_feature(qts, "host", "kvm-no-adjvtime", false);
     assert_set_feature(qts, "host", "kvm-no-adjvtime", false);
 
 
     if (g_str_equal(qtest_get_arch(), "aarch64")) {
     if (g_str_equal(qtest_get_arch(), "aarch64")) {
+        bool kvm_supports_pmu;
         bool kvm_supports_steal_time;
         bool kvm_supports_steal_time;
         bool kvm_supports_sve;
         bool kvm_supports_sve;
         char max_name[8], name[8];
         char max_name[8], name[8];
@@ -537,11 +538,6 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
 
 
         assert_has_feature_enabled(qts, "host", "aarch64");
         assert_has_feature_enabled(qts, "host", "aarch64");
 
 
-        /* Enabling and disabling pmu should always work. */
-        assert_has_feature_enabled(qts, "host", "pmu");
-        assert_set_feature(qts, "host", "pmu", false);
-        assert_set_feature(qts, "host", "pmu", true);
-
         /*
         /*
          * Some features would be enabled by default, but they're disabled
          * Some features would be enabled by default, but they're disabled
          * because this instance of KVM doesn't support them. Test that the
          * because this instance of KVM doesn't support them. Test that the
@@ -551,11 +547,18 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
         assert_has_feature(qts, "host", "sve");
         assert_has_feature(qts, "host", "sve");
 
 
         resp = do_query_no_props(qts, "host");
         resp = do_query_no_props(qts, "host");
+        kvm_supports_pmu = resp_get_feature(resp, "pmu");
         kvm_supports_steal_time = resp_get_feature(resp, "kvm-steal-time");
         kvm_supports_steal_time = resp_get_feature(resp, "kvm-steal-time");
         kvm_supports_sve = resp_get_feature(resp, "sve");
         kvm_supports_sve = resp_get_feature(resp, "sve");
         vls = resp_get_sve_vls(resp);
         vls = resp_get_sve_vls(resp);
         qobject_unref(resp);
         qobject_unref(resp);
 
 
+        if (kvm_supports_pmu) {
+            /* If we have pmu then we should be able to toggle it. */
+            assert_set_feature(qts, "host", "pmu", false);
+            assert_set_feature(qts, "host", "pmu", true);
+        }
+
         if (kvm_supports_steal_time) {
         if (kvm_supports_steal_time) {
             /* If we have steal-time then we should be able to toggle it. */
             /* If we have steal-time then we should be able to toggle it. */
             assert_set_feature(qts, "host", "kvm-steal-time", false);
             assert_set_feature(qts, "host", "kvm-steal-time", false);