drivers: pcie: initialize after interrupt controllers

PCIe devices refer to interrupt nodes, but are initialized with the same
priority, making the sequence depending on the linking order. Add a new
symbol and set it to one unit after intc to ensure that the
initialization sequence is stable.

Found with:

west build -p -b qemu_cortex_a53 \
	samples/drivers/virtualization/ivshmem/doorbell \
	-DCONFIG_CHECK_INIT_PRIORITIES=y
...
ERROR: /soc/pcie@4010000000 PRE_KERNEL_1 40 <
	/soc/interrupt-controller@8000000/its@8080000 POST_KERNEL 40

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2023-07-10 15:29:35 +00:00 committed by Carles Cufí
parent c2d049f56e
commit 5ea3f9a24e
3 changed files with 8 additions and 2 deletions

View file

@ -14,6 +14,12 @@ module = PCIE
module-str = pcie module-str = pcie
source "subsys/logging/Kconfig.template.log_config" source "subsys/logging/Kconfig.template.log_config"
config PCIE_INIT_PRIORITY
int "PCIe initialization priority"
default 41
help
PCIe host drivers initialization priority.
config PCIE_CONTROLLER config PCIE_CONTROLLER
bool "PCIe Controller management" bool "PCIe Controller management"
help help

View file

@ -554,4 +554,4 @@ static int pcie_init(void)
#define PCIE_SYS_INIT_LEVEL PRE_KERNEL_1 #define PCIE_SYS_INIT_LEVEL PRE_KERNEL_1
#endif #endif
SYS_INIT(pcie_init, PCIE_SYS_INIT_LEVEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); SYS_INIT(pcie_init, PCIE_SYS_INIT_LEVEL, CONFIG_PCIE_INIT_PRIORITY);

View file

@ -403,7 +403,7 @@ static const struct pcie_ctrl_driver_api pcie_ecam_api = {
&pcie_ecam_data##n, \ &pcie_ecam_data##n, \
&pcie_ecam_config##n, \ &pcie_ecam_config##n, \
PRE_KERNEL_1, \ PRE_KERNEL_1, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ CONFIG_PCIE_INIT_PRIORITY, \
&pcie_ecam_api); &pcie_ecam_api);
DT_INST_FOREACH_STATUS_OKAY(PCIE_ECAM_INIT) DT_INST_FOREACH_STATUS_OKAY(PCIE_ECAM_INIT)