Skip to content

Commit 4cacac5

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Allow use of indirect VCPU tables
The VCPU tables can be quite sparse as well, and it makes sense to use indirect tables as well if possible. 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 0e5ccf9 commit 4cacac5

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,10 +1077,13 @@ static int its_setup_baser(struct its_node *its, struct its_baser *baser,
10771077
return 0;
10781078
}
10791079

1080-
static bool its_parse_baser_device(struct its_node *its, struct its_baser *baser,
1081-
u32 psz, u32 *order)
1080+
static bool its_parse_indirect_baser(struct its_node *its,
1081+
struct its_baser *baser,
1082+
u32 psz, u32 *order)
10821083
{
1083-
u64 esz = GITS_BASER_ENTRY_SIZE(its_read_baser(its, baser));
1084+
u64 tmp = its_read_baser(its, baser);
1085+
u64 type = GITS_BASER_TYPE(tmp);
1086+
u64 esz = GITS_BASER_ENTRY_SIZE(tmp);
10841087
u64 val = GITS_BASER_InnerShareable | GITS_BASER_RaWaWb;
10851088
u32 ids = its->device_ids;
10861089
u32 new_order = *order;
@@ -1119,8 +1122,9 @@ static bool its_parse_baser_device(struct its_node *its, struct its_baser *baser
11191122
if (new_order >= MAX_ORDER) {
11201123
new_order = MAX_ORDER - 1;
11211124
ids = ilog2(PAGE_ORDER_TO_SIZE(new_order) / (int)esz);
1122-
pr_warn("ITS@%pa: Device Table too large, reduce ids %u->%u\n",
1123-
&its->phys_base, its->device_ids, ids);
1125+
pr_warn("ITS@%pa: %s Table too large, reduce ids %u->%u\n",
1126+
&its->phys_base, its_base_type_string[type],
1127+
its->device_ids, ids);
11241128
}
11251129

11261130
*order = new_order;
@@ -1168,11 +1172,16 @@ static int its_alloc_tables(struct its_node *its)
11681172
u32 order = get_order(psz);
11691173
bool indirect = false;
11701174

1171-
if (type == GITS_BASER_TYPE_NONE)
1175+
switch (type) {
1176+
case GITS_BASER_TYPE_NONE:
11721177
continue;
11731178

1174-
if (type == GITS_BASER_TYPE_DEVICE)
1175-
indirect = its_parse_baser_device(its, baser, psz, &order);
1179+
case GITS_BASER_TYPE_DEVICE:
1180+
case GITS_BASER_TYPE_VCPU:
1181+
indirect = its_parse_indirect_baser(its, baser,
1182+
psz, &order);
1183+
break;
1184+
}
11761185

11771186
err = its_setup_baser(its, baser, cache, shr, psz, order, indirect);
11781187
if (err < 0) {

0 commit comments

Comments
 (0)