Skip to content

Commit 3a881be

Browse files
qzhuo2gregkh
authored andcommitted
EDAC/i10nm: Use readl() to access MMIO registers
commit 83ff51c upstream. Instead of raw access, use readl() to access MMIO registers of memory controller to avoid possible compiler re-ordering. Fixes: d4dc89d ("EDAC, i10nm: Add a driver for Intel 10nm server processors") Cc: <stable@vger.kernel.org> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d03b710 commit 3a881be

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎drivers/edac/i10nm_base.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/kernel.h>
9+
#include <linux/io.h>
910
#include <asm/cpu_device_id.h>
1011
#include <asm/intel-family.h>
1112
#include <asm/mce.h>
@@ -19,14 +20,16 @@
1920
#define i10nm_printk(level, fmt, arg...) \
2021
edac_printk(level, "i10nm", fmt, ##arg)
2122

22-
#define I10NM_GET_SCK_BAR(d, reg) \
23+
#define I10NM_GET_SCK_BAR(d, reg) \
2324
pci_read_config_dword((d)->uracu, 0xd0, &(reg))
2425
#define I10NM_GET_IMC_BAR(d, i, reg) \
2526
pci_read_config_dword((d)->uracu, 0xd8 + (i) * 4, &(reg))
2627
#define I10NM_GET_DIMMMTR(m, i, j) \
27-
(*(u32 *)((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4))
28+
readl((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4)
2829
#define I10NM_GET_MCDDRTCFG(m, i, j) \
29-
(*(u32 *)((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4))
30+
readl((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4)
31+
#define I10NM_GET_MCMTR(m, i) \
32+
readl((m)->mbase + 0x20ef8 + (i) * 0x4000)
3033

3134
#define I10NM_GET_SCK_MMIO_BASE(reg) (GET_BITFIELD(reg, 0, 28) << 23)
3235
#define I10NM_GET_IMC_MMIO_OFFSET(reg) (GET_BITFIELD(reg, 0, 10) << 12)
@@ -148,7 +151,7 @@ static bool i10nm_check_ecc(struct skx_imc *imc, int chan)
148151
{
149152
u32 mcmtr;
150153

151-
mcmtr = *(u32 *)(imc->mbase + 0x20ef8 + chan * 0x4000);
154+
mcmtr = I10NM_GET_MCMTR(imc, chan);
152155
edac_dbg(1, "ch%d mcmtr reg %x\n", chan, mcmtr);
153156

154157
return !!GET_BITFIELD(mcmtr, 2, 2);

0 commit comments

Comments
 (0)