linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
@ 2025-09-25 20:26 Bjorn Helgaas
  2025-09-30 18:59 ` Linus Walleij
  2025-10-19  7:42 ` Manivannan Sadhasivam
  0 siblings, 2 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2025-09-25 20:26 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, linux-pci, linux-kernel,
	Bjorn Helgaas

From: Bjorn Helgaas <bhelgaas@google.com>

hook_fault_code() is an ARM32-specific API.  Guard it and related code with
CONFIG_ARM #ifdefs so the driver can be compile tested on other
architectures.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/controller/pci-ixp4xx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pci/controller/pci-ixp4xx.c b/drivers/pci/controller/pci-ixp4xx.c
index acb85e0d5675..9fd401838bad 100644
--- a/drivers/pci/controller/pci-ixp4xx.c
+++ b/drivers/pci/controller/pci-ixp4xx.c
@@ -214,6 +214,7 @@ static u32 ixp4xx_crp_byte_lane_enable_bits(u32 n, int size)
 	return 0xffffffff;
 }
 
+#ifdef CONFIG_ARM
 static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size,
 				  u32 *value)
 {
@@ -251,6 +252,7 @@ static int ixp4xx_crp_read_config(struct ixp4xx_pci *p, int where, int size,
 
 	return PCIBIOS_SUCCESSFUL;
 }
+#endif
 
 static int ixp4xx_crp_write_config(struct ixp4xx_pci *p, int where, int size,
 				   u32 value)
@@ -470,6 +472,7 @@ static int ixp4xx_pci_parse_map_dma_ranges(struct ixp4xx_pci *p)
 	return 0;
 }
 
+#ifdef CONFIG_ARM
 /* Only used to get context for abort handling */
 static struct ixp4xx_pci *ixp4xx_pci_abort_singleton;
 
@@ -509,6 +512,7 @@ static int ixp4xx_pci_abort_handler(unsigned long addr, unsigned int fsr,
 
 	return 0;
 }
