diff mbox series

[v2,1/2] ppc: Fix build with --without-default-devices

Message ID 160875160729.98237.3219319022197329254.stgit@bahia.lan (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] ppc: Fix build with --without-default-devices | expand

Commit Message

Greg Kurz Dec. 23, 2020, 7:26 p.m. UTC
Linking of the qemu-system-ppc64 fails on a POWER9 host when
--without-default-devices is passed to configure:

$ ./configure --without-default-devices \
              --target-list=ppc64-softmmu && make

...

libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o: In function `ppce500_init_mpic_kvm':
/home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/e500.c:777: undefined reference to `kvm_openpic_connect_vcpu'
libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_irq.c.o: In function `spapr_irq_check':
/home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/spapr_irq.c:189: undefined reference to `xics_kvm_has_broken_disconnect'
libqemu-ppc64-softmmu.fa.p/hw_intc_spapr_xive.c.o: In function `spapr_xive_post_load':
/home/greg/Work/qemu/qemu-ppc/build/../hw/intc/spapr_xive.c:530: undefined reference to `kvmppc_xive_post_load'

... and tons of other symbols belonging to the KVM backend of the
openpic, XICS and XIVE interrupt controllers.

It turns out that OPENPIC_KVM, XICS_KVM and XIVE_KVM are marked
to depend on KVM but this has no effect when minikconf runs in
allnoconfig mode. Such reverse dependencies should rather be
handled with a 'select' statement, eg.

config OPENPIC
    select OPENPIC_KVM if KVM

or even better by getting rid of the intermediate _KVM config
and directly checking CONFIG_KVM in the meson.build file:

specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
		if_true: files('openpic_kvm.c'))

Go for the latter with OPENPIC, XICS and XIVE. While here also move
XIVE_SPAPR to hw/intc/Kconfig where it belongs.

This went unnoticed so far because CI doesn't test the build with
--without-default-devices and KVM enabled on a POWER host.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
v2: - check CONFIG_KVM in the meson.build as suggested by Paolo
---
 hw/intc/Kconfig     |   14 +++++---------
 hw/intc/meson.build |    9 ++++++---
 hw/ppc/Kconfig      |   15 ---------------
 3 files changed, 11 insertions(+), 27 deletions(-)

Comments

