• M
    irqchip/gic-v3: Refactor ISB + EOIR at ack time · 6efb5092
    Mark Rutland 提交于
    There are cases where a context synchronization event is necessary
    between an IRQ being raised and being handled, and there are races such
    that we cannot rely upon the exception entry being subsequent to the
    interrupt being raised. To fix this, we place an ISB between a read of
    IAR and the subsequent invocation of an IRQ handler.
    
    When EOI mode 1 is in use, we need to EOI an interrupt prior to invoking
    its handler, and we have a write to EOIR for this. As this write to EOIR
    requires an ISB, and this is provided by the gic_write_eoir() helper, we
    omit the usual ISB in this case, with the logic being:
    
    |	if (static_branch_likely(&supports_deactivate_key))
    |		gic_write_eoir(irqnr);
    |	else
    |		isb();
    
    This is somewhat opaque, and it would be a little clearer if there were
    an unconditional ISB, with only the write to EOIR being conditional,
    e.g.
    
    |	if (static_branch_likely(&supports_deactivate_key))
    |		write_gicreg(irqnr, ICC_EOIR1_EL1);
    |
    |	isb();
    
    This patch rewrites the code that way, with this logic factored into a
    new helper function with comments explaining what the ISB is for, as
    were originally laid out in commit:
    
      39a06b67 ("irqchip/gic: Ensure we have an ISB between ack and ->handle_irq")
    
    Note that since then, we removed the IAR polling in commit:
    
      342677d7 ("irqchip/gic-v3: Remove acknowledge loop")
    
    ... which removed one of the two race conditions.
    
    For consistency, other portions of the driver are made to manipulate
    EOIR using write_gicreg() and explcit ISBs, and the gic_write_eoir()
    helper function is removed.
    
    There should be no functional change as a result of this patch.
    Signed-off-by: NMark Rutland <mark.rutland@arm.com>
    Cc: Marc Zyngier <maz@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Will Deacon <will.deacon@arm.com>
    Signed-off-by: NMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220513133038.226182-3-mark.rutland@arm.com
    6efb5092
arch_gicv3.h 6.2 KB