lkml.org 
[lkml]   [2024]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/3] irqchip/gic-v3-its: Do not assume vPE tables are preallocated
    Date
    We go through quite a bit of trouble to make sure we pick up any
    preallocated LPI tables on the redistributors, as enabling LPIs is a
    one-way switch. There is no such restriction for vLPIs, and for GICv4.1
    we expect to allocate a new vPE table at boot.

    This works as intended when initializing an ITS, however when setting up
    a redistributor in its_cpu_init_lpis() the early return for preallocated
    RD tables skips straight past GICv4 setup. This all comes to a head when
    trying to kexec into a new kernel, as the new kernel silently fails to
    set up GICv4, leading to a complete loss of SGIs and LPIs for KVM VMs
    (ouch).

    Slap a band-aid on the problem by ensuring its_cpu_init_lpis() always
    initializes GICv4 on the way out, even if the other RD tables were
    preallocated.

    Cc: stable@vger.kernel.org
    Fixes: 6479450f72c1 ("irqchip/gic-v4: Fix occasional VLPI drop")
    Reported-by: George Cherian <gcherian@marvell.com>
    Co-developed-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
    ---

    I debated a bit on the fixes tag between the blamed commit and commit
    5e5168461c22 ("irqchip/gic-v4.1: VPE table (aka GICR_VPROPBASER)
    allocation"), although it would appear GICv4 could be left in an unknown
    state after kexec too.

    drivers/irqchip/irq-gic-v3-its.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
    index d097001c1e3e..0022852ce494 100644
    --- a/drivers/irqchip/irq-gic-v3-its.c
    +++ b/drivers/irqchip/irq-gic-v3-its.c
    @@ -3172,6 +3172,7 @@ static void its_cpu_init_lpis(void)
    val |= GICR_CTLR_ENABLE_LPIS;
    writel_relaxed(val, rbase + GICR_CTLR);

    +out:
    if (gic_rdists->has_vlpis && !gic_rdists->has_rvpeid) {
    void __iomem *vlpi_base = gic_data_rdist_vlpi_base();

    @@ -3207,7 +3208,6 @@ static void its_cpu_init_lpis(void)

    /* Make sure the GIC has seen the above */
    dsb(sy);
    -out:
    gic_data_rdist()->flags |= RD_LOCAL_LPI_ENABLED;
    pr_info("GICv3: CPU%d: using %s LPI pending table @%pa\n",
    smp_processor_id(),
    --
    2.44.0.rc0.258.g7320e95886-goog

    \
     
     \ /
      Last update: 2024-05-27 15:10    [W:6.965 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site