Cédric Le Goater Dec. 24, 2020, 8:26 a.m. UTC | #1
On 12/23/20 8:26 PM, Greg Kurz wrote:
> Linking of the qemu-system-ppc64 fails on a POWER9 host when
> --without-default-devices is passed to configure:
> 
> $ ./configure --without-default-devices \
>               --target-list=ppc64-softmmu && make
> 
> ...
> 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o: In function `ppce500_init_mpic_kvm':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/e500.c:777: undefined reference to `kvm_openpic_connect_vcpu'
> libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_irq.c.o: In function `spapr_irq_check':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/spapr_irq.c:189: undefined reference to `xics_kvm_has_broken_disconnect'
> libqemu-ppc64-softmmu.fa.p/hw_intc_spapr_xive.c.o: In function `spapr_xive_post_load':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/intc/spapr_xive.c:530: undefined reference to `kvmppc_xive_post_load'
> 
> ... and tons of other symbols belonging to the KVM backend of the
> openpic, XICS and XIVE interrupt controllers.
> 
> It turns out that OPENPIC_KVM, XICS_KVM and XIVE_KVM are marked
> to depend on KVM but this has no effect when minikconf runs in
> allnoconfig mode. Such reverse dependencies should rather be
> handled with a 'select' statement, eg.
> 
> config OPENPIC
>     select OPENPIC_KVM if KVM
> 
> or even better by getting rid of the intermediate _KVM config
> and directly checking CONFIG_KVM in the meson.build file:
> 
> specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> 		if_true: files('openpic_kvm.c'))
> 
> Go for the latter with OPENPIC, XICS and XIVE. While here also move
> XIVE_SPAPR to hw/intc/Kconfig where it belongs.
> 
> This went unnoticed so far because CI doesn't test the build with
> --without-default-devices and KVM enabled on a POWER host.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> v2: - check CONFIG_KVM in the meson.build as suggested by Paolo
> ---
>  hw/intc/Kconfig     |   14 +++++---------
>  hw/intc/meson.build |    9 ++++++---
>  hw/ppc/Kconfig      |   15 ---------------
>  3 files changed, 11 insertions(+), 27 deletions(-)
> 
> diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
> index 468d548ca771..ee60d4bf7857 100644
> --- a/hw/intc/Kconfig
> +++ b/hw/intc/Kconfig
> @@ -30,23 +30,19 @@ config ARM_GIC_KVM
>      default y
>      depends on ARM_GIC && KVM
>  
> -config OPENPIC_KVM
> -    bool
> -    default y
> -    depends on OPENPIC && KVM
> -
>  config XICS
>      bool
> -    depends on POWERNV || PSERIES
>  
>  config XICS_SPAPR
>      bool
>      select XICS
>  
> -config XICS_KVM
> +config XIVE
>      bool
> -    default y
> -    depends on XICS && KVM
> +
> +config XIVE_SPAPR
> +    bool
> +    select XIVE
>  
>  config ALLWINNER_A10_PIC
>      bool
> diff --git a/hw/intc/meson.build b/hw/intc/meson.build
> index 68da782ad2c5..b6c9218908e3 100644
> --- a/hw/intc/meson.build
> +++ b/hw/intc/meson.build
> @@ -39,7 +39,8 @@ specific_ss.add(when: 'CONFIG_LOONGSON_LIOINTC', if_true: files('loongson_lioint
>  specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gic.c'))
>  specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_intc.c'))
>  specific_ss.add(when: 'CONFIG_OMPIC', if_true: files('ompic.c'))
> -specific_ss.add(when: 'CONFIG_OPENPIC_KVM', if_true: files('openpic_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> +		if_true: files('openpic_kvm.c'))
>  specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
>  specific_ss.add(when: 'CONFIG_PPC_UIC', if_true: files('ppc-uic.c'))
>  specific_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_ic.c', 'bcm2836_control.c'))
> @@ -50,8 +51,10 @@ specific_ss.add(when: 'CONFIG_SH4', if_true: files('sh_intc.c'))
>  specific_ss.add(when: 'CONFIG_SIFIVE_CLINT', if_true: files('sifive_clint.c'))
>  specific_ss.add(when: 'CONFIG_SIFIVE_PLIC', if_true: files('sifive_plic.c'))
>  specific_ss.add(when: 'CONFIG_XICS', if_true: files('xics.c'))
> -specific_ss.add(when: 'CONFIG_XICS_KVM', if_true: files('xics_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XICS'],
> +		if_true: files('xics_kvm.c'))
>  specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
>  specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c'))
> -specific_ss.add(when: 'CONFIG_XIVE_KVM', if_true: files('spapr_xive_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'],
> +		if_true: files('spapr_xive_kvm.c'))
>  specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
> diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> index 982d55f5875c..064bd6edd83d 100644
> --- a/hw/ppc/Kconfig
> +++ b/hw/ppc/Kconfig
> @@ -129,21 +129,6 @@ config VIRTEX
>      select XILINX_ETHLITE
>      select FDT_PPC
>  
> -config XIVE
> -    bool
> -    depends on POWERNV || PSERIES
> -
> -config XIVE_SPAPR
> -    bool
> -    default y
> -    depends on PSERIES
> -    select XIVE
> -
> -config XIVE_KVM
> -    bool
> -    default y
> -    depends on XIVE_SPAPR && KVM
> -
>  # Only used by 64-bit targets
>  config FW_CFG_PPC
>      bool
> 


There is still a small inconsistency I think,

In hw/ppc/Kconfig :

  config POWERNV
      ...
      select XICS
      select XIVE

  config PSERIES
      ...
      select XICS_SPAPR
      select XIVE_SPAPR

and in hw/intc/meson.build :

  specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
  ...  
  specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
  specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
  ...


Couldn't we simply select XICS and XIVE in the PSERIES machine and
compile 'xics_spapr.c' and 'spapr_xive.c'  when CONFIG_PSERIES is
defined ? This to be in sync with the POWERNV machine.

or introduce 'CONFIG_XICS_PNV 'CONFIG_XIVE_PNV' ? 

Thanks,

C.
Paolo Bonzini Dec. 24, 2020, 10:29 a.m. UTC | #2
On 24/12/20 09:26, Cédric Le Goater wrote:
> In hw/ppc/Kconfig :
> 
>    config POWERNV
>        ...
>        select XICS
>        select XIVE
> 
>    config PSERIES
>        ...
>        select XICS_SPAPR
>        select XIVE_SPAPR
> 
> and in hw/intc/meson.build :
> 
>    specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
>    ...
>    specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
>    specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
>    ...
> 
> 
> Couldn't we simply select XICS and XIVE in the PSERIES machine and
> compile 'xics_spapr.c' and 'spapr_xive.c'  when CONFIG_PSERIES is
> defined ? This to be in sync with the POWERNV machine.
> or introduce 'CONFIG_XICS_PNV 'CONFIG_XIVE_PNV' ?

I think just using CONFIG_PSERIES is the simplest.  But it's just a 
cleanup, not a bugfix.

Paolo
Cédric Le Goater Dec. 24, 2020, 10:34 a.m. UTC | #3
On 12/24/20 11:29 AM, Paolo Bonzini wrote:
> On 24/12/20 09:26, Cédric Le Goater wrote:
>> In hw/ppc/Kconfig :
>>
>>    config POWERNV
>>        ...
>>        select XICS
>>        select XIVE
>>
>>    config PSERIES
>>        ...
>>        select XICS_SPAPR
>>        select XIVE_SPAPR
>>
>> and in hw/intc/meson.build :
>>
>>    specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
>>    ...
>>    specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
>>    specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
>>    ...
>>
>>
>> Couldn't we simply select XICS and XIVE in the PSERIES machine and
>> compile 'xics_spapr.c' and 'spapr_xive.c'  when CONFIG_PSERIES is
>> defined ? This to be in sync with the POWERNV machine.
>> or introduce 'CONFIG_XICS_PNV 'CONFIG_XIVE_PNV' ?
> 
> I think just using CONFIG_PSERIES is the simplest.  But it's just a cleanup, not a bugfix.


yes. No big deal and it can come later.

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Cheers,

C.
Philippe Mathieu-Daudé Dec. 24, 2020, 10:58 a.m. UTC | #4
On 12/23/20 8:26 PM, Greg Kurz wrote:
> Linking of the qemu-system-ppc64 fails on a POWER9 host when
> --without-default-devices is passed to configure:
> 
> $ ./configure --without-default-devices \
>               --target-list=ppc64-softmmu && make
> 
> ...
> 
> libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o: In function `ppce500_init_mpic_kvm':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/e500.c:777: undefined reference to `kvm_openpic_connect_vcpu'
> libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_irq.c.o: In function `spapr_irq_check':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/spapr_irq.c:189: undefined reference to `xics_kvm_has_broken_disconnect'
> libqemu-ppc64-softmmu.fa.p/hw_intc_spapr_xive.c.o: In function `spapr_xive_post_load':
> /home/greg/Work/qemu/qemu-ppc/build/../hw/intc/spapr_xive.c:530: undefined reference to `kvmppc_xive_post_load'
> 
> ... and tons of other symbols belonging to the KVM backend of the
> openpic, XICS and XIVE interrupt controllers.
> 
> It turns out that OPENPIC_KVM, XICS_KVM and XIVE_KVM are marked
> to depend on KVM but this has no effect when minikconf runs in
> allnoconfig mode. Such reverse dependencies should rather be
> handled with a 'select' statement, eg.
> 
> config OPENPIC
>     select OPENPIC_KVM if KVM
> 
> or even better by getting rid of the intermediate _KVM config
> and directly checking CONFIG_KVM in the meson.build file:
> 
> specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> 		if_true: files('openpic_kvm.c'))
> 
> Go for the latter with OPENPIC, XICS and XIVE. While here also move
> XIVE_SPAPR to hw/intc/Kconfig where it belongs.
> 
> This went unnoticed so far because CI doesn't test the build with
> --without-default-devices and KVM enabled on a POWER host.
> 
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> v2: - check CONFIG_KVM in the meson.build as suggested by Paolo
> ---
>  hw/intc/Kconfig     |   14 +++++---------
>  hw/intc/meson.build |    9 ++++++---
>  hw/ppc/Kconfig      |   15 ---------------
>  3 files changed, 11 insertions(+), 27 deletions(-)
> 
> diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
> index 468d548ca771..ee60d4bf7857 100644
> --- a/hw/intc/Kconfig
> +++ b/hw/intc/Kconfig
> @@ -30,23 +30,19 @@ config ARM_GIC_KVM
>      default y
>      depends on ARM_GIC && KVM
>  
> -config OPENPIC_KVM
> -    bool
> -    default y
> -    depends on OPENPIC && KVM
> -
>  config XICS
>      bool
> -    depends on POWERNV || PSERIES
>  
>  config XICS_SPAPR
>      bool
>      select XICS
>  
> -config XICS_KVM
> +config XIVE
>      bool
> -    default y
> -    depends on XICS && KVM
> +
> +config XIVE_SPAPR
> +    bool
> +    select XIVE
>  
>  config ALLWINNER_A10_PIC
>      bool
> diff --git a/hw/intc/meson.build b/hw/intc/meson.build
> index 68da782ad2c5..b6c9218908e3 100644
> --- a/hw/intc/meson.build
> +++ b/hw/intc/meson.build
> @@ -39,7 +39,8 @@ specific_ss.add(when: 'CONFIG_LOONGSON_LIOINTC', if_true: files('loongson_lioint
>  specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gic.c'))
>  specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_intc.c'))
>  specific_ss.add(when: 'CONFIG_OMPIC', if_true: files('ompic.c'))
> -specific_ss.add(when: 'CONFIG_OPENPIC_KVM', if_true: files('openpic_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> +		if_true: files('openpic_kvm.c'))
>  specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
>  specific_ss.add(when: 'CONFIG_PPC_UIC', if_true: files('ppc-uic.c'))
>  specific_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_ic.c', 'bcm2836_control.c'))
> @@ -50,8 +51,10 @@ specific_ss.add(when: 'CONFIG_SH4', if_true: files('sh_intc.c'))
>  specific_ss.add(when: 'CONFIG_SIFIVE_CLINT', if_true: files('sifive_clint.c'))
>  specific_ss.add(when: 'CONFIG_SIFIVE_PLIC', if_true: files('sifive_plic.c'))
>  specific_ss.add(when: 'CONFIG_XICS', if_true: files('xics.c'))
> -specific_ss.add(when: 'CONFIG_XICS_KVM', if_true: files('xics_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XICS'],
> +		if_true: files('xics_kvm.c'))
>  specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
>  specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c'))
> -specific_ss.add(when: 'CONFIG_XIVE_KVM', if_true: files('spapr_xive_kvm.c'))
> +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'],
> +		if_true: files('spapr_xive_kvm.c'))
>  specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
> diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> index 982d55f5875c..064bd6edd83d 100644
> --- a/hw/ppc/Kconfig
> +++ b/hw/ppc/Kconfig
> @@ -129,21 +129,6 @@ config VIRTEX
>      select XILINX_ETHLITE
>      select FDT_PPC
>  
> -config XIVE
> -    bool
> -    depends on POWERNV || PSERIES
> -
> -config XIVE_SPAPR
> -    bool
> -    default y
> -    depends on PSERIES
> -    select XIVE
> -
> -config XIVE_KVM
> -    bool
> -    default y
> -    depends on XIVE_SPAPR && KVM
> -

Is it possible to split this patch in 2: XICS, XIVE (or 3: same + OPENPIC)?
Paolo Bonzini Dec. 24, 2020, 2:42 p.m. UTC | #5
Why? It's all KVM.

Paolo

Il gio 24 dic 2020, 11:58 Philippe Mathieu-Daudé <f4bug@amsat.org> ha
scritto:

> On 12/23/20 8:26 PM, Greg Kurz wrote:
> > Linking of the qemu-system-ppc64 fails on a POWER9 host when
> > --without-default-devices is passed to configure:
> >
> > $ ./configure --without-default-devices \
> >               --target-list=ppc64-softmmu && make
> >
> > ...
> >
> > libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o: In function
> `ppce500_init_mpic_kvm':
> > /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/e500.c:777: undefined
> reference to `kvm_openpic_connect_vcpu'
> > libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_irq.c.o: In function
> `spapr_irq_check':
> > /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/spapr_irq.c:189: undefined
> reference to `xics_kvm_has_broken_disconnect'
> > libqemu-ppc64-softmmu.fa.p/hw_intc_spapr_xive.c.o: In function
> `spapr_xive_post_load':
> > /home/greg/Work/qemu/qemu-ppc/build/../hw/intc/spapr_xive.c:530:
> undefined reference to `kvmppc_xive_post_load'
> >
> > ... and tons of other symbols belonging to the KVM backend of the
> > openpic, XICS and XIVE interrupt controllers.
> >
> > It turns out that OPENPIC_KVM, XICS_KVM and XIVE_KVM are marked
> > to depend on KVM but this has no effect when minikconf runs in
> > allnoconfig mode. Such reverse dependencies should rather be
> > handled with a 'select' statement, eg.
> >
> > config OPENPIC
> >     select OPENPIC_KVM if KVM
> >
> > or even better by getting rid of the intermediate _KVM config
> > and directly checking CONFIG_KVM in the meson.build file:
> >
> > specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> >               if_true: files('openpic_kvm.c'))
> >
> > Go for the latter with OPENPIC, XICS and XIVE. While here also move
> > XIVE_SPAPR to hw/intc/Kconfig where it belongs.
> >
> > This went unnoticed so far because CI doesn't test the build with
> > --without-default-devices and KVM enabled on a POWER host.
> >
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > v2: - check CONFIG_KVM in the meson.build as suggested by Paolo
> > ---
> >  hw/intc/Kconfig     |   14 +++++---------
> >  hw/intc/meson.build |    9 ++++++---
> >  hw/ppc/Kconfig      |   15 ---------------
> >  3 files changed, 11 insertions(+), 27 deletions(-)
> >
> > diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
> > index 468d548ca771..ee60d4bf7857 100644
> > --- a/hw/intc/Kconfig
> > +++ b/hw/intc/Kconfig
> > @@ -30,23 +30,19 @@ config ARM_GIC_KVM
> >      default y
> >      depends on ARM_GIC && KVM
> >
> > -config OPENPIC_KVM
> > -    bool
> > -    default y
> > -    depends on OPENPIC && KVM
> > -
> >  config XICS
> >      bool
> > -    depends on POWERNV || PSERIES
> >
> >  config XICS_SPAPR
> >      bool
> >      select XICS
> >
> > -config XICS_KVM
> > +config XIVE
> >      bool
> > -    default y
> > -    depends on XICS && KVM
> > +
> > +config XIVE_SPAPR
> > +    bool
> > +    select XIVE
> >
> >  config ALLWINNER_A10_PIC
> >      bool
> > diff --git a/hw/intc/meson.build b/hw/intc/meson.build
> > index 68da782ad2c5..b6c9218908e3 100644
> > --- a/hw/intc/meson.build
> > +++ b/hw/intc/meson.build
> > @@ -39,7 +39,8 @@ specific_ss.add(when: 'CONFIG_LOONGSON_LIOINTC',
> if_true: files('loongson_lioint
> >  specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gic.c'))
> >  specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_intc.c'))
> >  specific_ss.add(when: 'CONFIG_OMPIC', if_true: files('ompic.c'))
> > -specific_ss.add(when: 'CONFIG_OPENPIC_KVM', if_true:
> files('openpic_kvm.c'))
> > +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
> > +             if_true: files('openpic_kvm.c'))
> >  specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c',
> 'pnv_xive.c'))
> >  specific_ss.add(when: 'CONFIG_PPC_UIC', if_true: files('ppc-uic.c'))
> >  specific_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_ic.c',
> 'bcm2836_control.c'))
> > @@ -50,8 +51,10 @@ specific_ss.add(when: 'CONFIG_SH4', if_true:
> files('sh_intc.c'))
> >  specific_ss.add(when: 'CONFIG_SIFIVE_CLINT', if_true:
> files('sifive_clint.c'))
> >  specific_ss.add(when: 'CONFIG_SIFIVE_PLIC', if_true:
> files('sifive_plic.c'))
> >  specific_ss.add(when: 'CONFIG_XICS', if_true: files('xics.c'))
> > -specific_ss.add(when: 'CONFIG_XICS_KVM', if_true: files('xics_kvm.c'))
> > +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XICS'],
> > +             if_true: files('xics_kvm.c'))
> >  specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true:
> files('xics_spapr.c'))
> >  specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c'))
> > -specific_ss.add(when: 'CONFIG_XIVE_KVM', if_true:
> files('spapr_xive_kvm.c'))
> > +specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'],
> > +             if_true: files('spapr_xive_kvm.c'))
> >  specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true:
> files('spapr_xive.c'))
> > diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> > index 982d55f5875c..064bd6edd83d 100644
> > --- a/hw/ppc/Kconfig
> > +++ b/hw/ppc/Kconfig
> > @@ -129,21 +129,6 @@ config VIRTEX
> >      select XILINX_ETHLITE
> >      select FDT_PPC
> >
> > -config XIVE
> > -    bool
> > -    depends on POWERNV || PSERIES
> > -
> > -config XIVE_SPAPR
> > -    bool
> > -    default y
> > -    depends on PSERIES
> > -    select XIVE
> > -
> > -config XIVE_KVM
> > -    bool
> > -    default y
> > -    depends on XIVE_SPAPR && KVM
> > -
>
> Is it possible to split this patch in 2: XICS, XIVE (or 3: same + OPENPIC)?
>
>
Philippe Mathieu-Daudé Dec. 24, 2020, 3:37 p.m. UTC | #6
On 12/24/20 3:42 PM, Paolo Bonzini wrote:
> Why? It's all KVM.

