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>

+20 -9
+20 -9
drivers/irqchip/irq-gic-v3-its.c
··· 1208 1208 return 0; 1209 1209 } 1210 1210 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 + 1211 1229 static void its_cpu_init_lpis(void) 1212 1230 { 1213 1231 void __iomem *rbase = gic_data_rdist_rd_base(); ··· 1236 1218 pend_page = gic_data_rdist()->pend_page; 1237 1219 if (!pend_page) { 1238 1220 phys_addr_t paddr; 1239 - /* 1240 - * The pending pages have to be at least 64kB aligned, 1241 - * hence the 'max(LPI_PENDBASE_SZ, SZ_64K)' below. 1242 - */ 1243 - pend_page = alloc_pages(GFP_NOWAIT | __GFP_ZERO, 1244 - get_order(max_t(u32, LPI_PENDBASE_SZ, SZ_64K))); 1221 + 1222 + pend_page = its_allocate_pending_table(GFP_NOWAIT); 1245 1223 if (!pend_page) { 1246 1224 pr_err("Failed to allocate PENDBASE for CPU%d\n", 1247 1225 smp_processor_id()); 1248 1226 return; 1249 1227 } 1250 - 1251 - /* Make sure the GIC will observe the zero-ed page */ 1252 - gic_flush_dcache_to_poc(page_address(pend_page), LPI_PENDBASE_SZ); 1253 1228 1254 1229 paddr = page_to_phys(pend_page); 1255 1230 pr_info("CPU%d: using LPI pending table @%pa\n",