Skip to content

Commit

Permalink
merged to source
Browse files Browse the repository at this point in the history
  • Loading branch information
glblduh committed Dec 10, 2022
2 parents f83514e + a562178 commit 0e4bc05
Show file tree
Hide file tree
Showing 77 changed files with 579 additions and 235 deletions.
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 334
SUBLEVEL = 335
EXTRAVERSION =
NAME = Roaring Lionus

Expand Down Expand Up @@ -364,8 +364,8 @@ STRIP = llvm-strip
else
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
AR ?= $(CROSS_COMPILE)ar
NM ?= $(CROSS_COMPILE)nm
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump
READELF = $(CROSS_COMPILE)readelf
Expand Down Expand Up @@ -418,7 +418,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar \
-Werror-implicit-function-declaration \
-Wno-format-security \
-Wno-format-security -Wno-void-ptr-dereference \
-std=gnu11
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_AFLAGS_KERNEL :=
Expand Down Expand Up @@ -683,6 +683,22 @@ export LLVM_AR LLVM_DIS
KBUILD_LDFLAGS += --plugin-opt=O3
endif

ifdef CONFIG_LTO_GCC
LTO_CFLAGS := -flto -flto=jobserver -fipa-pta -fno-fat-lto-objects \
-fuse-linker-plugin -fwhole-program
KBUILD_CFLAGS += $(LTO_CFLAGS) --param=max-inline-insns-auto=1000
LTO_LDFLAGS := $(LTO_CFLAGS) -Wno-lto-type-mismatch -Wno-psabi \
-Wno-stringop-overflow -flinker-output=nolto-rel
LDFINAL := $(CONFIG_SHELL) $(srctree)/scripts/gcc-ld $(LTO_LDFLAGS)
AR := $(CROSS_COMPILE)gcc-ar
NM := $(CROSS_COMPILE)gcc-nm
DISABLE_LTO := -fno-lto
export DISABLE_LTO LDFINAL
else
LDFINAL := $(LD)
export LDFINAL
endif

# The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default
# values of the respective KBUILD_* variables
ARCH_CPPFLAGS :=
Expand Down Expand Up @@ -780,8 +796,10 @@ endif
ifeq ($(cc-name),clang)
KBUILD_CFLAGS += -mcpu=cortex-a55 -mtune=cortex-a55
else
ifndef CONFIG_LTO_GCC
KBUILD_CFLAGS += -mcpu=cortex-a75.cortex-a55 -mtune=cortex-a75.cortex-a55
endif
endif

ifdef CONFIG_CC_WERROR
KBUILD_CFLAGS += -Werror
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/boot/dts/at91sam9g20ek_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@

};

usb1 {
pinctrl_usb1_vbus_gpio: usb1_vbus_gpio {
atmel,pins =
<AT91_PIOC 5 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PC5 GPIO */
};
};

mmc0_slot1 {
pinctrl_board_mmc0_slot1: mmc0_slot1-board {
atmel,pins =
Expand Down Expand Up @@ -72,6 +79,8 @@
};

usb1: gadget@fffa4000 {
pinctrl-0 = <&pinctrl_usb1_vbus_gpio>;
pinctrl-names = "default";
atmel,vbus-gpio = <&pioC 5 GPIO_ACTIVE_HIGH>;
status = "okay";
};
Expand Down
4 changes: 3 additions & 1 deletion arch/arm/mach-mxs/mach-mxs.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ static void __init mxs_machine_init(void)

root = of_find_node_by_path("/");
ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
if (ret)
if (ret) {
kfree(soc_dev_attr);
return;
}

soc_dev_attr->family = "Freescale MXS Family";
soc_dev_attr->soc_id = mxs_get_soc_id();
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/configs/jd2019_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ CONFIG_BUILD_ARM64_DT_OVERLAY=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_COMPAT=y
CONFIG_COMPAT_VDSO=y
CONFIG_SUSPEND_SKIP_SYNC=y
CONFIG_PM_AUTOSLEEP=y
CONFIG_PM_WAKELOCKS=y
CONFIG_PM_WAKELOCKS_LIMIT=0
Expand Down
1 change: 0 additions & 1 deletion arch/arm64/configs/kunlun2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ CONFIG_BUILD_ARM64_DT_OVERLAY=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_COMPAT=y
CONFIG_COMPAT_VDSO=y
CONFIG_SUSPEND_SKIP_SYNC=y
CONFIG_PM_AUTOSLEEP=y
CONFIG_PM_WAKELOCKS=y
CONFIG_PM_WAKELOCKS_LIMIT=0
Expand Down
25 changes: 18 additions & 7 deletions arch/arm64/kernel/cpu_errata.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ static void __install_bp_hardening_cb(bp_hardening_cb_t fn,
__copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end);
}

