Skip to content

Commit b25319d

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3: Detect GICv4.1 supporting RVPEID
GICv4.1 supports the RVPEID ("Residency per vPE ID"), which allows for a much efficient way of making virtual CPUs resident (to allow direct injection of interrupts). The functionnality needs to be discovered on each and every redistributor in the system, and disabled if the settings are inconsistent. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 093bf43 commit b25319d

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

drivers/irqchip/irq-gic-v3.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,21 @@ static int __gic_update_rdist_properties(struct redist_region *region,
858858
void __iomem *ptr)
859859
{
860860
u64 typer = gic_read_typer(ptr + GICR_TYPER);
861+
861862
gic_data.rdists.has_vlpis &= !!(typer & GICR_TYPER_VLPIS);
862-
gic_data.rdists.has_direct_lpi &= !!(typer & GICR_TYPER_DirectLPIS);
863+
864+
/* RVPEID implies some form of DirectLPI, no matter what the doc says... :-/ */
865+
gic_data.rdists.has_rvpeid &= !!(typer & GICR_TYPER_RVPEID);
866+
gic_data.rdists.has_direct_lpi &= (!!(typer & GICR_TYPER_DirectLPIS) |
867+
gic_data.rdists.has_rvpeid);
868+
869+
/* Detect non-sensical configurations */
870+
if (WARN_ON_ONCE(gic_data.rdists.has_rvpeid && !gic_data.rdists.has_vlpis)) {
871+
gic_data.rdists.has_direct_lpi = false;
872+
gic_data.rdists.has_vlpis = false;
873+
gic_data.rdists.has_rvpeid = false;
874+
}
875+
863876
gic_data.ppi_nr = min(GICR_TYPER_NR_PPIS(typer), gic_data.ppi_nr);
864877

865878
return 1;
@@ -872,9 +885,10 @@ static void gic_update_rdist_properties(void)
872885
if (WARN_ON(gic_data.ppi_nr == UINT_MAX))
873886
gic_data.ppi_nr = 0;
874887
pr_info("%d PPIs implemented\n", gic_data.ppi_nr);
875-
pr_info("%sVLPI support, %sdirect LPI support\n",
888+
pr_info("%sVLPI support, %sdirect LPI support, %sRVPEID support\n",
876889
!gic_data.rdists.has_vlpis ? "no " : "",
877-
!gic_data.rdists.has_direct_lpi ? "no " : "");
890+
!gic_data.rdists.has_direct_lpi ? "no " : "",
891+
!gic_data.rdists.has_rvpeid ? "no " : "");
878892
}
879893

880894
/* Check whether it's single security state view */
@@ -1566,6 +1580,7 @@ static int __init gic_init_bases(void __iomem *dist_base,
15661580
&gic_data);
15671581
irq_domain_update_bus_token(gic_data.domain, DOMAIN_BUS_WIRED);
15681582
gic_data.rdists.rdist = alloc_percpu(typeof(*gic_data.rdists.rdist));
1583+
gic_data.rdists.has_rvpeid = true;
15691584
gic_data.rdists.has_vlpis = true;
15701585
gic_data.rdists.has_direct_lpi = true;
15711586

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
#define GICR_TYPER_VLPIS (1U << 1)
235235
#define GICR_TYPER_DirectLPIS (1U << 3)
236236
#define GICR_TYPER_LAST (1U << 4)
237+
#define GICR_TYPER_RVPEID (1U << 7)
237238

238239
#define GIC_V3_REDIST_SIZE 0x20000
239240

@@ -615,6 +616,7 @@ struct rdists {
615616
u64 flags;
616617
u32 gicd_typer;
617618
bool has_vlpis;
619+
bool has_rvpeid;
618620
bool has_direct_lpi;
619621
};
620622

0 commit comments

Comments
 (0)