Skip to content

Commit 91bf639

Browse files
author
Marc Zyngier
committed
irqchip/gic-v4.1: Add VPE residency callback
Making a VPE resident on GICv4.1 is pretty simple, as it is just a single write to the local redistributor. We just need extra information about which groups to enable, which the KVM code will have to provide. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d97c97b commit 91bf639

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,12 +3624,29 @@ static void its_vpe_4_1_unmask_irq(struct irq_data *d)
36243624
its_vpe_4_1_send_inv(d);
36253625
}
36263626

3627+
static void its_vpe_4_1_schedule(struct its_vpe *vpe,
3628+
struct its_cmd_info *info)
3629+
{
3630+
void __iomem *vlpi_base = gic_data_rdist_vlpi_base();
3631+
u64 val = 0;
3632+
3633+
/* Schedule the VPE */
3634+
val |= GICR_VPENDBASER_Valid;
3635+
val |= info->g0en ? GICR_VPENDBASER_4_1_VGRP0EN : 0;
3636+
val |= info->g1en ? GICR_VPENDBASER_4_1_VGRP1EN : 0;
3637+
val |= FIELD_PREP(GICR_VPENDBASER_4_1_VPEID, vpe->vpe_id);
3638+
3639+
gits_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER);
3640+
}
3641+
36273642
static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
36283643
{
3644+
struct its_vpe *vpe = irq_data_get_irq_chip_data(d);
36293645
struct its_cmd_info *info = vcpu_info;
36303646

36313647
switch (info->cmd_type) {
36323648
case SCHEDULE_VPE:
3649+
its_vpe_4_1_schedule(vpe, info);
36333650
return 0;
36343651

36353652
case DESCHEDULE_VPE:

include/linux/irqchip/arm-gic-v3.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,15 @@
327327
#define GICR_VPENDBASER_IDAI (1ULL << 62)
328328
#define GICR_VPENDBASER_Valid (1ULL << 63)
329329

330+
/*
331+
* GICv4.1 VPENDBASER, used for VPE residency. On top of these fields,
332+
* also use the above Valid, PendingLast and Dirty.
333+
*/
334+
#define GICR_VPENDBASER_4_1_DB (1ULL << 62)
335+
#define GICR_VPENDBASER_4_1_VGRP0EN (1ULL << 59)
336+
#define GICR_VPENDBASER_4_1_VGRP1EN (1ULL << 58)
337+
#define GICR_VPENDBASER_4_1_VPEID GENMASK_ULL(15, 0)
338+
330339
/*
331340
* ITS registers, offsets from ITS_base
332341
*/

include/linux/irqchip/arm-gic-v4.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ struct its_cmd_info {
100100
union {
101101
struct its_vlpi_map *map;
102102
u8 config;
103+
bool req_db;
104+
struct {
105+
bool g0en;
106+
bool g1en;
107+
};
103108
};
104109
};
105110

0 commit comments

Comments
 (0)