[PATCH 2/2] MIPS: Malta: Fix PCI southbridge legacy resource reservations

Maciej W. Rozycki posted 2 patches 20 hours ago
[PATCH 2/2] MIPS: Malta: Fix PCI southbridge legacy resource reservations
Posted by Maciej W. Rozycki 20 hours ago
Covering the PCI southbridge legacy port I/O range with a northbridge 
resource reservation prevents MIPS Malta platform code from claiming its 
standard legacy resources.  This is because request_resource() calls 
cause a clash with the previous reservation and consequently fail.

Change to using insert_resource() so as to prevent the clash, switching 
the legacy reservations from:

00000000-00ffffff : MSC PCI I/O
  00000020-00000021 : pic1
  00000070-00000077 : rtc0
  000000a0-000000a1 : pic2
  [...]

to:

00000000-00ffffff : MSC PCI I/O
  00000000-0000001f : dma1
  00000020-00000021 : pic1
  00000040-0000005f : timer
  00000060-0000006f : keyboard
  00000070-00000077 : rtc0
  00000080-0000008f : dma page reg
  000000a0-000000a1 : pic2
  000000c0-000000df : dma2
  [...]

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
Cc: stable@vger.kernel.org # v6.18+
---
 arch/mips/mti-malta/malta-setup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

linux-mips-malta-setup-insert-resource.diff
Index: linux-macro/arch/mips/mti-malta/malta-setup.c
===================================================================
--- linux-macro.orig/arch/mips/mti-malta/malta-setup.c
+++ linux-macro/arch/mips/mti-malta/malta-setup.c
@@ -213,7 +213,7 @@ void __init plat_mem_setup(void)
 
 	/* Request I/O space for devices used on the Malta board. */
 	for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
-		request_resource(&ioport_resource, standard_io_resources+i);
+		insert_resource(&ioport_resource, standard_io_resources + i);
 
 	/*
 	 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
Re: [PATCH 2/2] MIPS: Malta: Fix PCI southbridge legacy resource reservations
Posted by Jonas Gorski 4 hours ago
Hi,

On Tue, Oct 21, 2025 at 9:38 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> Covering the PCI southbridge legacy port I/O range with a northbridge
> resource reservation prevents MIPS Malta platform code from claiming its
> standard legacy resources.  This is because request_resource() calls
> cause a clash with the previous reservation and consequently fail.
>
> Change to using insert_resource() so as to prevent the clash, switching
> the legacy reservations from:
>
> 00000000-00ffffff : MSC PCI I/O
>   00000020-00000021 : pic1
>   00000070-00000077 : rtc0
>   000000a0-000000a1 : pic2
>   [...]
>
> to:
>
> 00000000-00ffffff : MSC PCI I/O
>   00000000-0000001f : dma1
>   00000020-00000021 : pic1
>   00000040-0000005f : timer
>   00000060-0000006f : keyboard
>   00000070-00000077 : rtc0
>   00000080-0000008f : dma page reg
>   000000a0-000000a1 : pic2
>   000000c0-000000df : dma2
>   [...]
>
> Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
> Cc: stable@vger.kernel.org # v6.18+
> ---
>  arch/mips/mti-malta/malta-setup.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> linux-mips-malta-setup-insert-resource.diff
> Index: linux-macro/arch/mips/mti-malta/malta-setup.c
> ===================================================================
> --- linux-macro.orig/arch/mips/mti-malta/malta-setup.c
> +++ linux-macro/arch/mips/mti-malta/malta-setup.c
> @@ -213,7 +213,7 @@ void __init plat_mem_setup(void)
>
>         /* Request I/O space for devices used on the Malta board. */

This comment doesn't match the code anymore.

>         for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
> -               request_resource(&ioport_resource, standard_io_resources+i);
> +               insert_resource(&ioport_resource, standard_io_resources + i);
>
>         /*
>          * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.
>

Best regards,
Jonas
Re: [PATCH 2/2] MIPS: Malta: Fix PCI southbridge legacy resource reservations
Posted by Maciej W. Rozycki 3 hours ago
On Wed, 22 Oct 2025, Jonas Gorski wrote:

> > Index: linux-macro/arch/mips/mti-malta/malta-setup.c
> > ===================================================================
> > --- linux-macro.orig/arch/mips/mti-malta/malta-setup.c
> > +++ linux-macro/arch/mips/mti-malta/malta-setup.c
> > @@ -213,7 +213,7 @@ void __init plat_mem_setup(void)
> >
> >         /* Request I/O space for devices used on the Malta board. */
> 
> This comment doesn't match the code anymore.

 Thank you for your input.  How do you propose to reword the comment then?  
The resources are still claimed, it's only the way that has changed.  Is 
s/Request/Claim/ what you're after?

  Maciej
Re: [PATCH 2/2] MIPS: Malta: Fix PCI southbridge legacy resource reservations
Posted by Thomas Bogendoerfer 20 hours ago
On Tue, Oct 21, 2025 at 08:38:29PM +0100, Maciej W. Rozycki wrote:
> Covering the PCI southbridge legacy port I/O range with a northbridge 
> resource reservation prevents MIPS Malta platform code from claiming its 
> standard legacy resources.  This is because request_resource() calls 
> cause a clash with the previous reservation and consequently fail.
> 
> Change to using insert_resource() so as to prevent the clash, switching 
> the legacy reservations from:
> 
> 00000000-00ffffff : MSC PCI I/O
>   00000020-00000021 : pic1
>   00000070-00000077 : rtc0
>   000000a0-000000a1 : pic2
>   [...]
> 
> to:
> 
> 00000000-00ffffff : MSC PCI I/O
>   00000000-0000001f : dma1
>   00000020-00000021 : pic1
>   00000040-0000005f : timer
>   00000060-0000006f : keyboard
>   00000070-00000077 : rtc0
>   00000080-0000008f : dma page reg
>   000000a0-000000a1 : pic2
>   000000c0-000000df : dma2
>   [...]
> 
> Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Fixes: ae81aad5c2e1 ("MIPS: PCI: Use pci_enable_resources()")
> Cc: stable@vger.kernel.org # v6.18+
> ---
>  arch/mips/mti-malta/malta-setup.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> linux-mips-malta-setup-insert-resource.diff
> Index: linux-macro/arch/mips/mti-malta/malta-setup.c
> ===================================================================
> --- linux-macro.orig/arch/mips/mti-malta/malta-setup.c
> +++ linux-macro/arch/mips/mti-malta/malta-setup.c
> @@ -213,7 +213,7 @@ void __init plat_mem_setup(void)
>  
>  	/* Request I/O space for devices used on the Malta board. */
>  	for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
> -		request_resource(&ioport_resource, standard_io_resources+i);
> +		insert_resource(&ioport_resource, standard_io_resources + i);
>  
>  	/*
>  	 * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge.

Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

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