Skip to content

Commit ff8be96

Browse files
committed
Merge tag 'edac_updates_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull EDAC updates from Borislav Petkov: - Add support for version 3 of the Synopsys DDR controller to synopsys_edac - Add support for DRR5 and new models 0x10-0x1f and 0x50-0x5f of AMD family 0x19 CPUs to amd64_edac - The usual set of fixes and cleanups * tag 'edac_updates_for_v5.17_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras: EDAC/amd64: Add support for family 19h, models 50h-5fh EDAC/sb_edac: Remove redundant initialization of variable rc RAS/CEC: Remove a repeated 'an' in a comment EDAC/amd64: Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh EDAC: Add RDDR5 and LRDDR5 memory types EDAC/sifive: Fix non-kernel-doc comment dt-bindings: memory: Add entry for version 3.80a EDAC/synopsys: Enable the driver on Intel's N5X platform EDAC/synopsys: Add support for version 3 of the Synopsys EDAC DDR EDAC/synopsys: Use the quirk for version instead of ddr version
2 parents 7e740ae + da0119a commit ff8be96

File tree

10 files changed

+98
-15
lines changed

10 files changed

+98
-15
lines changed

Documentation/devicetree/bindings/memory-controllers/synopsys,ddrc-ecc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ properties:
2626
enum:
2727
- xlnx,zynq-ddrc-a05
2828
- xlnx,zynqmp-ddrc-2.40a
29+
- snps,ddrc-3.80a
2930

3031
interrupts:
3132
maxItems: 1

drivers/edac/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ config EDAC_ARMADA_XP
484484

485485
config EDAC_SYNOPSYS
486486
tristate "Synopsys DDR Memory Controller"
487-
depends on ARCH_ZYNQ || ARCH_ZYNQMP
487+
depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_INTEL_SOCFPGA
488488
help
489489
Support for error detection and correction on the Synopsys DDR
490490
memory controller.

drivers/edac/amd64_edac.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2925,6 +2925,26 @@ static struct amd64_family_type family_types[] = {
29252925
.dbam_to_cs = f17_addr_mask_to_cs_size,
29262926
}
29272927
},
2928+
[F19_M10H_CPUS] = {
2929+
.ctl_name = "F19h_M10h",
2930+
.f0_id = PCI_DEVICE_ID_AMD_19H_M10H_DF_F0,
2931+
.f6_id = PCI_DEVICE_ID_AMD_19H_M10H_DF_F6,
2932+
.max_mcs = 12,
2933+
.ops = {
2934+
.early_channel_count = f17_early_channel_count,
2935+
.dbam_to_cs = f17_addr_mask_to_cs_size,
2936+
}
2937+
},
2938+
[F19_M50H_CPUS] = {
2939+
.ctl_name = "F19h_M50h",
2940+
.f0_id = PCI_DEVICE_ID_AMD_19H_M50H_DF_F0,
2941+
.f6_id = PCI_DEVICE_ID_AMD_19H_M50H_DF_F6,
2942+
.max_mcs = 2,
2943+
.ops = {
2944+
.early_channel_count = f17_early_channel_count,
2945+
.dbam_to_cs = f17_addr_mask_to_cs_size,
2946+
}
2947+
},
29282948
};
29292949

29302950
/*
@@ -3962,11 +3982,25 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
39623982
break;
39633983

39643984
case 0x19:
3965-
if (pvt->model >= 0x20 && pvt->model <= 0x2f) {
3985+
if (pvt->model >= 0x10 && pvt->model <= 0x1f) {
3986+
fam_type = &family_types[F19_M10H_CPUS];
3987+
pvt->ops = &family_types[F19_M10H_CPUS].ops;
3988+
break;
3989+
} else if (pvt->model >= 0x20 && pvt->model <= 0x2f) {
39663990
fam_type = &family_types[F17_M70H_CPUS];
39673991
pvt->ops = &family_types[F17_M70H_CPUS].ops;
39683992
fam_type->ctl_name = "F19h_M20h";
39693993
break;
3994+
} else if (pvt->model >= 0x50 && pvt->model <= 0x5f) {
3995+
fam_type = &family_types[F19_M50H_CPUS];
3996+
pvt->ops = &family_types[F19_M50H_CPUS].ops;
3997+
fam_type->ctl_name = "F19h_M50h";
3998+
break;
3999+
} else if (pvt->model >= 0xa0 && pvt->model <= 0xaf) {
4000+
fam_type = &family_types[F19_M10H_CPUS];
4001+
pvt->ops = &family_types[F19_M10H_CPUS].ops;
4002+
fam_type->ctl_name = "F19h_MA0h";
4003+
break;
39704004
}
39714005
fam_type = &family_types[F19_CPUS];
39724006
pvt->ops = &family_types[F19_CPUS].ops;

drivers/edac/amd64_edac.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
/* Hardware limit on ChipSelect rows per MC and processors per system */
9797
#define NUM_CHIPSELECTS 8
9898
#define DRAM_RANGES 8
99-
#define NUM_CONTROLLERS 8
99+
#define NUM_CONTROLLERS 12
100100