+#endif
 
 static int __init ixp4xx_pci_probe(struct platform_device *pdev)
 {
@@ -555,10 +559,12 @@ static int __init ixp4xx_pci_probe(struct platform_device *pdev)
 	dev_info(dev, "controller is in %s mode\n",
 		 p->host_mode ? "host" : "option");
 
+#ifdef CONFIG_ARM
 	/* Hook in our fault handler for PCI errors */
 	ixp4xx_pci_abort_singleton = p;
 	hook_fault_code(16+6, ixp4xx_pci_abort_handler, SIGBUS, 0,
 			"imprecise external abort");
+#endif
 
 	ret = ixp4xx_pci_parse_map_ranges(p);
 	if (ret)
-- 
2.43.0


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

* Re: [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
  2025-09-25 20:26 [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code() Bjorn Helgaas
@ 2025-09-30 18:59 ` Linus Walleij
  2025-09-30 20:50   ` Russell King (Oracle)
  2025-10-19  7:42 ` Manivannan Sadhasivam
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2025-09-30 18:59 UTC (permalink / raw)
  To: Bjorn Helgaas, Russell King
  Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, linux-pci, linux-kernel,
	Bjorn Helgaas

On Thu, Sep 25, 2025 at 10:27 PM Bjorn Helgaas <helgaas@kernel.org> wrote:

> From: Bjorn Helgaas <bhelgaas@google.com>
>
> hook_fault_code() is an ARM32-specific API.  Guard it and related code with
> CONFIG_ARM #ifdefs so the driver can be compile tested on other
> architectures.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

It looks OK to me
Acked-by: Linus Walleij <linus.walleij@linar.org>

I see some other ARM32 drivers use it too, but we surely do
not have a arch-agnostic way of handling bus errors so perhaps it
need to be like this.

I think Russell created the fault hooks originally so CC:ing him
in.

Yours,
Linus Walleij

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

* Re: [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
  2025-09-30 18:59 ` Linus Walleij
@ 2025-09-30 20:50   ` Russell King (Oracle)
  2025-10-06 19:42     ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Russell King (Oracle) @ 2025-09-30 20:50 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bjorn Helgaas, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, linux-pci, linux-kernel,
	Bjorn Helgaas

On Tue, Sep 30, 2025 at 08:59:36PM +0200, Linus Walleij wrote:
> On Thu, Sep 25, 2025 at 10:27 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> 
> > From: Bjorn Helgaas <bhelgaas@google.com>
> >
> > hook_fault_code() is an ARM32-specific API.  Guard it and related code with
> > CONFIG_ARM #ifdefs so the driver can be compile tested on other
> > architectures.
> >
> > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> It looks OK to me
> Acked-by: Linus Walleij <linus.walleij@linar.org>
> 
> I see some other ARM32 drivers use it too, but we surely do
> not have a arch-agnostic way of handling bus errors so perhaps it
> need to be like this.
> 
> I think Russell created the fault hooks originally so CC:ing him
> in.

I wonder what the point of compile testing if it needs code to be
#ifdef'd out.

Wouldn't it be better to add something like:

#ifndef CONFIG_ARM
static inline void hook_fault_code(int n, int (*fn)(unsigned long, unsigned int,
						    struct pt_regs *),
				   int sig, int code, const char *name)
{
}
#endif

maybe to a local header that pci-imx6, pci-keystone, pcie-rcar-host
and pci-ixp4xx can all share?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
  2025-09-30 20:50   ` Russell King (Oracle)
@ 2025-10-06 19:42     ` Bjorn Helgaas
  0 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2025-10-06 19:42 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Linus Walleij, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Rob Herring, linux-pci, linux-kernel,
	Bjorn Helgaas

On Tue, Sep 30, 2025 at 09:50:40PM +0100, Russell King (Oracle) wrote:
> On Tue, Sep 30, 2025 at 08:59:36PM +0200, Linus Walleij wrote:
> > On Thu, Sep 25, 2025 at 10:27 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > hook_fault_code() is an ARM32-specific API.  Guard it and related code with
> > > CONFIG_ARM #ifdefs so the driver can be compile tested on other
> > > architectures.
> > >
> > > Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> > 
> > It looks OK to me
> > Acked-by: Linus Walleij <linus.walleij@linar.org>
> > 
> > I see some other ARM32 drivers use it too, but we surely do
> > not have a arch-agnostic way of handling bus errors so perhaps it
> > need to be like this.
> > 
> > I think Russell created the fault hooks originally so CC:ing him
> > in.
> 
> I wonder what the point of compile testing if it needs code to be
> #ifdef'd out.

We can still catch errors in the bulk of the drivers.

> Wouldn't it be better to add something like:
> 
> #ifndef CONFIG_ARM
> static inline void hook_fault_code(int n, int (*fn)(unsigned long, unsigned int,
> 						    struct pt_regs *),
> 				   int sig, int code, const char *name)
> {
> }
> #endif
> 
> maybe to a local header that pci-imx6, pci-keystone, pcie-rcar-host
> and pci-ixp4xx can all share?

I guess we could put a stub like that in drivers/pci/pci.h.  But all
these drivers also have other CONFIG_ARM #ifdefs for the
hook_fault_code() *handlers*, so I'm not sure it's any better to
remove one #ifdef and leave the other.

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

* Re: [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
  2025-09-25 20:26 [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code() Bjorn Helgaas
  2025-09-30 18:59 ` Linus Walleij
@ 2025-10-19  7:42 ` Manivannan Sadhasivam
  1 sibling, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2025-10-19  7:42 UTC (permalink / raw)
  To: Linus Walleij, Bjorn Helgaas
  Cc: Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, linux-pci, linux-kernel,
	Bjorn Helgaas


On Thu, 25 Sep 2025 15:26:46 -0500, Bjorn Helgaas wrote:
> hook_fault_code() is an ARM32-specific API.  Guard it and related code with
> CONFIG_ARM #ifdefs so the driver can be compile tested on other
> architectures.
> 
> 

I've removed the ARM arch dependency from Kconfig and applied the patch, thanks!

[1/1] PCI: ixp4xx: Guard ARM32-specific hook_fault_code()
      commit: d2713dfda04ebc824c2c72f225a817e370dfa99f

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>

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

end of thread, other threads:[~2025-10-19  7:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 20:26 [PATCH] PCI: ixp4xx: Guard ARM32-specific hook_fault_code() Bjorn Helgaas
2025-09-30 18:59 ` Linus Walleij
2025-09-30 20:50   ` Russell King (Oracle)
2025-10-06 19:42     ` Bjorn Helgaas
2025-10-19  7:42 ` Manivannan Sadhasivam

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