This function is actually used only for capability verification, but now it will check for the correct GIC type.
Signed-off-by: Pavel Fedin <p.fe...@samsung.com> --- include/sysemu/kvm.h | 3 ++- kvm-all.c | 2 +- stubs/kvm.c | 2 +- target-arm/kvm.c | 8 ++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index f459fbd..b9009c8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -426,6 +426,7 @@ void kvm_init_irq_routing(KVMState *s); /** * kvm_arch_irqchip_create: * @KVMState: The KVMState pointer + * @type: irqchip type, architecture-specific * * Allow architectures to create an in-kernel irq chip themselves. * @@ -433,7 +434,7 @@ void kvm_init_irq_routing(KVMState *s); * 0: irq chip was not created * > 0: irq chip was created */ -int kvm_arch_irqchip_create(KVMState *s); +int kvm_arch_irqchip_create(KVMState *s, int type); /** * kvm_set_one_reg - set a register value in KVM via KVM_SET_ONE_REG ioctl diff --git a/kvm-all.c b/kvm-all.c index 6bb2716..fcee52c 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1351,7 +1351,7 @@ static int kvm_irqchip_create(MachineState *machine, KVMState *s) /* First probe and see if there's a arch-specific hook to create the * in-kernel irqchip for us */ - ret = kvm_arch_irqchip_create(s); + ret = kvm_arch_irqchip_create(s, machine->kernel_irqchip_type); if (ret < 0) { return ret; } else if (ret == 0) { diff --git a/stubs/kvm.c b/stubs/kvm.c index e7c60b6..a8505ff 100644 --- a/stubs/kvm.c +++ b/stubs/kvm.c @@ -1,7 +1,7 @@ #include "qemu-common.h" #include "sysemu/kvm.h" -int kvm_arch_irqchip_create(KVMState *s) +int kvm_arch_irqchip_create(KVMState *s, int type) { return 0; } diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 548bfd7..fa1073f 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -579,7 +579,7 @@ void kvm_arch_init_irq_routing(KVMState *s) { } -int kvm_arch_irqchip_create(KVMState *s) +int kvm_arch_irqchip_create(KVMState *s, int type) { int ret; @@ -587,11 +587,15 @@ int kvm_arch_irqchip_create(KVMState *s) * let the device do this when it initializes itself, otherwise we * fall back to the old API */ - ret = kvm_create_device(s, KVM_DEV_TYPE_ARM_VGIC_V2, true); + ret = kvm_create_device(s, type, true); if (ret == 0) { return 1; } + /* Fallback will create VGIC v2 */ + if (type != KVM_DEV_TYPE_ARM_VGIC_V2) { + return ret; + } return 0; } -- 1.9.5.msysgit.0