drivers: dwc_otg: stop GCC from patching FIQ functions
authorJonathan Bell <jonathan@raspberrypi.com>
Wed, 26 Oct 2022 16:46:44 +0000 (17:46 +0100)
committerPhil Elwell <phil@raspberrypi.com>
Thu, 27 Oct 2022 12:37:13 +0000 (13:37 +0100)
Configuring GCC to use task stack protector canaries means it will
insert calls to check functions in FIQ code. This is bad, as a) the
FIQ's stack is banked and b) the failure invokes __stack_chk_fail which
eventually tries to call printk(). Printing to the console inside the
FIQ is generally fatal.

Add CFLAGS to stop this happening in FIQ code.

Also catch one function where notrace wasn't specified.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
drivers/usb/host/dwc_otg/Makefile
drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c

index 7ea65a6..8cbe3e6 100644 (file)
@@ -28,6 +28,7 @@ ccflags-y     += -DDWC_LINUX
 ccflags-y      += $(CFI)
 ccflags-y      += $(BUS_INTERFACE)
 #ccflags-y     += -DDWC_DEV_SRPCAP
+CFLAGS_dwc_otg_fiq_fsm.o += -fno-stack-protector
 
 obj-$(CONFIG_USB_DWCOTG) += dwc_otg.o
 
index f644acb..67e2778 100644 (file)
@@ -142,7 +142,7 @@ inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) { }
  * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction
  * @channel: channel to re-enable
  */
-static void fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
+static void notrace fiq_fsm_restart_channel(struct fiq_state *st, int n, int force)
 {
        hcchar_data_t hcchar = { .d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCCHAR) };