__this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
__this_cpu_write(bp_hardening_data.fn, fn);
__this_cpu_write(bp_hardening_data.template_start, hyp_vecs_start);
__hardenbp_enab = true;
if (fn != __this_cpu_read(bp_hardening_data.fn)) {
__this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
__this_cpu_write(bp_hardening_data.fn, fn);
__this_cpu_write(bp_hardening_data.template_start, hyp_vecs_start);
__hardenbp_enab = true;
}
spin_unlock(&bp_lock);
}
#else
Expand Down Expand Up @@ -856,8 +858,11 @@ static void kvm_setup_bhb_slot(const char *hyp_vecs_start)
__copy_hyp_vect_bpi(slot, hyp_vecs_start, hyp_vecs_end);
}

__this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
__this_cpu_write(bp_hardening_data.template_start, hyp_vecs_start);
if (hyp_vecs_start != __this_cpu_read(bp_hardening_data.template_start)) {
__this_cpu_write(bp_hardening_data.hyp_vectors_slot, slot);
__this_cpu_write(bp_hardening_data.template_start,
hyp_vecs_start);
}
spin_unlock(&bp_lock);
}
#else
Expand Down Expand Up @@ -899,7 +904,13 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
} else if (spectre_bhb_loop_affected(SCOPE_LOCAL_CPU)) {
switch (spectre_bhb_loop_affected(SCOPE_SYSTEM)) {
case 8:
kvm_setup_bhb_slot(__spectre_bhb_loop_k8_start);
/*
* A57/A72-r0 will already have selected the
* spectre-indirect vector, which is sufficient
* for BHB too.
*/
if (!__this_cpu_read(bp_hardening_data.fn))
kvm_setup_bhb_slot(__spectre_bhb_loop_k8_start);
break;
case 24:
kvm_setup_bhb_slot(__spectre_bhb_loop_k24_start);
Expand Down
31 changes: 26 additions & 5 deletions arch/arm64/kernel/vdso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,31 @@
# Heavily based on the vDSO Makefiles for other archs.
#

obj-vdso := note.o sigreturn.o vgettimeofday.o
obj-vdso-s := note.o sigreturn.o
obj-vdso-c := vgettimeofday.o

# Build rules
targets := $(obj-vdso) vdso.so vdso.so.dbg
obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
targets := $(obj-vdso-s) $(obj-vdso-c) vdso.so vdso.so.dbg
obj-vdso-s := $(addprefix $(obj)/, $(obj-vdso-s))
obj-vdso-c := $(addprefix $(obj)/, $(obj-vdso-c))
obj-vdso := $(obj-vdso-c) $(obj-vdso-s)

ldflags-y := -shared -soname=linux-vdso.so.1 --hash-style=sysv \
-Bsymbolic --build-id=sha1 -n -T

ccflags-y += $(call cc-option, -fno-whole-program)
ccflags-y := -fno-common -fno-builtin -fno-stack-protector
ccflags-y += -DDISABLE_BRANCH_PROFILING -ffixed-x18
ccflags-y += $(DISABLE_LTO) $(DISABLE_SCS)
ccflags-y += $(DISABLE_SCS)

# Force -O2 to avoid libgcc dependencies
CFLAGS_REMOVE_vgettimeofday.o = -pg -Os
CFLAGS_vgettimeofday.o = -O2 -fPIC -mcmodel=tiny
CFLAGS_vgettimeofday.o = -O2 -fPIC
ifneq ($(cc-name),clang)
CFLAGS_vgettimeofday.o += -mcmodel=tiny
else
ccflags-y += $(DISABLE_LTO)
endif

# Disable gcov profiling for VDSO code
GCOV_PROFILE := n
Expand Down Expand Up @@ -53,6 +61,19 @@ quiet_cmd_vdsosym = VDSOSYM $@
include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
$(call if_changed,vdsosym)

# Assembly rules for the .S files
$(obj-vdso-s): %.o: %.S FORCE
$(call if_changed_dep,vdsoas)

$(obj-vdso-c): %.o: %.c FORCE
$(call if_changed_dep,vdsocc)

# Actual build commands
quiet_cmd_vdsocc = VDSOC $@
cmd_vdsocc = ${CC} $(c_flags) -c -o $@ $<
quiet_cmd_vdsoas = VDSOA $@
cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $<

# Install commands for the unstripped file
quiet_cmd_vdso_install = INSTALL $@
cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/include/asm/fw/fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ extern char *fw_getcmdline(void);
extern void fw_meminit(void);
extern char *fw_getenv(char *name);
extern unsigned long fw_getenvl(char *name);
extern void fw_init_early_console(char port);
extern void fw_init_early_console(void);

#endif /* __ASM_FW_H_ */
13 changes: 6 additions & 7 deletions arch/mips/pic32/pic32mzda/early_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#define U_BRG(x) (UART_BASE(x) + 0x40)

static void __iomem *uart_base;
static char console_port = -1;
static int console_port = -1;

static int __init configure_uart_pins(int port)
{
Expand All @@ -54,7 +54,7 @@ static int __init configure_uart_pins(int port)
return 0;
}

static void __init configure_uart(char port, int baud)
static void __init configure_uart(int port, int baud)
{
u32 pbclk;

Expand All @@ -67,7 +67,7 @@ static void __init configure_uart(char port, int baud)
uart_base + PIC32_SET(U_STA(port)));
}

static void __init setup_early_console(char port, int baud)
static void __init setup_early_console(int port, int baud)
{
if (configure_uart_pins(port))
return;
Expand Down Expand Up @@ -137,16 +137,15 @@ static int __init get_baud_from_cmdline(char *arch_cmdline)
return baud;
}

void __init fw_init_early_console(char port)
void __init fw_init_early_console(void)
{
char *arch_cmdline = pic32_getcmdline();
int baud = -1;
int baud, port;

uart_base = ioremap_nocache(PIC32_BASE_UART, 0xc00);

baud = get_baud_from_cmdline(arch_cmdline);
if (port == -1)
port = get_port_from_cmdline(arch_cmdline);
port = get_port_from_cmdline(arch_cmdline);

if (port == -1)
port = EARLY_CONSOLE_PORT;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/pic32/pic32mzda/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void __init plat_mem_setup(void)
strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);

#ifdef CONFIG_EARLY_PRINTK
fw_init_early_console(-1);
fw_init_early_console();
#endif
pic32_config_init();
}
Expand Down
2 changes: 1 addition & 1 deletion arch/nios2/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
$(call if_changed,gzip)

