Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/gicv3-its: Use MADT ITS subtable to do PCI/MSI domain initialization

Let ACPI build ITS PCI MSI domain. ACPI code is responsible for retrieving
inner domain token and passing it on to its_pci_msi_init_one generic
init call.

IORT maintains list of registered domain tokens and allows to find
corresponding domain based on MADT ITS subtable ID info.

Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

authored by

Tomasz Nowicki and committed by
Marc Zyngier
723344dd db744aaa

+44
+44
drivers/irqchip/irq-gic-v3-its-pci-msi.c
··· 15 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 17 18 + #include <linux/acpi_iort.h> 18 19 #include <linux/msi.h> 19 20 #include <linux/of.h> 20 21 #include <linux/of_irq.h> ··· 145 144 return 0; 146 145 } 147 146 147 + #ifdef CONFIG_ACPI 148 + 149 + static int __init 150 + its_pci_msi_parse_madt(struct acpi_subtable_header *header, 151 + const unsigned long end) 152 + { 153 + struct acpi_madt_generic_translator *its_entry; 154 + struct fwnode_handle *dom_handle; 155 + const char *node_name; 156 + int err = -ENXIO; 157 + 158 + its_entry = (struct acpi_madt_generic_translator *)header; 159 + node_name = kasprintf(GFP_KERNEL, "ITS@0x%lx", 160 + (long)its_entry->base_address); 161 + dom_handle = iort_find_domain_token(its_entry->translation_id); 162 + if (!dom_handle) { 163 + pr_err("%s: Unable to locate ITS domain handle\n", node_name); 164 + goto out; 165 + } 166 + 167 + err = its_pci_msi_init_one(dom_handle, node_name); 168 + if (!err) 169 + pr_info("PCI/MSI: %s domain created\n", node_name); 170 + 171 + out: 172 + kfree(node_name); 173 + return err; 174 + } 175 + 176 + static int __init its_pci_acpi_msi_init(void) 177 + { 178 + acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, 179 + its_pci_msi_parse_madt, 0); 180 + return 0; 181 + } 182 + #else 183 + static int __init its_pci_acpi_msi_init(void) 184 + { 185 + return 0; 186 + } 187 + #endif 188 + 148 189 static int __init its_pci_msi_init(void) 149 190 { 150 191 its_pci_of_msi_init(); 192 + its_pci_acpi_msi_init(); 151 193 152 194 return 0; 153 195 }