lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip: irq/core] irqchip/gic-v3: Detect GICv4.1 supporting RVPEID
    The following commit has been merged into the irq/core branch of tip:

    Commit-ID: b25319d279b63781b972c4966b4082193e69afac
    Gitweb: https://git.kernel.org/tip/b25319d279b63781b972c4966b4082193e69afac
    Author: Marc Zyngier <maz@kernel.org>
    AuthorDate: Tue, 24 Dec 2019 11:10:24
    Committer: Marc Zyngier <maz@kernel.org>
    CommitterDate: Wed, 22 Jan 2020 14:22:19

    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 <maz@kernel.org>
    Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
    Link: https://lore.kernel.org/r/20191224111055.11836-2-maz@kernel.org
    ---
    drivers/irqchip/irq-gic-v3.c | 21 ++++++++++++++++++---
    include/linux/irqchip/arm-gic-v3.h | 2 ++
    2 files changed, 20 insertions(+), 3 deletions(-)

    diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
    index d621801..ffcb018 100644
    --- a/drivers/irqchip/irq-gic-v3.c
    +++ b/drivers/irqchip/irq-gic-v3.c
    @@ -858,8 +858,21 @@ static int __gic_update_rdist_properties(struct redist_region *region,
    void __iomem *ptr)
    {
    u64 typer = gic_read_typer(ptr + GICR_TYPER);
    +
    gic_data.rdists.has_vlpis &= !!(typer & GICR_TYPER_VLPIS);
    - gic_data.rdists.has_direct_lpi &= !!(typer & GICR_TYPER_DirectLPIS);
    +
    + /* RVPEID implies some form of DirectLPI, no matter what the doc says... :-/ */
    + gic_data.rdists.has_rvpeid &= !!(typer & GICR_TYPER_RVPEID);
    + gic_data.rdists.has_direct_lpi &= (!!(typer & GICR_TYPER_DirectLPIS) |
    + gic_data.rdists.has_rvpeid);
    +
    + /* Detect non-sensical configurations */
    + if (WARN_ON_ONCE(gic_data.rdists.has_rvpeid && !gic_data.rdists.has_vlpis)) {
    + gic_data.rdists.has_direct_lpi = false;
    + gic_data.rdists.has_vlpis = false;
    + gic_data.rdists.has_rvpeid = false;
    + }
    +
    gic_data.ppi_nr = min(GICR_TYPER_NR_PPIS(typer), gic_data.ppi_nr);

    return 1;
    @@ -872,9 +885,10 @@ static void gic_update_rdist_properties(void)
    if (WARN_ON(gic_data.ppi_nr == UINT_MAX))
    gic_data.ppi_nr = 0;
    pr_info("%d PPIs implemented\n", gic_data.ppi_nr);
    - pr_info("%sVLPI support, %sdirect LPI support\n",
    + pr_info("%sVLPI support, %sdirect LPI support, %sRVPEID support\n",
    !gic_data.rdists.has_vlpis ? "no " : "",
    - !gic_data.rdists.has_direct_lpi ? "no " : "");
    + !gic_data.rdists.has_direct_lpi ? "no " : "",
    + !gic_data.rdists.has_rvpeid ? "no " : "");
    }

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

    diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h
    index de991d6..9a5f85d 100644
    --- a/include/linux/irqchip/arm-gic-v3.h
    +++ b/include/linux/irqchip/arm-gic-v3.h
    @@ -234,6 +234,7 @@
    #define GICR_TYPER_VLPIS (1U << 1)
    #define GICR_TYPER_DirectLPIS (1U << 3)
    #define GICR_TYPER_LAST (1U << 4)
    +#define GICR_TYPER_RVPEID (1U << 7)

    #define GIC_V3_REDIST_SIZE 0x20000

    @@ -615,6 +616,7 @@ struct rdists {
    u64 flags;
    u32 gicd_typer;
    bool has_vlpis;
    + bool has_rvpeid;
    bool has_direct_lpi;
    };

    \
     
     \ /
      Last update: 2020-01-24 20:12    [W:4.195 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site