irqchip/gic-v3: get free page instead of kmalloc for itt

Since kmalloc may not care about GFP_DMA32, change to use get free pages
for itt on its device.

To reduce the impact of this change, we only applied it to rk3566/rk3568.

Change-Id: I2e91c97bd4d61d2542cf437363fc3dd1d9fa669c
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
This commit is contained in:
Jianqun Xu
2021-03-16 10:00:13 +08:00
committed by Tao Huang
parent 0b2f07b378
commit ebc7e6d848

View File

@@ -161,6 +161,7 @@ struct its_device {
struct its_node *its;
struct event_lpi_map event_map;
void *itt;
u32 itt_sz;
u32 nr_ites;
u32 device_id;
bool shared;
@@ -3403,9 +3404,13 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
sz = nr_ites * (FIELD_GET(GITS_TYPER_ITT_ENTRY_SIZE, its->typer) + 1);
sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1;
gfp_flags = GFP_KERNEL;
if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566"))
if (of_machine_is_compatible("rockchip,rk3568") || of_machine_is_compatible("rockchip,rk3566")) {
gfp_flags |= GFP_DMA32;
itt = kzalloc_node(sz, gfp_flags, its->numa_node);
itt = (void *)__get_free_pages(gfp_flags, get_order(sz));
} else {
itt = kzalloc_node(sz, gfp_flags, its->numa_node);
}
if (alloc_lpis) {
lpi_map = its_lpi_alloc(nvecs, &lpi_base, &nr_lpis);
if (lpi_map)
@@ -3419,7 +3424,13 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
if (!dev || !itt || !col_map || (!lpi_map && alloc_lpis)) {
kfree(dev);
kfree(itt);
if (of_machine_is_compatible("rockchip,rk3568") ||
of_machine_is_compatible("rockchip,rk3566"))
free_pages((unsigned long)itt, get_order(sz));
else
kfree(itt);
kfree(lpi_map);
kfree(col_map);
return NULL;
@@ -3429,6 +3440,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
dev->its = its;
dev->itt = itt;
dev->itt_sz = sz;
dev->nr_ites = nr_ites;
dev->event_map.lpi_map = lpi_map;
dev->event_map.col_map = col_map;
@@ -3456,7 +3468,13 @@ static void its_free_device(struct its_device *its_dev)
list_del(&its_dev->entry);
raw_spin_unlock_irqrestore(&its_dev->its->lock, flags);
kfree(its_dev->event_map.col_map);
kfree(its_dev->itt);
if (of_machine_is_compatible("rockchip,rk3568") ||
of_machine_is_compatible("rockchip,rk3566"))
free_pages((unsigned long)its_dev->itt, get_order(its_dev->itt_sz));
else
kfree(its_dev->itt);
kfree(its_dev);
}