PCI: dwc: Skip allocating own MSI domain if using external MSI domain

On some platform, external MSI domain is using instead of the one
created by designware driver. For instance, if using GIC-V3-ITS
as a MSI domain, we only need set msi-map in the devicetree but
never need any bit in the designware driver to handle MSI stuff.
So skip allocating its own MSI domain for that case.

Change-Id: Ic4f5f0a1a1833c778c4e4750cb88f34a5b37a198
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Shawn Lin 2018-10-25 10:47:27 +08:00 committed by Tao Huang
commit 61ba789f0c
2 changed files with 10 additions and 1 deletions

View file

@ -277,6 +277,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct fwnode_handle *fwnode = of_node_to_fwnode(pci->dev->of_node);
/* Rely on the external MSI domain */
if (pp->msi_ext)
return 0;
pp->irq_domain = irq_domain_create_linear(fwnode, pp->num_vectors,
&dw_pcie_msi_domain_ops, pp);
if (!pp->irq_domain) {
@ -298,6 +302,9 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
void dw_pcie_free_msi(struct pcie_port *pp)
{
if (pp->msi_ext)
return;
irq_set_chained_handler(pp->msi_irq, NULL);
irq_set_handler_data(pp->msi_irq, NULL);
@ -443,7 +450,8 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (ret)
pci->num_viewport = 2;
if (pci_msi_enabled()) {
if (pci_msi_enabled() &&
!pp->msi_ext) {
/*
* If a specific SoC driver needs to change the
* default number of vectors, it needs to implement

View file

@ -168,6 +168,7 @@ struct pcie_port {
u32 num_vectors;
u32 irq_status[MAX_MSI_CTRLS];
raw_spinlock_t lock;
int msi_ext;
DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
};