I find it not obvious to figure out by simply looking at this diff.
I'm probably too tired. Anyway Cédric already reviewed it.

> 
> Paolo
> 
> Il gio 24 dic 2020, 11:58 Philippe Mathieu-Daudé <f4bug@amsat.org
> <mailto:f4bug@amsat.org>> ha scritto:
> 
>     On 12/23/20 8:26 PM, Greg Kurz wrote:
>     > Linking of the qemu-system-ppc64 fails on a POWER9 host when
>     > --without-default-devices is passed to configure:
>     >
>     > $ ./configure --without-default-devices \
>     >               --target-list=ppc64-softmmu && make
>     >
>     > ...
>     >
>     > libqemu-ppc64-softmmu.fa.p/hw_ppc_e500.c.o: In function
>     `ppce500_init_mpic_kvm':
>     > /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/e500.c:777:
>     undefined reference to `kvm_openpic_connect_vcpu'
>     > libqemu-ppc64-softmmu.fa.p/hw_ppc_spapr_irq.c.o: In function
>     `spapr_irq_check':
>     > /home/greg/Work/qemu/qemu-ppc/build/../hw/ppc/spapr_irq.c:189:
>     undefined reference to `xics_kvm_has_broken_disconnect'
>     > libqemu-ppc64-softmmu.fa.p/hw_intc_spapr_xive.c.o: In function
>     `spapr_xive_post_load':
>     > /home/greg/Work/qemu/qemu-ppc/build/../hw/intc/spapr_xive.c:530:
>     undefined reference to `kvmppc_xive_post_load'
>     >
>     > ... and tons of other symbols belonging to the KVM backend of the
>     > openpic, XICS and XIVE interrupt controllers.
>     >
>     > It turns out that OPENPIC_KVM, XICS_KVM and XIVE_KVM are marked
>     > to depend on KVM but this has no effect when minikconf runs in
>     > allnoconfig mode. Such reverse dependencies should rather be
>     > handled with a 'select' statement, eg.
>     >
>     > config OPENPIC
>     >     select OPENPIC_KVM if KVM
>     >
>     > or even better by getting rid of the intermediate _KVM config
>     > and directly checking CONFIG_KVM in the meson.build file:
>     >
>     > specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
>     >               if_true: files('openpic_kvm.c'))
>     >
>     > Go for the latter with OPENPIC, XICS and XIVE. While here also move
>     > XIVE_SPAPR to hw/intc/Kconfig where it belongs.
>     >
>     > This went unnoticed so far because CI doesn't test the build with
>     > --without-default-devices and KVM enabled on a POWER host.
>     >
>     > Signed-off-by: Greg Kurz <groug@kaod.org <mailto:groug@kaod.org>>
>     > ---
>     > v2: - check CONFIG_KVM in the meson.build as suggested by Paolo
>     > ---
>     >  hw/intc/Kconfig     |   14 +++++---------
>     >  hw/intc/meson.build |    9 ++++++---
>     >  hw/ppc/Kconfig      |   15 ---------------
>     >  3 files changed, 11 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig
index 468d548ca771..ee60d4bf7857 100644
--- a/hw/intc/Kconfig
+++ b/hw/intc/Kconfig
@@ -30,23 +30,19 @@  config ARM_GIC_KVM
     default y
     depends on ARM_GIC && KVM
 
