
From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> virt inclusion category: feature bugzilla: https://gitee.com/openeuler/qemu/issues/IBSJV9 ------------------------------------------------------------------------ This is useful to determine the host CPU vendor and can be used for migration support. Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- target/arm/kvm.c | 3 +++ target/arm/kvm64.c | 8 ++++++++ target/arm/kvm_arm.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 01ff28671f..d98c3d1bf5 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -188,6 +188,9 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu) cpu->kvm_target = arm_host_cpu_features.target; cpu->dtb_compatible = arm_host_cpu_features.dtb_compatible; cpu->isar = arm_host_cpu_features.isar; + cpu->midr = arm_host_cpu_features.midr; + cpu->revidr = arm_host_cpu_features.revidr; + cpu->ctr = arm_host_cpu_features.ctr; cpu->writable_masks = arm_host_cpu_features.writable_masks; env->features = arm_host_cpu_features.features; } diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c index 540da767c1..237de8015d 100644 --- a/target/arm/kvm64.c +++ b/target/arm/kvm64.c @@ -356,6 +356,14 @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, ARM64_SYS_REG(3, 0, 0, 7, 2)); + err |= read_sys_reg64(fdarray[2], &ahcf->midr, + ARM64_SYS_REG(3, 0, 0, 0, 0)); + err |= read_sys_reg64(fdarray[2], &ahcf->revidr, + ARM64_SYS_REG(3, 0, 0, 0, 6)); + + err |= read_sys_reg64(fdarray[2], &ahcf->ctr, + ARM64_SYS_REG(3, 3, 0, 0, 1)); + /* * Note that if AArch32 support is not present in the host, * the AArch32 sysregs are present to be read, but will diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h index bbf869860b..af95698b2b 100644 --- a/target/arm/kvm_arm.h +++ b/target/arm/kvm_arm.h @@ -242,6 +242,9 @@ typedef struct ARMHostCPUFeatures { uint64_t features; uint32_t target; const char *dtb_compatible; + uint64_t midr; + uint64_t revidr; + uint64_t ctr; uint64_t *writable_masks; } ARMHostCPUFeatures; -- 2.33.0