FROMLIST: genirq: Allow an interrupt to be marked as 'raw'
Some interrupts (such as the rescheduling IPI) rely on not going through the irq_enter()/irq_exit() calls. To distinguish such interrupts, add a new IRQ flag that allows the low-level handling code to sidestep the enter()/exit() calls. Only the architecture code is expected to use this. It will do the wrong thing on normal interrupts. Note that this is a band-aid until we can move to some more correct infrastructure (such as kernel/entry/common.c). Bug: 191808738 Link: https://lore.kernel.org/lkml/20201124141449.572446-3-maz@kernel.org/ Change-Id: I0609a8b689219ba9e769c8b9f7fcf1e77a0ff1ca Signed-off-by: Marc Zyngier <maz@kernel.org> [minor port to 5.10] Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
This commit is contained in:
@@ -72,6 +72,7 @@ enum irqchip_irq_state;
|
||||
* mechanism and from core side polling.
|
||||
* IRQ_DISABLE_UNLAZY - Disable lazy irq disable
|
||||
* IRQ_HIDDEN - Don't show up in /proc/interrupts
|
||||
* IRQ_RAW - Skip tick management and irqtime accounting
|
||||
*/
|
||||
enum {
|
||||
IRQ_TYPE_NONE = 0x00000000,
|
||||
@@ -99,6 +100,7 @@ enum {
|
||||
IRQ_IS_POLLED = (1 << 18),
|
||||
IRQ_DISABLE_UNLAZY = (1 << 19),
|
||||
IRQ_HIDDEN = (1 << 20),
|
||||
IRQ_RAW = (1 << 21),
|
||||
};
|
||||
|
||||
#define IRQF_MODIFY_MASK \
|
||||
|
@@ -109,6 +109,9 @@ config GENERIC_IRQ_MATRIX_ALLOCATOR
|
||||
config GENERIC_IRQ_RESERVATION_MODE
|
||||
bool
|
||||
|
||||
config ARCH_WANTS_IRQ_RAW
|
||||
bool
|
||||
|
||||
# Support forced irq threading
|
||||
config IRQ_FORCED_THREADING
|
||||
bool
|
||||
|
@@ -140,6 +140,7 @@ static const struct irq_bit_descr irqdesc_states[] = {
|
||||
BIT_MASK_DESCR(_IRQ_IS_POLLED),
|
||||
BIT_MASK_DESCR(_IRQ_DISABLE_UNLAZY),
|
||||
BIT_MASK_DESCR(_IRQ_HIDDEN),
|
||||
BIT_MASK_DESCR(_IRQ_RAW),
|
||||
};
|
||||
|
||||
static const struct irq_bit_descr irqdesc_istates[] = {
|
||||
|
@@ -667,10 +667,9 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
|
||||
{
|
||||
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||
unsigned int irq = hwirq;
|
||||
struct irq_desc *desc;
|
||||
int ret = 0;
|
||||
|
||||
irq_enter();
|
||||
|
||||
#ifdef CONFIG_IRQ_DOMAIN
|
||||
if (lookup)
|
||||
irq = irq_find_mapping(domain, hwirq);
|
||||
@@ -680,14 +679,22 @@ int __handle_domain_irq(struct irq_domain *domain, unsigned int hwirq,
|
||||
* Some hardware gives randomly wrong interrupts. Rather
|
||||
* than crashing, do something sensible.
|
||||
*/
|
||||
if (unlikely(!irq || irq >= nr_irqs)) {
|
||||
if (unlikely(!irq || irq >= nr_irqs || !(desc = irq_to_desc(irq)))) {
|
||||
ack_bad_irq(irq);
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
generic_handle_irq(irq);
|
||||
goto out;
|
||||
}
|
||||
|
||||
irq_exit();
|
||||
if (IS_ENABLED(CONFIG_ARCH_WANTS_IRQ_RAW) &&
|
||||
unlikely(irq_settings_is_raw(desc))) {
|
||||
generic_handle_irq_desc(desc);
|
||||
} else {
|
||||
irq_enter();
|
||||
generic_handle_irq_desc(desc);
|
||||
irq_exit();
|
||||
}
|
||||
|
||||
out:
|
||||
set_irq_regs(old_regs);
|
||||
return ret;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ enum {
|
||||
_IRQ_IS_POLLED = IRQ_IS_POLLED,
|
||||
_IRQ_DISABLE_UNLAZY = IRQ_DISABLE_UNLAZY,
|
||||
_IRQ_HIDDEN = IRQ_HIDDEN,
|
||||
_IRQ_RAW = IRQ_RAW,
|
||||
_IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
|
||||
};
|
||||
|
||||
@@ -33,6 +34,7 @@ enum {
|
||||
#define IRQ_IS_POLLED GOT_YOU_MORON
|
||||
#define IRQ_DISABLE_UNLAZY GOT_YOU_MORON
|
||||
#define IRQ_HIDDEN GOT_YOU_MORON
|
||||
#define IRQ_RAW GOT_YOU_MORON
|
||||
#undef IRQF_MODIFY_MASK
|
||||
#define IRQF_MODIFY_MASK GOT_YOU_MORON
|
||||
|
||||
@@ -180,3 +182,16 @@ static inline bool irq_settings_is_hidden(struct irq_desc *desc)
|
||||
{
|
||||
return desc->status_use_accessors & _IRQ_HIDDEN;
|
||||
}
|
||||
|
||||
static inline bool irq_settings_is_raw(struct irq_desc *desc)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_ARCH_WANTS_IRQ_RAW))
|
||||
return desc->status_use_accessors & _IRQ_RAW;
|
||||
|
||||
/*
|
||||
* Using IRQ_RAW on architectures that don't expect it is
|
||||
* likely to be wrong.
|
||||
*/
|
||||
WARN_ON_ONCE(1);
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user