linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
@ 2022-08-17 16:39 Pali Rohár
  2022-08-17 16:39 ` [PATCH 2/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Pali Rohár @ 2022-08-17 16:39 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

Creating or filling pci-OF-bus-map property in the device-tree is
deprecated since May 2006 [1]. Allow to disable filling this property by
unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
and powermac code.

Disabling of pci-OF-bus-map property allows to enable new option
CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.

[1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/Kconfig         | 12 +++++++++++-
 arch/powerpc/kernel/pci_32.c |  6 ++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5881441f7672..df2696c406ad 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -373,9 +373,19 @@ config PPC_DCR
 	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
 	default y
 
+config PPC_PCI_OF_BUS_MAP_FILL
+	bool "Fill pci-OF-bus-map property in the device-tree"
+	depends on PPC32
+	depends on PPC_PMAC || PPC_CHRP
+	default y
+	help
+	  This option creates and fills pci-OF-bus-map property in the
+	  device-tree which is deprecated and is needed only for old
+	  platforms.
+
 config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
 	depends on PPC32
-	depends on !PPC_PMAC && !PPC_CHRP
+	depends on !PPC_PCI_OF_BUS_MAP_FILL
 	bool "Assign PCI bus numbers from zero individually for each PCI domain"
 	help
 	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 433965bf37b4..ffc4e1928c80 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
 
 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
 
+#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
+
 static u8* pci_to_OF_bus_map;
 static int pci_bus_count;
 
@@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
 }
 #endif
 
+#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
+
 #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
 
 void pcibios_setup_phb_io_space(struct pci_controller *hose)
@@ -264,6 +268,7 @@ static int __init pcibios_init(void)
 	}
 
 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
+#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
 	pci_bus_count = next_busno;
 
 	/* OpenFirmware based machines need a map of OF bus
@@ -272,6 +277,7 @@ static int __init pcibios_init(void)
 	 */
 	if (pci_assign_all_buses)
 		pcibios_make_OF_bus_map();
+#endif
 #endif
 
 	/* Call common code to handle resource allocation */
-- 
2.20.1


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

* [PATCH 2/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
  2022-08-17 16:39 [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
@ 2022-08-17 16:39 ` Pali Rohár
  2022-10-09 11:25 ` [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
  2023-01-28 13:34 ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
  2 siblings, 0 replies; 12+ messages in thread
From: Pali Rohár @ 2022-08-17 16:39 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

It makes sense to enable CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
(when possible by dependencies) to take advantages of all 256 PCI buses on
each PCI domain, like it is already on all other kernel architectures.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index df2696c406ad..0905e4807815 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -387,6 +387,7 @@ config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
 	depends on PPC32
 	depends on !PPC_PCI_OF_BUS_MAP_FILL
 	bool "Assign PCI bus numbers from zero individually for each PCI domain"
+	default y
 	help
 	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
 	  So system could have only 256 PCI buses independently of available
-- 
2.20.1


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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2022-08-17 16:39 [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
  2022-08-17 16:39 ` [PATCH 2/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
@ 2022-10-09 11:25 ` Pali Rohár
  2022-11-01 22:26   ` Pali Rohár
  2023-01-28 13:34 ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
  2 siblings, 1 reply; 12+ messages in thread
From: Pali Rohár @ 2022-10-09 11:25 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

Hello! Any comments on this? It would be nice to take these two patches
(or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
by default where possible.

Per following comment there can be an issue with early powermac so seems
that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/

On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> Creating or filling pci-OF-bus-map property in the device-tree is
> deprecated since May 2006 [1]. Allow to disable filling this property by
> unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> and powermac code.
> 
> Disabling of pci-OF-bus-map property allows to enable new option
> CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> 
> [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  arch/powerpc/Kconfig         | 12 +++++++++++-
>  arch/powerpc/kernel/pci_32.c |  6 ++++++
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 5881441f7672..df2696c406ad 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -373,9 +373,19 @@ config PPC_DCR
>  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
>  	default y
>  
> +config PPC_PCI_OF_BUS_MAP_FILL
> +	bool "Fill pci-OF-bus-map property in the device-tree"
> +	depends on PPC32
> +	depends on PPC_PMAC || PPC_CHRP
> +	default y
> +	help
> +	  This option creates and fills pci-OF-bus-map property in the
> +	  device-tree which is deprecated and is needed only for old
> +	  platforms.
> +
>  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
>  	depends on PPC32
> -	depends on !PPC_PMAC && !PPC_CHRP
> +	depends on !PPC_PCI_OF_BUS_MAP_FILL
>  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
>  	help
>  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> index 433965bf37b4..ffc4e1928c80 100644
> --- a/arch/powerpc/kernel/pci_32.c
> +++ b/arch/powerpc/kernel/pci_32.c
> @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
>  
>  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
>  
> +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> +
>  static u8* pci_to_OF_bus_map;
>  static int pci_bus_count;
>  
> @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
>  }
>  #endif
>  
> +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> +
>  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
>  
>  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
>  	}
>  
>  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
>  	pci_bus_count = next_busno;
>  
>  	/* OpenFirmware based machines need a map of OF bus
> @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
>  	 */
>  	if (pci_assign_all_buses)
>  		pcibios_make_OF_bus_map();
> +#endif
>  #endif
>  
>  	/* Call common code to handle resource allocation */
> -- 
> 2.20.1
> 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2022-10-09 11:25 ` [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
@ 2022-11-01 22:26   ` Pali Rohár
  2022-11-26 16:23     ` Pali Rohár
  0 siblings, 1 reply; 12+ messages in thread
From: Pali Rohár @ 2022-11-01 22:26 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

Hello! Gentle reminder...

On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
> Hello! Any comments on this? It would be nice to take these two patches
> (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> by default where possible.
> 
> Per following comment there can be an issue with early powermac so seems
> that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
> implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
> https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
> 
> On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> > Creating or filling pci-OF-bus-map property in the device-tree is
> > deprecated since May 2006 [1]. Allow to disable filling this property by
> > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> > and powermac code.
> > 
> > Disabling of pci-OF-bus-map property allows to enable new option
> > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> > 
> > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> > 
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> >  arch/powerpc/Kconfig         | 12 +++++++++++-
> >  arch/powerpc/kernel/pci_32.c |  6 ++++++
> >  2 files changed, 17 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 5881441f7672..df2696c406ad 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -373,9 +373,19 @@ config PPC_DCR
> >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
> >  	default y
> >  
> > +config PPC_PCI_OF_BUS_MAP_FILL
> > +	bool "Fill pci-OF-bus-map property in the device-tree"
> > +	depends on PPC32
> > +	depends on PPC_PMAC || PPC_CHRP
> > +	default y
> > +	help
> > +	  This option creates and fills pci-OF-bus-map property in the
> > +	  device-tree which is deprecated and is needed only for old
> > +	  platforms.
> > +
> >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> >  	depends on PPC32
> > -	depends on !PPC_PMAC && !PPC_CHRP
> > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
> >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
> >  	help
> >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> > index 433965bf37b4..ffc4e1928c80 100644
> > --- a/arch/powerpc/kernel/pci_32.c
> > +++ b/arch/powerpc/kernel/pci_32.c
> > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
> >  
> >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> >  
> > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > +
> >  static u8* pci_to_OF_bus_map;
> >  static int pci_bus_count;
> >  
> > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
> >  }
> >  #endif
> >  
> > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> > +
> >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
> >  
> >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
> >  	}
> >  
> >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> >  	pci_bus_count = next_busno;
> >  
> >  	/* OpenFirmware based machines need a map of OF bus
> > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
> >  	 */
> >  	if (pci_assign_all_buses)
> >  		pcibios_make_OF_bus_map();
> > +#endif
> >  #endif
> >  
> >  	/* Call common code to handle resource allocation */
> > -- 
> > 2.20.1
> > 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2022-11-01 22:26   ` Pali Rohár
@ 2022-11-26 16:23     ` Pali Rohár
  2022-12-16 18:12       ` Pali Rohár
  0 siblings, 1 reply; 12+ messages in thread
From: Pali Rohár @ 2022-11-26 16:23 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

PING?

On Tuesday 01 November 2022 23:26:03 Pali Rohár wrote:
> Hello! Gentle reminder...
> 
> On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
> > Hello! Any comments on this? It would be nice to take these two patches
> > (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > by default where possible.
> > 
> > Per following comment there can be an issue with early powermac so seems
> > that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
> > implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
> > https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
> > 
> > On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> > > Creating or filling pci-OF-bus-map property in the device-tree is
> > > deprecated since May 2006 [1]. Allow to disable filling this property by
> > > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> > > and powermac code.
> > > 
> > > Disabling of pci-OF-bus-map property allows to enable new option
> > > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> > > 
> > > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> > > 
> > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > ---
> > >  arch/powerpc/Kconfig         | 12 +++++++++++-
> > >  arch/powerpc/kernel/pci_32.c |  6 ++++++
> > >  2 files changed, 17 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > > index 5881441f7672..df2696c406ad 100644
> > > --- a/arch/powerpc/Kconfig
> > > +++ b/arch/powerpc/Kconfig
> > > @@ -373,9 +373,19 @@ config PPC_DCR
> > >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
> > >  	default y
> > >  
> > > +config PPC_PCI_OF_BUS_MAP_FILL
> > > +	bool "Fill pci-OF-bus-map property in the device-tree"
> > > +	depends on PPC32
> > > +	depends on PPC_PMAC || PPC_CHRP
> > > +	default y
> > > +	help
> > > +	  This option creates and fills pci-OF-bus-map property in the
> > > +	  device-tree which is deprecated and is needed only for old
> > > +	  platforms.
> > > +
> > >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > >  	depends on PPC32
> > > -	depends on !PPC_PMAC && !PPC_CHRP
> > > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
> > >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
> > >  	help
> > >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> > > index 433965bf37b4..ffc4e1928c80 100644
> > > --- a/arch/powerpc/kernel/pci_32.c
> > > +++ b/arch/powerpc/kernel/pci_32.c
> > > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
> > >  
> > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > >  
> > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > > +
> > >  static u8* pci_to_OF_bus_map;
> > >  static int pci_bus_count;
> > >  
> > > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
> > >  }
> > >  #endif
> > >  
> > > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> > > +
> > >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
> > >  
> > >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> > > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
> > >  	}
> > >  
> > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > >  	pci_bus_count = next_busno;
> > >  
> > >  	/* OpenFirmware based machines need a map of OF bus
> > > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
> > >  	 */
> > >  	if (pci_assign_all_buses)
> > >  		pcibios_make_OF_bus_map();
> > > +#endif
> > >  #endif
> > >  
> > >  	/* Call common code to handle resource allocation */
> > > -- 
> > > 2.20.1
> > > 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2022-11-26 16:23     ` Pali Rohár
@ 2022-12-16 18:12       ` Pali Rohár
  2023-01-22 11:21         ` Pali Rohár
  0 siblings, 1 reply; 12+ messages in thread
From: Pali Rohár @ 2022-12-16 18:12 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

PING?

On Saturday 26 November 2022 17:23:45 Pali Rohár wrote:
> PING?
> 
> On Tuesday 01 November 2022 23:26:03 Pali Rohár wrote:
> > Hello! Gentle reminder...
> > 
> > On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
> > > Hello! Any comments on this? It would be nice to take these two patches
> > > (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > > by default where possible.
> > > 
> > > Per following comment there can be an issue with early powermac so seems
> > > that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
> > > implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
> > > https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
> > > 
> > > On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> > > > Creating or filling pci-OF-bus-map property in the device-tree is
> > > > deprecated since May 2006 [1]. Allow to disable filling this property by
> > > > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> > > > and powermac code.
> > > > 
> > > > Disabling of pci-OF-bus-map property allows to enable new option
> > > > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> > > > 
> > > > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> > > > 
> > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > ---
> > > >  arch/powerpc/Kconfig         | 12 +++++++++++-
> > > >  arch/powerpc/kernel/pci_32.c |  6 ++++++
> > > >  2 files changed, 17 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > > > index 5881441f7672..df2696c406ad 100644
> > > > --- a/arch/powerpc/Kconfig
> > > > +++ b/arch/powerpc/Kconfig
> > > > @@ -373,9 +373,19 @@ config PPC_DCR
> > > >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
> > > >  	default y
> > > >  
> > > > +config PPC_PCI_OF_BUS_MAP_FILL
> > > > +	bool "Fill pci-OF-bus-map property in the device-tree"
> > > > +	depends on PPC32
> > > > +	depends on PPC_PMAC || PPC_CHRP
> > > > +	default y
> > > > +	help
> > > > +	  This option creates and fills pci-OF-bus-map property in the
> > > > +	  device-tree which is deprecated and is needed only for old
> > > > +	  platforms.
> > > > +
> > > >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > > >  	depends on PPC32
> > > > -	depends on !PPC_PMAC && !PPC_CHRP
> > > > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
> > > >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
> > > >  	help
> > > >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> > > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> > > > index 433965bf37b4..ffc4e1928c80 100644
> > > > --- a/arch/powerpc/kernel/pci_32.c
> > > > +++ b/arch/powerpc/kernel/pci_32.c
> > > > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
> > > >  
> > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > > >  
> > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > > > +
> > > >  static u8* pci_to_OF_bus_map;
> > > >  static int pci_bus_count;
> > > >  
> > > > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
> > > >  }
> > > >  #endif
> > > >  
> > > > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> > > > +
> > > >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
> > > >  
> > > >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> > > > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
> > > >  	}
> > > >  
> > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > > >  	pci_bus_count = next_busno;
> > > >  
> > > >  	/* OpenFirmware based machines need a map of OF bus
> > > > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
> > > >  	 */
> > > >  	if (pci_assign_all_buses)
> > > >  		pcibios_make_OF_bus_map();
> > > > +#endif
> > > >  #endif
> > > >  
> > > >  	/* Call common code to handle resource allocation */
> > > > -- 
> > > > 2.20.1
> > > > 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2022-12-16 18:12       ` Pali Rohár
@ 2023-01-22 11:21         ` Pali Rohár
  2023-01-26 10:59           ` Michael Ellerman
  0 siblings, 1 reply; 12+ messages in thread