-config OPENPIC_KVM
-    bool
-    default y
-    depends on OPENPIC && KVM
-
 config XICS
     bool
-    depends on POWERNV || PSERIES
 
 config XICS_SPAPR
     bool
     select XICS
 
-config XICS_KVM
+config XIVE
     bool
-    default y
-    depends on XICS && KVM
+
+config XIVE_SPAPR
+    bool
+    select XIVE
 
 config ALLWINNER_A10_PIC
     bool
diff --git a/hw/intc/meson.build b/hw/intc/meson.build
index 68da782ad2c5..b6c9218908e3 100644
--- a/hw/intc/meson.build
+++ b/hw/intc/meson.build
@@ -39,7 +39,8 @@  specific_ss.add(when: 'CONFIG_LOONGSON_LIOINTC', if_true: files('loongson_lioint
 specific_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('mips_gic.c'))
 specific_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_intc.c'))
 specific_ss.add(when: 'CONFIG_OMPIC', if_true: files('ompic.c'))
-specific_ss.add(when: 'CONFIG_OPENPIC_KVM', if_true: files('openpic_kvm.c'))
+specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_OPENPIC'],
+		if_true: files('openpic_kvm.c'))
 specific_ss.add(when: 'CONFIG_POWERNV', if_true: files('xics_pnv.c', 'pnv_xive.c'))
 specific_ss.add(when: 'CONFIG_PPC_UIC', if_true: files('ppc-uic.c'))
 specific_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_ic.c', 'bcm2836_control.c'))
