From 66f0338778a3f0086e1a3fa9c945efcf6bb39872 Mon Sep 17 00:00:00 2001 From: Jia Qingtong Date: Tue, 30 Dec 2025 09:42:47 +0800 Subject: [PATCH] target/arm: support the IPIV feature virt inclusion category: feature bugzilla: https://gitee.com/openeuler/qemu/issues/IC1EV7 ------------------------------------------------------------------------ QEMU uses ioctl to enable IPIV. Signed-off-by: Jinqian Yang Signed-off-by: Jia Qingtong --- linux-headers/linux/kvm.h | 1 + target/arm/kvm.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index fa22d85adf..159b685c6f 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -1130,6 +1130,7 @@ struct kvm_ppc_resize_hpt { #define KVM_CAP_ARM_CPU_FEATURE 555 #define KVM_CAP_ARM_TMM 300 +#define KVM_CAP_ARM_HISI_IPIV 798 #define KVM_CAP_ARM_VIRT_MSI_BYPASS 799 #ifdef KVM_CAP_IRQ_ROUTING diff --git a/target/arm/kvm.c b/target/arm/kvm.c index f62d9ece3c..e7d9429af1 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -248,6 +248,22 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa) return ret > 0 ? ret : 40; } +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) { int ret = 0; @@ -281,6 +297,8 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } } + kvm_update_ipiv_cap(s); + return ret; } -- Gitee