[PATCH 0/2] MIPS: Loongson2ef: Use pcibios_align_resource() to block io range

Rong Zhang posted 2 patches 6 days, 8 hours ago
.../include/asm/mach-loongson2ef/loongson.h    |  6 ++++++
arch/mips/loongson2ef/common/pci.c             | 18 +++++++++++-------
arch/mips/loongson2ef/common/setup.c           |  1 +
3 files changed, 18 insertions(+), 7 deletions(-)
[PATCH 0/2] MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
Posted by Rong Zhang 6 days, 8 hours ago
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. Register PCI controller in plat_mem_setup()
instead of arch_initcall() to make it the root of other resources (e.g.,
i8259) and prevent resource conflicts. Then, make Loongson2ef PCI code
use PCIBIOS_MIN_IO too.

Rong Zhang (2):
  MIPS: Loongson2ef: Register PCI controller in early stage
  MIPS: Loongson2ef: Use pcibios_align_resource() to block io range

 .../include/asm/mach-loongson2ef/loongson.h    |  6 ++++++
 arch/mips/loongson2ef/common/pci.c             | 18 +++++++++++-------
 arch/mips/loongson2ef/common/setup.c           |  1 +
 3 files changed, 18 insertions(+), 7 deletions(-)


base-commit: ad9a728a3388dc5f66eab6b7135e0154249e9403
-- 
2.51.0
Re: [PATCH 0/2] MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
Posted by Thomas Bogendoerfer 1 day, 20 hours ago
On Sun, Feb 01, 2026 at 05:32:57AM +0800, Rong Zhang wrote:
> 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. Register PCI controller in plat_mem_setup()
> instead of arch_initcall() to make it the root of other resources (e.g.,
> i8259) and prevent resource conflicts. Then, make Loongson2ef PCI code
> use PCIBIOS_MIN_IO too.
> 
> Rong Zhang (2):
>   MIPS: Loongson2ef: Register PCI controller in early stage
>   MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
> 
>  .../include/asm/mach-loongson2ef/loongson.h    |  6 ++++++
>  arch/mips/loongson2ef/common/pci.c             | 18 +++++++++++-------
>  arch/mips/loongson2ef/common/setup.c           |  1 +
>  3 files changed, 18 insertions(+), 7 deletions(-)
> 
> 
> base-commit: ad9a728a3388dc5f66eab6b7135e0154249e9403
> -- 
> 2.51.0

series 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 ]
Re: [PATCH 0/2] MIPS: Loongson2ef: Use pcibios_align_resource() to block io range
Posted by Jiaxun Yang 6 days, 8 hours ago

On Sat, 31 Jan 2026, at 9:32 PM, Rong Zhang wrote:
> 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. Register PCI controller in plat_mem_setup()
> instead of arch_initcall() to make it the root of other resources (e.g.,
> i8259) and prevent resource conflicts. Then, make Loongson2ef PCI code
> use PCIBIOS_MIN_IO too.
>
> Rong Zhang (2):
>   MIPS: Loongson2ef: Register PCI controller in early stage
>   MIPS: Loongson2ef: Use pcibios_align_resource() to block io range

Acked-by: Jiaxun Yang <jiaxun.yang@flygoat.com>

>
>  .../include/asm/mach-loongson2ef/loongson.h    |  6 ++++++
>  arch/mips/loongson2ef/common/pci.c             | 18 +++++++++++-------
>  arch/mips/loongson2ef/common/setup.c           |  1 +
>  3 files changed, 18 insertions(+), 7 deletions(-)
>
>
> base-commit: ad9a728a3388dc5f66eab6b7135e0154249e9403
> -- 
> 2.51.0

-- 
- Jiaxun