Skip to content

Commit 0be3ff0

Browse files
committed
Merge tag 'edac_updates_for_v5.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras
Pull EDAC updates from Borislav Petkov: - Switch ghes_edac to use the CPER error reporting routines and simplify the code considerably this way - Rip out the silly edac_align_ptr() contraption which was computing the size of the private structures of each driver and thus allowing for a one-shot memory allocation. This was clearly unnecessary and confusing so switch to simple and boring kmalloc* calls. - Last but not least, the usual garden variety of fixes, cleanups and improvements all over EDAC land * tag 'edac_updates_for_v5.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras: EDAC/xgene: Fix typo processsors -> processors EDAC/i5100: Remove unused inline function i5100_nrecmema_dm_buf_id() EDAC: Use kcalloc() EDAC/ghes: Change ghes_hw from global to static EDAC/armada_xp: Use devm_platform_ioremap_resource() EDAC/synopsys: Add a SPDX identifier EDAC/synopsys: Add driver support for i.MX platforms EDAC/dmc520: Don't print an error for each unconfigured interrupt line EDAC/mc: Get rid of edac_align_ptr() EDAC/device: Sanitize edac_device_alloc_ctl_info() definition EDAC/device: Get rid of the silly one-shot memory allocation in edac_device_alloc_ctl_info() EDAC/pci: Get rid of the silly one-shot memory allocation in edac_pci_alloc_ctl_info() EDAC/mc: Get rid of silly one-shot struct allocation in edac_mc_alloc() efi/cper: Reformat CPER memory error location to more readable EDAC/ghes: Unify CPER memory error location reporting efi/cper: Add a cper_mem_err_status_str() to decode error description powerpc/85xx: Remove fsl,85... bindings
2 parents 03e1ccd + be80a1c commit 0be3ff0

18 files changed

Lines changed: 184 additions & 428 deletions

File tree

Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ddr.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ properties:
2525
- const: fsl,qoriq-memory-controller
2626
- enum:
2727
- fsl,bsc9132-memory-controller
28-
- fsl,8540-memory-controller
29-
- fsl,8541-memory-controller
30-
- fsl,8544-memory-controller
31-
- fsl,8548-memory-controller
32-
- fsl,8555-memory-controller
33-
- fsl,8568-memory-controller
3428
- fsl,mpc8536-memory-controller
3529
- fsl,mpc8540-memory-controller
3630
- fsl,mpc8541-memory-controller

Documentation/devicetree/bindings/powerpc/fsl/l2cache.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ The cache bindings explained below are Devicetree Specification compliant
66
Required Properties:
77

88
- compatible : Should include one of the following:
9-
"fsl,8540-l2-cache-controller"
10-
"fsl,8541-l2-cache-controller"
11-
"fsl,8544-l2-cache-controller"
12-
"fsl,8548-l2-cache-controller"
13-
"fsl,8555-l2-cache-controller"
14-
"fsl,8568-l2-cache-controller"
159
"fsl,b4420-l2-cache-controller"
1610
"fsl,b4860-l2-cache-controller"
1711
"fsl,bsc9131-l2-cache-controller"

drivers/edac/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ config EDAC_DECODE_MCE
5555
config EDAC_GHES
5656
bool "Output ACPI APEI/GHES BIOS detected errors via EDAC"
5757
depends on ACPI_APEI_GHES && (EDAC=y)
58+
select UEFI_CPER
5859
help
5960
Not all machines support hardware-driven error report. Some of those
6061
provide a BIOS-driven error report mechanism via ACPI, using the
@@ -484,7 +485,7 @@ config EDAC_ARMADA_XP
484485

485486
config EDAC_SYNOPSYS
486487
tristate "Synopsys DDR Memory Controller"
487-
depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_INTEL_SOCFPGA
488+
depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_INTEL_SOCFPGA || ARCH_MXC
488489
help
489490
Support for error detection and correction on the Synopsys DDR
490491
memory controller.

