aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShanker Donthineni <shankerd@codeaurora.org>2017-10-07 16:43:48 -0400
committerMarc Zyngier <marc.zyngier@arm.com>2017-10-13 11:30:52 -0400
commit32bd44dc19de012e22f1fdebd2606b5fb86d54c5 (patch)
tree6dba1a8256021f1142d9c5368d98d0869d6ecde7
parentc427a475b6bc9d3304cca04acdec53464f71f24c (diff)
irqchip/gic-v3-its: Fix the incorrect parsing of VCPU table size
The VCPU table consists of vPE entries, and its size provides the number of VPEs supported by GICv4 hardware. Unfortunately the maximum size of the VPE table is not discoverable like Device table. All VLPI commands limits the number of bits to 16 to hold VPEID, which is index into VCPU table. Don't apply DEVID bits for VCPU table instead assume maximum bits to 16. ITS log messages on QDF2400 without fix: allocated 524288 Devices (indirect, esz 8, psz 64K, shr 1) allocated 8192 Interrupt Collections (flat, esz 8, psz 64K, shr 1) Virtual CPUs Table too large, reduce ids 32->26 Virtual CPUs too large, reduce ITS pages 8192->256 allocated 2097152 Virtual CPUs (flat, esz 8, psz 64K, shr 1) ITS log messages on QDF2400 with fix: allocated 524288 Devices (indirect, esz 8, psz 64K, shr 1) allocated 8192 Interrupt Collections (flat, esz 8, psz 64K, shr 1) allocated 65536 Virtual CPUs (flat, esz 8, psz 64K, shr 1) Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index e3a59f43def8..991cf33750c6 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -107,6 +107,10 @@ struct its_node {
107 107
108#define ITS_ITT_ALIGN SZ_256 108#define ITS_ITT_ALIGN SZ_256
109 109
110/* The maximum number of VPEID bits supported by VLPI commands */
111#define ITS_MAX_VPEID_BITS (16)
112#define ITS_MAX_VPEID (1 << (ITS_MAX_VPEID_BITS))
113
110/* Convert page order to size in bytes */ 114/* Convert page order to size in bytes */
111#define PAGE_ORDER_TO_SIZE(o) (PAGE_SIZE << (o)) 115#define PAGE_ORDER_TO_SIZE(o) (PAGE_SIZE << (o))
112 116
@@ -1582,13 +1586,12 @@ retry_baser:
1582 1586
1583static bool its_parse_indirect_baser(struct its_node *its, 1587static bool its_parse_indirect_baser(struct its_node *its,
1584 struct its_baser *baser, 1588 struct its_baser *baser,
1585 u32 psz, u32 *order) 1589 u32 psz, u32 *order, u32 ids)
1586{ 1590{
1587 u64 tmp = its_read_baser(its, baser); 1591 u64 tmp = its_read_baser(its, baser);
1588 u64 type = GITS_BASER_TYPE(tmp); 1592 u64 type = GITS_BASER_TYPE(tmp);
1589 u64 esz = GITS_BASER_ENTRY_SIZE(tmp); 1593 u64 esz = GITS_BASER_ENTRY_SIZE(tmp);
1590 u64 val = GITS_BASER_InnerShareable | GITS_BASER_RaWaWb; 1594 u64 val = GITS_BASER_InnerShareable | GITS_BASER_RaWaWb;
1591 u32 ids = its->device_ids;
1592 u32 new_order = *order; 1595 u32 new_order = *order;
1593 bool indirect = false; 1596 bool indirect = false;
1594 1597
@@ -1680,9 +1683,13 @@ static int its_alloc_tables(struct its_node *its)
1680 continue; 1683 continue;
1681 1684
1682 case GITS_BASER_TYPE_DEVICE: 1685 case GITS_BASER_TYPE_DEVICE:
1686 indirect = its_parse_indirect_baser(its, baser,
1687 psz, &order,
1688 its->device_ids);
1683 case GITS_BASER_TYPE_VCPU: 1689 case GITS_BASER_TYPE_VCPU:
1684 indirect = its_parse_indirect_baser(its, baser, 1690 indirect = its_parse_indirect_baser(its, baser,
1685 psz, &order); 1691 psz, &order,
1692 ITS_MAX_VPEID_BITS);
1686 break; 1693 break;
1687 } 1694 }
1688 1695
@@ -2551,7 +2558,7 @@ static struct irq_chip its_vpe_irq_chip = {
2551 2558
2552static int its_vpe_id_alloc(void) 2559static int its_vpe_id_alloc(void)
2553{ 2560{
2554 return ida_simple_get(&its_vpeid_ida, 0, 1 << 16, GFP_KERNEL); 2561 return ida_simple_get(&its_vpeid_ida, 0, ITS_MAX_VPEID, GFP_KERNEL);
2555} 2562}
2556 2563
2557static void its_vpe_id_free(u16 id) 2564static void its_vpe_id_free(u16 id)