From: Pali Rohár @ 2023-01-22 11:21 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

PING? It is more than 5 months since this patch series is there and it
still has not received any comment.

On Friday 16 December 2022 19:12:06 Pali Rohár wrote:
> PING?
> 
> On Saturday 26 November 2022 17:23:45 Pali Rohár wrote:
> > PING?
> > 
> > On Tuesday 01 November 2022 23:26:03 Pali Rohár wrote:
> > > Hello! Gentle reminder...
> > > 
> > > On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
> > > > Hello! Any comments on this? It would be nice to take these two patches
> > > > (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > > > by default where possible.
> > > > 
> > > > Per following comment there can be an issue with early powermac so seems
> > > > that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
> > > > implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
> > > > https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
> > > > 
> > > > On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> > > > > Creating or filling pci-OF-bus-map property in the device-tree is
> > > > > deprecated since May 2006 [1]. Allow to disable filling this property by
> > > > > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> > > > > and powermac code.
> > > > > 
> > > > > Disabling of pci-OF-bus-map property allows to enable new option
> > > > > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> > > > > 
> > > > > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> > > > > 
> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> > > > > ---
> > > > >  arch/powerpc/Kconfig         | 12 +++++++++++-
> > > > >  arch/powerpc/kernel/pci_32.c |  6 ++++++
> > > > >  2 files changed, 17 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > > > > index 5881441f7672..df2696c406ad 100644
> > > > > --- a/arch/powerpc/Kconfig
> > > > > +++ b/arch/powerpc/Kconfig
> > > > > @@ -373,9 +373,19 @@ config PPC_DCR
> > > > >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
> > > > >  	default y
> > > > >  
> > > > > +config PPC_PCI_OF_BUS_MAP_FILL
> > > > > +	bool "Fill pci-OF-bus-map property in the device-tree"
> > > > > +	depends on PPC32
> > > > > +	depends on PPC_PMAC || PPC_CHRP
> > > > > +	default y
> > > > > +	help
> > > > > +	  This option creates and fills pci-OF-bus-map property in the
> > > > > +	  device-tree which is deprecated and is needed only for old
> > > > > +	  platforms.
> > > > > +
> > > > >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> > > > >  	depends on PPC32
> > > > > -	depends on !PPC_PMAC && !PPC_CHRP
> > > > > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
> > > > >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
> > > > >  	help
> > > > >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> > > > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> > > > > index 433965bf37b4..ffc4e1928c80 100644
> > > > > --- a/arch/powerpc/kernel/pci_32.c
> > > > > +++ b/arch/powerpc/kernel/pci_32.c
> > > > > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
> > > > >  
> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > > > >  
> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > > > > +
> > > > >  static u8* pci_to_OF_bus_map;
> > > > >  static int pci_bus_count;
> > > > >  
> > > > > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
> > > > >  }
> > > > >  #endif
> > > > >  
> > > > > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> > > > > +
> > > > >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
> > > > >  
> > > > >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> > > > > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
> > > > >  	}
> > > > >  
> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> > > > >  	pci_bus_count = next_busno;
> > > > >  
> > > > >  	/* OpenFirmware based machines need a map of OF bus
> > > > > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
> > > > >  	 */
> > > > >  	if (pci_assign_all_buses)
> > > > >  		pcibios_make_OF_bus_map();
> > > > > +#endif
> > > > >  #endif
> > > > >  
> > > > >  	/* Call common code to handle resource allocation */
> > > > > -- 
> > > > > 2.20.1
> > > > > 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2023-01-22 11:21         ` Pali Rohár
@ 2023-01-26 10:59           ` Michael Ellerman
  2023-01-28 13:23             ` Pali Rohár
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Ellerman @ 2023-01-26 10:59 UTC (permalink / raw)
  To: Pali Rohár, Benjamin Herrenschmidt, Paul Mackerras
  Cc: linuxppc-dev, linux-kernel

Pali Rohár <pali@kernel.org> writes:
> PING? It is more than 5 months since this patch series is there and it
> still has not received any comment.

There was some related discussion in another thread.

I planned to pick it up last merge window, but it breaks the
pmac32_defconfig build when CONFIG_PPC_PCI_OF_BUS_MAP_FILL=n:

  ld: arch/powerpc/platforms/powermac/feature.o: in function `core99_ata100_enable':
  feature.c:(.text+0xcd0): undefined reference to `pci_device_from_OF_node'
  ld: arch/powerpc/platforms/powermac/pci.o: in function `pmac_pci_init':
  pci.c:(.init.text+0x5d4): undefined reference to `pci_device_from_OF_node'
  ld: pci.c:(.init.text+0x660): undefined reference to `pci_device_from_OF_node'

