Message ID | 20240501121742.1215792-9-sunilvl@ventanamicro.com |
---|---|
State | New |
Headers | show |
Series | RISC-V: ACPI: Add external interrupt controller support | expand |
On Wed, May 01, 2024 at 05:47:33PM +0530, Sunil V L wrote: > RISC-V platforms need to use dependencies between PCI host bridge, Link > devices and the interrupt controllers to ensure probe order. The > dependency is like below. > > Interrupt controller <-- Link Device <-- PCI Host bridge. > > If there is no dependency added between Link device and PCI Host Bridge, > then the PCI end points can get probed prior to link device, unable to > get mapping for INTx. > > So, add the link device's HID to dependency honor list and also clear it > after its probe. > > Since this is required only for architectures like RISC-V, enable this > code under a new config option and set this only in RISC-V. > > Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> > --- > arch/riscv/Kconfig | 1 + > drivers/acpi/Kconfig | 3 +++ > drivers/acpi/pci_link.c | 3 +++ > drivers/acpi/scan.c | 1 + > 4 files changed, 8 insertions(+) > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig > index f961449ca077..f7a36d79ff1a 100644 > --- a/arch/riscv/Kconfig > +++ b/arch/riscv/Kconfig > @@ -14,6 +14,7 @@ config RISCV > def_bool y > select ACPI_GENERIC_GSI if ACPI > select ACPI_REDUCED_HARDWARE_ONLY if ACPI > + select ARCH_ACPI_DEFERRED_GSI if ACPI > select ARCH_DMA_DEFAULT_COHERENT > select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION > select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig > index e3a7c2aedd5f..ebec1707f662 100644 > --- a/drivers/acpi/Kconfig > +++ b/drivers/acpi/Kconfig > @@ -587,6 +587,9 @@ config ACPI_PRMT > substantially increase computational overhead related to the > initialization of some server systems. > > +config ARCH_ACPI_DEFERRED_GSI > + bool > + > endif # ACPI > > config X86_PM_TIMER > diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c > index aa1038b8aec4..48cdcedafad6 100644 > --- a/drivers/acpi/pci_link.c > +++ b/drivers/acpi/pci_link.c > @@ -748,6 +748,9 @@ static int acpi_pci_link_add(struct acpi_device *device, > if (result) > kfree(link); > > + if (IS_ENABLED(CONFIG_ARCH_ACPI_DEFERRED_GSI)) > + acpi_dev_clear_dependencies(device); This is really a question for Rafael, but it doesn't seem right that this completely depends on a config option. Is there a reason this wouldn't work for all architectures, i.e., what would happen if you just called acpi_dev_clear_dependencies() unconditionally? > + > return result < 0 ? result : 1; > } > > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c > index 3eeb4ce39fcc..67677a6ff8e3 100644 > --- a/drivers/acpi/scan.c > +++ b/drivers/acpi/scan.c > @@ -834,6 +834,7 @@ static const char * const acpi_honor_dep_ids[] = { > "INTC10CF", /* IVSC (MTL) driver must be loaded to allow i2c access to camera sensors */ > "RSCV0001", /* RISC-V PLIC */ > "RSCV0002", /* RISC-V APLIC */ > + "PNP0C0F", /* PCI Link Device */ > NULL > }; > > -- > 2.40.1 > >
On Wed, May 01, 2024 at 11:56:15AM -0500, Bjorn Helgaas wrote: > On Wed, May 01, 2024 at 05:47:33PM +0530, Sunil V L wrote: > > RISC-V platforms need to use dependencies between PCI host bridge, Link > > devices and the interrupt controllers to ensure probe order. The > > dependency is like below. > > > > Interrupt controller <-- Link Device <-- PCI Host bridge. > > > > If there is no dependency added between Link device and PCI Host Bridge, > > then the PCI end points can get probed prior to link device, unable to > > get mapping for INTx. > > > > So, add the link device's HID to dependency honor list and also clear it > > after its probe. > > > > Since this is required only for architectures like RISC-V, enable this > > code under a new config option and set this only in RISC-V. ... > > + if (IS_ENABLED(CONFIG_ARCH_ACPI_DEFERRED_GSI)) > > + acpi_dev_clear_dependencies(device); > > This is really a question for Rafael, but it doesn't seem right that > this completely depends on a config option. +1 here, fells like a hack and looks like a hack. > Is there a reason this wouldn't work for all architectures, i.e., what > would happen if you just called acpi_dev_clear_dependencies() > unconditionally?
On Thu, May 02, 2024 at 12:25:35PM +0300, Andy Shevchenko wrote: > On Wed, May 01, 2024 at 11:56:15AM -0500, Bjorn Helgaas wrote: > > On Wed, May 01, 2024 at 05:47:33PM +0530, Sunil V L wrote: > > > RISC-V platforms need to use dependencies between PCI host bridge, Link > > > devices and the interrupt controllers to ensure probe order. The > > > dependency is like below. > > > > > > Interrupt controller <-- Link Device <-- PCI Host bridge. > > > > > > If there is no dependency added between Link device and PCI Host Bridge, > > > then the PCI end points can get probed prior to link device, unable to > > > get mapping for INTx. > > > > > > So, add the link device's HID to dependency honor list and also clear it > > > after its probe. > > > > > > Since this is required only for architectures like RISC-V, enable this > > > code under a new config option and set this only in RISC-V. > > ... > > > > + if (IS_ENABLED(CONFIG_ARCH_ACPI_DEFERRED_GSI)) > > > + acpi_dev_clear_dependencies(device); > > > > This is really a question for Rafael, but it doesn't seem right that > > this completely depends on a config option. > > +1 here, fells like a hack and looks like a hack. > I can remove the config option. I just thought this would probably never required to be called on other architectures. Unless there is an objection, I will remove it in next version. Thanks! Sunil > > Is there a reason this wouldn't work for all architectures, i.e., what > > would happen if you just called acpi_dev_clear_dependencies() > > unconditionally? > > -- > With Best Regards, > Andy Shevchenko > >
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index f961449ca077..f7a36d79ff1a 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -14,6 +14,7 @@ config RISCV def_bool y select ACPI_GENERIC_GSI if ACPI select ACPI_REDUCED_HARDWARE_ONLY if ACPI + select ARCH_ACPI_DEFERRED_GSI if ACPI select ARCH_DMA_DEFAULT_COHERENT select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index e3a7c2aedd5f..ebec1707f662 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -587,6 +587,9 @@ config ACPI_PRMT substantially increase computational overhead related to the initialization of some server systems. +config ARCH_ACPI_DEFERRED_GSI + bool + endif # ACPI config X86_PM_TIMER diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index aa1038b8aec4..48cdcedafad6 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -748,6 +748,9 @@ static int acpi_pci_link_add(struct acpi_device *device, if (result) kfree(link); + if (IS_ENABLED(CONFIG_ARCH_ACPI_DEFERRED_GSI)) + acpi_dev_clear_dependencies(device); + return result < 0 ? result : 1; } diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3eeb4ce39fcc..67677a6ff8e3 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -834,6 +834,7 @@ static const char * const acpi_honor_dep_ids[] = { "INTC10CF", /* IVSC (MTL) driver must be loaded to allow i2c access to camera sensors */ "RSCV0001", /* RISC-V PLIC */ "RSCV0002", /* RISC-V APLIC */ + "PNP0C0F", /* PCI Link Device */ NULL };
RISC-V platforms need to use dependencies between PCI host bridge, Link devices and the interrupt controllers to ensure probe order. The dependency is like below. Interrupt controller <-- Link Device <-- PCI Host bridge. If there is no dependency added between Link device and PCI Host Bridge, then the PCI end points can get probed prior to link device, unable to get mapping for INTx. So, add the link device's HID to dependency honor list and also clear it after its probe. Since this is required only for architectures like RISC-V, enable this code under a new config option and set this only in RISC-V. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> --- arch/riscv/Kconfig | 1 + drivers/acpi/Kconfig | 3 +++ drivers/acpi/pci_link.c | 3 +++ drivers/acpi/scan.c | 1 + 4 files changed, 8 insertions(+)