summaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-gic-v3-its.c
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2018-05-31 10:01:59 +0200
committerMarc Zyngier <marc.zyngier@arm.com>2018-07-16 15:22:19 +0200
commit12b2905af183c931bedcab4292c81d3a415e080f (patch)
tree6c3e17b3d69030ff654f77a5d5dbf7df74889ead /drivers/irqchip/irq-gic-v3-its.c
parentirqchip/gic-v3: Expose GICD_TYPER in the rdist structure (diff)
downloadlinux-12b2905af183c931bedcab4292c81d3a415e080f.tar.xz
linux-12b2905af183c931bedcab4292c81d3a415e080f.zip
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>
Diffstat (limited to 'drivers/irqchip/irq-gic-v3-its.c')
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index efe6d1a6c32e..f56c84977241 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1541,8 +1541,17 @@ out:
static int __init its_lpi_init(u32 id_bits)
{
u32 lpis = (1UL << id_bits) - 8192;
+ u32 numlpis;
int err;
+ numlpis = 1UL << GICD_TYPER_NUM_LPIS(gic_rdists->gicd_typer);
+
+ if (numlpis > 2 && !WARN_ON(numlpis > lpis)) {
+ lpis = numlpis;
+ pr_info("ITS: Using hypervisor restricted LPI range [%u]\n",
+ lpis);
+ }
+
/*
* Initializing the allocator is just the same as freeing the
* full range of LPIs.