[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260131214003.833520-3-rongrong@oss.cipunited.com>
Date: Sun, 1 Feb 2026 05:32:59 +0800
From: "Rong Zhang" <rongrong@....cipunited.com>
To: "Jiaxun Yang" <jiaxun.yang@...goat.com>,
"Thomas Bogendoerfer" <tsbogend@...ha.franken.de>
Cc: "Rong Zhang" <rongrong@....cipunited.com>, "Rong Zhang" <i@...g.moe>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
<linux-mips@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<stable@...r.kernel.org>, "Beiyan Yun" <root@...i.wang>,
"Yao Zi" <me@...ao.cc>
Subject: [PATCH 2/2] MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
Loongson2ef reserves io range below 0x4000 (LOONGSON_PCI_IO_START) while
ISA-mode only IDE controller on the south bridge still has a hard
dependency on ISA IO ports.
The reservation was done by lifting loongson_pci_io_resource.start onto
0x4000. Prior to commit ae81aad5c2e1 ("MIPS: PCI: Use
pci_enable_resources()"), the arch specific pcibios_enable_resources()
did not check if the resources were claimed, which diverges from what
PCI core checks, effectively hiding the fact that IDE IO resources were
not properly within the resource tree. After starting to use
pcibios_enable_resources() from PCI core, enabling IDE controller fails:
pata_cs5536 0000:00:0e.2: BAR 0 [io 0x01f0-0x01f7]: not claimed; can't enable device
pata_cs5536 0000:00:0e.2: probe with driver pata_cs5536 failed with error -22
MIPS PCI code already has support for enforcing lower bounds using
PCIBIOS_MIN_IO in pcibios_align_resource() without altering the IO
window start address itself. Make Loongson2ef PCI code use
PCIBIOS_MIN_IO too.
Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
Cc: stable@...r.kernel.org
Tested-by: Beiyan Yun <root@...i.wang>
Tested-by: Yao Zi <me@...ao.cc>
Signed-off-by: Rong Zhang <rongrong@....cipunited.com>
---
arch/mips/loongson2ef/common/pci.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/mips/loongson2ef/common/pci.c b/arch/mips/loongson2ef/common/pci.c
index 55524f9a7b96b..0f11392104bfd 100644
--- a/arch/mips/loongson2ef/common/pci.c
+++ b/arch/mips/loongson2ef/common/pci.c
@@ -17,7 +17,7 @@ static struct resource loongson_pci_mem_resource = {
static struct resource loongson_pci_io_resource = {
.name = "pci io space",
- .start = LOONGSON_PCI_IO_START,
+ .start = 0x00000000UL, /* See loongson2ef_pcibios_init(). */
.end = IO_SPACE_LIMIT,
.flags = IORESOURCE_IO,
};
@@ -77,6 +77,15 @@ void __init loongson2ef_pcibios_init(void)
{
setup_pcimap();
+ /*
+ * ISA-mode only IDE controllers have a hard dependency on ISA IO ports.
+ *
+ * Claim them by setting PCI IO space to start at 0x00000000, and set
+ * PCIBIOS_MIN_IO to prevent non-legacy PCI devices from touching
+ * reserved regions.
+ */
+ PCIBIOS_MIN_IO = LOONGSON_PCI_IO_START;
+
loongson_pci_controller.io_map_base = mips_io_port_base;
register_pci_controller(&loongson_pci_controller);
}
--
2.51.0
Powered by blists - more mailing lists