101101
#define ON true
102102
#define OFF false
@@ -126,6 +126,10 @@
126126
#define PCI_DEVICE_ID_AMD_17H_M70H_DF_F6 0x1446
127127
#define PCI_DEVICE_ID_AMD_19H_DF_F0 0x1650
128128
#define PCI_DEVICE_ID_AMD_19H_DF_F6 0x1656
129+
#define PCI_DEVICE_ID_AMD_19H_M10H_DF_F0 0x14ad
130+
#define PCI_DEVICE_ID_AMD_19H_M10H_DF_F6 0x14b3
131+
#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F0 0x166a
132+
#define PCI_DEVICE_ID_AMD_19H_M50H_DF_F6 0x1670
129133

130134
/*
131135
* Function 1 - Address Map
@@ -298,6 +302,8 @@ enum amd_families {
298302
F17_M60H_CPUS,
299303
F17_M70H_CPUS,
300304
F19_CPUS,
305+
F19_M10H_CPUS,
306+
F19_M50H_CPUS,
301307
NUM_FAMILIES,
302308
};
303309

drivers/edac/edac_mc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ const char * const edac_mem_types[] = {
162162
[MEM_LPDDR4] = "Low-Power-DDR4-RAM",
163163
[MEM_LRDDR4] = "Load-Reduced-DDR4-RAM",
164164
[MEM_DDR5] = "Unbuffered-DDR5",
165+
[MEM_RDDR5] = "Registered-DDR5",
166+
[MEM_LRDDR5] = "Load-Reduced-DDR5-RAM",
165167
[MEM_NVDIMM] = "Non-volatile-RAM",
166168
[MEM_WIO2] = "Wide-IO-2",
167169
[MEM_HBM2] = "High-bandwidth-memory-Gen2",

drivers/edac/sb_edac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3439,7 +3439,7 @@ MODULE_DEVICE_TABLE(x86cpu, sbridge_cpuids);
34393439

34403440
static int sbridge_probe(const struct x86_cpu_id *id)
34413441
{
3442-
int rc = -ENODEV;
3442+
int rc;
34433443
u8 mc, num_mc = 0;
34443444
struct sbridge_dev *sbridge_dev;
34453445
struct pci_id_table *ptable = (struct pci_id_table *)id->driver_data;

drivers/edac/sifive_edac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct sifive_edac_priv {
1919
struct edac_device_ctl_info *dci;
2020
};
2121

22-
/**
22+
/*
2323
* EDAC error callback
2424
*
2525
* @event: non-zero if unrecoverable.

drivers/edac/synopsys_edac.c

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
/* DDR ECC Quirks */
102102
#define DDR_ECC_INTR_SUPPORT BIT(0)
103103
#define DDR_ECC_DATA_POISON_SUPPORT BIT(1)
104+
#define DDR_ECC_INTR_SELF_CLEAR BIT(2)
104105

105106
/* ZynqMP Enhanced DDR memory controller registers that are relevant to ECC */
106107
/* ECC Configuration Registers */
@@ -171,6 +172,10 @@
171172
#define DDR_QOS_IRQ_EN_OFST 0x20208
172173
#define DDR_QOS_IRQ_DB_OFST 0x2020C
173174

175+
/* DDR QOS Interrupt register definitions */
176+
#define DDR_UE_MASK BIT(9)
177+
#define DDR_CE_MASK BIT(8)
178+
174179
/* ECC Corrected Error Register Mask and Shifts*/
175180
#define ECC_CEADDR0_RW_MASK 0x3FFFF
176181
#define ECC_CEADDR0_RNK_MASK BIT(24)
@@ -533,10 +538,16 @@ static irqreturn_t intr_handler(int irq, void *dev_id)
533538
priv = mci->pvt_info;
534539
p_data = priv->p_data;
535540

536-
regval = readl(priv->baseaddr + DDR_QOS_IRQ_STAT_OFST);
537-
regval &= (DDR_QOSCE_MASK | DDR_QOSUE_MASK);
538-
if (!(regval & ECC_CE_UE_INTR_MASK))
539-
return IRQ_NONE;
541+
/*
542+
* v3.0 of the controller has the ce/ue bits cleared automatically,
543+
* so this condition does not apply.
544+
*/
545+
if (!(priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR)) {
546+
regval = readl(priv->baseaddr + DDR_QOS_IRQ_STAT_OFST);
547+
regval &= (DDR_QOSCE_MASK | DDR_QOSUE_MASK);
548+
if (!(regval & ECC_CE_UE_INTR_MASK))
549+
return IRQ_NONE;
550+
}
540551

541552
status = p_data->get_error_info(priv);
542553
if (status)
@@ -548,7 +559,9 @@ static irqreturn_t intr_handler(int irq, void *dev_id)
548559

549560
edac_dbg(3, "Total error count CE %d UE %d\n",
550561
priv->ce_cnt, priv->ue_cnt);
551-
writel(regval, priv->baseaddr + DDR_QOS_IRQ_STAT_OFST);
562+
/* v3.0 of the controller does not have this register */
563+
if (!(priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR))
564+
writel(regval, priv->baseaddr + DDR_QOS_IRQ_STAT_OFST);
552565
return IRQ_HANDLED;
553566
}
554567