@@ -50,8 +51,10 @@  specific_ss.add(when: 'CONFIG_SH4', if_true: files('sh_intc.c'))
 specific_ss.add(when: 'CONFIG_SIFIVE_CLINT', if_true: files('sifive_clint.c'))
 specific_ss.add(when: 'CONFIG_SIFIVE_PLIC', if_true: files('sifive_plic.c'))
 specific_ss.add(when: 'CONFIG_XICS', if_true: files('xics.c'))
-specific_ss.add(when: 'CONFIG_XICS_KVM', if_true: files('xics_kvm.c'))
+specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XICS'],
+		if_true: files('xics_kvm.c'))
 specific_ss.add(when: 'CONFIG_XICS_SPAPR', if_true: files('xics_spapr.c'))
 specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c'))
-specific_ss.add(when: 'CONFIG_XIVE_KVM', if_true: files('spapr_xive_kvm.c'))
+specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'],
+		if_true: files('spapr_xive_kvm.c'))
 specific_ss.add(when: 'CONFIG_XIVE_SPAPR', if_true: files('spapr_xive.c'))
diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
index 982d55f5875c..064bd6edd83d 100644
--- a/hw/ppc/Kconfig
+++ b/hw/ppc/Kconfig
@@ -129,21 +129,6 @@  config VIRTEX
     select XILINX_ETHLITE
     select FDT_PPC
 
-config XIVE
-    bool
-    depends on POWERNV || PSERIES
-
-config XIVE_SPAPR
-    bool
-    default y
-    depends on PSERIES
-    select XIVE
-
-config XIVE_KVM
-    bool
-    default y
-    depends on XIVE_SPAPR && KVM
-
 # Only used by 64-bit targets
 config FW_CFG_PPC
     bool