Skip to content

Commit 9521778

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "A KVM guest fix, and a kdump kernel relocation errors fix" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/timer: Force PIT initialization when !X86_FEATURE_ARAT x86/purgatory: Change compiler flags from -mcmodel=kernel to -mcmodel=large to fix kexec relocation errors
2 parents ad32b48 + afa8b47 commit 9521778

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

arch/x86/kernel/apic/apic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,10 @@ bool __init apic_needs_pit(void)
834834
if (!boot_cpu_has(X86_FEATURE_APIC))
835835
return true;
836836

837+
/* Virt guests may lack ARAT, but still have DEADLINE */
838+
if (!boot_cpu_has(X86_FEATURE_ARAT))
839+
return true;
840+
837841
/* Deadline timer is based on TSC so no further PIT action required */
838842
if (boot_cpu_has(X86_FEATURE_TSC_DEADLINE_TIMER))
839843
return false;

arch/x86/purgatory/Makefile

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,40 @@ targets += purgatory.ro
1818
KASAN_SANITIZE := n
1919
KCOV_INSTRUMENT := n
2020

21+
# These are adjustments to the compiler flags used for objects that
22+
# make up the standalone purgatory.ro
23+
24+
PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
25+
PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss
26+
2127
# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
2228
# in turn leaves some undefined symbols like __fentry__ in purgatory and not
2329
# sure how to relocate those.
2430
ifdef CONFIG_FUNCTION_TRACER
25-
CFLAGS_REMOVE_sha256.o += $(CC_FLAGS_FTRACE)
26-
CFLAGS_REMOVE_purgatory.o += $(CC_FLAGS_FTRACE)
27-
CFLAGS_REMOVE_string.o += $(CC_FLAGS_FTRACE)
28-
CFLAGS_REMOVE_kexec-purgatory.o += $(CC_FLAGS_FTRACE)
31+
PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_FTRACE)
2932
endif
3033

3134
ifdef CONFIG_STACKPROTECTOR
32-
CFLAGS_REMOVE_sha256.o += -fstack-protector
33-
CFLAGS_REMOVE_purgatory.o += -fstack-protector
34-
CFLAGS_REMOVE_string.o += -fstack-protector
35-
CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector
35+
PURGATORY_CFLAGS_REMOVE += -fstack-protector
3636
endif
3737

3838
ifdef CONFIG_STACKPROTECTOR_STRONG
39-
CFLAGS_REMOVE_sha256.o += -fstack-protector-strong
40-
CFLAGS_REMOVE_purgatory.o += -fstack-protector-strong
41-
CFLAGS_REMOVE_string.o += -fstack-protector-strong
42-
CFLAGS_REMOVE_kexec-purgatory.o += -fstack-protector-strong
39+
PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong
4340
endif
4441

4542
ifdef CONFIG_RETPOLINE
46-
CFLAGS_REMOVE_sha256.o += $(RETPOLINE_CFLAGS)
47-
CFLAGS_REMOVE_purgatory.o += $(RETPOLINE_CFLAGS)
48-
CFLAGS_REMOVE_string.o += $(RETPOLINE_CFLAGS)
49-
CFLAGS_REMOVE_kexec-purgatory.o += $(RETPOLINE_CFLAGS)
43+
PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS)
5044
endif
5145

46+
CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE)
47+
CFLAGS_purgatory.o += $(PURGATORY_CFLAGS)
48+
49+
CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE)
50+
CFLAGS_sha256.o += $(PURGATORY_CFLAGS)
51+
52+
CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE)
53+
CFLAGS_string.o += $(PURGATORY_CFLAGS)
54+
5255
$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
5356
$(call if_changed,ld)
5457

0 commit comments

Comments
 (0)