mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 21:35:46 +02:00
PCI: Fix issue with "pci=disable_acs_redir" parameter being ignored
[ Upstream commitd5bc73f34c
] In most cases, kmalloc() will not be available early in boot when pci_setup() is called. Thus, the kstrdup() call that was added to fix the __initdata bug with the disable_acs_redir parameter usually returns NULL, so the parameter is discarded and has no effect. To fix this, store the string that's in initdata until an initcall function can allocate the memory appropriately. This way we don't need any additional static memory. Fixes:d2fd6e8191
("PCI: Fix __initdata issue with "pci=disable_acs_redir" parameter") Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fa42fde1f8
commit
48be4d7ced
|
@ -6266,8 +6266,7 @@ static int __init pci_setup(char *str)
|
||||||
} else if (!strncmp(str, "pcie_scan_all", 13)) {
|
} else if (!strncmp(str, "pcie_scan_all", 13)) {
|
||||||
pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
|
pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
|
||||||
} else if (!strncmp(str, "disable_acs_redir=", 18)) {
|
} else if (!strncmp(str, "disable_acs_redir=", 18)) {
|
||||||
disable_acs_redir_param =
|
disable_acs_redir_param = str + 18;
|
||||||
kstrdup(str + 18, GFP_KERNEL);
|
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_ERR "PCI: Unknown option `%s'\n",
|
printk(KERN_ERR "PCI: Unknown option `%s'\n",
|
||||||
str);
|
str);
|
||||||
|
@ -6278,3 +6277,19 @@ static int __init pci_setup(char *str)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
early_param("pci", pci_setup);
|
early_param("pci", pci_setup);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 'disable_acs_redir_param' is initialized in pci_setup(), above, to point
|
||||||
|
* to data in the __initdata section which will be freed after the init
|
||||||
|
* sequence is complete. We can't allocate memory in pci_setup() because some
|
||||||
|
* architectures do not have any memory allocation service available during
|
||||||
|
* an early_param() call. So we allocate memory and copy the variable here
|
||||||
|
* before the init section is freed.
|
||||||
|
*/
|
||||||
|
static int __init pci_realloc_setup_params(void)
|
||||||
|
{
|
||||||
|
disable_acs_redir_param = kstrdup(disable_acs_redir_param, GFP_KERNEL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
pure_initcall(pci_realloc_setup_params);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user