diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-09-09 09:49:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-09-09 09:49:29 -0400 |
commit | 225ad3cfec4c0ad1971b3c00f379986a3eb6ab07 (patch) | |
tree | a0618374dfdd5052be900be302ebc78ac6d4732a | |
parent | e0a0d05848401df48b10f3defce14a5670a0f9f6 (diff) | |
parent | 4cb205c0c50f613e2de91f0eb19d5247ed003e89 (diff) |
Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull irqchip fix from Thomas Gleixner:
"A single fix to prevent allocating excessive memory in the GIC/ITS
driver.
While the subject of the patch might suggest otherwise this is a real
fix as some SoCs exceed the memory allocation limits and fail to boot"
* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
irqchip/gic-v3-its: Cap lpi_id_bits to reduce memory footprint
-rw-r--r-- | drivers/irqchip/irq-gic-v3-its.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 316a57530f6d..c2df341ff6fa 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -1439,6 +1439,7 @@ static struct irq_chip its_irq_chip = { | |||
1439 | * The consequence of the above is that allocation is cost is low, but | 1439 | * The consequence of the above is that allocation is cost is low, but |
1440 | * freeing is expensive. We assumes that freeing rarely occurs. | 1440 | * freeing is expensive. We assumes that freeing rarely occurs. |
1441 | */ | 1441 | */ |
1442 | #define ITS_MAX_LPI_NRBITS 16 /* 64K LPIs */ | ||
1442 | 1443 | ||
1443 | static DEFINE_MUTEX(lpi_range_lock); | 1444 | static DEFINE_MUTEX(lpi_range_lock); |
1444 | static LIST_HEAD(lpi_range_list); | 1445 | static LIST_HEAD(lpi_range_list); |
@@ -1625,7 +1626,8 @@ static int __init its_alloc_lpi_tables(void) | |||
1625 | { | 1626 | { |
1626 | phys_addr_t paddr; | 1627 | phys_addr_t paddr; |
1627 | 1628 | ||
1628 | lpi_id_bits = GICD_TYPER_ID_BITS(gic_rdists->gicd_typer); | 1629 | lpi_id_bits = min_t(u32, GICD_TYPER_ID_BITS(gic_rdists->gicd_typer), |
1630 | ITS_MAX_LPI_NRBITS); | ||
1629 | gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); | 1631 | gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT); |
1630 | if (!gic_rdists->prop_page) { | 1632 | if (!gic_rdists->prop_page) { |
1631 | pr_err("Failed to allocate PROPBASE\n"); | 1633 | pr_err("Failed to allocate PROPBASE\n"); |