@@ -834,8 +847,13 @@ static void mc_init(struct mem_ctl_info *mci, struct platform_device *pdev)
834847
static void enable_intr(struct synps_edac_priv *priv)
835848
{
836849
/* Enable UE/CE Interrupts */
837-
writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK,
838-
priv->baseaddr + DDR_QOS_IRQ_EN_OFST);
850+
if (priv->p_data->quirks & DDR_ECC_INTR_SELF_CLEAR)
851+
writel(DDR_UE_MASK | DDR_CE_MASK,
852+
priv->baseaddr + ECC_CLR_OFST);
853+
else
854+
writel(DDR_QOSUE_MASK | DDR_QOSCE_MASK,
855+
priv->baseaddr + DDR_QOS_IRQ_EN_OFST);
856+
839857
}
840858

841859
static void disable_intr(struct synps_edac_priv *priv)
@@ -890,6 +908,19 @@ static const struct synps_platform_data zynqmp_edac_def = {
890908
),
891909
};
892910

911+
static const struct synps_platform_data synopsys_edac_def = {
912+
.get_error_info = zynqmp_get_error_info,
913+
.get_mtype = zynqmp_get_mtype,
914+
.get_dtype = zynqmp_get_dtype,
915+
.get_ecc_state = zynqmp_get_ecc_state,
916+
.quirks = (DDR_ECC_INTR_SUPPORT | DDR_ECC_INTR_SELF_CLEAR
917+
#ifdef CONFIG_EDAC_DEBUG
918+
| DDR_ECC_DATA_POISON_SUPPORT
919+
#endif
920+
),
921+
};
922+
923+
893924
static const struct of_device_id synps_edac_match[] = {
894925
{
895926
.compatible = "xlnx,zynq-ddrc-a05",
@@ -899,6 +930,10 @@ static const struct of_device_id synps_edac_match[] = {
899930
.compatible = "xlnx,zynqmp-ddrc-2.40a",
900931
.data = (void *)&zynqmp_edac_def
901932
},
933+
{
934+
.compatible = "snps,ddrc-3.80a",
935+
.data = (void *)&synopsys_edac_def
936+
},
902937
{
903938
/* end of table */
904939
}
@@ -1352,8 +1387,7 @@ static int mc_probe(struct platform_device *pdev)
13521387
}
13531388
}
13541389

1355-
if (of_device_is_compatible(pdev->dev.of_node,
1356-
"xlnx,zynqmp-ddrc-2.40a"))
1390+
if (priv->p_data->quirks & DDR_ECC_INTR_SUPPORT)
13571391
setup_address_map(priv);
13581392
#endif
13591393

drivers/ras/cec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* elements entered into the array, during which, we're decaying all elements.
3939
* If, after decay, an element gets inserted again, its generation is set to 11b
4040
* to make sure it has higher numerical count than other, older elements and
41-
* thus emulate an an LRU-like behavior when deleting elements to free up space
41+
* thus emulate an LRU-like behavior when deleting elements to free up space
4242
* in the page.
4343
*
4444
* When an element reaches it's max count of action_threshold, we try to poison

include/linux/edac.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ static inline char *mc_event_error_type(const unsigned int err_type)
182182
* @MEM_LRDDR4: Load-Reduced DDR4 memory.
183183
* @MEM_LPDDR4: Low-Power DDR4 memory.
184184
* @MEM_DDR5: Unbuffered DDR5 RAM
185+
* @MEM_RDDR5: Registered DDR5 RAM
186+
* @MEM_LRDDR5: Load-Reduced DDR5 memory.
185187
* @MEM_NVDIMM: Non-volatile RAM
186188
* @MEM_WIO2: Wide I/O 2.
187189
* @MEM_HBM2: High bandwidth Memory Gen 2.
@@ -211,6 +213,8 @@ enum mem_type {
211213
MEM_LRDDR4,
212214
MEM_LPDDR4,
213215
MEM_DDR5,
216+
MEM_RDDR5,
217+
MEM_LRDDR5,
214218
MEM_NVDIMM,
215219
MEM_WIO2,
216220
MEM_HBM2,
@@ -239,6 +243,8 @@ enum mem_type {
239243
#define MEM_FLAG_LRDDR4 BIT(MEM_LRDDR4)
240244
#define MEM_FLAG_LPDDR4 BIT(MEM_LPDDR4)
241245
#define MEM_FLAG_DDR5 BIT(MEM_DDR5)
246+
#define MEM_FLAG_RDDR5 BIT(MEM_RDDR5)
247+
#define MEM_FLAG_LRDDR5 BIT(MEM_LRDDR5)
242248
#define MEM_FLAG_NVDIMM BIT(MEM_NVDIMM)
243249
#define MEM_FLAG_WIO2 BIT(MEM_WIO2)
244250
#define MEM_FLAG_HBM2 BIT(MEM_HBM2)

0 commit comments

Comments
 (0)