[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v2 05/10] target/arm: Introduce kvm_arm_cpu_feature_supported
From: |
Peng Liang |
Subject: |
[RFC v2 05/10] target/arm: Introduce kvm_arm_cpu_feature_supported |
Date: |
Thu, 17 Sep 2020 20:14:44 +0800 |
Introduce kvm_arm_cpu_feature_supported to check whether KVM supports to
set CPU features in ARM.
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
---
target/arm/kvm_arm.h | 7 +++++++
target/arm/kvm64.c | 14 ++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index bc178eeb84c0..33b3f107b47d 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -290,6 +290,13 @@ bool kvm_arm_pmu_supported(void);
*/
bool kvm_arm_sve_supported(void);
+/**
+ * kvm_arm_cpu_feature_supported:
+ *
+ * Returns true if KVM can set CPU features and false otherwise.
+ */
+bool kvm_arm_cpu_feature_supported(void);
+
/**
* kvm_arm_get_max_vm_ipa_size:
* @ms: Machine state handle
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 542ade8fac9d..d0a8a7e8194a 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -663,6 +663,20 @@ bool kvm_arm_sve_supported(void)
return kvm_check_extension(kvm_state, KVM_CAP_ARM_SVE);
}
+bool kvm_arm_cpu_feature_supported(void)
+{
+ static bool cpu_feature_initialized;
+ static bool cpu_feature_supported;
+
+ if (!cpu_feature_initialized) {
+ cpu_feature_supported = kvm_check_extension(kvm_state,
+ KVM_CAP_ARM_CPU_FEATURE);
+ cpu_feature_initialized = true;
+ }
+
+ return cpu_feature_supported;
+}
+
QEMU_BUILD_BUG_ON(KVM_ARM64_SVE_VQ_MIN != 1);
void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map)
--
2.26.2
- [RFC v2 00/10] Support disable/enable CPU features for AArch64, Peng Liang, 2020/09/17
- [RFC v2 01/10] linux-header: Introduce KVM_CAP_ARM_CPU_FEATURE, Peng Liang, 2020/09/17
- [RFC v2 03/10] target/arm: only set ID_PFR1_EL1.GIC for AArch32 guest, Peng Liang, 2020/09/17
- [RFC v2 02/10] target/arm: Update ID fields, Peng Liang, 2020/09/17
- [RFC v2 04/10] target/arm: convert isar regs to array, Peng Liang, 2020/09/17
- [RFC v2 05/10] target/arm: Introduce kvm_arm_cpu_feature_supported,
Peng Liang <=
- [RFC v2 07/10] target/arm: Allow ID registers to synchronize to KVM, Peng Liang, 2020/09/17
- [RFC v2 10/10] target/arm: Add CPU features to query-cpu-model-expansion, Peng Liang, 2020/09/17
- [RFC v2 08/10] target/arm: Introduce user_mask to indicate whether the feature is set explicitly, Peng Liang, 2020/09/17
- [RFC v2 06/10] target/arm: register CPU features for property, Peng Liang, 2020/09/17
- [RFC v2 09/10] target/arm: introduce CPU feature dependency mechanism, Peng Liang, 2020/09/17