diff options
-rw-r--r-- | accel/kvm/kvm-all.c | 23 | ||||
-rw-r--r-- | hw/ppc/e500.c | 5 | ||||
-rw-r--r-- | hw/ppc/spapr_irq.c | 16 | ||||
-rw-r--r-- | include/sysemu/kvm.h | 7 | ||||
-rw-r--r-- | target/arm/kvm.c | 8 | ||||
-rw-r--r-- | target/i386/kvm.c | 4 | ||||
-rw-r--r-- | target/mips/kvm.c | 2 | ||||
-rw-r--r-- | target/ppc/kvm.c | 2 | ||||
-rw-r--r-- | target/s390x/kvm.c | 2 |
9 files changed, 39 insertions, 30 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4770dd8c67..34e8f26d6a 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1774,7 +1774,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi) g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi)); } -static void kvm_irqchip_create(MachineState *machine, KVMState *s) +static void kvm_irqchip_create(KVMState *s) { int ret; @@ -1792,9 +1792,9 @@ static void 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(machine, s); + ret = kvm_arch_irqchip_create(s); if (ret == 0) { - if (machine_kernel_irqchip_split(machine)) { + if (kvm_kernel_irqchip_split()) { perror("Split IRQ chip mode not supported."); exit(1); } else { @@ -2066,7 +2066,7 @@ static int kvm_init(MachineState *ms) } if (machine_kernel_irqchip_allowed(ms)) { - kvm_irqchip_create(ms, s); + kvm_irqchip_create(s); } if (kvm_eventfds_allowed) { @@ -2983,6 +2983,21 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v, s->kvm_shadow_mem = value; } +bool kvm_kernel_irqchip_allowed(void) +{ + return machine_kernel_irqchip_allowed(current_machine); +} + +bool kvm_kernel_irqchip_required(void) +{ + return machine_kernel_irqchip_required(current_machine); +} + +bool kvm_kernel_irqchip_split(void) +{ + return machine_kernel_irqchip_split(current_machine); +} + static void kvm_accel_instance_init(Object *obj) { KVMState *s = KVM_STATE(obj); diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 91cd4c26f9..12b6a5b2a8 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -793,7 +793,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms, MemoryRegion *ccsr, IrqLines *irqs) { - MachineState *machine = MACHINE(pms); const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(pms); DeviceState *dev = NULL; SysBusDevice *s; @@ -801,10 +800,10 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineState *pms, if (kvm_enabled()) { Error *err = NULL; - if (machine_kernel_irqchip_allowed(machine)) { + if (kvm_kernel_irqchip_allowed()) { dev = ppce500_init_mpic_kvm(pmc, irqs, &err); } - if (machine_kernel_irqchip_required(machine) && !dev) { + if (kvm_kernel_irqchip_required() && !dev) { error_reportf_err(err, "kernel_irqchip requested but unavailable: "); exit(1); diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 07e08d6544..373505d28b 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -75,12 +75,11 @@ int spapr_irq_init_kvm(SpaprInterruptControllerInitKvm fn, uint32_t nr_servers, Error **errp) { - MachineState *machine = MACHINE(qdev_get_machine()); Error *local_err = NULL; - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { + if (kvm_enabled() && kvm_kernel_irqchip_allowed()) { if (fn(intc, nr_servers, &local_err) < 0) { - if (machine_kernel_irqchip_required(machine)) { + if (kvm_kernel_irqchip_required()) { error_prepend(&local_err, "kernel_irqchip requested but unavailable: "); error_propagate(errp, local_err); @@ -185,7 +184,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Error **errp) */ if (kvm_enabled() && spapr->irq == &spapr_irq_dual && - machine_kernel_irqchip_required(machine) && + kvm_kernel_irqchip_required() && xics_kvm_has_broken_disconnect(spapr)) { error_setg(errp, "KVM is too old to support ic-mode=dual,kernel-irqchip=on"); return -1; @@ -288,20 +287,13 @@ uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr) void spapr_irq_init(SpaprMachineState *spapr, Error **errp) { - MachineState *machine = MACHINE(spapr); SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); - if (machine_kernel_irqchip_split(machine)) { + if (kvm_enabled() && kvm_kernel_irqchip_split()) { error_setg(errp, "kernel_irqchip split mode not supported on pseries"); return; } - if (!kvm_enabled() && machine_kernel_irqchip_required(machine)) { - error_setg(errp, - "kernel_irqchip requested but only available with KVM"); - return; - } - if (spapr_irq_check(spapr, errp) < 0) { return; } diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 9fe233b9bf..aaf2a502e8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -519,10 +519,13 @@ void kvm_pc_gsi_handler(void *opaque, int n, int level); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); +bool kvm_kernel_irqchip_allowed(void); +bool kvm_kernel_irqchip_required(void); +bool kvm_kernel_irqchip_split(void); + /** * kvm_arch_irqchip_create: * @KVMState: The KVMState pointer - * @MachineState: The MachineState pointer * * Allow architectures to create an in-kernel irq chip themselves. * @@ -530,7 +533,7 @@ void kvm_init_irq_routing(KVMState *s); * 0: irq chip was not created * > 0: irq chip was created */ -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s); +int kvm_arch_irqchip_create(KVMState *s); /** * kvm_set_one_reg - set a register value in KVM via KVM_SET_ONE_REG ioctl diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 5b82cefef6..b87b59a02a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -741,11 +741,11 @@ void kvm_arch_init_irq_routing(KVMState *s) { } -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { - if (machine_kernel_irqchip_split(ms)) { - perror("-machine kernel_irqchip=split is not supported on ARM."); - exit(1); + if (kvm_kernel_irqchip_split()) { + perror("-machine kernel_irqchip=split is not supported on ARM."); + exit(1); } /* If we can create the VGIC using the newer device control API, we diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 62ce681a96..ef63f3a5a6 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -4494,10 +4494,10 @@ void kvm_arch_init_irq_routing(KVMState *s) } } -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { int ret; - if (machine_kernel_irqchip_split(ms)) { + if (kvm_kernel_irqchip_split()) { ret = kvm_vm_enable_cap(s, KVM_CAP_SPLIT_IRQCHIP, 0, 24); if (ret) { error_report("Could not enable split irqchip mode: %s", diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 578bc14625..de3e26ef1f 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -57,7 +57,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 7406d18945..f7e187c961 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -152,7 +152,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ad6e38c876..15260aeb9a 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -374,7 +374,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } |