Skip to content

Commit

Permalink
PCI: ACPI: Add helper to register the MSI domain directly.
Browse files Browse the repository at this point in the history
Some architectures like X86, sets up the MSI domain but not registered
with IRQ framework. This causes pci_host_bridge_acpi_msi_domain() to not
find it. pci_msi_register_fwnode_provider() can not be used because
these domains seem to be created differently as in
native_create_pci_msi_domain(). Hence, add a new helper to register the
domain directly and check this first while searching for the MSI domain.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>

X86: msi.c: Register the MSI domain with IRQ framework

Register the default MSI irq domain so that
pci_host_bridge_acpi_msi_domain() is able to the MSI domain from PCI
host bridge.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
  • Loading branch information
vlsunil committed Apr 18, 2024
1 parent da86a2d commit d6cf76f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kernel/apic/msi.c
Expand Up @@ -278,6 +278,7 @@ struct irq_domain * __init native_create_pci_msi_domain(void)
void __init x86_create_pci_msi_domain(void)
{
x86_pci_msi_default_domain = x86_init.irqs.create_pci_msi_domain();
pci_msi_register_default_domain(x86_pci_msi_default_domain);
}

/* Keep around for hyperV */
Expand Down
15 changes: 15 additions & 0 deletions drivers/pci/pci-acpi.c
Expand Up @@ -1461,6 +1461,7 @@ void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev)
}

static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev);
static struct irq_domain *pci_msi_default_domain;

/**
* pci_msi_register_fwnode_provider - Register callback to retrieve fwnode
Expand All @@ -1476,6 +1477,17 @@ pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *))
pci_msi_get_fwnode_cb = fn;
}

/**
* pci_msi_register_default_domain - Register default MSI domain
*
* This should be called by irqchip driver, which is the parent of
* the MSI domain to provide callback interface to query fwnode.
*/
void pci_msi_register_default_domain(struct irq_domain *msidom)
{
pci_msi_default_domain = msidom;
}

/**
* pci_host_bridge_acpi_msi_domain - Retrieve MSI domain of a PCI host bridge
* @bus: The PCI host bridge bus.
Expand All @@ -1489,6 +1501,9 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
{
struct fwnode_handle *fwnode;

if (pci_msi_default_domain)
return pci_msi_default_domain;

if (!pci_msi_get_fwnode_cb)
return NULL;

Expand Down
1 change: 1 addition & 0 deletions include/linux/pci.h
Expand Up @@ -2614,6 +2614,7 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus);

void
pci_msi_register_fwnode_provider(struct fwnode_handle *(*fn)(struct device *));
void pci_msi_register_default_domain(struct irq_domain *msidom);
bool pci_pr3_present(struct pci_dev *pdev);
#else
static inline struct irq_domain *
Expand Down

0 comments on commit d6cf76f

Please sign in to comment.