public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 5.15 25/99] mips: bmips: BCM6358: disable RAC flush for TP1
Date: Mon,  3 Apr 2023 16:08:48 +0200	[thread overview]
Message-ID: <20230403140403.446794619@linuxfoundation.org> (raw)
In-Reply-To: <20230403140356.079638751@linuxfoundation.org>

From: Álvaro Fernández Rojas <noltari@gmail.com>

[ Upstream commit ab327f8acdf8d06601fbf058859a539a9422afff ]

RAC flush causes kernel panics on BCM6358 with EHCI/OHCI when booting from TP1:
[    3.881739] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    3.895011] Reserved instruction in kernel code[#1]:
[    3.900113] CPU: 0 PID: 1 Comm: init Not tainted 5.10.16 #0
[    3.905829] $ 0   : 00000000 10008700 00000000 77d94060
[    3.911238] $ 4   : 7fd1f088 00000000 81431cac 81431ca0
[    3.916641] $ 8   : 00000000 ffffefff 8075cd34 00000000
[    3.922043] $12   : 806f8d40 f3e812b7 00000000 000d9aaa
[    3.927446] $16   : 7fd1f068 7fd1f080 7ff559b8 81428470
[    3.932848] $20   : 00000000 00000000 55590000 77d70000
[    3.938251] $24   : 00000018 00000010
[    3.943655] $28   : 81430000 81431e60 81431f28 800157fc
[    3.949058] Hi    : 00000000
[    3.952013] Lo    : 00000000
[    3.955019] epc   : 80015808 setup_sigcontext+0x54/0x24c
[    3.960464] ra    : 800157fc setup_sigcontext+0x48/0x24c
[    3.965913] Status: 10008703	KERNEL EXL IE
[    3.970216] Cause : 00800028 (ExcCode 0a)
[    3.974340] PrId  : 0002a010 (Broadcom BMIPS4350)
[    3.979170] Modules linked in: ohci_platform ohci_hcd fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug usbcore nls_base usb_common
[    3.992907] Process init (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=77e22ec8)
[    4.000776] Stack : 81431ef4 7fd1f080 81431f28 81428470 7fd1f068 81431edc 7ff559b8 81428470
[    4.009467]         81431f28 7fd1f080 55590000 77d70000 77d5498c 80015c70 806f0000 8063ae74
[    4.018149]         08100002 81431f28 0000000a 08100002 81431f28 0000000a 77d6b418 00000003
[    4.026831]         ffffffff 80016414 80080734 81431ecc 81431ecc 00000001 00000000 04000000
[    4.035512]         77d54874 00000000 00000000 00000000 00000000 00000012 00000002 00000000
[    4.044196]         ...
[    4.046706] Call Trace:
[    4.049238] [<80015808>] setup_sigcontext+0x54/0x24c
[    4.054356] [<80015c70>] setup_frame+0xdc/0x124
[    4.059015] [<80016414>] do_notify_resume+0x1dc/0x288
[    4.064207] [<80011b50>] work_notifysig+0x10/0x18
[    4.069036]
[    4.070538] Code: 8fc300b4  00001025  26240008 <ac820000> ac830004  3c048063  0c0228aa  24846a00  26240010
[    4.080686]
[    4.082517] ---[ end trace 22a8edb41f5f983b ]---
[    4.087374] Kernel panic - not syncing: Fatal exception
[    4.092753] Rebooting in 1 seconds..

Because the bootloader (CFE) is not initializing the Read-ahead cache properly
on the second thread (TP1). Since the RAC was not initialized properly, we
should avoid flushing it at the risk of corrupting the instruction stream as
seen in the trace above.

Fixes: d59098a0e9cb ("MIPS: bmips: use generic dma noncoherent ops")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/mips/bmips/dma.c   | 5 +++++
 arch/mips/bmips/setup.c | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/mips/bmips/dma.c b/arch/mips/bmips/dma.c
index 915ce4b189c15..76c5d8e4d6e2d 100644
--- a/arch/mips/bmips/dma.c
+++ b/arch/mips/bmips/dma.c
@@ -64,6 +64,8 @@ phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dma_addr)
 	return dma_addr;
 }
 
+bool bmips_rac_flush_disable;
+
 void arch_sync_dma_for_cpu_all(void)
 {
 	void __iomem *cbr = BMIPS_GET_CBR();
@@ -74,6 +76,9 @@ void arch_sync_dma_for_cpu_all(void)
 	    boot_cpu_type() != CPU_BMIPS4380)
 		return;
 
+	if (unlikely(bmips_rac_flush_disable))
+		return;
+
 	/* Flush stale data out of the readahead cache */
 	cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
 	__raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
