Skip to content

Commit 7c297a2

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Split out pending table allocation
Just as for the property table, let's move the pending table allocation to a separate function. Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 4cacac5 commit 7c297a2

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,24 @@ static int its_alloc_collections(struct its_node *its)
12081208
return 0;
12091209
}
12101210

1211+
static struct page *its_allocate_pending_table(gfp_t gfp_flags)
1212+
{
1213+
struct page *pend_page;
1214+
/*
1215+
* The pending pages have to be at least 64kB aligned,
1216+
* hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below.
1217+
*/
1218+
pend_page = alloc_pages(gfp_flags | __GFP_ZERO,
1219+
get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
1220+
if (!pend_page)
1221+
return NULL;
1222+
1223+
/* Make sure the GIC will observe the zero-ed page */
1224+
gic_flush_dcache_to_poc(page_address(pend_page), LPI_PENDBASE_SZ);
1225+
1226+
return pend_page;
1227+
}
1228+
12111229
static void its_cpu_init_lpis(void)
12121230
{
12131231
void __iomem *rbase = gic_data_rdist_rd_base();
@@ -1218,21 +1236,14 @@ static void its_cpu_init_lpis(void)
12181236
pend_page = gic_data_rdist()->pend_page;
12191237
if (!pend_page) {
12201238
phys_addr_t paddr;
1221-
/*
1222-
* The pending pages have to be at least 64kB aligned,
1223-
* hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below.
1224-
*/
1225-
pend_page = alloc_pages(GFP_NOWAIT | __GFP_ZERO,
1226-
get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K)));
1239+
1240+
pend_page = its_allocate_pending_table(GFP_NOWAIT);
12271241
if (!pend_page) {
12281242
pr_err("Failed to allocate PENDBASE for CPU%d\n",
12291243
smp_processor_id());
12301244
return;
12311245
}
12321246

1233-
/* Make sure the GIC will observe the zero-ed page */
1234-
gic_flush_dcache_to_poc(page_address(pend_page), LPI_PENDBASE_SZ);
1235-
12361247
paddr = page_to_phys(pend_page);
12371248
pr_info("CPU%d: using LPI pending table @%pa\n",
12381249
smp_processor_id(), &paddr);

0 commit comments

Comments
 (0)