2024-02-23 10:38:10

by Paolo Bonzini

[permalink] [raw]
Subject: [PATCH] x86: irq: unconditionally define KVM interrupt vectors

Unlike arch/x86/kernel/idt.c, FRED support chose to remove the #ifdefs
from the .c files and concentrate them in the headers, where unused
handlers are #define'd to NULL.

However, the constants for KVM's 3 posted interrupt vectors are still
defined conditionally in irq_vectors.h. In the tree that FRED support was
developed on, this is innocuous because CONFIG_HAVE_KVM was effectively
always set. With the cleanups that recently went into the KVM tree to
remove CONFIG_HAVE_KVM, the conditional became IS_ENABLED(CONFIG_KVM).
This causes a linux-next compilation failure in FRED code, when
CONFIG_KVM=n.

In preparation for the merging of FRED in Linux 6.9, define the interrupt
vector numbers unconditionally.

Cc: [email protected]
Reported-by: Stephen Rothwell <[email protected]>
Suggested-by: Xin Li (Intel) <[email protected]>
Suggested-by: Thomas Gleixner <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
---
arch/x86/include/asm/irq_vectors.h | 2 --
1 file changed, 2 deletions(-)

diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 3f73ac3ed3a0..d18bfb238f66 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -84,11 +84,9 @@
#define HYPERVISOR_CALLBACK_VECTOR 0xf3

/* Vector for KVM to deliver posted interrupt IPI */
-#if IS_ENABLED(CONFIG_KVM)
#define POSTED_INTR_VECTOR 0xf2
#define POSTED_INTR_WAKEUP_VECTOR 0xf1
#define POSTED_INTR_NESTED_VECTOR 0xf0
-#endif

#define MANAGED_IRQ_SHUTDOWN_VECTOR 0xef

--
2.39.1



2024-02-23 18:53:10

by Xin Li (Intel)

[permalink] [raw]
Subject: Re: [PATCH] x86: irq: unconditionally define KVM interrupt vectors

On 2/23/2024 2:22 AM, Paolo Bonzini wrote:
> Unlike arch/x86/kernel/idt.c, FRED support chose to remove the #ifdefs
> from the .c files and concentrate them in the headers, where unused
> handlers are #define'd to NULL.
>
> However, the constants for KVM's 3 posted interrupt vectors are still
> defined conditionally in irq_vectors.h. In the tree that FRED support was
> developed on, this is innocuous because CONFIG_HAVE_KVM was effectively
> always set. With the cleanups that recently went into the KVM tree to
> remove CONFIG_HAVE_KVM, the conditional became IS_ENABLED(CONFIG_KVM).
> This causes a linux-next compilation failure in FRED code, when
> CONFIG_KVM=n.
>
> In preparation for the merging of FRED in Linux 6.9, define the interrupt
> vector numbers unconditionally.
>
> Cc: [email protected]
> Reported-by: Stephen Rothwell <[email protected]>
> Suggested-by: Xin Li (Intel) <[email protected]>
> Suggested-by: Thomas Gleixner <[email protected]>
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
> arch/x86/include/asm/irq_vectors.h | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
> index 3f73ac3ed3a0..d18bfb238f66 100644
> --- a/arch/x86/include/asm/irq_vectors.h
> +++ b/arch/x86/include/asm/irq_vectors.h
> @@ -84,11 +84,9 @@
> #define HYPERVISOR_CALLBACK_VECTOR 0xf3
>
> /* Vector for KVM to deliver posted interrupt IPI */
> -#if IS_ENABLED(CONFIG_KVM)
> #define POSTED_INTR_VECTOR 0xf2
> #define POSTED_INTR_WAKEUP_VECTOR 0xf1
> #define POSTED_INTR_NESTED_VECTOR 0xf0
> -#endif
>
> #define MANAGED_IRQ_SHUTDOWN_VECTOR 0xef
>

Thank you very much!
Xin


2024-02-26 15:28:38

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] x86: irq: unconditionally define KVM interrupt vectors

On Fri, Feb 23 2024 at 05:22, Paolo Bonzini wrote:
> Unlike arch/x86/kernel/idt.c, FRED support chose to remove the #ifdefs
> from the .c files and concentrate them in the headers, where unused
> handlers are #define'd to NULL.
>
> However, the constants for KVM's 3 posted interrupt vectors are still
> defined conditionally in irq_vectors.h. In the tree that FRED support was
> developed on, this is innocuous because CONFIG_HAVE_KVM was effectively
> always set. With the cleanups that recently went into the KVM tree to
> remove CONFIG_HAVE_KVM, the conditional became IS_ENABLED(CONFIG_KVM).
> This causes a linux-next compilation failure in FRED code, when
> CONFIG_KVM=n.
>
> In preparation for the merging of FRED in Linux 6.9, define the interrupt
> vector numbers unconditionally.
>
> Cc: [email protected]
> Reported-by: Stephen Rothwell <[email protected]>
> Suggested-by: Xin Li (Intel) <[email protected]>
> Suggested-by: Thomas Gleixner <[email protected]>
> Signed-off-by: Paolo Bonzini <[email protected]>

Reviewed-by: Thomas Gleixner <[email protected]>