aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 3bfbf8d96a0e..5fd5f62c925d 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1843,7 +1843,7 @@ struct its_srat_map {
1843 u32 its_id; 1843 u32 its_id;
1844}; 1844};
1845 1845
1846static struct its_srat_map its_srat_maps[MAX_NUMNODES] __initdata; 1846static struct its_srat_map *its_srat_maps __initdata;
1847static int its_in_srat __initdata; 1847static int its_in_srat __initdata;
1848 1848
1849static int __init acpi_get_its_numa_node(u32 its_id) 1849static int __init acpi_get_its_numa_node(u32 its_id)
@@ -1857,6 +1857,12 @@ static int __init acpi_get_its_numa_node(u32 its_id)
1857 return NUMA_NO_NODE; 1857 return NUMA_NO_NODE;
1858} 1858}
1859 1859
1860static int __init gic_acpi_match_srat_its(struct acpi_subtable_header *header,
1861 const unsigned long end)
1862{
1863 return 0;
1864}
1865
1860static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header, 1866static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header,
1861 const unsigned long end) 1867 const unsigned long end)
1862{ 1868{
@@ -1873,12 +1879,6 @@ static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header,
1873 return -EINVAL; 1879 return -EINVAL;
1874 } 1880 }
1875 1881
1876 if (its_in_srat >= MAX_NUMNODES) {
1877 pr_err("SRAT: ITS affinity exceeding max count[%d]\n",
1878 MAX_NUMNODES);
1879 return -EINVAL;
1880 }
1881
1882 node = acpi_map_pxm_to_node(its_affinity->proximity_domain); 1882 node = acpi_map_pxm_to_node(its_affinity->proximity_domain);
1883 1883
1884 if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) { 1884 if (node == NUMA_NO_NODE || node >= MAX_NUMNODES) {
@@ -1897,14 +1897,37 @@ static int __init gic_acpi_parse_srat_its(struct acpi_subtable_header *header,
1897 1897
1898static void __init acpi_table_parse_srat_its(void) 1898static void __init acpi_table_parse_srat_its(void)
1899{ 1899{
1900 int count;
1901
1902 count = acpi_table_parse_entries(ACPI_SIG_SRAT,
1903 sizeof(struct acpi_table_srat),
1904 ACPI_SRAT_TYPE_GIC_ITS_AFFINITY,
1905 gic_acpi_match_srat_its, 0);
1906 if (count <= 0)
1907 return;
1908
1909 its_srat_maps = kmalloc(count * sizeof(struct its_srat_map),
1910 GFP_KERNEL);
1911 if (!its_srat_maps) {
1912 pr_warn("SRAT: Failed to allocate memory for its_srat_maps!\n");
1913 return;
1914 }
1915
1900 acpi_table_parse_entries(ACPI_SIG_SRAT, 1916 acpi_table_parse_entries(ACPI_SIG_SRAT,
1901 sizeof(struct acpi_table_srat), 1917 sizeof(struct acpi_table_srat),
1902 ACPI_SRAT_TYPE_GIC_ITS_AFFINITY, 1918 ACPI_SRAT_TYPE_GIC_ITS_AFFINITY,
1903 gic_acpi_parse_srat_its, 0); 1919 gic_acpi_parse_srat_its, 0);
1904} 1920}
1921
1922/* free the its_srat_maps after ITS probing */
1923static void __init acpi_its_srat_maps_free(void)
1924{
1925 kfree(its_srat_maps);
1926}
1905#else 1927#else
1906static void __init acpi_table_parse_srat_its(void) { } 1928static void __init acpi_table_parse_srat_its(void) { }
1907static int __init acpi_get_its_numa_node(u32 its_id) { return NUMA_NO_NODE; } 1929static int __init acpi_get_its_numa_node(u32 its_id) { return NUMA_NO_NODE; }
1930static void __init acpi_its_srat_maps_free(void) { }
1908#endif 1931#endif
1909 1932
1910static int __init gic_acpi_parse_madt_its(struct acpi_subtable_header *header, 1933static int __init gic_acpi_parse_madt_its(struct acpi_subtable_header *header,
@@ -1951,6 +1974,7 @@ static void __init its_acpi_probe(void)
1951 acpi_table_parse_srat_its(); 1974 acpi_table_parse_srat_its();
1952 acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR, 1975 acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
1953 gic_acpi_parse_madt_its, 0); 1976 gic_acpi_parse_madt_its, 0);
1977 acpi_its_srat_maps_free();
1954} 1978}
1955#else 1979#else
1956static void __init its_acpi_probe(void) { } 1980static void __init its_acpi_probe(void) { }