Skip to content

Commit 6e241bc

Browse files
yghannambp3tk0v
authored andcommitted
EDAC/amd64: Remove scrub rate control for Family 17h and later
The scrub registers on AMD Family 17h and later may be inaccessible to the OS. Furthermore, hardware designers recommend that the scrubbing feature is managed by the firmware. Remove support for the sdram_scrub_rate interface for AMD Family 17h systems and later by not setting the scrub function pointers. The EDAC MC core will then not expose the scrub files in sysfs. Signed-off-by: Yazen Ghannam <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent fdce765 commit 6e241bc

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

drivers/edac/amd64_edac.c

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,6 @@ static inline int amd64_read_dct_pci_cfg(struct amd64_pvt *pvt, u8 dct,
182182
* other archs, we might not have access to the caches directly.
183183
*/
184184

185-
static inline void __f17h_set_scrubval(struct amd64_pvt *pvt, u32 scrubval)
186-
{
187-
/*
188-
* Fam17h supports scrub values between 0x5 and 0x14. Also, the values
189-
* are shifted down by 0x5, so scrubval 0x5 is written to the register
190-
* as 0x0, scrubval 0x6 as 0x1, etc.
191-
*/
192-
if (scrubval >= 0x5 && scrubval <= 0x14) {
193-
scrubval -= 0x5;
194-
pci_write_bits32(pvt->F6, F17H_SCR_LIMIT_ADDR, scrubval, 0xF);
195-
pci_write_bits32(pvt->F6, F17H_SCR_BASE_ADDR, 1, 0x1);
196-
} else {
197-
pci_write_bits32(pvt->F6, F17H_SCR_BASE_ADDR, 0, 0x1);
198-
}
199-
}
200185
/*
201186
* Scan the scrub rate mapping table for a close or matching bandwidth value to
202187
* issue. If requested is too big, then use last maximum value found.
@@ -229,9 +214,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 new_bw, u32 min_rate)
229214

230215
scrubval = scrubrates[i].scrubval;
231216

232-
if (pvt->umc) {
233-
__f17h_set_scrubval(pvt, scrubval);
234-
} else if (pvt->fam == 0x15 && pvt->model == 0x60) {
217+
if (pvt->fam == 0x15 && pvt->model == 0x60) {
235218
f15h_select_dct(pvt, 0);
236219
pci_write_bits32(pvt->F2, F15H_M60H_SCRCTRL, scrubval, 0x001F);
237220
f15h_select_dct(pvt, 1);
@@ -271,16 +254,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
271254
int i, retval = -EINVAL;
272255
u32 scrubval = 0;
273256

274-
if (pvt->umc) {
275-
amd64_read_pci_cfg(pvt->F6, F17H_SCR_BASE_ADDR, &scrubval);
276-
if (scrubval & BIT(0)) {
277-
amd64_read_pci_cfg(pvt->F6, F17H_SCR_LIMIT_ADDR, &scrubval);
278-
scrubval &= 0xF;
279-
scrubval += 0x5;
280-
} else {
281-
scrubval = 0;
282-
}
283-
} else if (pvt->fam == 0x15) {
257+
if (pvt->fam == 0x15) {
284258
/* Erratum #505 */
285259
if (pvt->model < 0x10)
286260
f15h_select_dct(pvt, 0);
@@ -3967,6 +3941,9 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci)
39673941
mci->dev_name = pci_name(pvt->F3);
39683942
mci->ctl_page_to_phys = NULL;
39693943

3944+
if (pvt->fam >= 0x17)
3945+
return;
3946+
39703947
/* memory scrubber interface */
39713948
mci->set_sdram_scrub_rate = set_scrub_rate;
39723949
mci->get_sdram_scrub_rate = get_scrub_rate;

drivers/edac/amd64_edac.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@
215215
#define DCT_SEL_HI 0x114
216216

217217
#define F15H_M60H_SCRCTRL 0x1C8
218-
#define F17H_SCR_BASE_ADDR 0x48
219-
#define F17H_SCR_LIMIT_ADDR 0x4C
220218

221219
/*
222220
* Function 3 - Misc Control

0 commit comments

Comments
 (0)