Skip to contentSkip to conversation

x86, quirks: Add workaround for AMD F16h Erratum792

PATCH Superseded Aravind Gopalakrishnan 2 participants 4 messages Jan 17, 2014 – Jan 23, 2014

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, quirks: Add workaround for AMD F16h Erratum792

The workaround for this Erratum is included in AGESA. But BIOSes spun only after Jan2014 will have the fix (atleast server versions of the chip). The erratum affects both client and server platforms and since we cannot say with certainity that ALL BIOSes on systems out in the field will have the fix, we should probably insulate ourselves in case BIOS does not do the right thing or someone is using old BIOSes.

Refer Revision Guide for AMD F16h models 00h-0fh, document 51810 Rev. 3.04, November2013 for details on the Erratum.

Tested the patch on Fam16h server platform and works fine.

---
 arch/x86/kernel/quirks.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/x86/kernel/quirks.c +31 -0
index 04ee1e2..e55ae02 100644
@@ -571,3 +571,34 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5,
 			quirk_amd_nb_node);
 
 #endif
+
+#if defined(CONFIG_PCI)
+/*
+ * Apply AMD Fam16h Erratum792
+ * see Revision Guide for AMD F16h models 00h-0fh,
+ * document 51810 rev. 3.04, Nov 2013
+ */
+static void quirk_amd_dram_scrub(struct pci_dev *dev)
+{
+	u32 val;
+
+	/* Suggested workaround:
+	 * set D18F3x58[4:0] = 00h and set D18F3x5C[0] = 0b
+	 */
+	pci_read_config_dword(dev, 0x58, &val);
+	if (val & 0x1F) {
+		val &= ~(0x1F);
+		pci_write_config_dword(dev, 0x58, val);
+	}
+
+	pci_read_config_dword(dev, 0x5C, &val);
+	if (val & BIT(0)) {
+		val &= ~BIT(0);
+		pci_write_config_dword(dev, 0x5c, val);
+	}
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3,
+			quirk_amd_dram_scrub);
+
+#endif
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 23 lines · Aravind Gopalakrishnan

The workaround for this Erratum is included in AGESA. But BIOSes spun only after Jan2014 will have the fix (atleast server versions of the chip). The erratum affects both client and server platforms and since we cannot say with certainity that ALL BIOSes on systems out in the field will have the fix, we should probably insulate ourselves in case BIOS does not do the right thing or someone is using old BIOSes.

Refer Revision Guide for AMD F16h models 00h-0fh, document 51810 Rev. 3.04, November2013 for details on the Erratum.

Tested the patch on Fam16h server platform and works fine.

---
 arch/x86/kernel/quirks.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/x86/kernel/quirks.c +0 -0
index 04ee1e2..e55ae02 100644
@@ -571,3 +571,34 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5,
 			quirk_amd_nb_node);

arch/x86/kernel/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, · line 581

Quoted 10 lines
arch/x86/kernel/quirks.c +8 -0
 
 #endif
+
+#if defined(CONFIG_PCI)
+/*
+ * Apply AMD Fam16h Erratum792
+ * see Revision Guide for AMD F16h models 00h-0fh,
+ * document 51810 rev. 3.04, Nov 2013
+ */
+static void quirk_amd_dram_scrub(struct pci_dev *dev)

The reference to the erratum is useful for people who want to see more details, but at least a short description of the problem being fixed and systems affected by the quirk is needed. 'DRAM scrub' is not very informative.

Thanks,

Ingo

#2 lore raw
Quoted 16 lines · Ingo Molnar

arch/x86/kernel/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, · line 581

Quoted 8 lines · Aravind Gopalakrishnan
arch/x86/kernel/quirks.c +8 -0
+
+#if defined(CONFIG_PCI)
+/*
+ * Apply AMD Fam16h Erratum792
+ * see Revision Guide for AMD F16h models 00h-0fh,
+ * document 51810 rev. 3.04, Nov 2013
+ */
+static void quirk_amd_dram_scrub(struct pci_dev *dev)

The reference to the erratum is useful for people who want to see more details, but at least a short description of the problem being fixed and systems affected by the quirk is needed. 'DRAM scrub' is not very informative.

Ok, I'll reword the comment in a V2.
But there's an internal discussion going on about the erratum, so I'll hold off spinning a V2 until that's over..

Thanks,
-Aravind.

#3 lore raw
Quoted 17 lines · Aravind Gopalakrishnan
Quoted 16 lines · Ingo Molnar

arch/x86/kernel/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, · line 581

Quoted 8 lines · Aravind Gopalakrishnan
arch/x86/kernel/quirks.c +8 -0
+
+#if defined(CONFIG_PCI)
+/*
+ * Apply AMD Fam16h Erratum792
+ * see Revision Guide for AMD F16h models 00h-0fh,
+ * document 51810 rev. 3.04, Nov 2013
+ */
+static void quirk_amd_dram_scrub(struct pci_dev *dev)

The reference to the erratum is useful for people who want to see more details, but at least a short description of the problem being fixed and systems affected by the quirk is needed. 'DRAM scrub' is not very informative.

Quoted 5 lines

Ok, I'll reword the comment in a V2.
But there's an internal discussion going on about the erratum, so I'll hold off spinning a V2 until that's over..

Thanks,
-Aravind.

Addressing hpa and Boris' earlier concern (http://marc.info/?l=linux-kernel&m=138998314409664&w=2)
I can say with better certainty now that there is a coverage hole:
Initial production parts shipped last year, while fix will be in BIOS only from now onwards; (at least server platforms..)

I have also reworded the comment and function name per Ingo's suggestion.. Sending V2 of patch (rebased off latest tip/master)

Thanks,
-Aravind