Skip to content

Commit db744aa

Browse files
nowicki-tomaszMarc Zyngier
authored andcommitted
irqchip/gicv3-its: Factor out PCI-MSI part that might be reused for ACPI
Firmware agnostic code lands in common functions which do necessary domain initialization based on unique domain handler. DT specific code goes to DT specific init call. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 3f010cf commit db744aa

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

drivers/irqchip/irq-gic-v3-its-pci-msi.c

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,48 @@ static struct of_device_id its_device_id[] = {
106106
{},
107107
};
108108

109-
static int __init its_pci_msi_init(void)
109+
static int __init its_pci_msi_init_one(struct fwnode_handle *handle,
110+
const char *name)
110111
{
111-
struct device_node *np;
112112
struct irq_domain *parent;
113113

114+
parent = irq_find_matching_fwnode(handle, DOMAIN_BUS_NEXUS);
115+
if (!parent || !msi_get_domain_info(parent)) {
116+
pr_err("%s: Unable to locate ITS domain\n", name);
117+
return -ENXIO;
118+
}
119+
120+
if (!pci_msi_create_irq_domain(handle, &its_pci_msi_domain_info,
121+
parent)) {
122+
pr_err("%s: Unable to create PCI domain\n", name);
123+
return -ENOMEM;
124+
}
125+
126+
return 0;
127+
}
128+
129+
static int __init its_pci_of_msi_init(void)
130+
{
131+
struct device_node *np;
132+
114133
for (np = of_find_matching_node(NULL, its_device_id); np;
115134
np = of_find_matching_node(np, its_device_id)) {
116135
if (!of_property_read_bool(np, "msi-controller"))
117136
continue;
118137

119-
parent = irq_find_matching_host(np, DOMAIN_BUS_NEXUS);
120-
if (!parent || !msi_get_domain_info(parent)) {
121-
pr_err("%s: unable to locate ITS domain\n",
122-
np->full_name);
138+
if (its_pci_msi_init_one(of_node_to_fwnode(np), np->full_name))
123139
continue;
124-
}
125-
126-
if (!pci_msi_create_irq_domain(of_node_to_fwnode(np),
127-
&its_pci_msi_domain_info,
128-
parent)) {
129-
pr_err("%s: unable to create PCI domain\n",
130-
np->full_name);
131-
continue;
132-
}
133140

134141
pr_info("PCI/MSI: %s domain created\n", np->full_name);
135142
}
136143

137144
return 0;
138145
}
146+
147+
static int __init its_pci_msi_init(void)
148+
{
149+
its_pci_of_msi_init();
150+
151+
return 0;
152+
}
139153
early_initcall(its_pci_msi_init);

0 commit comments

Comments
 (0)