On Mon, Sep 18, 2017 at 7:24 PM, Lorenzo Pieralisi lorenzo.pieralisi@arm.com wrote:
On Mon, Sep 18, 2017 at 05:56:02PM +0200, Arnd Bergmann wrote:
[...]
Section mismatches summary: 27 WARNING: modpost: Found 1 section mismatch(es). 6 WARNING: modpost: Found 2 section mismatch(es).
These are all MIPS warnings caused by Lorenzo's
04c81c7293df ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
The problem is that now we can reference pci_fixup_irqs from a function that is not marked __init, and probably should not be, since pcibios_scanbus() itself can be called at any time. Even before Lorenzo's change, having pcibios_map_irq as an __init function was problematic AFAICT on any platform that has hotplug-capable PCIe slots, or that can have a PCI host bridge driver in a loadable module.
The safe fix would be to remove all the __init annotations as well as the __initdata and __initconst annotations on data referenced by the map_irq functions.
Right. Patch below, I will send it out tomorrow (I certainly missed some annotations) please let me know if that's reasonable.
I tried the same thing, but ran into a problem at this point:
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c index f5b367e..29b7179 100644 --- a/arch/mips/txx9/rbtx4927/setup.c +++ b/arch/mips/txx9/rbtx4927/setup.c @@ -354,7 +354,7 @@ static void __init rbtx4927_device_init(void) rbtx4927_gpioled_init(); }
-struct txx9_board_vec rbtx4927_vec __initdata = { +struct txx9_board_vec rbtx4927_vec = { .system = "Toshiba RBTX4927", .prom_init = rbtx4927_prom_init, .mem_setup = rbtx4927_mem_setup,
Now we have the next problem with the pointers inside of rbtx4927_vec that kbuild complains about pointing to __init functions. I think the txx9_board_vec structures all have to remain __initdata or __initconst, with some other way to get the pointer at runtime.
something like this maybe:
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c index 0bd2a1e1ff9a..f0b291c889c4 100644 --- a/arch/mips/txx9/generic/pci.c +++ b/arch/mips/txx9/generic/pci.c @@ -386,9 +386,11 @@ int pcibios_plat_dev_init(struct pci_dev *dev) return 0; }
-int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +static int (*txx9_pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); + +int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) { - return txx9_board_vec->pci_map_irq(dev, slot, pin); + return txx9_pci_map_irq(dev, slot, pin); }
char * (*txx9_board_pcibios_setup)(char *str) __initdata; @@ -424,5 +426,7 @@ char *__init txx9_pcibios_setup(char *str) txx9_pci_err_action = TXX9_PCI_ERR_IGNORE; return NULL; } + txx9_pci_map_irq = txx9_board_vec->pci_map_irq; + return str; }
Arnd