
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