[PATCH] x86/irq: Use existing helper for pending vector check

Jacob Pan posted 1 patch 1 year, 7 months ago
There is a newer version of this series
arch/x86/include/asm/apic.h | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
[PATCH] x86/irq: Use existing helper for pending vector check
Posted by Jacob Pan 1 year, 7 months ago
lapic_vector_set_in_irr() is already available, use it for checking
pending vectors at the local APIC. No functional change.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Imran Khan <imran.f.khan@oracle.com>
---
 arch/x86/include/asm/apic.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 9122e93b89ea..d7a8ac961af8 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -505,13 +505,7 @@ static inline bool lapic_vector_set_in_irr(unsigned int vector)
 
 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 pi_pending_this_cpu(vector);
+	return lapic_vector_set_in_irr(vector) || pi_pending_this_cpu(vector);
 }
 
 /*
-- 
2.25.1
Re: [PATCH] x86/irq: Use existing helper for pending vector check
Posted by imran.f.khan@oracle.com 1 year, 7 months ago
Hello Jacob,
This looks good to me.


On 7/5/2024 3:56 am, Jacob Pan wrote:
> lapic_vector_set_in_irr() is already available, use it for checking
> pending vectors at the local APIC. No functional change.
> 
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Cc: Imran Khan <imran.f.khan@oracle.com>

Reviewed-by: Imran Khan <imran.f.khan@oracle.com>
> ---
>  arch/x86/include/asm/apic.h | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
> index 9122e93b89ea..d7a8ac961af8 100644
> --- a/arch/x86/include/asm/apic.h
> +++ b/arch/x86/include/asm/apic.h
> @@ -505,13 +505,7 @@ static inline bool lapic_vector_set_in_irr(unsigned int vector)
>  
>  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 pi_pending_this_cpu(vector);
> +	return lapic_vector_set_in_irr(vector) || pi_pending_this_cpu(vector);
>  }
>  
>  /*
[tip: x86/irq] x86/irq: Use existing helper for pending vector check
Posted by tip-bot2 for Jacob Pan 1 year, 7 months ago
The following commit has been merged into the x86/irq branch of tip:

Commit-ID:     6ecc2e7932fe8f132d3b671685f9995785f19e9a
Gitweb:        https://git.kernel.org/tip/6ecc2e7932fe8f132d3b671685f9995785f19e9a
Author:        Jacob Pan <jacob.jun.pan@linux.intel.com>
AuthorDate:    Mon, 06 May 2024 10:56:12 -07:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 08 May 2024 15:15:15 +02:00

x86/irq: Use existing helper for pending vector check

lapic_vector_set_in_irr() is already available, use it for checking
pending vectors at the local APIC. No functional change.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Imran Khan <imran.f.khan@oracle.com>
Link: https://lore.kernel.org/r/20240506175612.1141095-1-jacob.jun.pan@linux.intel.com

---
 arch/x86/include/asm/apic.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 5644c39..467532b 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -503,13 +503,7 @@ static inline bool lapic_vector_set_in_irr(unsigned int vector)
 
 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 pi_pending_this_cpu(vector);
+	return lapic_vector_set_in_irr(vector) || pi_pending_this_cpu(vector);
 }
 
 /*