Skip to content

Commit 12b2905

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Honor hypervisor enforced LPI range
A recent extension to the GIC architecture allows a hypervisor to arbitrarily reduce the number of LPIs available to a guest, no matter what the GIC says about the valid range of IntIDs. Let's factor in this information when computing the number of available LPIs Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent a4f9edb commit 12b2905

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎drivers/irqchip/irq-gic-v3-its.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,8 +1541,17 @@ static int free_lpi_range(u32 base, u32 nr_lpis)
15411541
static int __init its_lpi_init(u32 id_bits)
15421542
{
15431543
u32 lpis = (1UL << id_bits) - 8192;
1544+
u32 numlpis;
15441545
int err;
15451546

1547+
numlpis = 1UL << GICD_TYPER_NUM_LPIS(gic_rdists->gicd_typer);
1548+
1549+
if (numlpis > 2 && !WARN_ON(numlpis > lpis)) {
1550+
lpis = numlpis;
1551+
pr_info("ITS: Using hypervisor restricted LPI range [%u]\n",
1552+
lpis);
1553+
}
1554+
15461555
/*
15471556
* Initializing the allocator is just the same as freeing the
15481557
* full range of LPIs.

‎include/linux/irqchip/arm-gic-v3.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
#define GICD_TYPER_MBIS (1U << 16)
7474

7575
#define GICD_TYPER_ID_BITS(typer) ((((typer) >> 19) & 0x1f) + 1)
76+
#define GICD_TYPER_NUM_LPIS(typer) ((((typer) >> 11) & 0x1f) + 1)
7677
#define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32)
7778

7879
#define GICD_IROUTER_SPI_MODE_ONE (0U << 31)

0 commit comments

Comments
 (0)