| @@ -1089,11 +1089,10 @@ static void gic_init_chip(struct gic_chip_data *gic, struct device *dev, · 1088 unmodified lines |
| 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, · 45 unmodified lines |
| 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: · 22 unmodified lines |
| 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, · 29 unmodified lines |
| 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) · 136 unmodified lines |
| 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) · 53 unmodified lines |
| 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, · 184 unmodified lines |
| 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); |