drivers/edac/armada_xp_edac.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,10 @@ static int axp_mc_probe(struct platform_device *pdev)
286286
struct edac_mc_layer layers[1];
287287
const struct of_device_id *id;
288288
struct mem_ctl_info *mci;
289-
struct resource *r;
290289
void __iomem *base;
291290
uint32_t config;
292291

293-
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
294-
if (!r) {
295-
dev_err(&pdev->dev, "Unable to get mem resource\n");
296-
return -ENODEV;
297-
}
298-
299-
base = devm_ioremap_resource(&pdev->dev, r);
292+
base = devm_platform_ioremap_resource(pdev, 0);
300293
if (IS_ERR(base)) {
301294
dev_err(&pdev->dev, "Unable to map regs\n");
302295
return PTR_ERR(base);
@@ -516,15 +509,8 @@ static int aurora_l2_probe(struct platform_device *pdev)
516509
const struct of_device_id *id;
517510
uint32_t l2x0_aux_ctrl;
518511
void __iomem *base;
519-
struct resource *r;
520-
521-
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
522-
if (!r) {
523-
dev_err(&pdev->dev, "Unable to get mem resource\n");
524-
return -ENODEV;
525-
}
526512

527-
base = devm_ioremap_resource(&pdev->dev, r);
513+
base = devm_platform_ioremap_resource(pdev, 0);
528514
if (IS_ERR(base)) {
529515
dev_err(&pdev->dev, "Unable to map regs\n");
530516
return PTR_ERR(base);

drivers/edac/dmc520_edac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int dmc520_edac_probe(struct platform_device *pdev)
489489
dev = &pdev->dev;
490490

491491
for (idx = 0; idx < NUMBER_OF_IRQS; idx++) {
492-
irq = platform_get_irq_byname(pdev, dmc520_irq_configs[idx].name);
492+
irq = platform_get_irq_byname_optional(pdev, dmc520_irq_configs[idx].name);
493493
irqs[idx] = irq;
494494
masks[idx] = dmc520_irq_configs[idx].mask;
495495
if (irq >= 0) {

drivers/edac/edac_device.c

Lines changed: 50 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -47,99 +47,67 @@ static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
4747
}
4848
#endif /* CONFIG_EDAC_DEBUG */
4949

50-
struct edac_device_ctl_info *edac_device_alloc_ctl_info(
51-
unsigned sz_private,
52-
char *edac_device_name, unsigned nr_instances,
53-
char *edac_block_name, unsigned nr_blocks,
54-
unsigned offset_value, /* zero, 1, or other based offset */
55-
struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib,
56-
int device_index)
50+
/*
51+
* @off_val: zero, 1, or other based offset
52+
*/
53+
struct edac_device_ctl_info *
54+
edac_device_alloc_ctl_info(unsigned pvt_sz, char *dev_name, unsigned nr_instances,
55+
char *blk_name, unsigned nr_blocks, unsigned off_val,
56+
struct edac_dev_sysfs_block_attribute *attrib_spec,
57+
unsigned nr_attrib, int device_index)
5758
{
58-
struct edac_device_ctl_info *dev_ctl;
59-
struct edac_device_instance *dev_inst, *inst;
60-
struct edac_device_block *dev_blk, *blk_p, *blk;
6159
struct edac_dev_sysfs_block_attribute *dev_attrib, *attrib_p, *attrib;
62-
unsigned total_size;
63-
unsigned count;
60+
struct edac_device_block *dev_blk, *blk_p, *blk;
61+
struct edac_device_instance *dev_inst, *inst;
62+
struct edac_device_ctl_info *dev_ctl;
6463
unsigned instance, block, attr;
65-
void *pvt, *p;
64+
void *pvt;
6665
int err;
6766

6867
edac_dbg(4, "instances=%d blocks=%d\n", nr_instances, nr_blocks);
6968

70-
/* Calculate the size of memory we need to allocate AND
71-
* determine the offsets of the various item arrays
72-
* (instance,block,attrib) from the start of an allocated structure.
73-
* We want the alignment of each item (instance,block,attrib)
74-
* to be at least as stringent as what the compiler would
75-
* provide if we could simply hardcode everything into a single struct.
76-
*/
77-
p = NULL;
78-
dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);
69+
dev_ctl = kzalloc(sizeof(struct edac_device_ctl_info), GFP_KERNEL);
70+
if (!dev_ctl)
71+
return NULL;
7972

80-
/* Calc the 'end' offset past end of ONE ctl_info structure
81-
* which will become the start of the 'instance' array
82-
*/
83-
dev_inst = edac_align_ptr(&p, sizeof(*dev_inst), nr_instances);
73+
dev_inst = kcalloc(nr_instances, sizeof(struct edac_device_instance), GFP_KERNEL);
74+
if (!dev_inst)
75+
goto free;
8476

85-
/* Calc the 'end' offset past the instance array within the ctl_info
86-
* which will become the start of the block array
87-
*/
88-
count = nr_instances * nr_blocks;
89-
dev_blk = edac_align_ptr(&p, sizeof(*dev_blk), count);
77+
dev_ctl->instances = dev_inst;
9078

91-
/* Calc the 'end' offset past the dev_blk array
92-
* which will become the start of the attrib array, if any.
93-
*/
94-
/* calc how many nr_attrib we need */
95-
if (nr_attrib > 0)
96-
count *= nr_attrib;
97-
dev_attrib = edac_align_ptr(&p, sizeof(*dev_attrib), count);
79+
dev_blk = kcalloc(nr_instances * nr_blocks, sizeof(struct edac_device_block), GFP_KERNEL);
80+
if (!dev_blk)
81+
goto free;
9882

99-
/* Calc the 'end' offset past the attributes array */
100-
pvt = edac_align_ptr(&p, sz_private, 1);
83+
dev_ctl->blocks = dev_blk;
10184

102-
/* 'pvt' now points to where the private data area is.
103-
* At this point 'pvt' (like dev_inst,dev_blk and dev_attrib)
104-
* is baselined at ZERO
105-
*/
106-
total_size = ((unsigned long)pvt) + sz_private;
85+
if (nr_attrib) {
86+
dev_attrib = kcalloc(nr_attrib, sizeof(struct edac_dev_sysfs_block_attribute),
87+
GFP_KERNEL);
88+
if (!dev_attrib)
89+
goto free;
10790

108-
/* Allocate the amount of memory for the set of control structures */
109-
dev_ctl = kzalloc(total_size, GFP_KERNEL);
110-
if (dev_ctl == NULL)
111-
return NULL;
91+
dev_ctl->attribs = dev_attrib;
92+
}
11293

113-
/* Adjust pointers so they point within the actual memory we
114-
* just allocated rather than an imaginary chunk of memory
115-
* located at address 0.
116-
* 'dev_ctl' points to REAL memory, while the others are
117-
* ZERO based and thus need to be adjusted to point within
118-
* the allocated memory.
119-
*/
120-
dev_inst = (struct edac_device_instance *)
121-
(((char *)dev_ctl) + ((unsigned long)dev_inst));
122-
dev_blk = (struct edac_device_block *)
123-
(((char *)dev_ctl) + ((unsigned long)dev_blk));
124-
dev_attrib = (struct edac_dev_sysfs_block_attribute *)
125-
(((char *)dev_ctl) + ((unsigned long)dev_attrib));
126-
pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL;
127-
128-
/* Begin storing the information into the control info structure */
129-
dev_ctl->dev_idx = device_index;
130-
dev_ctl->nr_instances = nr_instances;
131-
dev_ctl->instances = dev_inst;
132-
dev_ctl->pvt_info = pvt;
94+
if (pvt_sz) {
95+
pvt = kzalloc(pvt_sz, GFP_KERNEL);
96+
if (!pvt)
97+
goto free;
98+
99+
dev_ctl->pvt_info = pvt;
100+
}
101+
102+
dev_ctl->dev_idx = device_index;
103+
dev_ctl->nr_instances = nr_instances;
133104

134105
/* Default logging of CEs and UEs */
135106
dev_ctl->log_ce = 1;
136107
dev_ctl->log_ue = 1;
137108

138109
/* Name of this edac device */
139-
snprintf(dev_ctl->name,sizeof(dev_ctl->name),"%s",edac_device_name);
140-
141-
edac_dbg(4, "edac_dev=%p next after end=%p\n",
142-
dev_ctl, pvt + sz_private);
110+
snprintf(dev_ctl->name, sizeof(dev_ctl->name),"%s", dev_name);
143111

144112
/* Initialize every Instance */
145113
for (instance = 0; instance < nr_instances; instance++) {
@@ -150,15 +118,14 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
150118
inst->blocks = blk_p;
151119

152120
/* name of this instance */
153-
snprintf(inst->name, sizeof(inst->name),
154-
"%s%u", edac_device_name, instance);
121+
snprintf(inst->name, sizeof(inst->name), "%s%u", dev_name, instance);
155122

156123
/* Initialize every block in each instance */
157124
for (block = 0; block < nr_blocks; block++) {
158125
blk = &blk_p[block];
159126
blk->instance = inst;
160127
snprintf(blk->name, sizeof(blk->name),
161-
"%s%d", edac_block_name, block+offset_value);
128+
"%s%d", blk_name, block + off_val);
162129

163130
edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n",
164131
instance, inst, block, blk, blk->name);
@@ -210,10 +177,8 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
210177
* Initialize the 'root' kobj for the edac_device controller
211178
*/
212179
err = edac_device_register_sysfs_main_kobj(dev_ctl);
213-
if (err) {
214-
kfree(dev_ctl);
215-
return NULL;
216-
}
180+
if (err)
181+
goto free;
217182

218183
/* at this point, the root kobj is valid, and in order to
219184
* 'free' the object, then the function:
@@ -223,6 +188,11 @@ struct edac_device_ctl_info *edac_device_alloc_ctl_info(
223188
*/
224189

225190
return dev_ctl;
191+
192+
free:
193+
__edac_device_free_ctl_info(dev_ctl);
194+
195+
return NULL;
226196
}
227197
EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info);
228198

drivers/edac/edac_device.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ struct edac_device_ctl_info {
216216
*/
217217
u32 nr_instances;
218218
struct edac_device_instance *instances;
219+
struct edac_device_block *blocks;
220+
struct edac_dev_sysfs_block_attribute *attribs;
219221

220222
/* Event counters for the this whole EDAC Device */
221223
struct edac_device_counter counters;
@@ -348,4 +350,16 @@ edac_device_handle_ue(struct edac_device_ctl_info *edac_dev, int inst_nr,
348350
*/
349351
extern int edac_device_alloc_index(void);
350352
extern const char *edac_layer_name[];
353+
354+
/* Free the actual struct */
355+
static inline void __edac_device_free_ctl_info(struct edac_device_ctl_info *ci)
356+
{
357+
if (ci) {
358+
kfree(ci->pvt_info);
359+
kfree(ci->attribs);
360+
kfree(ci->blocks);
361+
kfree(ci->instances);
362+
kfree(ci);
363+
}
364+
}
351365
#endif

drivers/edac/edac_device_sysfs.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,7 @@ static void edac_device_ctrl_master_release(struct kobject *kobj)
208208
/* decrement the EDAC CORE module ref count */
209209
module_put(edac_dev->owner);
210210

211-
/* free the control struct containing the 'main' kobj
212-
* passed in to this routine
213-
*/
214-
kfree(edac_dev);
211+
__edac_device_free_ctl_info(edac_dev);
215212
}
216213

217214
/* ktype for the main (master) kobject */

0 commit comments

Comments
 (0)