All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] MIPS: Only define pci_remap_iospace() for Ralink
@ 2021-12-08  9:27 Tiezhu Yang
  2021-12-09  9:24 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2021-12-08  9:27 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Sergio Paracuellos, Xuefeng Li, linux-mips, linux-kernel

After commit 9f76779f2418 ("MIPS: implement architecture-specific
'pci_remap_iospace()'"), there exists the following warning on the
Loongson64 platform:

    loongson-pci 1a000000.pci:       IO 0x0018020000..0x001803ffff -> 0x0000020000
    loongson-pci 1a000000.pci:      MEM 0x0040000000..0x007fffffff -> 0x0040000000
    ------------[ cut here ]------------
    WARNING: CPU: 2 PID: 1 at arch/mips/pci/pci-generic.c:55 pci_remap_iospace+0x84/0x90
    resource start address is not zero
    ...
    Call Trace:
    [<ffffffff8020dc78>] show_stack+0x40/0x120
    [<ffffffff80cf4a0c>] dump_stack_lvl+0x58/0x74
    [<ffffffff8023a0b0>] __warn+0xe0/0x110
    [<ffffffff80cee02c>] warn_slowpath_fmt+0xa4/0xd0
    [<ffffffff80cecf24>] pci_remap_iospace+0x84/0x90
    [<ffffffff807f9864>] devm_pci_remap_iospace+0x5c/0xb8
    [<ffffffff808121b0>] devm_of_pci_bridge_init+0x178/0x1f8
    [<ffffffff807f4000>] devm_pci_alloc_host_bridge+0x78/0x98
    [<ffffffff80819454>] loongson_pci_probe+0x34/0x160
    [<ffffffff809203cc>] platform_probe+0x6c/0xe0
    [<ffffffff8091d5d4>] really_probe+0xbc/0x340
    [<ffffffff8091d8f0>] __driver_probe_device+0x98/0x110
    [<ffffffff8091d9b8>] driver_probe_device+0x50/0x118
    [<ffffffff8091dea0>] __driver_attach+0x80/0x118
    [<ffffffff8091b280>] bus_for_each_dev+0x80/0xc8
    [<ffffffff8091c6d8>] bus_add_driver+0x130/0x210
    [<ffffffff8091ead4>] driver_register+0x8c/0x150
    [<ffffffff80200a8c>] do_one_initcall+0x54/0x288
    [<ffffffff811a5320>] kernel_init_freeable+0x27c/0x2e4
    [<ffffffff80cfc380>] kernel_init+0x2c/0x134
    [<ffffffff80205a2c>] ret_from_kernel_thread+0x14/0x1c
    ---[ end trace e4a0efe10aa5cce6 ]---
    loongson-pci 1a000000.pci: error -19: failed to map resource [io  0x20000-0x3ffff]

We can see that the resource start address is 0x0000020000, because
the ISA Bridge used the zero address which is defined in the dts file
arch/mips/boot/dts/loongson/ls7a-pch.dtsi:

    ISA Bridge: /bus@10000000/isa@18000000
    IO 0x0000000018000000..0x000000001801ffff  ->  0x0000000000000000

Based on the above analysis, the architecture-specific pci_remap_iospace()
is not suitable for Loongson64, we should only define pci_remap_iospace()
for Ralink on MIPS based on the commit background.

Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/include/asm/mach-ralink/spaces.h | 2 ++
 arch/mips/include/asm/pci.h                | 4 ----
 arch/mips/pci/pci-generic.c                | 2 ++
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/include/asm/mach-ralink/spaces.h b/arch/mips/include/asm/mach-ralink/spaces.h
index 05d14c2..f7af11e 100644
--- a/arch/mips/include/asm/mach-ralink/spaces.h
+++ b/arch/mips/include/asm/mach-ralink/spaces.h
@@ -6,5 +6,7 @@
 #define PCI_IOSIZE	SZ_64K
 #define IO_SPACE_LIMIT	(PCI_IOSIZE - 1)
 
+#define pci_remap_iospace pci_remap_iospace
+
 #include <asm/mach-generic/spaces.h>
 #endif
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 421231f..9ffc819 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -20,10 +20,6 @@
 #include <linux/list.h>
 #include <linux/of.h>
 
-#ifdef CONFIG_PCI_DRIVERS_GENERIC
-#define pci_remap_iospace pci_remap_iospace
-#endif
-
 #ifdef CONFIG_PCI_DRIVERS_LEGACY
 
 /*
diff --git a/arch/mips/pci/pci-generic.c b/arch/mips/pci/pci-generic.c
index 18eb8a4..d2d68bac 100644
--- a/arch/mips/pci/pci-generic.c
+++ b/arch/mips/pci/pci-generic.c
@@ -47,6 +47,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 	pci_read_bridge_bases(bus);
 }
 
+#ifdef pci_remap_iospace
 int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
 {
 	unsigned long vaddr;
@@ -60,3 +61,4 @@ int pci_remap_iospace(const struct resource *res, phys_addr_t phys_addr)
 	set_io_port_base(vaddr);
 	return 0;
 }
+#endif
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] MIPS: Only define pci_remap_iospace() for Ralink
  2021-12-08  9:27 [PATCH v2] MIPS: Only define pci_remap_iospace() for Ralink Tiezhu Yang
@ 2021-12-09  9:24 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-12-09  9:24 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: Sergio Paracuellos, Xuefeng Li, linux-mips, linux-kernel

On Wed, Dec 08, 2021 at 05:27:19PM +0800, Tiezhu Yang wrote:
> After commit 9f76779f2418 ("MIPS: implement architecture-specific
> 'pci_remap_iospace()'"), there exists the following warning on the
> Loongson64 platform:
> 
>     loongson-pci 1a000000.pci:       IO 0x0018020000..0x001803ffff -> 0x0000020000
>     loongson-pci 1a000000.pci:      MEM 0x0040000000..0x007fffffff -> 0x0040000000
>     ------------[ cut here ]------------
>     WARNING: CPU: 2 PID: 1 at arch/mips/pci/pci-generic.c:55 pci_remap_iospace+0x84/0x90
>     resource start address is not zero
>     ...
>     Call Trace:
>     [<ffffffff8020dc78>] show_stack+0x40/0x120
>     [<ffffffff80cf4a0c>] dump_stack_lvl+0x58/0x74
>     [<ffffffff8023a0b0>] __warn+0xe0/0x110
>     [<ffffffff80cee02c>] warn_slowpath_fmt+0xa4/0xd0
>     [<ffffffff80cecf24>] pci_remap_iospace+0x84/0x90
>     [<ffffffff807f9864>] devm_pci_remap_iospace+0x5c/0xb8
>     [<ffffffff808121b0>] devm_of_pci_bridge_init+0x178/0x1f8
>     [<ffffffff807f4000>] devm_pci_alloc_host_bridge+0x78/0x98
>     [<ffffffff80819454>] loongson_pci_probe+0x34/0x160
>     [<ffffffff809203cc>] platform_probe+0x6c/0xe0
>     [<ffffffff8091d5d4>] really_probe+0xbc/0x340
>     [<ffffffff8091d8f0>] __driver_probe_device+0x98/0x110
>     [<ffffffff8091d9b8>] driver_probe_device+0x50/0x118
>     [<ffffffff8091dea0>] __driver_attach+0x80/0x118
>     [<ffffffff8091b280>] bus_for_each_dev+0x80/0xc8
>     [<ffffffff8091c6d8>] bus_add_driver+0x130/0x210
>     [<ffffffff8091ead4>] driver_register+0x8c/0x150
>     [<ffffffff80200a8c>] do_one_initcall+0x54/0x288
>     [<ffffffff811a5320>] kernel_init_freeable+0x27c/0x2e4
>     [<ffffffff80cfc380>] kernel_init+0x2c/0x134
>     [<ffffffff80205a2c>] ret_from_kernel_thread+0x14/0x1c
>     ---[ end trace e4a0efe10aa5cce6 ]---
>     loongson-pci 1a000000.pci: error -19: failed to map resource [io  0x20000-0x3ffff]
> 
> We can see that the resource start address is 0x0000020000, because
> the ISA Bridge used the zero address which is defined in the dts file
> arch/mips/boot/dts/loongson/ls7a-pch.dtsi:
> 
>     ISA Bridge: /bus@10000000/isa@18000000
>     IO 0x0000000018000000..0x000000001801ffff  ->  0x0000000000000000
> 
> Based on the above analysis, the architecture-specific pci_remap_iospace()
> is not suitable for Loongson64, we should only define pci_remap_iospace()
> for Ralink on MIPS based on the commit background.
> 
> Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  arch/mips/include/asm/mach-ralink/spaces.h | 2 ++
>  arch/mips/include/asm/pci.h                | 4 ----
>  arch/mips/pci/pci-generic.c                | 2 ++
>  3 files changed, 4 insertions(+), 4 deletions(-)

applied to mips-fixes.

Thomas.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-09  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08  9:27 [PATCH v2] MIPS: Only define pci_remap_iospace() for Ralink Tiezhu Yang
2021-12-09  9:24 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.