$(obj)/vmImage: $(obj)/vmlinux.gz
$(obj)/vmImage: $(obj)/vmlinux.gz FORCE
$(call if_changed,uimage)
@$(kecho) 'Kernel: $@ is ready'

Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/crash_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct save_area {
u64 fprs[16];
u32 fpc;
u32 prefix;
u64 todpreg;
u32 todpreg;
u64 timer;
u64 todcmp;
u64 vxrs_low[16];
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/cpufeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
#define X86_FEATURE_FENCE_SWAPGS_KERNEL ( 7*32+11) /* "" LFENCE in kernel entry SWAPGS path */
#define X86_FEATURE_RETPOLINE ( 7*32+12) /* "" Generic Retpoline mitigation for Spectre variant 2 */
#define X86_FEATURE_RETPOLINE_LFENCE ( 7*32+13) /* "" Use LFENCE for Spectre variant 2 */
#define X86_FEATURE_MSR_TSX_CTRL ( 7*32+14) /* "" MSR IA32_TSX_CTRL (Intel) implemented */

#define X86_FEATURE_MSR_SPEC_CTRL ( 7*32+16) /* "" MSR SPEC_CTRL is implemented */
#define X86_FEATURE_SSBD ( 7*32+17) /* Speculative Store Bypass Disable */
Expand Down
33 changes: 14 additions & 19 deletions arch/x86/kernel/cpu/tsx.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,6 @@ void tsx_enable(void)
wrmsrl(MSR_IA32_TSX_CTRL, tsx);
}

static bool __init tsx_ctrl_is_supported(void)
{
u64 ia32_cap = x86_read_arch_cap_msr();

/*
* TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this
* MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES.
*
* TSX control (aka MSR_IA32_TSX_CTRL) is only available after a
* microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES
* bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get
* MSR_IA32_TSX_CTRL support even after a microcode update. Thus,
* tsx= cmdline requests will do nothing on CPUs without
* MSR_IA32_TSX_CTRL support.
*/
return !!(ia32_cap & ARCH_CAP_TSX_CTRL_MSR);
}

static enum tsx_ctrl_states x86_get_tsx_auto_mode(void)
{
if (boot_cpu_has_bug(X86_BUG_TAA))
Expand All @@ -86,9 +68,22 @@ void __init tsx_init(void)
char arg[5] = {};
int ret;

if (!tsx_ctrl_is_supported())
/*
* TSX is controlled via MSR_IA32_TSX_CTRL. However, support for this
* MSR is enumerated by ARCH_CAP_TSX_MSR bit in MSR_IA32_ARCH_CAPABILITIES.
*
* TSX control (aka MSR_IA32_TSX_CTRL) is only available after a
* microcode update on CPUs that have their MSR_IA32_ARCH_CAPABILITIES
* bit MDS_NO=1. CPUs with MDS_NO=0 are not planned to get
* MSR_IA32_TSX_CTRL support even after a microcode update. Thus,
* tsx= cmdline requests will do nothing on CPUs without
* MSR_IA32_TSX_CTRL support.
*/
if (!(x86_read_arch_cap_msr() & ARCH_CAP_TSX_CTRL_MSR))
return;

setup_force_cpu_cap(X86_FEATURE_MSR_TSX_CTRL);

ret = cmdline_find_option(boot_command_line, "tsx", arg, sizeof(arg));
if (ret >= 0) {
if (!strcmp(arg, "on")) {
Expand Down
8 changes: 7 additions & 1 deletion arch/x86/mm/ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,15 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
* Mappings have to be page-aligned
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PHYSICAL_PAGE_MASK;
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr+1) - phys_addr;

/*
* Mask out any bits not part of the actual physical
* address, like memory encryption bits.
*/
phys_addr &= PHYSICAL_PAGE_MASK;

retval = reserve_memtype(phys_addr, (u64)phys_addr + size,
pcm, &new_pcm);
if (retval) {
Expand Down
Loading

0 comments on commit 0e4bc05

Please sign in to comment.