So I dropped it, and haven't had time to work out a fix.

cheers

> On Friday 16 December 2022 19:12:06 Pali Rohár wrote:
>> PING?
>> 
>> On Saturday 26 November 2022 17:23:45 Pali Rohár wrote:
>> > PING?
>> > 
>> > On Tuesday 01 November 2022 23:26:03 Pali Rohár wrote:
>> > > Hello! Gentle reminder...
>> > > 
>> > > On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
>> > > > Hello! Any comments on this? It would be nice to take these two patches
>> > > > (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
>> > > > by default where possible.
>> > > > 
>> > > > Per following comment there can be an issue with early powermac so seems
>> > > > that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
>> > > > implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
>> > > > https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
>> > > > 
>> > > > On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
>> > > > > Creating or filling pci-OF-bus-map property in the device-tree is
>> > > > > deprecated since May 2006 [1]. Allow to disable filling this property by
>> > > > > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
>> > > > > and powermac code.
>> > > > > 
>> > > > > Disabling of pci-OF-bus-map property allows to enable new option
>> > > > > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
>> > > > > 
>> > > > > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
>> > > > > 
>> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
>> > > > > ---
>> > > > >  arch/powerpc/Kconfig         | 12 +++++++++++-
>> > > > >  arch/powerpc/kernel/pci_32.c |  6 ++++++
>> > > > >  2 files changed, 17 insertions(+), 1 deletion(-)
>> > > > > 
>> > > > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> > > > > index 5881441f7672..df2696c406ad 100644
>> > > > > --- a/arch/powerpc/Kconfig
>> > > > > +++ b/arch/powerpc/Kconfig
>> > > > > @@ -373,9 +373,19 @@ config PPC_DCR
>> > > > >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
>> > > > >  	default y
>> > > > >  
>> > > > > +config PPC_PCI_OF_BUS_MAP_FILL
>> > > > > +	bool "Fill pci-OF-bus-map property in the device-tree"
>> > > > > +	depends on PPC32
>> > > > > +	depends on PPC_PMAC || PPC_CHRP
>> > > > > +	default y
>> > > > > +	help
>> > > > > +	  This option creates and fills pci-OF-bus-map property in the
>> > > > > +	  device-tree which is deprecated and is needed only for old
>> > > > > +	  platforms.
>> > > > > +
>> > > > >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
>> > > > >  	depends on PPC32
>> > > > > -	depends on !PPC_PMAC && !PPC_CHRP
>> > > > > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
>> > > > >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
>> > > > >  	help
>> > > > >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
>> > > > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
>> > > > > index 433965bf37b4..ffc4e1928c80 100644
>> > > > > --- a/arch/powerpc/kernel/pci_32.c
>> > > > > +++ b/arch/powerpc/kernel/pci_32.c
>> > > > > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
>> > > > >  
>> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
>> > > > >  
>> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
>> > > > > +
>> > > > >  static u8* pci_to_OF_bus_map;
>> > > > >  static int pci_bus_count;
>> > > > >  
>> > > > > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
>> > > > >  }
>> > > > >  #endif
>> > > > >  
>> > > > > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
>> > > > > +
>> > > > >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
>> > > > >  
>> > > > >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
>> > > > > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
>> > > > >  	}
>> > > > >  
>> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
>> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
>> > > > >  	pci_bus_count = next_busno;
>> > > > >  
>> > > > >  	/* OpenFirmware based machines need a map of OF bus
>> > > > > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
>> > > > >  	 */
>> > > > >  	if (pci_assign_all_buses)
>> > > > >  		pcibios_make_OF_bus_map();
>> > > > > +#endif
>> > > > >  #endif
>> > > > >  
>> > > > >  	/* Call common code to handle resource allocation */
>> > > > > -- 
>> > > > > 2.20.1
>> > > > > 

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

