Re: [PATCH v5 4/4] PCI: keystone: Add support to build as a loadable module

From: Russell King (Oracle)

Date: Thu Nov 13 2025 - 13:35:43 EST


On Thu, Nov 13, 2025 at 12:13:55PM -0600, Bjorn Helgaas wrote:
> > config PCI_KEYSTONE_HOST
> > - bool "TI Keystone PCIe controller (host mode)"
> > + tristate "TI Keystone PCIe controller (host mode)"
> > depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
> > depends on PCI_MSI
> > select PCIE_DW_HOST
> > - select PCI_KEYSTONE
> > + select PCI_KEYSTONE if ARM
> > + select PCI_KEYSTONE_TRISTATE if !ARM
>
> This is kind of a lot of dancing to make keystone built-in on ARM32
> because hook_fault_code() is __init, while making it modular
> everywhere else.
>
> Is hook_fault_code() __init for some intrinsic reason? All the
> existing callers are __init, so that's one reason. But could it be
> made non-__init?

Yes. To discourage use in modules, because there is *no* way to safely
remove a hook.

While one can call hook_fault_code() with a NULL handler, that doesn't
mean that another CPU isn't executing in that function. If that code
gets unmapped while another CPU is executing it (because of a module
being unmapped) then we'll get another fault.

Trying to throw locks at this doesn't help - not without holding locks
over the execution of the called function, which *will* be extremely
detrimental on all fault handling, and probably introduce deadlocks.

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