Skip to content

Commit

Permalink
apic: fix kvm build on UP without IOAPIC
Browse files Browse the repository at this point in the history
On UP i386, when APIC is disabled
# CONFIG_X86_UP_APIC is not set
# CONFIG_PCI_IOAPIC is not set

code looking at apicdrivers never has any effect but it
still gets compiled in. In particular, this causes
build failures with kvm, but it generally bloats the kernel
unnecessarily.

Fix by defining both __apicdrivers and __apicdrivers_end
to be NULL when CONFIG_X86_LOCAL_APIC is unset: I verified
that as the result any loop scanning __apicdrivers gets optimized out by
the compiler.

Warning: a .config with apic disabled doesn't seem to boot
for me (even without this patch). Still verifying why,
meanwhile this patch is compile-tested only.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: Randy Dunlap <rdunlap@xenotime.net>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
  • Loading branch information
Michael S. Tsirkin authored and Marcelo Tosatti committed Jul 3, 2012
1 parent ae7a2a3 commit f9808b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/x86/include/asm/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,12 @@ extern struct apic *apic;
__aligned(sizeof(struct apic *)) \
__section(.apicdrivers) = { &sym1, &sym2 }

#ifdef CONFIG_X86_LOCAL_APIC
extern struct apic *__apicdrivers[], *__apicdrivers_end[];
#else
#define __apicdrivers ((struct apic **)NULL)
#define __apicdrivers_end ((struct apic **)NULL)
#endif

/*
* APIC functionality to boot other CPUs - only used on SMP:
Expand Down

0 comments on commit f9808b7

Please sign in to comment.