* Re: [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2023-01-26 10:59           ` Michael Ellerman
@ 2023-01-28 13:23             ` Pali Rohár
  0 siblings, 0 replies; 12+ messages in thread
From: Pali Rohár @ 2023-01-28 13:23 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel

On Thursday 26 January 2023 21:59:43 Michael Ellerman wrote:
> Pali Rohár <pali@kernel.org> writes:
> > PING? It is more than 5 months since this patch series is there and it
> > still has not received any comment.
> 
> There was some related discussion in another thread.
> 
> I planned to pick it up last merge window, but it breaks the
> pmac32_defconfig build when CONFIG_PPC_PCI_OF_BUS_MAP_FILL=n:
> 
>   ld: arch/powerpc/platforms/powermac/feature.o: in function `core99_ata100_enable':
>   feature.c:(.text+0xcd0): undefined reference to `pci_device_from_OF_node'
>   ld: arch/powerpc/platforms/powermac/pci.o: in function `pmac_pci_init':
>   pci.c:(.init.text+0x5d4): undefined reference to `pci_device_from_OF_node'
>   ld: pci.c:(.init.text+0x660): undefined reference to `pci_device_from_OF_node'
> 
> So I dropped it, and haven't had time to work out a fix.

I think I see where is the issue. Function pci_device_from_OF_node()
needs to be always provided. I will send fix for this in v2.

> cheers
> 
> > On Friday 16 December 2022 19:12:06 Pali Rohár wrote:
> >> PING?
> >> 
> >> On Saturday 26 November 2022 17:23:45 Pali Rohár wrote:
> >> > PING?
> >> > 
> >> > On Tuesday 01 November 2022 23:26:03 Pali Rohár wrote:
> >> > > Hello! Gentle reminder...
> >> > > 
> >> > > On Sunday 09 October 2022 13:25:55 Pali Rohár wrote:
> >> > > > Hello! Any comments on this? It would be nice to take these two patches
> >> > > > (or at least patch 2) to finally enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> >> > > > by default where possible.
> >> > > > 
> >> > > > Per following comment there can be an issue with early powermac so seems
> >> > > > that PPC_PCI_OF_BUS_MAP_FILL still has to be by default enabled (which
> >> > > > implies that PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT is disabled) on powermac:
> >> > > > https://lore.kernel.org/linuxppc-dev/575f239205e8635add81c9f902b7d9db7beb83ea.camel@kernel.crashing.org/
> >> > > > 
> >> > > > On Wednesday 17 August 2022 18:39:26 Pali Rohár wrote:
> >> > > > > Creating or filling pci-OF-bus-map property in the device-tree is
> >> > > > > deprecated since May 2006 [1]. Allow to disable filling this property by
> >> > > > > unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
> >> > > > > and powermac code.
> >> > > > > 
> >> > > > > Disabling of pci-OF-bus-map property allows to enable new option
> >> > > > > CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.
> >> > > > > 
> >> > > > > [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/
> >> > > > > 
> >> > > > > Signed-off-by: Pali Rohár <pali@kernel.org>
> >> > > > > ---
> >> > > > >  arch/powerpc/Kconfig         | 12 +++++++++++-
> >> > > > >  arch/powerpc/kernel/pci_32.c |  6 ++++++
> >> > > > >  2 files changed, 17 insertions(+), 1 deletion(-)
> >> > > > > 
> >> > > > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> >> > > > > index 5881441f7672..df2696c406ad 100644
> >> > > > > --- a/arch/powerpc/Kconfig
> >> > > > > +++ b/arch/powerpc/Kconfig
> >> > > > > @@ -373,9 +373,19 @@ config PPC_DCR
> >> > > > >  	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
> >> > > > >  	default y
> >> > > > >  
> >> > > > > +config PPC_PCI_OF_BUS_MAP_FILL
> >> > > > > +	bool "Fill pci-OF-bus-map property in the device-tree"
> >> > > > > +	depends on PPC32
> >> > > > > +	depends on PPC_PMAC || PPC_CHRP
> >> > > > > +	default y
> >> > > > > +	help
> >> > > > > +	  This option creates and fills pci-OF-bus-map property in the
> >> > > > > +	  device-tree which is deprecated and is needed only for old
> >> > > > > +	  platforms.
> >> > > > > +
> >> > > > >  config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
> >> > > > >  	depends on PPC32
> >> > > > > -	depends on !PPC_PMAC && !PPC_CHRP
> >> > > > > +	depends on !PPC_PCI_OF_BUS_MAP_FILL
> >> > > > >  	bool "Assign PCI bus numbers from zero individually for each PCI domain"
> >> > > > >  	help
> >> > > > >  	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
> >> > > > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
> >> > > > > index 433965bf37b4..ffc4e1928c80 100644
> >> > > > > --- a/arch/powerpc/kernel/pci_32.c
> >> > > > > +++ b/arch/powerpc/kernel/pci_32.c
> >> > > > > @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
> >> > > > >  
> >> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> >> > > > >  
> >> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> >> > > > > +
> >> > > > >  static u8* pci_to_OF_bus_map;
> >> > > > >  static int pci_bus_count;
> >> > > > >  
> >> > > > > @@ -223,6 +225,8 @@ pci_create_OF_bus_map(void)
> >> > > > >  }
> >> > > > >  #endif
> >> > > > >  
> >> > > > > +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
> >> > > > > +
> >> > > > >  #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
> >> > > > >  
> >> > > > >  void pcibios_setup_phb_io_space(struct pci_controller *hose)
> >> > > > > @@ -264,6 +268,7 @@ static int __init pcibios_init(void)
> >> > > > >  	}
> >> > > > >  
> >> > > > >  #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
> >> > > > > +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
> >> > > > >  	pci_bus_count = next_busno;
> >> > > > >  
> >> > > > >  	/* OpenFirmware based machines need a map of OF bus
> >> > > > > @@ -272,6 +277,7 @@ static int __init pcibios_init(void)
> >> > > > >  	 */
> >> > > > >  	if (pci_assign_all_buses)
> >> > > > >  		pcibios_make_OF_bus_map();
> >> > > > > +#endif
> >> > > > >  #endif
> >> > > > >  
> >> > > > >  	/* Call common code to handle resource allocation */
> >> > > > > -- 
> >> > > > > 2.20.1
> >> > > > > 

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

* [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
  2022-08-17 16:39 [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
  2022-08-17 16:39 ` [PATCH 2/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
  2022-10-09 11:25 ` [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
@ 2023-01-28 13:34 ` Pali Rohár
  2023-01-28 13:34   ` [PATCH v2 2/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
  2023-02-15 12:40   ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Michael Ellerman
  2 siblings, 2 replies; 12+ messages in thread
From: Pali Rohár @ 2023-01-28 13:34 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy
  Cc: linuxppc-dev, linux-kernel

It makes sense to enable CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
(when possible by dependencies) to take advantages of all 256 PCI buses on
each PCI domain, like it is already on all other kernel architectures.

Fixes: 566356813082 ("powerpc/pci: Add config option for using all 256 PCI buses")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index b8c4ac56bddc..fad25aa602c8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -392,6 +392,7 @@ config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
 	depends on PPC32
 	depends on !PPC_PMAC && !PPC_CHRP
 	bool "Assign PCI bus numbers from zero individually for each PCI domain"
+	default y
 	help
 	  By default on PPC32 were PCI bus numbers unique across all PCI domains.
 	  So system could have only 256 PCI buses independently of available
-- 
2.20.1


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

* [PATCH v2 2/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map
  2023-01-28 13:34 ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
@ 2023-01-28 13:34   ` Pali Rohár
  2023-02-15 12:40   ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Michael Ellerman
  1 sibling, 0 replies; 12+ messages in thread
From: Pali Rohár @ 2023-01-28 13:34 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy
  Cc: linuxppc-dev, linux-kernel

Creating or filling pci-OF-bus-map property in the device-tree is
deprecated since May 2006 [1]. Allow to disable filling this property by
unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp
and powermac code.

Disabling of pci-OF-bus-map property allows to enable new option
CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac.

[1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/

Signed-off-by: Pali Rohár <pali@kernel.org>
---
Changes in v2:
* Provide stripped version of pci_device_from_OF_node() without
  pci_to_OF_bus_map when compiling with CONFIG_PPC_PCI_OF_BUS_MAP_FILL=n
---
 arch/powerpc/Kconfig         | 12 +++++++++++-
 arch/powerpc/kernel/pci_32.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fad25aa602c8..3f8499faa88a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -388,9 +388,19 @@ config PPC_DCR
 	depends on PPC_DCR_NATIVE || PPC_DCR_MMIO
 	default y
 
+config PPC_PCI_OF_BUS_MAP_FILL
+	bool "Fill pci-OF-bus-map property in the device-tree"
+	depends on PPC32
+	depends on PPC_PMAC || PPC_CHRP
+	default y
+	help
+	  This option creates and fills pci-OF-bus-map property in the
+	  device-tree which is deprecated and is needed only for old
+	  platforms.
+
 config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT
 	depends on PPC32
-	depends on !PPC_PMAC && !PPC_CHRP
+	depends on !PPC_PCI_OF_BUS_MAP_FILL
 	bool "Assign PCI bus numbers from zero individually for each PCI domain"
 	default y
 	help
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 855b59892c5c..82a8981d4c47 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM,	PCI_DEVICE_ID_IBM_CPC710_PCI64,	fixu
 
 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
 
+#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
+
 static u8* pci_to_OF_bus_map;
 static int pci_bus_count;
 
@@ -223,6 +225,32 @@ pci_create_OF_bus_map(void)
 }
 #endif
 
+#else /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
+
+/*
+ * Returns the PCI device matching a given OF node without pci_to_OF_bus_map
+ */
+int pci_device_from_OF_node(struct device_node *node, u8 *bus, u8 *devfn)
+{
+	const __be32 *reg;
+	int size;
+
+	/* Check if it might have a chance to be a PCI device */
+	if (!pci_find_hose_for_OF_device(node))
+		return -ENODEV;
+
+	reg = of_get_property(node, "reg", &size);
+	if (!reg || size < 5 * sizeof(u32))
+		return -ENODEV;
+
+	*bus = (be32_to_cpup(&reg[0]) >> 16) & 0xff;
+	*devfn = (be32_to_cpup(&reg[0]) >> 8) & 0xff;
+
+	return 0;
+}
+
+#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */
+
 #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */
 
 void pcibios_setup_phb_io_space(struct pci_controller *hose)
@@ -273,6 +301,7 @@ static int __init pcibios_init(void)
 	}
 
 #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP)
+#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL
 	pci_bus_count = next_busno;
 
 	/* OpenFirmware based machines need a map of OF bus
@@ -281,6 +310,7 @@ static int __init pcibios_init(void)
 	 */
 	if (pci_assign_all_buses)
 		pcibios_make_OF_bus_map();
+#endif
 #endif
 
 	/* Call common code to handle resource allocation */
-- 
2.20.1


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

* Re: [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
  2023-01-28 13:34 ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
  2023-01-28 13:34   ` [PATCH v2 2/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
@ 2023-02-15 12:40   ` Michael Ellerman
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2023-02-15 12:40 UTC (permalink / raw)
  To: Nicholas Piggin, Michael Ellerman, Christophe Leroy, Pali Rohár
  Cc: linuxppc-dev, linux-kernel

On Sat, 28 Jan 2023 14:34:58 +0100, Pali Rohár wrote:
> It makes sense to enable CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
> (when possible by dependencies) to take advantages of all 256 PCI buses on
> each PCI domain, like it is already on all other kernel architectures.
> 
> 

Patch 1 applied to powerpc/next.

[1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default
      https://git.kernel.org/powerpc/c/34557b7504778e32b166cf46c6f774086124e845

cheers

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

end of thread, other threads:[~2023-02-15 12:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 16:39 [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
2022-08-17 16:39 ` [PATCH 2/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
2022-10-09 11:25 ` [PATCH 1/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
2022-11-01 22:26   ` Pali Rohár
2022-11-26 16:23     ` Pali Rohár
2022-12-16 18:12       ` Pali Rohár
2023-01-22 11:21         ` Pali Rohár
2023-01-26 10:59           ` Michael Ellerman
2023-01-28 13:23             ` Pali Rohár
2023-01-28 13:34 ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Pali Rohár
2023-01-28 13:34   ` [PATCH v2 2/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Pali Rohár
2023-02-15 12:40   ` [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Michael Ellerman

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).