diff --git a/arch/mips/bmips/setup.c b/arch/mips/bmips/setup.c
index 31bcfa4e08b99..45c7cf582348e 100644
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
@@ -34,6 +34,8 @@
 #define REG_BCM6328_OTP		((void __iomem *)CKSEG1ADDR(0x1000062c))
 #define BCM6328_TP1_DISABLED	BIT(9)
 
+extern bool bmips_rac_flush_disable;
+
 static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
 
 struct bmips_quirk {
@@ -103,6 +105,12 @@ static void bcm6358_quirks(void)
 	 * disable SMP for now
 	 */
 	bmips_smp_enabled = 0;
+
+	/*
+	 * RAC flush causes kernel panics on BCM6358 when booting from TP1
+	 * because the bootloader is not initializing it properly.
+	 */
+	bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31));
 }
 
 static void bcm6368_quirks(void)
-- 
2.39.2




  parent reply	other threads:[~2023-04-03 14:31 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 14:08 [PATCH 5.15 00/99] 5.15.106-rc1 review Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 01/99] fsverity: dont drop pagecache at end of FS_IOC_ENABLE_VERITY Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 02/99] usb: dwc3: gadget: move cmd_endtransfer to extra function Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 03/99] usb: dwc3: gadget: Add 1ms delay after end transfer command without IOC Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 04/99] kernel: kcsan: kcsan_test: build without structleak plugin Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 05/99] kcsan: avoid passing -g for test Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 06/99] ksmbd: dont terminate inactive sessions after a few seconds Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 07/99] bus: imx-weim: fix branch condition evaluates to a garbage value Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 08/99] xfrm: Zero padding when dumping algos and encap Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 09/99] ASoC: codecs: tx-macro: Fix for KASAN: slab-out-of-bounds Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 10/99] md: avoid signed overflow in slot_store() Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 11/99] x86/PVH: obtain VGA console info in Dom0 Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 12/99] net: hsr: Dont log netdev_err message on unknown prp dst node Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 13/99] ALSA: asihpi: check pao in control_message() Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 14/99] ALSA: hda/ca0132: fixup buffer overrun at tuning_ctl_set() Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 15/99] fbdev: tgafb: Fix potential divide by zero Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 16/99] sched_getaffinity: dont assume cpumask_size() is fully initialized Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 17/99] fbdev: nvidia: Fix potential divide by zero Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 18/99] fbdev: intelfb: " Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 19/99] fbdev: lxfb: " Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 20/99] fbdev: au1200fb: " Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 21/99] tools/power turbostat: Fix /dev/cpu_dma_latency warnings Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 22/99] tools/power turbostat: fix decoding of HWP_STATUS Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 23/99] tracing: Fix wrong return in kprobe_event_gen_test.c Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 24/99] ca8210: Fix unsigned mac_len comparison with zero in ca8210_skb_tx() Greg Kroah-Hartman
