Skip to content

Commit dcf0926

Browse files
committed
x86: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM)
It is more accurate to check if KVM is enabled, instead of having the architecture say so. Architectures always "have" KVM, so for example checking CONFIG_HAVE_KVM in x86 code is pointless, but if KVM is disabled in a specific build, there is no need for support code. Alternatively, many of the #ifdefs could simply be deleted. However, this would add completely dead code. For example, when KVM is disabled, there should not be any posted interrupts, i.e. NOT wiring up the "dummy" handlers and treating IRQs on those vectors as spurious is the right thing to do. Cc: [email protected] Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a6d5433 commit dcf0926

File tree

9 files changed

+14
-10
lines changed

9 files changed

+14
-10
lines changed

arch/x86/include/asm/hardirq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ typedef struct {
1515
unsigned int irq_spurious_count;
1616
unsigned int icr_read_retry_count;
1717
#endif
18-
#ifdef CONFIG_HAVE_KVM
18+
#if IS_ENABLED(CONFIG_KVM)
1919
unsigned int kvm_posted_intr_ipis;
2020
unsigned int kvm_posted_intr_wakeup_ipis;
2121
unsigned int kvm_posted_intr_nested_ipis;

arch/x86/include/asm/idtentry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR, sysvec_irq_work);
675675
# endif
676676
#endif
677677

678-
#ifdef CONFIG_HAVE_KVM
678+
#if IS_ENABLED(CONFIG_KVM)
679679
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR, sysvec_kvm_posted_intr_ipi);
680680
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR, sysvec_kvm_posted_intr_wakeup_ipi);
681681
DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR, sysvec_kvm_posted_intr_nested_ipi);

arch/x86/include/asm/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct irq_desc;
2929

3030
extern void fixup_irqs(void);
3131

32-
#ifdef CONFIG_HAVE_KVM
32+
#if IS_ENABLED(CONFIG_KVM)
3333
extern void kvm_set_posted_intr_wakeup_handler(void (*handler)(void));
3434
#endif
3535

arch/x86/include/asm/irq_vectors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#define HYPERVISOR_CALLBACK_VECTOR 0xf3
8585

8686
/* Vector for KVM to deliver posted interrupt IPI */
87-
#ifdef CONFIG_HAVE_KVM
87+
#if IS_ENABLED(CONFIG_KVM)
8888
#define POSTED_INTR_VECTOR 0xf2
8989
#define POSTED_INTR_WAKEUP_VECTOR 0xf1
9090
#define POSTED_INTR_NESTED_VECTOR 0xf0

arch/x86/kernel/idt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static const __initconst struct idt_data apic_idts[] = {
153153
#ifdef CONFIG_X86_LOCAL_APIC
154154
INTG(LOCAL_TIMER_VECTOR, asm_sysvec_apic_timer_interrupt),
155155
INTG(X86_PLATFORM_IPI_VECTOR, asm_sysvec_x86_platform_ipi),
156-
# ifdef CONFIG_HAVE_KVM
156+
# if IS_ENABLED(CONFIG_KVM)
157157
INTG(POSTED_INTR_VECTOR, asm_sysvec_kvm_posted_intr_ipi),
158158
INTG(POSTED_INTR_WAKEUP_VECTOR, asm_sysvec_kvm_posted_intr_wakeup_ipi),
159159
INTG(POSTED_INTR_NESTED_VECTOR, asm_sysvec_kvm_posted_intr_nested_ipi),

arch/x86/kernel/irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
164164
#if defined(CONFIG_X86_IO_APIC)
165165
seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
166166
#endif
167-
#ifdef CONFIG_HAVE_KVM
167+
#if IS_ENABLED(CONFIG_KVM)
168168
seq_printf(p, "%*s: ", prec, "PIN");
169169
for_each_online_cpu(j)
170170
seq_printf(p, "%10u ", irq_stats(j)->kvm_posted_intr_ipis);
@@ -290,7 +290,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_x86_platform_ipi)
290290
}
291291
#endif
292292

293-
#ifdef CONFIG_HAVE_KVM
293+
#if IS_ENABLED(CONFIG_KVM)
294294
static void dummy_handler(void) {}
295295
static void (*kvm_posted_intr_wakeup_handler)(void) = dummy_handler;
296296

scripts/gdb/linux/constants.py.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ LX_CONFIG(CONFIG_X86_MCE_THRESHOLD)
130130
LX_CONFIG(CONFIG_X86_MCE_AMD)
131131
LX_CONFIG(CONFIG_X86_MCE)
132132
LX_CONFIG(CONFIG_X86_IO_APIC)
133-
LX_CONFIG(CONFIG_HAVE_KVM)
133+
/*
134+
* CONFIG_KVM can be "m" but it affects common code too. Use CONFIG_KVM_COMMON
135+
* as a proxy for IS_ENABLED(CONFIG_KVM).
136+
*/
137+
LX_CONFIG_KVM = IS_BUILTIN(CONFIG_KVM_COMMON)
134138
LX_CONFIG(CONFIG_NUMA)
135139
LX_CONFIG(CONFIG_ARM64)
136140
LX_CONFIG(CONFIG_ARM64_4K_PAGES)

scripts/gdb/linux/interrupts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def x86_show_interupts(prec):
151151
if cnt is not None:
152152
text += "%*s: %10u\n" % (prec, "MIS", cnt['counter'])
153153

154-
if constants.LX_CONFIG_HAVE_KVM:
154+
if constants.LX_CONFIG_KVM:
155155
text += x86_show_irqstat(prec, "PIN", 'kvm_posted_intr_ipis', 'Posted-interrupt notification event')
156156
text += x86_show_irqstat(prec, "NPI", 'kvm_posted_intr_nested_ipis', 'Nested posted-interrupt event')
157157
text += x86_show_irqstat(prec, "PIW", 'kvm_posted_intr_wakeup_ipis', 'Posted-interrupt wakeup event')

tools/arch/x86/include/asm/irq_vectors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
#define HYPERVISOR_CALLBACK_VECTOR 0xf3
8585

8686
/* Vector for KVM to deliver posted interrupt IPI */
87-
#ifdef CONFIG_HAVE_KVM
87+
#if IS_ENABLED(CONFIG_KVM)
8888
#define POSTED_INTR_VECTOR 0xf2
8989
#define POSTED_INTR_WAKEUP_VECTOR 0xf1
9090
#define POSTED_INTR_NESTED_VECTOR 0xf0

0 commit comments

Comments
 (0)