From d192a9f7e4e0f67d45c5121ce637c92b25f498b8 Mon Sep 17 00:00:00 2001 From: Jinqian Yang Date: Fri, 16 May 2025 18:20:17 +0800 Subject: [PATCH] target/arm: support the IPIV feature commit 4db69439ab84a108795f7dc1ea218aa746f1d2be openEuler. QEMU uses ioctl to enable IPIV. Signed-off-by: Jinqian Yang Conflicts: linux-headers/linux/kvm.h [zhangxinghao: Resolved conflicts -adapted changes to anolis 8.2.0 version.] Signed-off-by: zhangxinghao --- 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 a511e5fc13..72135409f1 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -934,6 +934,7 @@ struct kvm_enable_cap { #define KVM_CAP_ARM_TMM 300 +#define KVM_CAP_ARM_HISI_IPIV 798 #define KVM_CAP_ARM_VIRT_MSI_BYPASS 799 struct kvm_irq_routing_irqchip { diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 6f66d64290..64164f0ea8 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -258,6 +258,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) { int ret = 0; @@ -312,6 +328,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } kvm_arm_init_debug(s); + kvm_update_ipiv_cap(s); return ret; } -- Gitee