Skip to content

Commit 0e5ccf9

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Split out property table allocation
Move the LPI property table allocation into its own function, as this is going to be required for those associated with VMs in the future. Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 8d85dce commit 0e5ccf9

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -905,13 +905,32 @@ static void its_lpi_free(struct event_lpi_map *map)
905905
kfree(map->col_map);
906906
}
907907

908+
static struct page *its_allocate_prop_table(gfp_t gfp_flags)
909+
{
910+
struct page *prop_page;
911+
912+
prop_page = alloc_pages(gfp_flags, get_order(LPI_PROPBASE_SZ));
913+
if (!prop_page)
914+
return NULL;
915+
916+
/* Priority 0xa0, Group-1, disabled */
917+
memset(page_address(prop_page),
918+
LPI_PROP_DEFAULT_PRIO | LPI_PROP_GROUP1,
919+
LPI_PROPBASE_SZ);
920+
921+
/* Make sure the GIC will observe the written configuration */
922+
gic_flush_dcache_to_poc(page_address(prop_page), LPI_PROPBASE_SZ);
923+
924+
return prop_page;
925+
}
926+
927+
908928
static int __init its_alloc_lpi_tables(void)
909929
{
910930
phys_addr_t paddr;
911931

912932
lpi_id_bits = min_t(u32, gic_rdists->id_bits, ITS_MAX_LPI_NRBITS);
913-
gic_rdists->prop_page = alloc_pages(GFP_NOWAIT,
914-
get_order(LPI_PROPBASE_SZ));
933+
gic_rdists->prop_page = its_allocate_prop_table(GFP_NOWAIT);
915934
if (!gic_rdists->prop_page) {
916935
pr_err("Failed to allocate PROPBASE\n");
917936
return -ENOMEM;
@@ -920,14 +939,6 @@ static int __init its_alloc_lpi_tables(void)
920939
paddr = page_to_phys(gic_rdists->prop_page);
921940
pr_info("GIC: using LPI property table @%pa\n", &paddr);
922941

923-
/* Priority 0xa0, Group-1, disabled */
924-
memset(page_address(gic_rdists->prop_page),
925-
LPI_PROP_DEFAULT_PRIO | LPI_PROP_GROUP1,
926-
LPI_PROPBASE_SZ);
927-
928-
/* Make sure the GIC will observe the written configuration */
929-
gic_flush_dcache_to_poc(page_address(gic_rdists->prop_page), LPI_PROPBASE_SZ);
930-
931942
return its_lpi_init(lpi_id_bits);
932943
}
933944

0 commit comments

Comments
 (0)