f017549ee5726b0f8a57ba49b0ff269ce389e86b
[openwrt/staging/ansuel.git] /
1 From 63c794845de126d36d75c7d992fa2e5221651b1b Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Wed, 26 Oct 2022 17:46:44 +0100
4 Subject: [PATCH] drivers: dwc_otg: stop GCC from patching FIQ
5 functions
6
7 Configuring GCC to use task stack protector canaries means it will
8 insert calls to check functions in FIQ code. This is bad, as a) the
9 FIQ's stack is banked and b) the failure invokes __stack_chk_fail which
10 eventually tries to call printk(). Printing to the console inside the
11 FIQ is generally fatal.
12
13 Add CFLAGS to stop this happening in FIQ code.
14
15 Also catch one function where notrace wasn't specified.
16
17 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
18 ---
19 drivers/usb/host/dwc_otg/Makefile | 1 +
20 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 2 +-
21 2 files changed, 2 insertions(+), 1 deletion(-)
22
23 --- a/drivers/usb/host/dwc_otg/Makefile
24 +++ b/drivers/usb/host/dwc_otg/Makefile
25 @@ -28,6 +28,7 @@ ccflags-y += -DDWC_LINUX
26 ccflags-y += $(CFI)
27 ccflags-y += $(BUS_INTERFACE)
28 #ccflags-y += -DDWC_DEV_SRPCAP
29 +CFLAGS_dwc_otg_fiq_fsm.o += -fno-stack-protector
30
31 obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o
32
33 --- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
34 +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
35 @@ -142,7 +142,7 @@ inline void fiq_fsm_spin_unlock(fiq_lock
36 * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction
37 * @channel: channel to re-enable
38 */
39 -static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
40 +static void notrace fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
41 {
42 hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) };
43