From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Paul Burton <paul.burton@imgtec.com>,
linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.9 54/72] MIPS: traps: Ensure L1 & L2 ECC checking match for CM3 systems
Date: Sun, 19 Nov 2017 15:38:58 +0100 [thread overview]
Message-ID: <20171119143534.588743686@linuxfoundation.org> (raw)
In-Reply-To: <20171119143532.376035495@linuxfoundation.org>
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <paul.burton@imgtec.com>
[ Upstream commit 35e6de38858f59b6b65dcfeaf700b5d06fc2b93d ]
On systems with CM3, we must ensure that the L1 & L2 ECC enables are set
to the same value. This is presumed by the hardware & cache corruption
can occur when it is not the case. Support enabling & disabling the L2
ECC checking on CM3 systems where this is controlled via a GCR, and
ensure that it matches the state of L1 ECC checking. Remove I6400 from
the switch statement it will no longer hit, and which was incorrect
since the L2 ECC enable bit isn't in the CP0 ErrCtl register.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14413/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/mips/include/asm/mips-cm.h | 7 ++++
arch/mips/kernel/traps.c | 63 ++++++++++++++++++++++++++++++++++++++--
2 files changed, 67 insertions(+), 3 deletions(-)
--- a/arch/mips/include/asm/mips-cm.h
+++ b/arch/mips/include/asm/mips-cm.h
@@ -187,6 +187,7 @@ BUILD_CM_R_(config, MIPS_CM_GCB_OFS + 0
BUILD_CM_RW(base, MIPS_CM_GCB_OFS + 0x08)
BUILD_CM_RW(access, MIPS_CM_GCB_OFS + 0x20)
BUILD_CM_R_(rev, MIPS_CM_GCB_OFS + 0x30)
+BUILD_CM_RW(err_control, MIPS_CM_GCB_OFS + 0x38)
BUILD_CM_RW(error_mask, MIPS_CM_GCB_OFS + 0x40)
BUILD_CM_RW(error_cause, MIPS_CM_GCB_OFS + 0x48)
BUILD_CM_RW(error_addr, MIPS_CM_GCB_OFS + 0x50)
@@ -266,6 +267,12 @@ BUILD_CM_Cx_R_(tcid_8_priority, 0x80)
#define CM_REV_CM2_5 CM_ENCODE_REV(7, 0)
#define CM_REV_CM3 CM_ENCODE_REV(8, 0)
+/* GCR_ERR_CONTROL register fields */
+#define CM_GCR_ERR_CONTROL_L2_ECC_EN_SHF 1
+#define CM_GCR_ERR_CONTROL_L2_ECC_EN_MSK (_ULCAST_(0x1) << 1)
+#define CM_GCR_ERR_CONTROL_L2_ECC_SUPPORT_SHF 0
+#define CM_GCR_ERR_CONTROL_L2_ECC_SUPPORT_MSK (_ULCAST_(0x1) << 0)
+
/* GCR_ERROR_CAUSE register fields */
#define CM_GCR_ERROR_CAUSE_ERRTYPE_SHF 27
#define CM_GCR_ERROR_CAUSE_ERRTYPE_MSK (_ULCAST_(0x1f) << 27)
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -51,6 +51,7 @@
#include <asm/idle.h>
#include <asm/mips-cm.h>
#include <asm/mips-r2-to-r6-emul.h>
+#include <asm/mips-cm.h>
#include <asm/mipsregs.h>
#include <asm/mipsmtregs.h>
#include <asm/module.h>
@@ -1646,6 +1647,65 @@ __setup("nol2par", nol2parity);
*/
static inline void parity_protection_init(void)
{
+#define ERRCTL_PE 0x80000000
+#define ERRCTL_L2P 0x00800000
+
+ if (mips_cm_revision() >= CM_REV_CM3) {
+ ulong gcr_ectl, cp0_ectl;
+
+ /*
+ * With CM3 systems we need to ensure that the L1 & L2
+ * parity enables are set to the same value, since this
+ * is presumed by the hardware engineers.
+ *
+ * If the user disabled either of L1 or L2 ECC checking,
+ * disable both.
+ */
+ l1parity &= l2parity;
+ l2parity &= l1parity;
+
+ /* Probe L1 ECC support */
+ cp0_ectl = read_c0_ecc();
+ write_c0_ecc(cp0_ectl | ERRCTL_PE);
+ back_to_back_c0_hazard();
+ cp0_ectl = read_c0_ecc();
+
+ /* Probe L2 ECC support */
+ gcr_ectl = read_gcr_err_control();
+
+ if (!(gcr_ectl & CM_GCR_ERR_CONTROL_L2_ECC_SUPPORT_MSK) ||
+ !(cp0_ectl & ERRCTL_PE)) {
+ /*
+ * One of L1 or L2 ECC checking isn't supported,
+ * so we cannot enable either.
+ */
+ l1parity = l2parity = 0;
+ }
+
+ /* Configure L1 ECC checking */
+ if (l1parity)
+ cp0_ectl |= ERRCTL_PE;
+ else
+ cp0_ectl &= ~ERRCTL_PE;
+ write_c0_ecc(cp0_ectl);
+ back_to_back_c0_hazard();
+ WARN_ON(!!(read_c0_ecc() & ERRCTL_PE) != l1parity);
+
+ /* Configure L2 ECC checking */
+ if (l2parity)
+ gcr_ectl |= CM_GCR_ERR_CONTROL_L2_ECC_EN_MSK;
+ else
+ gcr_ectl &= ~CM_GCR_ERR_CONTROL_L2_ECC_EN_MSK;
+ write_gcr_err_control(gcr_ectl);
+ gcr_ectl = read_gcr_err_control();
+ gcr_ectl &= CM_GCR_ERR_CONTROL_L2_ECC_EN_MSK;
+ WARN_ON(!!gcr_ectl != l2parity);
+
+ pr_info("Cache parity protection %sabled\n",
+ l1parity ? "en" : "dis");
+ return;
+ }
+
switch (current_cpu_type()) {
case CPU_24K:
case CPU_34K:
@@ -1656,11 +1716,8 @@ static inline void parity_protection_ini
case CPU_PROAPTIV:
case CPU_P5600:
case CPU_QEMU_GENERIC:
- case CPU_I6400:
case CPU_P6600:
{
-#define ERRCTL_PE 0x80000000
-#define ERRCTL_L2P 0x00800000
unsigned long errctl;
unsigned int l1parity_present, l2parity_present;
next prev parent reply other threads:[~2017-11-19 14:41 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-19 14:38 [PATCH 4.9 00/72] 4.9.64-stable review Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 01/72] media: imon: Fix null-ptr-deref in imon_probe Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 02/72] media: dib0700: fix invalid dvb_detach argument Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 03/72] [PATCH -stable] arm: crypto: reduce priority of bit-sliced AES cipher Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 04/72] Bluetooth: btusb: fix QCA Rome suspend/resume Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 05/72] extcon: Remove potential problem when calling extcon_register_notifier() Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 06/72] extcon: palmas: Check the parent instance to prevent the NULL Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 07/72] fm10k: request reset when mbx->state changes Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 08/72] ARM: dts: Fix compatible for ti81xx uarts for 8250 Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 09/72] ARM: dts: Fix am335x and dm814x scm syscon to probe children Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 10/72] ARM: OMAP2+: Fix init for multiple quirks for the same SoC Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 11/72] ARM: dts: Fix omap3 off mode pull defines Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 12/72] ARM: dts: omap5-uevm: Allow bootloader to configure USB Ethernet MAC Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 13/72] ata: ATA_BMDMA should depend on HAS_DMA Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 14/72] ata: SATA_HIGHBANK " Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 15/72] ata: SATA_MV " Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 16/72] drm/sti: sti_vtg: Handle return NULL error from devm_ioremap_nocache Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 17/72] igb: reset the PHY before reading the PHY ID Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 18/72] igb: close/suspend race in netif_device_detach Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 19/72] igb: Fix hw_dbg logging in igb_update_flash_i210 Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 20/72] scsi: ufs-qcom: Fix module autoload Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 21/72] scsi: ufs: add capability to keep auto bkops always enabled Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 22/72] tcp: provide timestamps for partial writes Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 23/72] staging: rtl8188eu: fix incorrect ERROR tags from logs Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 24/72] x86/irq, trace: Add __irq_entry annotation to x86s platform IRQ handlers Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 25/72] scsi: lpfc: Add missing memory barrier Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 26/72] scsi: lpfc: FCoE VPort enable-disable does not bring up the VPort Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 27/72] scsi: lpfc: Correct host name in symbolic_name field Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 28/72] scsi: lpfc: Correct issue leading to oops during link reset Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 29/72] scsi: lpfc: Clear the VendorVersion in the PLOGI/PLOGI ACC payload Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 30/72] rtc: rx8010: change lock mechanism Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 31/72] power: supply: axp288_fuel_gauge: Read 15 bit values 2 registers at a time Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 32/72] power: supply: axp288_fuel_gauge: Read 12 " Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 33/72] ALSA: vx: Dont try to update capture stream before running Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 34/72] ALSA: vx: Fix possible transfer overflow Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 35/72] drm/omap: panel-sony-acx565akm.c: Add MODULE_ALIAS Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 37/72] backlight: adp5520: Fix error handling in adp5520_bl_probe() Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 38/72] gpu: drm: mgag200: mgag200_main:- Handle error from pci_iomap Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 39/72] ALSA: hda/realtek - Add new codec ID ALC299 Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 40/72] arm64: dts: NS2: reserve memory for Nitro firmware Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 41/72] ixgbe: Configure advertised speeds correctly for KR/KX backplane Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 42/72] ixgbe: fix AER error handling Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 43/72] ixgbe: handle close/suspend race with netif_device_detach/present Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 44/72] ixgbe: Fix reporting of 100Mb capability Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 45/72] ixgbe: Reduce I2C retry count on X550 devices Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 46/72] ixgbe: add mask for 64 RSS queues Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 47/72] ixgbe: do not disable FEC from the driver Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 48/72] staging: rtl8712: fixed little endian problem Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 49/72] staging: wilc1000: Fix endian sparse warning Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 50/72] staging: greybus: add host device function pointer checks Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 51/72] MIPS: End asm function prologue macros with .insn Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 52/72] MIPS: init: Ensure bootmem does not corrupt reserved memory Greg Kroah-Hartman
2017-11-19 14:38 ` [PATCH 4.9 53/72] MIPS: init: Ensure reserved memory regions are not added to bootmem Greg Kroah-Hartman
2017-11-19 14:38 ` Greg Kroah-Hartman [this message]
2017-11-19 14:39 ` [PATCH 4.9 56/72] Revert "crypto: xts - Add ECB dependency" Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 57/72] Revert "uapi: fix linux/rds.h userspace compilation errors" Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 58/72] uapi: fix linux/rds.h userspace compilation error Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 59/72] uapi: fix linux/rds.h userspace compilation errors Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 60/72] Revert "dt-bindings: Add vendor prefix for LEGO" Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 61/72] Revert "dt-bindings: Add LEGO MINDSTORMS EV3 compatible specification" Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 62/72] crypto: dh - Dont permit p to be 0 Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 63/72] crypto: dh - Dont permit key or g size longer than p Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 64/72] USB: usbfs: compute urb->actual_length for isochronous Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 65/72] USB: Add delay-init quirk for Corsair K70 LUX keyboards Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 66/72] usb: gadget: f_fs: Fix use-after-free in ffs_free_inst Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 67/72] USB: serial: qcserial: add pid/vid for Sierra Wireless EM7355 fw update Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 68/72] USB: serial: garmin_gps: fix I/O after failed probe and remove Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 69/72] USB: serial: garmin_gps: fix memory leak on probe errors Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 70/72] x86/MCE/AMD: Always give panic severity for UC errors in kernel context Greg Kroah-Hartman
2017-11-19 14:39 ` [PATCH 4.9 72/72] staging: greybus: spilib: fix use-after-free after deregistration Greg Kroah-Hartman
2017-11-20 6:22 ` [PATCH 4.9 00/72] 4.9.64-stable review Naresh Kamboju
2017-11-20 19:25 ` Greg Kroah-Hartman
2017-11-20 14:10 ` Guenter Roeck
2017-11-20 15:10 ` Greg Kroah-Hartman
2017-11-20 21:17 ` Shuah Khan
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=20171119143534.588743686@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=alexander.levin@verizon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=paul.burton@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.org \
/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