Message ID | 155023082996.1011724.16237920586343905010.stgit@bahia.lan |
---|---|
State | New |
Headers | show |
Series | xics: Get rid of KVM specific classes | expand |
On 2/15/19 12:40 PM, Greg Kurz wrote: > We want to use the "simple" ICS type in both KVM and non-KVM setups. > Teach the "simple" ICS how to present interrupts to KVM and adapt > sPAPR accordingly. I don't see the benefits of this change. C. > Signed-off-by: Greg Kurz <groug@kaod.org> > --- > hw/intc/xics.c | 5 +++++ > hw/intc/xics_kvm.c | 3 +-- > hw/ppc/spapr_irq.c | 7 +------ > include/hw/ppc/xics.h | 2 +- > 4 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 49401745c410..3009fa747277 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int val) > { > ICSState *ics = (ICSState *)opaque; > > + if (kvm_irqchip_in_kernel()) { > + ics_kvm_set_irq(ics, srcno, val); > + return; > + } > + > if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { > ics_simple_set_irq_lsi(ics, srcno, val); > } else { > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > index e7b8d4c29ce6..f34eacda03e7 100644 > --- a/hw/intc/xics_kvm.c > +++ b/hw/intc/xics_kvm.c > @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) > return 0; > } > > -void ics_kvm_set_irq(void *opaque, int srcno, int val) > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) > { > - ICSState *ics = opaque; > struct kvm_irq_level args; > int rc; > > diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c > index e6893df61e76..9f43b7b3bf16 100644 > --- a/hw/ppc/spapr_irq.c > +++ b/hw/ppc/spapr_irq.c > @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id) > static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) > { > sPAPRMachineState *spapr = opaque; > - MachineState *machine = MACHINE(opaque); > > - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { > - ics_kvm_set_irq(spapr->ics, srcno, val); > - } else { > - ics_simple_set_irq(spapr->ics, srcno, val); > - } > + ics_simple_set_irq(spapr->ics, srcno, val); > } > > static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index 06e87128f88e..61bd0fb9784f 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); > void ics_simple_write_xive(ICSState *ics, int nr, int server, > uint8_t priority, uint8_t saved_priority); > void ics_simple_set_irq(void *opaque, int srcno, int val); > -void ics_kvm_set_irq(void *opaque, int srcno, int val); > > void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); > void icp_pic_print_info(ICPState *icp, Monitor *mon); > @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); > void ics_get_kvm_state(ICSState *ics); > int ics_set_kvm_state(ICSState *ics); > void ics_synchronize_state(ICSState *ics); > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); > > #endif /* XICS_H */ >
On Fri, 15 Feb 2019 13:59:36 +0100 Cédric Le Goater <clg@kaod.org> wrote: > On 2/15/19 12:40 PM, Greg Kurz wrote: > > We want to use the "simple" ICS type in both KVM and non-KVM setups. > > Teach the "simple" ICS how to present interrupts to KVM and adapt > > sPAPR accordingly. > > I don't see the benefits of this change. > Consistency with what the rest of the series actually does: hiding the KVM details under XICS. But I agree it doesn't buy anything more so I don't mind if it is dropped. > C. > > > > Signed-off-by: Greg Kurz <groug@kaod.org> > > --- > > hw/intc/xics.c | 5 +++++ > > hw/intc/xics_kvm.c | 3 +-- > > hw/ppc/spapr_irq.c | 7 +------ > > include/hw/ppc/xics.h | 2 +- > > 4 files changed, 8 insertions(+), 9 deletions(-) > > > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > > index 49401745c410..3009fa747277 100644 > > --- a/hw/intc/xics.c > > +++ b/hw/intc/xics.c > > @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int val) > > { > > ICSState *ics = (ICSState *)opaque; > > > > + if (kvm_irqchip_in_kernel()) { > > + ics_kvm_set_irq(ics, srcno, val); > > + return; > > + } > > + > > if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { > > ics_simple_set_irq_lsi(ics, srcno, val); > > } else { > > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > > index e7b8d4c29ce6..f34eacda03e7 100644 > > --- a/hw/intc/xics_kvm.c > > +++ b/hw/intc/xics_kvm.c > > @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) > > return 0; > > } > > > > -void ics_kvm_set_irq(void *opaque, int srcno, int val) > > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) > > { > > - ICSState *ics = opaque; > > struct kvm_irq_level args; > > int rc; > > > > diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c > > index e6893df61e76..9f43b7b3bf16 100644 > > --- a/hw/ppc/spapr_irq.c > > +++ b/hw/ppc/spapr_irq.c > > @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id) > > static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) > > { > > sPAPRMachineState *spapr = opaque; > > - MachineState *machine = MACHINE(opaque); > > > > - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { > > - ics_kvm_set_irq(spapr->ics, srcno, val); > > - } else { > > - ics_simple_set_irq(spapr->ics, srcno, val); > > - } > > + ics_simple_set_irq(spapr->ics, srcno, val); > > } > > > > static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) > > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > > index 06e87128f88e..61bd0fb9784f 100644 > > --- a/include/hw/ppc/xics.h > > +++ b/include/hw/ppc/xics.h > > @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); > > void ics_simple_write_xive(ICSState *ics, int nr, int server, > > uint8_t priority, uint8_t saved_priority); > > void ics_simple_set_irq(void *opaque, int srcno, int val); > > -void ics_kvm_set_irq(void *opaque, int srcno, int val); > > > > void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); > > void icp_pic_print_info(ICPState *icp, Monitor *mon); > > @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); > > void ics_get_kvm_state(ICSState *ics); > > int ics_set_kvm_state(ICSState *ics); > > void ics_synchronize_state(ICSState *ics); > > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); > > > > #endif /* XICS_H */ > > >
On Fri, Feb 15, 2019 at 12:40:30PM +0100, Greg Kurz wrote: > We want to use the "simple" ICS type in both KVM and non-KVM setups. > Teach the "simple" ICS how to present interrupts to KVM and adapt > sPAPR accordingly. > > Signed-off-by: Greg Kurz <groug@kaod.org> As Cédric points out, not strictly required to accomplish the series' goals, but I think it's a nice cleanup, so applied. > --- > hw/intc/xics.c | 5 +++++ > hw/intc/xics_kvm.c | 3 +-- > hw/ppc/spapr_irq.c | 7 +------ > include/hw/ppc/xics.h | 2 +- > 4 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/hw/intc/xics.c b/hw/intc/xics.c > index 49401745c410..3009fa747277 100644 > --- a/hw/intc/xics.c > +++ b/hw/intc/xics.c > @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int val) > { > ICSState *ics = (ICSState *)opaque; > > + if (kvm_irqchip_in_kernel()) { > + ics_kvm_set_irq(ics, srcno, val); > + return; > + } > + > if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { > ics_simple_set_irq_lsi(ics, srcno, val); > } else { > diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c > index e7b8d4c29ce6..f34eacda03e7 100644 > --- a/hw/intc/xics_kvm.c > +++ b/hw/intc/xics_kvm.c > @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) > return 0; > } > > -void ics_kvm_set_irq(void *opaque, int srcno, int val) > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) > { > - ICSState *ics = opaque; > struct kvm_irq_level args; > int rc; > > diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c > index e6893df61e76..9f43b7b3bf16 100644 > --- a/hw/ppc/spapr_irq.c > +++ b/hw/ppc/spapr_irq.c > @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id) > static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) > { > sPAPRMachineState *spapr = opaque; > - MachineState *machine = MACHINE(opaque); > > - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { > - ics_kvm_set_irq(spapr->ics, srcno, val); > - } else { > - ics_simple_set_irq(spapr->ics, srcno, val); > - } > + ics_simple_set_irq(spapr->ics, srcno, val); > } > > static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) > diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h > index 06e87128f88e..61bd0fb9784f 100644 > --- a/include/hw/ppc/xics.h > +++ b/include/hw/ppc/xics.h > @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); > void ics_simple_write_xive(ICSState *ics, int nr, int server, > uint8_t priority, uint8_t saved_priority); > void ics_simple_set_irq(void *opaque, int srcno, int val); > -void ics_kvm_set_irq(void *opaque, int srcno, int val); > > void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); > void icp_pic_print_info(ICPState *icp, Monitor *mon); > @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); > void ics_get_kvm_state(ICSState *ics); > int ics_set_kvm_state(ICSState *ics); > void ics_synchronize_state(ICSState *ics); > +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); > > #endif /* XICS_H */ >
diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 49401745c410..3009fa747277 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -466,6 +466,11 @@ void ics_simple_set_irq(void *opaque, int srcno, int val) { ICSState *ics = (ICSState *)opaque; + if (kvm_irqchip_in_kernel()) { + ics_kvm_set_irq(ics, srcno, val); + return; + } + if (ics->irqs[srcno].flags & XICS_FLAGS_IRQ_LSI) { ics_simple_set_irq_lsi(ics, srcno, val); } else { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index e7b8d4c29ce6..f34eacda03e7 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -259,9 +259,8 @@ int ics_set_kvm_state(ICSState *ics) return 0; } -void ics_kvm_set_irq(void *opaque, int srcno, int val) +void ics_kvm_set_irq(ICSState *ics, int srcno, int val) { - ICSState *ics = opaque; struct kvm_irq_level args; int rc; diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index e6893df61e76..9f43b7b3bf16 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -222,13 +222,8 @@ static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id) static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val) { sPAPRMachineState *spapr = opaque; - MachineState *machine = MACHINE(opaque); - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { - ics_kvm_set_irq(spapr->ics, srcno, val); - } else { - ics_simple_set_irq(spapr->ics, srcno, val); - } + ics_simple_set_irq(spapr->ics, srcno, val); } static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp) diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 06e87128f88e..61bd0fb9784f 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -180,7 +180,6 @@ void icp_eoi(ICPState *icp, uint32_t xirr); void ics_simple_write_xive(ICSState *ics, int nr, int server, uint8_t priority, uint8_t saved_priority); void ics_simple_set_irq(void *opaque, int srcno, int val); -void ics_kvm_set_irq(void *opaque, int srcno, int val); void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); void icp_pic_print_info(ICPState *icp, Monitor *mon); @@ -201,5 +200,6 @@ void icp_kvm_realize(DeviceState *dev, Error **errp); void ics_get_kvm_state(ICSState *ics); int ics_set_kvm_state(ICSState *ics); void ics_synchronize_state(ICSState *ics); +void ics_kvm_set_irq(ICSState *ics, int srcno, int val); #endif /* XICS_H */
We want to use the "simple" ICS type in both KVM and non-KVM setups. Teach the "simple" ICS how to present interrupts to KVM and adapt sPAPR accordingly. Signed-off-by: Greg Kurz <groug@kaod.org> --- hw/intc/xics.c | 5 +++++ hw/intc/xics_kvm.c | 3 +-- hw/ppc/spapr_irq.c | 7 +------ include/hw/ppc/xics.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-)