Skip to content

Commit 3227c3a

Browse files
Sticklyman1936Marc Zyngier
authored andcommitted
irqchip/gic-v5: Check if impl is virt capable
Now that there is support for creating a GICv5-based guest with KVM, check that the hardware itself supports virtualisation, skipping the setting of struct gic_kvm_info if not. Note: If native GICv5 virt is not supported, then nor is FEAT_GCIE_LEGACY, so we are able to skip altogether. Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Reviewed-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20260128175919.3828384-33-sascha.bischoff@arm.com [maz: cosmetic changes] Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 9435c1e commit 3227c3a

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

drivers/irqchip/irq-gic-v5-irs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static int __init gicv5_irs_init(struct device_node *node)
743743
* be consistent across IRSes by the architecture.
744744
*/
745745
if (list_empty(&irs_nodes)) {
746+
idr = irs_readl_relaxed(irs_data, GICV5_IRS_IDR0);
747+
gicv5_global_data.virt_capable = !FIELD_GET(GICV5_IRS_IDR0_VIRT, idr);
746748

747749
idr = irs_readl_relaxed(irs_data, GICV5_IRS_IDR1);
748750
irs_setup_pri_bits(idr);

drivers/irqchip/irq-gic-v5.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,16 @@ static struct gic_kvm_info gic_v5_kvm_info __initdata;
10641064

10651065
static void __init gic_of_setup_kvm_info(struct device_node *node)
10661066
{
1067+
/*
1068+
* If we don't have native GICv5 virtualisation support, then
1069+
* we also don't have FEAT_GCIE_LEGACY - the architecture
1070+
* forbids this combination.
1071+
*/
1072+
if (!gicv5_global_data.virt_capable) {
1073+
pr_info("GIC implementation is not virtualization capable\n");
1074+
return;
1075+
}
1076+
10671077
gic_v5_kvm_info.type = GIC_V5;
10681078

10691079
/* GIC Virtual CPU interface maintenance interrupt */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
/*
4444
* IRS registers and tables structures
4545
*/
46+
#define GICV5_IRS_IDR0 0x0000
4647
#define GICV5_IRS_IDR1 0x0004
4748
#define GICV5_IRS_IDR2 0x0008
4849
#define GICV5_IRS_IDR5 0x0014
@@ -63,6 +64,8 @@
6364
#define GICV5_IRS_IST_STATUSR 0x0194
6465
#define GICV5_IRS_MAP_L2_ISTR 0x01c0
6566

67+
#define GICV5_IRS_IDR0_VIRT BIT(6)
68+
6669
#define GICV5_IRS_IDR1_PRIORITY_BITS GENMASK(22, 20)
6770
#define GICV5_IRS_IDR1_IAFFID_BITS GENMASK(19, 16)
6871

@@ -278,6 +281,7 @@ struct gicv5_chip_data {
278281
u8 cpuif_pri_bits;
279282
u8 cpuif_id_bits;
280283
u8 irs_pri_bits;
284+
bool virt_capable;
281285
struct {
282286
__le64 *l1ist_addr;
283287
u32 l2_size;

0 commit comments

Comments
 (0)