[PATCH] powerpc/powernv/pci: Fix build of pci-ioda.o

Gustavo Romero gromero at linux.vnet.ibm.com
Wed Jul 29 22:31:32 AEST 2020


Hi Oliver,

On 7/28/20 7:50 PM, Oliver O'Halloran wrote:
> On Wed, Jul 29, 2020 at 8:35 AM Gustavo Romero <gromero at linux.ibm.com> wrote:
>>
>> Currently pnv_ioda_setup_bus_dma() is outside of a CONFIG_IOMMU_API guard
>> and if CONFIG_IOMMU_API=n the build can fail if the compiler sets
>> -Werror=unused-function, because pnv_ioda_setup_bus_dma() is only used in
>> functions guarded by a CONFIG_IOMMU_API guard.
>>
>> That issue can be easily reproduced using the skiroot_defconfig. For other
>> configs, like powernv_defconfig, that issue is hidden by the fact that
>> if CONFIG_IOMMU_SUPPORT is enabled plus other common IOMMU options, like
>> CONFIG_OF_IOMMU, by default CONFIG_IOMMU_API is enabled as well. Hence, for
>> powernv_defconfig, it's necessary to set CONFIG_IOMMU_SUPPORT=n to make the
>> build fail, because CONFIG_PCI=y and pci-ioda.c is included in the build,
>> but since CONFIG_IOMMU_SUPPORT=n the CONFIG_IOMMU_API is disabled, breaking
>> the build.
>>
>> This commit fixes that build issue by moving the pnv_ioda_setup_bus_dma()
>> inside a CONFIG_IOMMU_API guard, so when CONFIG_IOMMU_API is disabled that
>> function is not defined.
> 
> I think a fix for this is already in -next.

Indeed.

For the records, it's fixed in -next by:

commit e3417faec526cbf97773dca691dcd743f5bfeb64
Author: Oliver O'Halloran <oohall at gmail.com>
Date:   Sun Jul 5 23:35:57 2020 +1000

     powerpc/powernv: Move pnv_ioda_setup_bus_dma under CONFIG_IOMMU_API
     
     pnv_ioda_setup_bus_dma() is only used when a passed through PE is
     returned to the host. If the kernel is built without IOMMU support
     this is dead code. Move it under the #ifdef with the rest of the
     IOMMU API support.
     
     Reported-by: kernel test robot <lkp at intel.com>
     Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
     Reviewed-by: Alexey Kardashevskiy <aik at ozlabs.ru>
     Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
     Link: https://lore.kernel.org/r/20200705133557.443607-2-oohall@gmail.com


Thanks.


Cheers,
Gustavo


More information about the Linuxppc-dev mailing list