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

irqchip/gic-v3: Dynamically allocate PPI partition descriptors

Again, PPIs are becoming a variable set. Let's hack the PPI partition
code to make the top-level array dynamically allocated.

Signed-off-by: Marc Zyngier <maz@kernel.org>

+11 -3
+11 -3
drivers/irqchip/irq-gic-v3.c
··· 52 52 u64 flags; 53 53 bool has_rss; 54 54 unsigned int ppi_nr; 55 - struct partition_desc *ppi_descs[16]; 55 + struct partition_desc **ppi_descs; 56 56 }; 57 57 58 58 static struct gic_chip_data gic_data __read_mostly; ··· 1354 1354 * then we need to match the partition domain. 1355 1355 */ 1356 1356 if (fwspec->param_count >= 4 && 1357 - fwspec->param[0] == 1 && fwspec->param[3] != 0) 1357 + fwspec->param[0] == 1 && fwspec->param[3] != 0 && 1358 + gic_data.ppi_descs) 1358 1359 return d == partition_get_domain(gic_data.ppi_descs[fwspec->param[1]]); 1359 1360 1360 1361 return d == gic_data.domain; ··· 1375 1374 { 1376 1375 struct device_node *np; 1377 1376 int ret; 1377 + 1378 + if (!gic_data.ppi_descs) 1379 + return -ENOMEM; 1378 1380 1379 1381 np = of_find_node_by_phandle(fwspec->param[3]); 1380 1382 if (WARN_ON(!np)) ··· 1535 1531 if (!parts_node) 1536 1532 return; 1537 1533 1534 + gic_data.ppi_descs = kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_descs), GFP_KERNEL); 1535 + if (!gic_data.ppi_descs) 1536 + return; 1537 + 1538 1538 nr_parts = of_get_child_count(parts_node); 1539 1539 1540 1540 if (!nr_parts) ··· 1590 1582 part_idx++; 1591 1583 } 1592 1584 1593 - for (i = 0; i < 16; i++) { 1585 + for (i = 0; i < gic_data.ppi_nr; i++) { 1594 1586 unsigned int irq; 1595 1587 struct partition_desc *desc; 1596 1588 struct irq_fwspec ppi_fwspec = {