[PATCH qemu-8.2.0 v2 0/2] IPIV-BUGFIX for HIP12

Jinqian Yang (2): Revert "target/arm: Change arm_cpu_mp_affinity when enabled IPIV feature" target/arm: support the IPIV feature linux-headers/linux/kvm.h | 3 +-- target/arm/cpu.c | 22 +++------------------- target/arm/kvm.c | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 21 deletions(-) -- 2.33.0

virt inclusion category: feature bugzilla: https://gitee.com/openeuler/qemu/issues/IC1EV7 ------------------------------------------------------------------------ This reverts commit 33aa02dc05bed8316b1c64131e8269f404287598. OpenEuler kernel OLK-6.6 add the SMCCC interface so that the guest OS can control the enabling of IPIV. When IPIV is enabled, the guest OS uses multiple unicast to implement multicast. So do not need to modify the MPIDR. Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- linux-headers/linux/kvm.h | 2 -- target/arm/cpu.c | 22 +++------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index a19683f1e9..b711c04506 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1205,8 +1205,6 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_SEV_ES_GHCB 500 #define KVM_CAP_HYGON_COCO_EXT 501 - -#define KVM_CAP_ARM_IPIV_MODE 503 /* support userspace to request firmware to build CSV3 guest's memory space */ #define KVM_CAP_HYGON_COCO_EXT_CSV3_SET_PRIV_MEM (1 << 0) /* support request to update CSV3 guest's memory region multiple times */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index b0f70de018..09d391bd34 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1324,25 +1324,9 @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags) uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz) { - uint64_t Aff0 = 0, Aff1 = 0, Aff2 = 0, Aff3 = 0; - int mode; - - if (!kvm_enabled()) { - Aff1 = idx / clustersz; - Aff0 = idx % clustersz; - return (Aff1 << ARM_AFF1_SHIFT) | Aff0; - } - - mode = kvm_check_extension(kvm_state, KVM_CAP_ARM_IPIV_MODE); - if (mode) { - Aff1 = idx % 16; - Aff2 = idx / 16; - } else { - Aff1 = idx / clustersz; - Aff0 = idx % clustersz; - } - return (Aff3 << ARM_AFF3_SHIFT) | (Aff2 << ARM_AFF2_SHIFT) | - (Aff1 << ARM_AFF1_SHIFT) | Aff0; + uint32_t Aff1 = idx / clustersz; + uint32_t Aff0 = idx % clustersz; + return (Aff1 << ARM_AFF1_SHIFT) | Aff0; } static void arm_cpu_initfn(Object *obj) -- 2.33.0

virt inclusion category: feature bugzilla: https://gitee.com/openeuler/qemu/issues/IC1EV7 ------------------------------------------------------------------------ QEMU uses ioctl to enable IPIV. Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- linux-headers/linux/kvm.h | 1 + target/arm/kvm.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index b711c04506..b76865b4e8 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1213,6 +1213,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_HYGON_COCO_EXT_CSV3_INJ_SECRET (1 << 2) #define KVM_CAP_ARM_HW_DIRTY_STATE_TRACK 502 +#define KVM_CAP_ARM_HISI_IPIV 503 #define KVM_CAP_ARM_VIRT_MSI_BYPASS 799 diff --git a/target/arm/kvm.c b/target/arm/kvm.c index ee5ba68305..ab31515a2a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -257,6 +257,22 @@ int kvm_arch_get_default_type(MachineState *ms) return fixed_ipa ? 0 : size; } +static void kvm_update_ipiv_cap(KVMState *s) +{ + int ret; + + if (!kvm_check_extension(s, KVM_CAP_ARM_HISI_IPIV)) { + return; + } + + ret = kvm_vm_enable_cap(s, KVM_CAP_ARM_HISI_IPIV, 0); + if (ret) { + fprintf(stderr, "Could not enable KVM_CAP_ARM_HISI_IPIV: %d\n", ret); + } + + return; +} + int kvm_arch_init(MachineState *ms, KVMState *s) { MachineClass *mc = MACHINE_GET_CLASS(ms); @@ -330,6 +346,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } kvm_arm_init_debug(s); + kvm_update_ipiv_cap(s); return ret; } -- 2.33.0
participants (1)
-
Jinqian Yang