2023-04-03 14:08 ` Greg Kroah-Hartman [this message]
2023-04-03 14:08 ` [PATCH 5.15 26/99] ALSA: usb-audio: Fix recursive locking at XRUN during syncing Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 27/99] platform/x86: think-lmi: add missing type attribute Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 28/99] platform/x86: think-lmi: use correct possible_values delimiters Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 29/99] platform/x86: think-lmi: only display possible_values if available Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 30/99] platform/x86: think-lmi: Add possible_values for ThinkStation Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 31/99] mtd: rawnand: meson: invalidate cache on polling ECC bit Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 32/99] SUNRPC: fix shutdown of NFS TCP client socket Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 33/99] sfc: ef10: dont overwrite offload features at NIC reset Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 34/99] scsi: megaraid_sas: Fix crash after a double completion Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 35/99] scsi: mpt3sas: Dont print sense pool info twice Greg Kroah-Hartman
2023-04-03 14:08 ` [PATCH 5.15 36/99] ptp_qoriq: fix memory leak in probe() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 37/99] net: dsa: microchip: ksz8863_smi: fix bulk access Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 38/99] r8169: fix RTL8168H and RTL8107E rx crc error Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 39/99] regulator: Handle deferred clk Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 40/99] net/net_failover: fix txq exceeding warning Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 41/99] net: stmmac: dont reject VLANs when IFF_PROMISC is set Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 42/99] drm/i915/tc: Fix the ICL PHY ownership check in TC-cold state Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 43/99] platform/x86/intel/pmc: Alder Lake PCH slp_s0_residency fix Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 44/99] can: bcm: bcm_tx_setup(): fix KMSAN uninit-value in vfs_write Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 45/99] s390/vfio-ap: fix memory leak in vfio_ap device driver Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 46/99] loop: suppress uevents while reconfiguring the device Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 47/99] loop: LOOP_CONFIGURE: send uevents for partitions Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 48/99] net: mvpp2: classifier flow fix fragmentation flags Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 49/99] net: mvpp2: parser fix QinQ Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 50/99] net: mvpp2: parser fix PPPoE Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 51/99] smsc911x: avoid PHY being resumed when interface is not up Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 52/99] ice: add profile conflict check for AVF FDIR Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 53/99] ice: fix invalid check for empty list in ice_sched_assoc_vsi_to_agg() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 54/99] ALSA: ymfpci: Create card with device-managed snd_devm_card_new() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 55/99] ALSA: ymfpci: Fix BUG_ON in probe function Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 56/99] net: ipa: compute DMA pool size properly Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 57/99] i40e: fix registers dump after run ethtool adapter self test Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 58/99] bnxt_en: Fix reporting of test result in ethtool selftest Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 59/99] bnxt_en: Fix typo in PCI id to device description string mapping Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 60/99] bnxt_en: Add missing 200G link speed reporting Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 61/99] net: dsa: mv88e6xxx: Enable IGMP snooping on user ports only Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 62/99] net: ethernet: mtk_eth_soc: fix flow block refcounting logic Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 63/99] pinctrl: ocelot: Fix alt mode for ocelot Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 64/99] iommu/vt-d: Allow zero SAGAW if second-stage not supported Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 65/99] Input: alps - fix compatibility with -funsigned-char Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 66/99] Input: focaltech - use explicitly signed char type Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 67/99] cifs: prevent infinite recursion in CIFSGetDFSRefer() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 68/99] cifs: fix DFS traversal oops without CONFIG_CIFS_DFS_UPCALL Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 69/99] Input: goodix - add Lenovo Yoga Book X90F to nine_bytes_report DMI table Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 70/99] btrfs: fix race between quota disable and quota assign ioctls Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 71/99] btrfs: scan device in non-exclusive mode Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 72/99] zonefs: Always invalidate last cached page on append write Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 73/99] can: j1939: prevent deadlock by moving j1939_sk_errqueue() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 74/99] xen/netback: dont do grant copy across page boundary Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 75/99] net: phy: dp83869: fix default value for tx-/rx-internal-delay Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 76/99] pinctrl: amd: Disable and mask interrupts on resume Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 77/99] pinctrl: at91-pio4: fix domain name assignment Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 78/99] powerpc: Dont try to copy PPR for task with NULL pt_regs Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 79/99] NFSv4: Fix hangs when recovering open state after a server reboot Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 80/99] ALSA: hda/conexant: Partial revert of a quirk for Lenovo Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 81/99] ALSA: usb-audio: Fix regression on detection of Roland VS-100 Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 82/99] ALSA: hda/realtek: Add quirks for some Clevo laptops Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 83/99] ALSA: hda/realtek: Add quirk for Lenovo ZhaoYang CF4620Z Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 84/99] xtensa: fix KASAN report for show_stack Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 85/99] rcu: Fix rcu_torture_read ftrace event Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 86/99] drm/etnaviv: fix reference leak when mmaping imported buffer Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 87/99] drm/amd/display: Add DSC Support for Synaptics Cascaded MST Hub Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 88/99] KVM: arm64: Disable interrupts while walking userspace PTs Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 89/99] s390/uaccess: add missing earlyclobber annotations to __clear_user() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 90/99] KVM: VMX: Move preemption timer <=> hrtimer dance to common x86 Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 91/99] KVM: x86: Inject #GP on x2APIC WRMSR that sets reserved bits 63:32 Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 92/99] KVM: x86: Purge "highest ISR" cache when updating APICv state Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 93/99] zonefs: Fix error message in zonefs_file_dio_append() Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 94/99] selftests/bpf: Test btf dump for struct with padding only fields Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 95/99] libbpf: Fix BTF-to-C converters padding logic Greg Kroah-Hartman
2023-04-03 14:09 ` [PATCH 5.15 96/99] selftests/bpf: Add few corner cases to test padding handling of btf_dump Greg Kroah-Hartman
2023-04-03 14:10 ` [PATCH 5.15 97/99] libbpf: Fix btf_dumps packed struct determination Greg Kroah-Hartman
2023-04-03 14:10 ` [PATCH 5.15 98/99] hsr: ratelimit only when errors are printed Greg Kroah-Hartman
2023-04-03 14:10 ` [PATCH 5.15 99/99] x86/PVH: avoid 32-bit build warning when obtaining VGA console info Greg Kroah-Hartman
2023-04-03 22:59 ` [PATCH 5.15 00/99] 5.15.106-rc1 review Shuah Khan
2023-04-04  2:06 ` Florian Fainelli
2023-04-04  2:41 ` Bagas Sanjaya
2023-04-04 10:05 ` Naresh Kamboju
2023-04-04 10:55 ` Chris Paterson
2023-04-04 21:21 ` Guenter Roeck
2023-04-05  6:08 ` Harshit Mogalapalli
2023-04-05  8:49 ` Ron Economos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230403140403.446794619@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=noltari@gmail.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox