Commit 84504930 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'edac_for_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp

Pull EDAC updates from Borislav Petkov:

 - Stratix10 SDRAM support to altera_edac (Thor Thayer)

 - the usual misc fixes all over the place

[ Also, shared branch for socfpga_stratix10.dtsi file changes with the
  socfpga tree ]

* tag 'edac_for_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp:
  EDAC, ghes: Make platform-based whitelisting x86-only
  EDAC, altera: Fix ARM64 build warning
  EDAC, skx: Fix skx_edac build error when ACPI_NFIT=m
  EDAC, ghes: Use BIT() macro
  EDAC, ghes: Add DDR4 and NVDIMM memory types
  EDAC, altera: Handle SDRAM Uncorrectable Errors on Stratix10
  Documentation: dt: edac: Move Altera SOCFPGA EDAC file
  EDAC, altera: Add support for Stratix10 SDRAM EDAC
  Documentation: dt: socfpga: Add Stratix10 ECC Manager binding
  EDAC, ghes: Remove unused argument to ghes_edac_report_mem_error()
  arm64: dts: stratix10: add sdram ecc
  EDAC, i7core: Fix spelling mistake: "redundacy" -> "redundancy"
  EDAC, ghes: Add a null pointer check in ghes_edac_unregister()
  ghes, EDAC: Fix ghes_edac registration
  arm64: dts: stratix10: Change pad skew values for EMAC0 PHY driver
  ARM: dts: consistently use 'atmel' as at24 manufacturer in cyclone5
  arm64: dts: stratix10: Add PL330 DMAC to Stratix10 dts
  arm64: dts: stratix10: enable i2c, add i2c periperals
  arm64: dts: stratix10: use clock bindings for the Stratix10 platform
parents 311da497 eaa3a1d4
...@@ -231,3 +231,38 @@ Example: ...@@ -231,3 +231,38 @@ Example:
<48 IRQ_TYPE_LEVEL_HIGH>; <48 IRQ_TYPE_LEVEL_HIGH>;
}; };
}; };
Stratix10 SoCFPGA ECC Manager
The Stratix10 SoC ECC Manager handles the IRQs for each peripheral
in a shared register similar to the Arria10. However, ECC requires
access to registers that can only be read from Secure Monitor with
SMC calls. Therefore the device tree is slightly different.
Required Properties:
- compatible : Should be "altr,socfpga-s10-ecc-manager"
- interrupts : Should be single bit error interrupt, then double bit error
interrupt.
- interrupt-controller : boolean indicator that ECC Manager is an interrupt controller
- #interrupt-cells : must be set to 2.
Subcomponents:
SDRAM ECC
Required Properties:
- compatible : Should be "altr,sdram-edac-s10"
- interrupts : Should be single bit error interrupt, then double bit error
interrupt, in this order.
Example:
eccmgr {
compatible = "altr,socfpga-s10-ecc-manager";
interrupts = <0 15 4>, <0 95 4>;
interrupt-controller;
#interrupt-cells = <2>;
sdramedac {
compatible = "altr,sdram-edac-s10";
interrupts = <16 4>, <48 4>;
};
};
...@@ -161,7 +161,7 @@ temp: lm75@48 { ...@@ -161,7 +161,7 @@ temp: lm75@48 {
}; };
at24@50 { at24@50 {
compatible = "at24,24c01"; compatible = "atmel,24c01";
pagesize = <8>; pagesize = <8>;
reg = <0x50>; reg = <0x50>;
}; };
...@@ -213,7 +213,7 @@ i2c@6 { /* Backplane EEPROM */ ...@@ -213,7 +213,7 @@ i2c@6 { /* Backplane EEPROM */
#size-cells = <0>; #size-cells = <0>;
reg = <6>; reg = <6>;
eeprom@51 { eeprom@51 {
compatible = "at,24c01"; compatible = "atmel,24c01";
pagesize = <8>; pagesize = <8>;
reg = <0x51>; reg = <0x51>;
}; };
...@@ -224,7 +224,7 @@ i2c@7 { /* Power board EEPROM */ ...@@ -224,7 +224,7 @@ i2c@7 { /* Power board EEPROM */
#size-cells = <0>; #size-cells = <0>;
reg = <7>; reg = <7>;
eeprom@51 { eeprom@51 {
compatible = "at,24c01"; compatible = "atmel,24c01";
pagesize = <8>; pagesize = <8>;
reg = <0x51>; reg = <0x51>;
}; };
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
/dts-v1/; /dts-v1/;
#include <dt-bindings/reset/altr,rst-mgr-s10.h> #include <dt-bindings/reset/altr,rst-mgr-s10.h>
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/clock/stratix10-clock.h>
/ { / {
compatible = "altr,socfpga-stratix10"; compatible = "altr,socfpga-stratix10";
...@@ -92,9 +93,32 @@ soc { ...@@ -92,9 +93,32 @@ soc {
interrupt-parent = <&intc>; interrupt-parent = <&intc>;
ranges = <0 0 0 0xffffffff>; ranges = <0 0 0 0xffffffff>;
clkmgr@ffd1000 { clkmgr: clock-controller@ffd10000 {
compatible = "altr,clk-mgr"; compatible = "intel,stratix10-clkmgr";
reg = <0xffd10000 0x1000>; reg = <0xffd10000 0x1000>;
#clock-cells = <1>;
};
clocks {
cb_intosc_hs_div2_clk: cb-intosc-hs-div2-clk {
#clock-cells = <0>;
compatible = "fixed-clock";
};
cb_intosc_ls_clk: cb-intosc-ls-clk {
#clock-cells = <0>;
compatible = "fixed-clock";
};
f2s_free_clk: f2s-free-clk {
#clock-cells = <0>;
compatible = "fixed-clock";
};
osc1: osc1 {
#clock-cells = <0>;
compatible = "fixed-clock";
};
}; };
gmac0: ethernet@ff800000 { gmac0: ethernet@ff800000 {
...@@ -105,6 +129,8 @@ gmac0: ethernet@ff800000 { ...@@ -105,6 +129,8 @@ gmac0: ethernet@ff800000 {
mac-address = [00 00 00 00 00 00]; mac-address = [00 00 00 00 00 00];
resets = <&rst EMAC0_RESET>; resets = <&rst EMAC0_RESET>;
reset-names = "stmmaceth"; reset-names = "stmmaceth";
clocks = <&clkmgr STRATIX10_EMAC0_CLK>;
clock-names = "stmmaceth";
status = "disabled"; status = "disabled";
}; };
...@@ -116,6 +142,8 @@ gmac1: ethernet@ff802000 { ...@@ -116,6 +142,8 @@ gmac1: ethernet@ff802000 {
mac-address = [00 00 00 00 00 00]; mac-address = [00 00 00 00 00 00];
resets = <&rst EMAC1_RESET>; resets = <&rst EMAC1_RESET>;
reset-names = "stmmaceth"; reset-names = "stmmaceth";
clocks = <&clkmgr STRATIX10_EMAC1_CLK>;
clock-names = "stmmaceth";
status = "disabled"; status = "disabled";
}; };
...@@ -127,6 +155,8 @@ gmac2: ethernet@ff804000 { ...@@ -127,6 +155,8 @@ gmac2: ethernet@ff804000 {
mac-address = [00 00 00 00 00 00]; mac-address = [00 00 00 00 00 00];
resets = <&rst EMAC2_RESET>; resets = <&rst EMAC2_RESET>;
reset-names = "stmmaceth"; reset-names = "stmmaceth";
clocks = <&clkmgr STRATIX10_EMAC2_CLK>;
clock-names = "stmmaceth";
status = "disabled"; status = "disabled";
}; };
...@@ -177,6 +207,7 @@ i2c0: i2c@ffc02800 { ...@@ -177,6 +207,7 @@ i2c0: i2c@ffc02800 {
reg = <0xffc02800 0x100>; reg = <0xffc02800 0x100>;
interrupts = <0 103 4>; interrupts = <0 103 4>;
resets = <&rst I2C0_RESET>; resets = <&rst I2C0_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -187,6 +218,7 @@ i2c1: i2c@ffc02900 { ...@@ -187,6 +218,7 @@ i2c1: i2c@ffc02900 {
reg = <0xffc02900 0x100>; reg = <0xffc02900 0x100>;
interrupts = <0 104 4>; interrupts = <0 104 4>;
resets = <&rst I2C1_RESET>; resets = <&rst I2C1_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -197,6 +229,7 @@ i2c2: i2c@ffc02a00 { ...@@ -197,6 +229,7 @@ i2c2: i2c@ffc02a00 {
reg = <0xffc02a00 0x100>; reg = <0xffc02a00 0x100>;
interrupts = <0 105 4>; interrupts = <0 105 4>;
resets = <&rst I2C2_RESET>; resets = <&rst I2C2_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -207,6 +240,7 @@ i2c3: i2c@ffc02b00 { ...@@ -207,6 +240,7 @@ i2c3: i2c@ffc02b00 {
reg = <0xffc02b00 0x100>; reg = <0xffc02b00 0x100>;
interrupts = <0 106 4>; interrupts = <0 106 4>;
resets = <&rst I2C3_RESET>; resets = <&rst I2C3_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -217,6 +251,7 @@ i2c4: i2c@ffc02c00 { ...@@ -217,6 +251,7 @@ i2c4: i2c@ffc02c00 {
reg = <0xffc02c00 0x100>; reg = <0xffc02c00 0x100>;
interrupts = <0 107 4>; interrupts = <0 107 4>;
resets = <&rst I2C4_RESET>; resets = <&rst I2C4_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -229,6 +264,9 @@ mmc: dwmmc0@ff808000 { ...@@ -229,6 +264,9 @@ mmc: dwmmc0@ff808000 {
fifo-depth = <0x400>; fifo-depth = <0x400>;
resets = <&rst SDMMC_RESET>; resets = <&rst SDMMC_RESET>;
reset-names = "reset"; reset-names = "reset";
clocks = <&clkmgr STRATIX10_L4_MP_CLK>,
<&clkmgr STRATIX10_SDMMC_CLK>;
clock-names = "biu", "ciu";
status = "disabled"; status = "disabled";
}; };
...@@ -237,6 +275,25 @@ ocram: sram@ffe00000 { ...@@ -237,6 +275,25 @@ ocram: sram@ffe00000 {
reg = <0xffe00000 0x100000>; reg = <0xffe00000 0x100000>;
}; };
pdma: pdma@ffda0000 {
compatible = "arm,pl330", "arm,primecell";
reg = <0xffda0000 0x1000>;
interrupts = <0 81 4>,
<0 82 4>,
<0 83 4>,
<0 84 4>,
<0 85 4>,
<0 86 4>,
<0 87 4>,
<0 88 4>,
<0 89 4>;
#dma-cells = <1>;
#dma-channels = <8>;
#dma-requests = <32>;
clocks = <&clkmgr STRATIX10_L4_MAIN_CLK>;
clock-names = "apb_pclk";
};
rst: rstmgr@ffd11000 { rst: rstmgr@ffd11000 {
#reset-cells = <1>; #reset-cells = <1>;
compatible = "altr,rst-mgr"; compatible = "altr,rst-mgr";
...@@ -288,24 +345,32 @@ timer0: timer0@ffc03000 { ...@@ -288,24 +345,32 @@ timer0: timer0@ffc03000 {
compatible = "snps,dw-apb-timer"; compatible = "snps,dw-apb-timer";
interrupts = <0 113 4>; interrupts = <0 113 4>;
reg = <0xffc03000 0x100>; reg = <0xffc03000 0x100>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
clock-names = "timer";
}; };
timer1: timer1@ffc03100 { timer1: timer1@ffc03100 {
compatible = "snps,dw-apb-timer"; compatible = "snps,dw-apb-timer";
interrupts = <0 114 4>; interrupts = <0 114 4>;
reg = <0xffc03100 0x100>; reg = <0xffc03100 0x100>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
clock-names = "timer";
}; };
timer2: timer2@ffd00000 { timer2: timer2@ffd00000 {
compatible = "snps,dw-apb-timer"; compatible = "snps,dw-apb-timer";
interrupts = <0 115 4>; interrupts = <0 115 4>;
reg = <0xffd00000 0x100>; reg = <0xffd00000 0x100>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
clock-names = "timer";
}; };
timer3: timer3@ffd00100 { timer3: timer3@ffd00100 {
compatible = "snps,dw-apb-timer"; compatible = "snps,dw-apb-timer";
interrupts = <0 116 4>; interrupts = <0 116 4>;
reg = <0xffd00100 0x100>; reg = <0xffd00100 0x100>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
clock-names = "timer";
}; };
uart0: serial0@ffc02000 { uart0: serial0@ffc02000 {
...@@ -315,6 +380,7 @@ uart0: serial0@ffc02000 { ...@@ -315,6 +380,7 @@ uart0: serial0@ffc02000 {
reg-shift = <2>; reg-shift = <2>;
reg-io-width = <4>; reg-io-width = <4>;
resets = <&rst UART0_RESET>; resets = <&rst UART0_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -325,6 +391,7 @@ uart1: serial1@ffc02100 { ...@@ -325,6 +391,7 @@ uart1: serial1@ffc02100 {
reg-shift = <2>; reg-shift = <2>;
reg-io-width = <4>; reg-io-width = <4>;
resets = <&rst UART1_RESET>; resets = <&rst UART1_RESET>;
clocks = <&clkmgr STRATIX10_L4_SP_CLK>;
status = "disabled"; status = "disabled";
}; };
...@@ -387,5 +454,17 @@ watchdog3: watchdog@ffd00500 { ...@@ -387,5 +454,17 @@ watchdog3: watchdog@ffd00500 {
resets = <&rst WATCHDOG3_RESET>; resets = <&rst WATCHDOG3_RESET>;
status = "disabled"; status = "disabled";
}; };
eccmgr {
compatible = "altr,socfpga-s10-ecc-manager";
interrupts = <0 15 4>, <0 95 4>;
interrupt-controller;
#interrupt-cells = <2>;
sdramedac {
compatible = "altr,sdram-edac-s10";
interrupts = <16 4>, <48 4>;
};
};
}; };
}; };
...@@ -50,6 +50,21 @@ memory { ...@@ -50,6 +50,21 @@ memory {
/* We expect the bootloader to fill in the reg */ /* We expect the bootloader to fill in the reg */
reg = <0 0 0 0>; reg = <0 0 0 0>;
}; };
ref_033v: 033-v-ref {
compatible = "regulator-fixed";
regulator-name = "0.33V";
regulator-min-microvolt = <330000>;
regulator-max-microvolt = <330000>;
};
soc {
clocks {
osc1 {
clock-frequency = <25000000>;
};
};
};
}; };
&gpio1 { &gpio1 {
...@@ -79,7 +94,7 @@ phy0: ethernet-phy@0 { ...@@ -79,7 +94,7 @@ phy0: ethernet-phy@0 {
rxd2-skew-ps = <420>; /* 0ps */ rxd2-skew-ps = <420>; /* 0ps */
rxd3-skew-ps = <420>; /* 0ps */ rxd3-skew-ps = <420>; /* 0ps */
txen-skew-ps = <0>; /* -420ps */ txen-skew-ps = <0>; /* -420ps */
txc-skew-ps = <1860>; /* 960ps */ txc-skew-ps = <900>; /* 0ps */
rxdv-skew-ps = <420>; /* 0ps */ rxdv-skew-ps = <420>; /* 0ps */
rxc-skew-ps = <1680>; /* 780ps */ rxc-skew-ps = <1680>; /* 780ps */
}; };
...@@ -105,3 +120,30 @@ &usb0 { ...@@ -105,3 +120,30 @@ &usb0 {
&watchdog0 { &watchdog0 {
status = "okay"; status = "okay";
}; };
&i2c1 {
status = "okay";
clock-frequency = <100000>;
adc@14 {
compatible = "lltc,ltc2497";
reg = <0x14>;
vref-supply = <&ref_033v>;
};
temp@4c {
compatible = "maxim,max1619";
reg = <0x4c>;
};
eeprom@51 {
compatible = "atmel,24c32";
reg = <0x51>;
pagesize = <32>;
};
rtc@68 {
compatible = "dallas,ds1339";
reg = <0x68>;
};
};
...@@ -481,7 +481,7 @@ static void ghes_do_proc(struct ghes *ghes, ...@@ -481,7 +481,7 @@ static void ghes_do_proc(struct ghes *ghes,
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata); struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
ghes_edac_report_mem_error(ghes, sev, mem_err); ghes_edac_report_mem_error(sev, mem_err);
arch_apei_report_mem_error(sev, mem_err); arch_apei_report_mem_error(sev, mem_err);
ghes_handle_memory_failure(gdata, sev); ghes_handle_memory_failure(gdata, sev);
...@@ -1087,10 +1087,6 @@ static int ghes_probe(struct platform_device *ghes_dev) ...@@ -1087,10 +1087,6 @@ static int ghes_probe(struct platform_device *ghes_dev)
goto err; goto err;
} }
rc = ghes_edac_register(ghes, &ghes_dev->dev);
if (rc < 0)
goto err;
switch (generic->notify.type) { switch (generic->notify.type) {
case ACPI_HEST_NOTIFY_POLLED: case ACPI_HEST_NOTIFY_POLLED:
timer_setup(&ghes->timer, ghes_poll_func, TIMER_DEFERRABLE); timer_setup(&ghes->timer, ghes_poll_func, TIMER_DEFERRABLE);
...@@ -1102,14 +1098,14 @@ static int ghes_probe(struct platform_device *ghes_dev) ...@@ -1102,14 +1098,14 @@ static int ghes_probe(struct platform_device *ghes_dev)
if (rc) { if (rc) {
pr_err(GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n", pr_err(GHES_PFX "Failed to map GSI to IRQ for generic hardware error source: %d\n",
generic->header.source_id); generic->header.source_id);
goto err_edac_unreg; goto err;
} }
rc = request_irq(ghes->irq, ghes_irq_func, IRQF_SHARED, rc = request_irq(ghes->irq, ghes_irq_func, IRQF_SHARED,
"GHES IRQ", ghes); "GHES IRQ", ghes);
if (rc) { if (rc) {
pr_err(GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n", pr_err(GHES_PFX "Failed to register IRQ for generic hardware error source: %d\n",
generic->header.source_id); generic->header.source_id);
goto err_edac_unreg; goto err;
} }
break; break;
...@@ -1132,14 +1128,16 @@ static int ghes_probe(struct platform_device *ghes_dev) ...@@ -1132,14 +1128,16 @@ static int ghes_probe(struct platform_device *ghes_dev)
default: default:
BUG(); BUG();
} }
platform_set_drvdata(ghes_dev, ghes); platform_set_drvdata(ghes_dev, ghes);
ghes_edac_register(ghes, &ghes_dev->dev);
/* Handle any pending errors right away */ /* Handle any pending errors right away */
ghes_proc(ghes); ghes_proc(ghes);
return 0; return 0;
err_edac_unreg:
ghes_edac_unregister(ghes);
err: err:
if (ghes) { if (ghes) {
ghes_fini(ghes); ghes_fini(ghes);
......
...@@ -232,6 +232,7 @@ config EDAC_SBRIDGE ...@@ -232,6 +232,7 @@ config EDAC_SBRIDGE
config EDAC_SKX config EDAC_SKX
tristate "Intel Skylake server Integrated MC" tristate "Intel Skylake server Integrated MC"
depends on PCI && X86_64 && X86_MCE_INTEL && PCI_MMCONFIG depends on PCI && X86_64 && X86_MCE_INTEL && PCI_MMCONFIG
depends on ACPI_NFIT || !ACPI_NFIT # if ACPI_NFIT=m, EDAC_SKX can't be y
select DMI select DMI
help help
Support for error detection and correction the Intel Support for error detection and correction the Intel
...@@ -374,7 +375,7 @@ config EDAC_THUNDERX ...@@ -374,7 +375,7 @@ config EDAC_THUNDERX
config EDAC_ALTERA config EDAC_ALTERA
bool "Altera SOCFPGA ECC" bool "Altera SOCFPGA ECC"
depends on EDAC=y && ARCH_SOCFPGA depends on EDAC=y && (ARCH_SOCFPGA || ARCH_STRATIX10)
help help
Support for error detection and correction on the Support for error detection and correction on the
Altera SOCs. This must be selected for SDRAM ECC. Altera SOCs. This must be selected for SDRAM ECC.
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* * Copyright (C) 2017-2018, Intel Corporation
* Copyright (C) 2015 Altera Corporation * Copyright (C) 2015 Altera Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _ALTERA_EDAC_H #ifndef _ALTERA_EDAC_H
#define _ALTERA_EDAC_H #define _ALTERA_EDAC_H
#include <linux/arm-smccc.h>
#include <linux/edac.h> #include <linux/edac.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -94,6 +84,7 @@ ...@@ -94,6 +84,7 @@
/* SDRAM Controller Address Width Register */ /* SDRAM Controller Address Width Register */
#define CV_DRAMADDRW 0xFFC2502C #define CV_DRAMADDRW 0xFFC2502C
#define A10_DRAMADDRW 0xFFCFA0A8 #define A10_DRAMADDRW 0xFFCFA0A8
#define S10_DRAMADDRW 0xF80110E0
/* SDRAM Controller Address Widths Field Register */ /* SDRAM Controller Address Widths Field Register */
#define DRAMADDRW_COLBIT_MASK 0x001F #define DRAMADDRW_COLBIT_MASK 0x001F
...@@ -115,6 +106,7 @@ ...@@ -115,6 +106,7 @@
/* SDRAM Controller Interface Data Width Register */ /* SDRAM Controller Interface Data Width Register */
#define CV_DRAMIFWIDTH 0xFFC25030 #define CV_DRAMIFWIDTH 0xFFC25030
#define A10_DRAMIFWIDTH 0xFFCFB008 #define A10_DRAMIFWIDTH 0xFFCFB008
#define S10_DRAMIFWIDTH 0xF8011008
/* SDRAM Controller Interface Data Width Defines */ /* SDRAM Controller Interface Data Width Defines */
#define CV_DRAMIFWIDTH_16B_ECC 24 #define CV_DRAMIFWIDTH_16B_ECC 24
...@@ -164,6 +156,34 @@ ...@@ -164,6 +156,34 @@
#define A10_INTMASK_CLR_OFST 0x10 #define A10_INTMASK_CLR_OFST 0x10
#define A10_DDR0_IRQ_MASK BIT(17) #define A10_DDR0_IRQ_MASK BIT(17)
/************* Stratix10 Defines **************/
/* SDRAM Controller EccCtrl Register */
#define S10_ECCCTRL1_OFST 0xF8011100
/* SDRAM Controller DRAM IRQ Register */
#define S10_ERRINTEN_OFST 0xF8011110
/* SDRAM Interrupt Mode Register */
#define S10_INTMODE_OFST 0xF801111C
/* SDRAM Controller Error Status Register */
#define S10_INTSTAT_OFST 0xF8011120
/* SDRAM Controller ECC Error Address Register */
#define S10_DERRADDR_OFST 0xF801112C
#define S10_SERRADDR_OFST 0xF8011130
/* SDRAM Controller ECC Diagnostic Register */
#define S10_DIAGINTTEST_OFST 0xF8011124
/* SDRAM Single Bit Error Count Compare Set Register */
#define S10_SERRCNTREG_OFST 0xF801113C
/* Sticky registers for Uncorrected Errors */
#define S10_SYSMGR_UE_VAL_OFST 0xFFD12220
#define S10_SYSMGR_UE_ADDR_OFST 0xFFD12224
struct altr_sdram_prv_data { struct altr_sdram_prv_data {
int ecc_ctrl_offset; int ecc_ctrl_offset;
int ecc_ctl_en_mask; int ecc_ctl_en_mask;
...@@ -296,6 +316,18 @@ struct altr_sdram_mc_data { ...@@ -296,6 +316,18 @@ struct altr_sdram_mc_data {
/* A10 ECC Controller memory initialization timeout */ /* A10 ECC Controller memory initialization timeout */
#define ALTR_A10_ECC_INIT_WATCHDOG_10US 10000 #define ALTR_A10_ECC_INIT_WATCHDOG_10US 10000
/************* Stratix10 Defines **************/
/* Stratix10 ECC Manager Defines */
#define S10_SYSMGR_ECC_INTMASK_VAL_OFST 0xFFD12090
#define S10_SYSMGR_ECC_INTMASK_SET_OFST 0xFFD12094
#define S10_SYSMGR_ECC_INTMASK_CLR_OFST 0xFFD12098
#define S10_SYSMGR_ECC_INTSTAT_SERR_OFST 0xFFD1209C
#define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xFFD120A0
#define S10_DDR0_IRQ_MASK BIT(16)
struct altr_edac_device_dev; struct altr_edac_device_dev;
struct edac_device_prv_data { struct edac_device_prv_data {
...@@ -340,4 +372,78 @@ struct altr_arria10_edac { ...@@ -340,4 +372,78 @@ struct altr_arria10_edac {
struct list_head a10_ecc_devices; struct list_head a10_ecc_devices;
}; };
/*
* Functions specified by ARM SMC Calling convention:
*
* FAST call executes atomic operations, returns when the requested operation
* has completed.
* STD call starts a operation which can be preempted by a non-secure
* interrupt. The call can return before the requested operation has
* completed.
*
* a0..a7 is used as register names in the descriptions below, on arm32
* that translates to r0..r7 and on arm64 to w0..w7.
*/
#define INTEL_SIP_SMC_STD_CALL_VAL(func_num) \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL, ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_SIP, (func_num))
#define INTEL_SIP_SMC_FAST_CALL_VAL(func_num) \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_SIP, (func_num))
#define INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION 0xFFFFFFFF
#define INTEL_SIP_SMC_STATUS_OK 0x0
#define INTEL_SIP_SMC_REG_ERROR 0x5
/*
* Request INTEL_SIP_SMC_REG_READ
*
* Read a protected register using SMCCC
*
* Call register usage:
* a0: INTEL_SIP_SMC_REG_READ.
* a1: register address.
* a2-7: not used.
*
* Return status:
* a0: INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_REG_ERROR, or
* INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION
* a1: Value in the register
* a2-3: not used.
*/
#define INTEL_SIP_SMC_FUNCID_REG_READ 7
#define INTEL_SIP_SMC_REG_READ \
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_REG_READ)
/*
* Request INTEL_SIP_SMC_REG_WRITE
*
* Write a protected register using SMCCC
*
* Call register usage:
* a0: INTEL_SIP_SMC_REG_WRITE.
* a1: register address
* a2: value to program into register.
* a3-7: not used.
*
* Return status:
* a0: INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_REG_ERROR, or
* INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION
* a1-3: not used.
*/
#define INTEL_SIP_SMC_FUNCID_REG_WRITE 8
#define INTEL_SIP_SMC_REG_WRITE \
INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_REG_WRITE)
struct altr_stratix10_edac {
struct device *dev;
int sb_irq;
struct irq_domain *domain;
struct irq_chip irq_chip;
struct list_head s10_ecc_devices;
struct notifier_block panic_notifier;
};
#endif /* #ifndef _ALTERA_EDAC_H */ #endif /* #ifndef _ALTERA_EDAC_H */
...@@ -91,6 +91,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) ...@@ -91,6 +91,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms,
mci->n_layers, mci->n_layers,
dimm_fill->count, 0, 0); dimm_fill->count, 0, 0);
u16 rdr_mask = BIT(7) | BIT(13);
if (entry->size == 0xffff) { if (entry->size == 0xffff) {
pr_info("Can't get DIMM%i size\n", pr_info("Can't get DIMM%i size\n",
...@@ -99,22 +100,21 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) ...@@ -99,22 +100,21 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
} else if (entry->size == 0x7fff) { } else if (entry->size == 0x7fff) {
dimm->nr_pages = MiB_TO_PAGES(entry->extended_size); dimm->nr_pages = MiB_TO_PAGES(entry->extended_size);
} else { } else {
if (entry->size & 1 << 15) if (entry->size & BIT(15))
dimm->nr_pages = MiB_TO_PAGES((entry->size & dimm->nr_pages = MiB_TO_PAGES((entry->size & 0x7fff) << 10);
0x7fff) << 10);
else else
dimm->nr_pages = MiB_TO_PAGES(entry->size); dimm->nr_pages = MiB_TO_PAGES(entry->size);
} }
switch (entry->memory_type) { switch (entry->memory_type) {
case 0x12: case 0x12:
if (entry->type_detail & 1 << 13) if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR; dimm->mtype = MEM_RDDR;
else else
dimm->mtype = MEM_DDR; dimm->mtype = MEM_DDR;
break; break;
case 0x13: case 0x13:
if (entry->type_detail & 1 << 13) if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR2; dimm->mtype = MEM_RDDR2;
else else
dimm->mtype = MEM_DDR2; dimm->mtype = MEM_DDR2;
...@@ -123,20 +123,29 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) ...@@ -123,20 +123,29 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
dimm->mtype = MEM_FB_DDR2; dimm->mtype = MEM_FB_DDR2;
break; break;
case 0x18: case 0x18:
if (entry->type_detail & 1 << 13) if (entry->type_detail & BIT(12))
dimm->mtype = MEM_NVDIMM;
else if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR3; dimm->mtype = MEM_RDDR3;
else else
dimm->mtype = MEM_DDR3; dimm->mtype = MEM_DDR3;
break; break;
case 0x1a:
if (entry->type_detail & BIT(12))
dimm->mtype = MEM_NVDIMM;
else if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR4;
else
dimm->mtype = MEM_DDR4;
break;
default: default:
if (entry->type_detail & 1 << 6) if (entry->type_detail & BIT(6))
dimm->mtype = MEM_RMBS; dimm->mtype = MEM_RMBS;
else if ((entry->type_detail & ((1 << 7) | (1 << 13))) else if ((entry->type_detail & rdr_mask) == rdr_mask)
== ((1 << 7) | (1 << 13)))
dimm->mtype = MEM_RDR; dimm->mtype = MEM_RDR;
else if (entry->type_detail & 1 << 7) else if (entry->type_detail & BIT(7))
dimm->mtype = MEM_SDR; dimm->mtype = MEM_SDR;
else if (entry->type_detail & 1 << 9) else if (entry->type_detail & BIT(9))
dimm->mtype = MEM_EDO; dimm->mtype = MEM_EDO;
else else
dimm->mtype = MEM_UNKNOWN; dimm->mtype = MEM_UNKNOWN;
...@@ -172,8 +181,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg) ...@@ -172,8 +181,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
} }
} }
void ghes_edac_report_mem_error(struct ghes *ghes, int sev, void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
struct cper_sec_mem_err *mem_err)
{ {
enum hw_event_mc_err_type type; enum hw_event_mc_err_type type;
struct edac_raw_error_desc *e; struct edac_raw_error_desc *e;
...@@ -183,10 +191,8 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev, ...@@ -183,10 +191,8 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev,
char *p; char *p;
u8 grain_bits; u8 grain_bits;
if (!pvt) { if (!pvt)
pr_err("Internal error: Can't find EDAC structure\n");
return; return;
}
/* /*
* We can do the locking below because GHES defers error processing * We can do the locking below because GHES defers error processing
...@@ -434,12 +440,16 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev) ...@@ -434,12 +440,16 @@ int ghes_edac_register(struct ghes *ghes, struct device *dev)
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
struct edac_mc_layer layers[1]; struct edac_mc_layer layers[1];
struct ghes_edac_dimm_fill dimm_fill; struct ghes_edac_dimm_fill dimm_fill;
int idx; int idx = -1;
/* Check if safe to enable on this system */ if (IS_ENABLED(CONFIG_X86)) {
idx = acpi_match_platform_list(plat_list); /* Check if safe to enable on this system */
if (!force_load && idx < 0) idx = acpi_match_platform_list(plat_list);
return 0; if (!force_load && idx < 0)
return -ENODEV;
} else {
idx = 0;
}
/* /*
* We have only one logical memory controller to which all DIMMs belong. * We have only one logical memory controller to which all DIMMs belong.
...@@ -519,6 +529,9 @@ void ghes_edac_unregister(struct ghes *ghes) ...@@ -519,6 +529,9 @@ void ghes_edac_unregister(struct ghes *ghes)
{ {
struct mem_ctl_info *mci; struct mem_ctl_info *mci;
if (!ghes_pvt)
return;
mci = ghes_pvt->mci; mci = ghes_pvt->mci;
edac_mc_del_mc(mci->pdev); edac_mc_del_mc(mci->pdev);
edac_mc_free(mci); edac_mc_free(mci);
......
...@@ -1743,7 +1743,7 @@ static void i7core_mce_output_error(struct mem_ctl_info *mci, ...@@ -1743,7 +1743,7 @@ static void i7core_mce_output_error(struct mem_ctl_info *mci,
err = "write parity error"; err = "write parity error";
break; break;
case 19: case 19:
err = "redundacy loss"; err = "redundancy loss";
break; break;
case 20: case 20:
err = "reserved"; err = "reserved";
......
...@@ -55,22 +55,21 @@ enum { ...@@ -55,22 +55,21 @@ enum {
/* From drivers/edac/ghes_edac.c */ /* From drivers/edac/ghes_edac.c */
#ifdef CONFIG_EDAC_GHES #ifdef CONFIG_EDAC_GHES
void ghes_edac_report_mem_error(struct ghes *ghes, int sev, void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err);
struct cper_sec_mem_err *mem_err);
int ghes_edac_register(struct ghes *ghes, struct device *dev); int ghes_edac_register(struct ghes *ghes, struct device *dev);
void ghes_edac_unregister(struct ghes *ghes); void ghes_edac_unregister(struct ghes *ghes);
#else #else
static inline void ghes_edac_report_mem_error(struct ghes *ghes, int sev, static inline void ghes_edac_report_mem_error(int sev,
struct cper_sec_mem_err *mem_err) struct cper_sec_mem_err *mem_err)
{ {
} }
static inline int ghes_edac_register(struct ghes *ghes, struct device *dev) static inline int ghes_edac_register(struct ghes *ghes, struct device *dev)
{ {
return 0; return -ENODEV;
} }
static inline void ghes_edac_unregister(struct ghes *ghes) static inline void ghes_edac_unregister(struct ghes *ghes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment