Skip to content

Commit b01aec9

Browse files
committed
EDAC: Cleanup atomic_scrub mess
So first of all, this atomic_scrub() function's naming is bad. It looks like an atomic_t helper. Change it to edac_atomic_scrub(). The bigger problem is that this function is arch-specific and every new arch which doesn't necessarily need that functionality still needs to define it, otherwise EDAC doesn't compile. So instead of doing that and including arch-specific headers, have each arch define an EDAC_ATOMIC_SCRUB symbol which can be used in edac_mc.c for ifdeffery. Much cleaner. And we already are doing this with another symbol - EDAC_SUPPORT. This is also much cleaner than having CONFIG_EDAC enumerate all the arches which need/have EDAC support and drivers. This way I can kill the useless edac.h header in tile too. Acked-by: Ralf Baechle <[email protected]> Acked-by: Michael Ellerman <[email protected]> Acked-by: Chris Metcalf <[email protected]> Acked-by: Ingo Molnar <[email protected]> Acked-by: Russell King <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Doug Thompson <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: "Maciej W. Rozycki" <[email protected]> Cc: Markos Chandras <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: "Steven J. Hill" <[email protected]> Cc: [email protected] Signed-off-by: Borislav Petkov <[email protected]>
1 parent 30c7469 commit b01aec9

File tree

12 files changed

+27
-41
lines changed

12 files changed

+27
-41
lines changed

arch/arm/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ config ARM
1515
select CLONE_BACKWARDS
1616
select CPU_PM if (SUSPEND || CPU_IDLE)
1717
select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
18+
select EDAC_SUPPORT
19+
select EDAC_ATOMIC_SCRUB
1820
select GENERIC_ALLOCATOR
1921
select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI)
2022
select GENERIC_CLOCKEVENTS_BROADCAST if SMP

arch/arm/include/asm/edac.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
#define ASM_EDAC_H
1919
/*
2020
* ECC atomic, DMA, SMP and interrupt safe scrub function.
21-
* Implements the per arch atomic_scrub() that EDAC use for software
21+
* Implements the per arch edac_atomic_scrub() that EDAC use for software
2222
* ECC scrubbing. It reads memory and then writes back the original
2323
* value, allowing the hardware to detect and correct memory errors.
2424
*/
25-
static inline void atomic_scrub(void *va, u32 size)
25+
26+
static inline void edac_atomic_scrub(void *va, u32 size)
2627
{
2728
#if __LINUX_ARM_ARCH__ >= 6
2829
unsigned int *virt_addr = va;

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ config CAVIUM_OCTEON_SOC
819819
select SYS_SUPPORTS_64BIT_KERNEL
820820
select SYS_SUPPORTS_BIG_ENDIAN
821821
select EDAC_SUPPORT
822+
select EDAC_ATOMIC_SCRUB
822823
select SYS_SUPPORTS_LITTLE_ENDIAN
823824
select SYS_SUPPORTS_HOTPLUG_CPU if CPU_BIG_ENDIAN
824825
select SYS_HAS_EARLY_PRINTK

arch/mips/include/asm/edac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
/* ECC atomic, DMA, SMP and interrupt safe scrub function */
77

8-
static inline void atomic_scrub(void *va, u32 size)
8+
static inline void edac_atomic_scrub(void *va, u32 size)
99
{
1010
unsigned long *virt_addr = va;
1111
unsigned long temp;
@@ -21,7 +21,7 @@ static inline void atomic_scrub(void *va, u32 size)
2121

2222
__asm__ __volatile__ (
2323
" .set mips2 \n"
24-
"1: ll %0, %1 # atomic_scrub \n"
24+
"1: ll %0, %1 # edac_atomic_scrub \n"
2525
" addu %0, $0 \n"
2626
" sc %0, %1 \n"
2727
" beqz %0, 1b \n"

arch/powerpc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ config PPC
153153
select NO_BOOTMEM
154154
select HAVE_GENERIC_RCU_GUP
155155
select HAVE_PERF_EVENTS_NMI if PPC64
156+
select EDAC_SUPPORT
157+
select EDAC_ATOMIC_SCRUB
156158

157159
config GENERIC_CSUM
158160
def_bool CPU_LITTLE_ENDIAN

arch/powerpc/include/asm/edac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#define ASM_EDAC_H
1313
/*
1414
* ECC atomic, DMA, SMP and interrupt safe scrub function.
15-
* Implements the per arch atomic_scrub() that EDAC use for software
15+
* Implements the per arch edac_atomic_scrub() that EDAC use for software
1616
* ECC scrubbing. It reads memory and then writes back the original
1717
* value, allowing the hardware to detect and correct memory errors.
1818
*/
19-
static __inline__ void atomic_scrub(void *va, u32 size)
19+
static __inline__ void edac_atomic_scrub(void *va, u32 size)
2020
{
2121
unsigned int *virt_addr = va;
2222
unsigned int temp;

arch/tile/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ config TILE
2828
select HAVE_DEBUG_STACKOVERFLOW
2929
select ARCH_WANT_FRAME_POINTERS
3030
select HAVE_CONTEXT_TRACKING
31+
select EDAC_SUPPORT
3132

3233
# FIXME: investigate whether we need/want these options.
3334
# select HAVE_IOREMAP_PROT

arch/tile/include/asm/edac.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

arch/x86/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ config X86
143143
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
144144
select X86_FEATURE_NAMES if PROC_FS
145145
select SRCU
146+
select EDAC_SUPPORT
147+
select EDAC_ATOMIC_SCRUB
146148

147149
config INSTRUCTION_DECODER
148150
def_bool y

arch/x86/include/asm/edac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
/* ECC atomic, DMA, SMP and interrupt safe scrub function */
55

6-
static inline void atomic_scrub(void *va, u32 size)
6+
static inline void edac_atomic_scrub(void *va, u32 size)
77
{
88
u32 i, *virt_addr = va;
99

drivers/edac/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# EDAC Kconfig
33
# Copyright (c) 2008 Doug Thompson www.softwarebitmaker.com
44
# Licensed and distributed under the GPL
5-
#
5+
6+
config EDAC_ATOMIC_SCRUB
7+
bool
68

79
config EDAC_SUPPORT
810
bool
911

1012
menuconfig EDAC
1113
bool "EDAC (Error Detection And Correction) reporting"
12-
depends on HAS_IOMEM
13-
depends on X86 || PPC || TILE || ARM || EDAC_SUPPORT
14+
depends on HAS_IOMEM && EDAC_SUPPORT
1415
help
1516
EDAC is designed to report errors in the core system.
1617
These are low-level errors that are reported in the CPU or

drivers/edac/edac_mc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@
3030
#include <linux/bitops.h>
3131
#include <asm/uaccess.h>
3232
#include <asm/page.h>
33-
#include <asm/edac.h>
3433
#include "edac_core.h"
3534
#include "edac_module.h"
3635
#include <ras/ras_event.h>
3736

37+
#ifdef CONFIG_EDAC_ATOMIC_SCRUB
38+
#include <asm/edac.h>
39+
#else
40+
#define edac_atomic_scrub(va, size) do { } while (0)
41+
#endif
42+
3843
/* lock to memory controller's control array */
3944
static DEFINE_MUTEX(mem_ctls_mutex);
4045
static LIST_HEAD(mc_devices);
@@ -874,7 +879,7 @@ static void edac_mc_scrub_block(unsigned long page, unsigned long offset,
874879
virt_addr = kmap_atomic(pg);
875880

876881
/* Perform architecture specific atomic scrub operation */
877-
atomic_scrub(virt_addr + offset, size);
882+
edac_atomic_scrub(virt_addr + offset, size);
878883

879884
/* Unmap and complete */
880885
kunmap_atomic(virt_addr);

0 commit comments

Comments
 (0)