mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
hw/arm/virt: Implement kvm-steal-time
We add the kvm-steal-time CPU property and implement it for machvirt. A tiny bit of refactoring was also done to allow pmu and pvtime to use the same vcpu device helper functions. Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Andrew Jones <drjones@redhat.com> Message-id: 20201001061718.101915-7-drjones@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
05889d15d1
commit
68970d1e0d
10 changed files with 209 additions and 13 deletions
|
@ -452,6 +452,7 @@ static void test_query_cpu_model_expansion(const void *data)
|
|||
assert_set_feature(qts, "max", "pmu", true);
|
||||
|
||||
assert_has_not_feature(qts, "max", "kvm-no-adjvtime");
|
||||
assert_has_not_feature(qts, "max", "kvm-steal-time");
|
||||
|
||||
if (g_str_equal(qtest_get_arch(), "aarch64")) {
|
||||
assert_has_feature_enabled(qts, "max", "aarch64");
|
||||
|
@ -493,6 +494,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
|
|||
assert_set_feature(qts, "host", "kvm-no-adjvtime", false);
|
||||
|
||||
if (g_str_equal(qtest_get_arch(), "aarch64")) {
|
||||
bool kvm_supports_steal_time;
|
||||
bool kvm_supports_sve;
|
||||
char max_name[8], name[8];
|
||||
uint32_t max_vq, vq;
|
||||
|
@ -500,6 +502,10 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
|
|||
QDict *resp;
|
||||
char *error;
|
||||
|
||||
assert_error(qts, "cortex-a15",
|
||||
"We cannot guarantee the CPU type 'cortex-a15' works "
|
||||
"with KVM on this host", NULL);
|
||||
|
||||
assert_has_feature_enabled(qts, "host", "aarch64");
|
||||
|
||||
/* Enabling and disabling pmu should always work. */
|
||||
|
@ -507,16 +513,26 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
|
|||
assert_set_feature(qts, "host", "pmu", false);
|
||||
assert_set_feature(qts, "host", "pmu", true);
|
||||
|
||||
assert_error(qts, "cortex-a15",
|
||||
"We cannot guarantee the CPU type 'cortex-a15' works "
|
||||
"with KVM on this host", NULL);
|
||||
|
||||
/*
|
||||
* Some features would be enabled by default, but they're disabled
|
||||
* because this instance of KVM doesn't support them. Test that the
|
||||
* features are present, and, when enabled, issue further tests.
|
||||
*/
|
||||
assert_has_feature(qts, "host", "kvm-steal-time");
|
||||
assert_has_feature(qts, "host", "sve");
|
||||
|
||||
resp = do_query_no_props(qts, "host");
|
||||
kvm_supports_steal_time = resp_get_feature(resp, "kvm-steal-time");
|
||||
kvm_supports_sve = resp_get_feature(resp, "sve");
|
||||
vls = resp_get_sve_vls(resp);
|
||||
qobject_unref(resp);
|
||||
|
||||
if (kvm_supports_steal_time) {
|
||||
/* 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", true);
|
||||
}
|
||||
|
||||
if (kvm_supports_sve) {
|
||||
g_assert(vls != 0);
|
||||
max_vq = 64 - __builtin_clzll(vls);
|
||||
|
@ -577,6 +593,7 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
|
|||
assert_has_not_feature(qts, "host", "aarch64");
|
||||
assert_has_not_feature(qts, "host", "pmu");
|
||||
assert_has_not_feature(qts, "host", "sve");
|
||||
assert_has_not_feature(qts, "host", "kvm-steal-time");
|
||||
}
|
||||
|
||||
qtest_quit(qts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue