diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2019-03-11 11:38:10 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2019-03-11 11:38:10 -0400 |
commit | b41fdc4a7bf9045e4871c5b15905ea732ffd044f (patch) | |
tree | 4cdbaefe72458c801e026bed3b1a5516083e5ddc | |
parent | 7d3a5eb78e3614b025389d2cd89d6d85e91f5549 (diff) |
irqchip/gic: Drop support for secondary GIC in non-DT systems
We do not have any in-tree platform with this pathological setup,
and only a single system (Cavium's cns3xxx) isn't DT aware.
Let's drop the secondary GIC support for now, until we remove
the above horror altogether.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | arch/arm/mach-cns3xxx/core.c | 2 | ||||
-rw-r--r-- | drivers/irqchip/irq-gic.c | 45 | ||||
-rw-r--r-- | include/linux/irqchip/arm-gic.h | 3 |
3 files changed, 18 insertions, 32 deletions
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c index 7d5a44a06648..f676592d8402 100644 --- a/arch/arm/mach-cns3xxx/core.c +++ b/arch/arm/mach-cns3xxx/core.c | |||
@@ -90,7 +90,7 @@ void __init cns3xxx_map_io(void) | |||
90 | /* used by entry-macro.S */ | 90 | /* used by entry-macro.S */ |
91 | void __init cns3xxx_init_irq(void) | 91 | void __init cns3xxx_init_irq(void) |
92 | { | 92 | { |
93 | gic_init(0, 29, IOMEM(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT), | 93 | gic_init(IOMEM(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT), |
94 | IOMEM(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT)); | 94 | IOMEM(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT)); |
95 | } | 95 | } |
96 | 96 | ||
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index ba2a37a27a54..fd3110c171ba 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -1089,11 +1089,10 @@ static void gic_init_chip(struct gic_chip_data *gic, struct device *dev, | |||
1089 | #endif | 1089 | #endif |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | static int gic_init_bases(struct gic_chip_data *gic, int irq_start, | 1092 | static int gic_init_bases(struct gic_chip_data *gic, |
1093 | struct fwnode_handle *handle) | 1093 | struct fwnode_handle *handle) |
1094 | { | 1094 | { |
1095 | irq_hw_number_t hwirq_base; | 1095 | int gic_irqs, ret; |
1096 | int gic_irqs, irq_base, ret; | ||
1097 | 1096 | ||
1098 | if (IS_ENABLED(CONFIG_GIC_NON_BANKED) && gic->percpu_offset) { | 1097 | if (IS_ENABLED(CONFIG_GIC_NON_BANKED) && gic->percpu_offset) { |
1099 | /* Frankein-GIC without banked registers... */ | 1098 | /* Frankein-GIC without banked registers... */ |
@@ -1145,28 +1144,21 @@ static int gic_init_bases(struct gic_chip_data *gic, int irq_start, | |||
1145 | } else { /* Legacy support */ | 1144 | } else { /* Legacy support */ |
1146 | /* | 1145 | /* |
1147 | * For primary GICs, skip over SGIs. | 1146 | * For primary GICs, skip over SGIs. |
1148 | * For secondary GICs, skip over PPIs, too. | 1147 | * No secondary GIC support whatsoever. |
1149 | */ | 1148 | */ |
1150 | if (gic == &gic_data[0] && (irq_start & 31) > 0) { | 1149 | int irq_base; |
1151 | hwirq_base = 16; | ||
1152 | if (irq_start != -1) | ||
1153 | irq_start = (irq_start & ~31) + 16; | ||
1154 | } else { | ||
1155 | hwirq_base = 32; | ||
1156 | } | ||
1157 | 1150 | ||
1158 | gic_irqs -= hwirq_base; /* calculate # of irqs to allocate */ | 1151 | gic_irqs -= 16; /* calculate # of irqs to allocate */ |
1159 | 1152 | ||
1160 | irq_base = irq_alloc_descs(irq_start, 16, gic_irqs, | 1153 | irq_base = irq_alloc_descs(16, 16, gic_irqs, |
1161 | numa_node_id()); | 1154 | numa_node_id()); |
1162 | if (irq_base < 0) { | 1155 | if (irq_base < 0) { |
1163 | WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n", | 1156 | WARN(1, "Cannot allocate irq_descs @ IRQ16, assuming pre-allocated\n"); |
1164 | irq_start); | 1157 | irq_base = 16; |
1165 | irq_base = irq_start; | ||
1166 | } | 1158 | } |
1167 | 1159 | ||
1168 | gic->domain = irq_domain_add_legacy(NULL, gic_irqs, irq_base, | 1160 | gic->domain = irq_domain_add_legacy(NULL, gic_irqs, irq_base, |
1169 | hwirq_base, &gic_irq_domain_ops, gic); | 1161 | 16, &gic_irq_domain_ops, gic); |
1170 | } | 1162 | } |
1171 | 1163 | ||
1172 | if (WARN_ON(!gic->domain)) { | 1164 | if (WARN_ON(!gic->domain)) { |
@@ -1195,7 +1187,6 @@ error: | |||
1195 | } | 1187 | } |
1196 | 1188 | ||
1197 | static int __init __gic_init_bases(struct gic_chip_data *gic, | 1189 | static int __init __gic_init_bases(struct gic_chip_data *gic, |
1198 | int irq_start, | ||
1199 | struct fwnode_handle *handle) | 1190 | struct fwnode_handle *handle) |
1200 | { | 1191 | { |
1201 | char *name; | 1192 | char *name; |
@@ -1231,32 +1222,28 @@ static int __init __gic_init_bases(struct gic_chip_data *gic, | |||
1231 | gic_init_chip(gic, NULL, name, false); | 1222 | gic_init_chip(gic, NULL, name, false); |
1232 | } | 1223 | } |
1233 | 1224 | ||
1234 | ret = gic_init_bases(gic, irq_start, handle); | 1225 | ret = gic_init_bases(gic, handle); |
1235 | if (ret) | 1226 | if (ret) |
1236 | kfree(name); | 1227 | kfree(name); |
1237 | 1228 | ||
1238 | return ret; | 1229 | return ret; |
1239 | } | 1230 | } |
1240 | 1231 | ||
1241 | void __init gic_init(unsigned int gic_nr, int irq_start, | 1232 | void __init gic_init(void __iomem *dist_base, void __iomem *cpu_base) |
1242 | void __iomem *dist_base, void __iomem *cpu_base) | ||
1243 | { | 1233 | { |
1244 | struct gic_chip_data *gic; | 1234 | struct gic_chip_data *gic; |
1245 | 1235 | ||
1246 | if (WARN_ON(gic_nr >= CONFIG_ARM_GIC_MAX_NR)) | ||
1247 | return; | ||
1248 | |||
1249 | /* | 1236 | /* |
1250 | * Non-DT/ACPI systems won't run a hypervisor, so let's not | 1237 | * Non-DT/ACPI systems won't run a hypervisor, so let's not |
1251 | * bother with these... | 1238 | * bother with these... |
1252 | */ | 1239 | */ |
1253 | static_branch_disable(&supports_deactivate_key); | 1240 | static_branch_disable(&supports_deactivate_key); |
1254 | 1241 | ||
1255 | gic = &gic_data[gic_nr]; | 1242 | gic = &gic_data[0]; |
1256 | gic->raw_dist_base = dist_base; | 1243 | gic->raw_dist_base = dist_base; |
1257 | gic->raw_cpu_base = cpu_base; | 1244 | gic->raw_cpu_base = cpu_base; |
1258 | 1245 | ||
1259 | __gic_init_bases(gic, irq_start, NULL); | 1246 | __gic_init_bases(gic, NULL); |
1260 | } | 1247 | } |
1261 | 1248 | ||
1262 | static void gic_teardown(struct gic_chip_data *gic) | 1249 | static void gic_teardown(struct gic_chip_data *gic) |
@@ -1399,7 +1386,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq) | |||
1399 | if (ret) | 1386 | if (ret) |
1400 | return ret; | 1387 | return ret; |
1401 | 1388 | ||
1402 | ret = gic_init_bases(*gic, -1, &dev->of_node->fwnode); | 1389 | ret = gic_init_bases(*gic, &dev->of_node->fwnode); |
1403 | if (ret) { | 1390 | if (ret) { |
1404 | gic_teardown(*gic); | 1391 | gic_teardown(*gic); |
1405 | return ret; | 1392 | return ret; |
@@ -1459,7 +1446,7 @@ gic_of_init(struct device_node *node, struct device_node *parent) | |||
1459 | if (gic_cnt == 0 && !gic_check_eoimode(node, &gic->raw_cpu_base)) | 1446 | if (gic_cnt == 0 && !gic_check_eoimode(node, &gic->raw_cpu_base)) |
1460 | static_branch_disable(&supports_deactivate_key); | 1447 | static_branch_disable(&supports_deactivate_key); |
1461 | 1448 | ||
1462 | ret = __gic_init_bases(gic, -1, &node->fwnode); | 1449 | ret = __gic_init_bases(gic, &node->fwnode); |
1463 | if (ret) { | 1450 | if (ret) { |
1464 | gic_teardown(gic); | 1451 | gic_teardown(gic); |
1465 | return ret; | 1452 | return ret; |
@@ -1650,7 +1637,7 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header, | |||
1650 | return -ENOMEM; | 1637 | return -ENOMEM; |
1651 | } | 1638 | } |
1652 | 1639 | ||
1653 | ret = __gic_init_bases(gic, -1, domain_handle); | 1640 | ret = __gic_init_bases(gic, domain_handle); |
1654 | if (ret) { | 1641 | if (ret) { |
1655 | pr_err("Failed to initialise GIC\n"); | 1642 | pr_err("Failed to initialise GIC\n"); |
1656 | irq_domain_free_fwnode(domain_handle); | 1643 | irq_domain_free_fwnode(domain_handle); |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 626179077bb0..0f049b384ccd 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
@@ -158,8 +158,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq); | |||
158 | * Legacy platforms not converted to DT yet must use this to init | 158 | * Legacy platforms not converted to DT yet must use this to init |
159 | * their GIC | 159 | * their GIC |
160 | */ | 160 | */ |
161 | void gic_init(unsigned int nr, int start, | 161 | void gic_init(void __iomem *dist , void __iomem *cpu); |
162 | void __iomem *dist , void __iomem *cpu); | ||
163 | 162 | ||
164 | int gicv2m_init(struct fwnode_handle *parent_handle, | 163 | int gicv2m_init(struct fwnode_handle *parent_handle, |
165 | struct irq_domain *parent); | 164 | struct irq_domain *parent); |