linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Xuefeng Li <lixuefeng@loongson.cn>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] MIPS: RALINK: Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC
Date: Thu, 26 May 2022 10:14:12 +0200	[thread overview]
Message-ID: <20220526081412.GA5108@alpha.franken.de> (raw)
In-Reply-To: <1653478195-21095-1-git-send-email-yangtiezhu@loongson.cn>

On Wed, May 25, 2022 at 07:29:55PM +0800, Tiezhu Yang wrote:
> kernel test robot reports a build error used with clang compiler and
> mips-randconfig [1]:
> 
>     ld.lld: error: undefined symbol: pci_remap_iospace
> 
> we can see the following configs in the mips-randconfig file:
> 
>     CONFIG_RALINK=y
>     CONFIG_SOC_MT7620=y
>     CONFIG_PCI_DRIVERS_LEGACY=y
>     CONFIG_PCI=y
> 
> CONFIG_RALINK is set, so pci_remap_iospace is defined in the related
> arch/mips/include/asm/mach-ralink/spaces.h header file:
> 
>     #define pci_remap_iospace pci_remap_iospace
> 
> CONFIG_PCI is set, so pci_remap_iospace() in drivers/pci/pci.c is not
> built due to pci_remap_iospace is defined under CONFIG_RALINK.
> 
>     #ifndef pci_remap_iospace
>     int pci_remap_iospace(const struct resource *res, ...)
> 
>     $ objdump -d drivers/pci/pci.o | grep pci_remap_iospace
>     00004cc8 <devm_pci_remap_iospace>:
>         4d18:	10400008 	beqz	v0,4d3c <devm_pci_remap_iospace+0x74>
>         4d2c:	1040000c 	beqz	v0,4d60 <devm_pci_remap_iospace+0x98>
>         4d70:	1000fff3 	b	4d40 <devm_pci_remap_iospace+0x78>
> 
> In addition, CONFIG_PCI_DRIVERS_GENERIC is not set, so pci_remap_iospace()
> in arch/mips/pci/pci-generic.c is not built too.
> 
>     #ifdef pci_remap_iospace
>     int pci_remap_iospace(const struct resource *res, ...)
> 
> For the above reasons, undefined reference pci_remap_iospace() looks like
> reasonable.
> 
> Here are simple steps to reproduce used with gcc and defconfig:
> 
>     cd mips.git
>     make vocore2_defconfig # set RALINK, SOC_MT7620, PCI_DRIVERS_LEGACY
>     make menuconfig        # set PCI
>     make
> 
> there exists the following build error:
> 
>       LD      vmlinux.o
>       MODPOST vmlinux.symvers
>       MODINFO modules.builtin.modinfo
>       GEN     modules.builtin
>       LD      .tmp_vmlinux.kallsyms1
>     drivers/pci/pci.o: In function `devm_pci_remap_iospace':
>     pci.c:(.text+0x4d24): undefined reference to `pci_remap_iospace'
>     Makefile:1158: recipe for target 'vmlinux' failed
>     make: *** [vmlinux] Error 1
> 
> Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC can fix the build
> error, with this patch, no build error remains. This patch is similar with
> commit e538e8649892 ("MIPS: asm: pci: define arch-specific
> 'pci_remap_iospace()' dependent on 'CONFIG_PCI_DRIVERS_GENERIC'").
> 
> [1] https://lore.kernel.org/lkml/202205251247.nQ5cxSV6-lkp@intel.com/
> 
> Fixes: 09d97da660ff ("MIPS: Only define pci_remap_iospace() for Ralink")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/include/asm/mach-ralink/spaces.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/include/asm/mach-ralink/spaces.h b/arch/mips/include/asm/mach-ralink/spaces.h
> index f7af11e..a9f0570 100644
> --- a/arch/mips/include/asm/mach-ralink/spaces.h
> +++ b/arch/mips/include/asm/mach-ralink/spaces.h
> @@ -6,7 +6,9 @@
>  #define PCI_IOSIZE	SZ_64K
>  #define IO_SPACE_LIMIT	(PCI_IOSIZE - 1)
>  
> +#ifdef CONFIG_PCI_DRIVERS_GENERIC
>  #define pci_remap_iospace pci_remap_iospace
> +#endif
>  
>  #include <asm/mach-generic/spaces.h>
>  #endif
> -- 
> 2.1.0

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

      parent reply	other threads:[~2022-05-26  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 11:29 [PATCH] MIPS: RALINK: Define pci_remap_iospace under CONFIG_PCI_DRIVERS_GENERIC Tiezhu Yang
2022-05-26  5:24 ` Sergio Paracuellos
2022-05-26  8:14 ` Thomas Bogendoerfer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220526081412.GA5108@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=lkp@intel.com \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).