x86/irq: Factor out common code for checking pending interrupts
Use a common function for checking pending interrupt vector in APIC IRR instead of duplicated open coding them. Additional checks for posted MSI vectors can then be contained in this function. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240423174114.526704-10-jacob.jun.pan@linux.intel.com
This commit is contained in:
parent
1b03d82ba1
commit
fef05a078b
@ -500,6 +500,17 @@ static inline bool lapic_vector_set_in_irr(unsigned int vector)
|
|||||||
return !!(irr & (1U << (vector % 32)));
|
return !!(irr & (1U << (vector % 32)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool is_vector_pending(unsigned int vector)
|
||||||
|
{
|
||||||
|
unsigned int irr;
|
||||||
|
|
||||||
|
irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
|
||||||
|
if (irr & (1 << (vector % 32)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warm reset vector position:
|
* Warm reset vector position:
|
||||||
*/
|
*/
|
||||||
|
@ -965,7 +965,7 @@ static void __vector_cleanup(struct vector_cleanup *cl, bool check_irr)
|
|||||||
lockdep_assert_held(&vector_lock);
|
lockdep_assert_held(&vector_lock);
|
||||||
|
|
||||||
hlist_for_each_entry_safe(apicd, tmp, &cl->head, clist) {
|
hlist_for_each_entry_safe(apicd, tmp, &cl->head, clist) {
|
||||||
unsigned int irr, vector = apicd->prev_vector;
|
unsigned int vector = apicd->prev_vector;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paranoia: Check if the vector that needs to be cleaned
|
* Paranoia: Check if the vector that needs to be cleaned
|
||||||
@ -979,8 +979,7 @@ static void __vector_cleanup(struct vector_cleanup *cl, bool check_irr)
|
|||||||
* fixup_irqs() was just called to scan IRR for set bits and
|
* fixup_irqs() was just called to scan IRR for set bits and
|
||||||
* forward them to new destination CPUs via IPIs.
|
* forward them to new destination CPUs via IPIs.
|
||||||
*/
|
*/
|
||||||
irr = check_irr ? apic_read(APIC_IRR + (vector / 32 * 0x10)) : 0;
|
if (check_irr && is_vector_pending(vector)) {
|
||||||
if (irr & (1U << (vector % 32))) {
|
|
||||||
pr_warn_once("Moved interrupt pending in old target APIC %u\n", apicd->irq);
|
pr_warn_once("Moved interrupt pending in old target APIC %u\n", apicd->irq);
|
||||||
rearm = true;
|
rearm = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -484,7 +484,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
|
|||||||
/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
|
/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
|
||||||
void fixup_irqs(void)
|
void fixup_irqs(void)
|
||||||
{
|
{
|
||||||
unsigned int irr, vector;
|
unsigned int vector;
|
||||||
struct irq_desc *desc;
|
struct irq_desc *desc;
|
||||||
struct irq_data *data;
|
struct irq_data *data;
|
||||||
struct irq_chip *chip;
|
struct irq_chip *chip;
|
||||||
@ -511,8 +511,7 @@ void fixup_irqs(void)
|
|||||||
if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
|
if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
|
if (is_vector_pending(vector)) {
|
||||||
if (irr & (1 << (vector % 32))) {
|
|
||||||
desc = __this_cpu_read(vector_irq[vector]);
|
desc = __this_cpu_read(vector_irq[vector]);
|
||||||
|
|
||||||
raw_spin_lock(&desc->lock);
|
raw_spin_lock(&desc->lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user