aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-13 11:17:12 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:45 +0100
commit4376c40dedb22530738eeb104a603e94ed03f719 (patch)
tree2749159f46643a7e1e2f74ecd9491f189976c93f /hw
parent23b0898e4471f42e62aa1fea304f6a6e23d03310 (diff)
downloadqemu-4376c40dedb22530738eeb104a603e94ed03f719.zip
qemu-4376c40dedb22530738eeb104a603e94ed03f719.tar.gz
qemu-4376c40dedb22530738eeb104a603e94ed03f719.tar.bz2
kvm: introduce kvm_kernel_irqchip_* functions
The KVMState struct is opaque, so provide accessors for the fields that will be moved from current_machine to the accelerator. For now they just forward to the machine object, but this will change. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ppc/e500.c5
-rw-r--r--hw/ppc/spapr_irq.c16
2 files changed, 6 insertions, 15 deletions
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 91cd4c2..12b6a5b 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 07e08d6..373505d 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;
}