xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] x86/AMD: Apply workaround for AMD F16h Erratum792
@ 2014-02-06 19:33 Aravind Gopalakrishnan
  2014-02-07 10:14 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Aravind Gopalakrishnan @ 2014-02-06 19:33 UTC (permalink / raw)
  To: jbeulich, suravee.suthikulpanit, xen-devel, keir, andrew.cooper3
  Cc: Aravind Gopalakrishnan

Workaround for the Erratum will be in BIOSes spun only after
Jan 2014 onwards. But initial production parts shipped in 2013
itself. Since there is a coverage hole, we should carry this fix
in software in case BIOS does not do the right thing or someone
is using old BIOS.

Refer to 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 it works fine.

Changes in V2: (per Andrew.C comments)
	- Move pci_val into same scope
	- rework indentation to match linux style
Changes in V3: (per Jan comments)
	- remove pci_val, use 'l' and 'h' instead
	- print warning message to hypervisor log

Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/amd.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index 3307141..d83906a 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -477,6 +477,42 @@ static void __devinit init_amd(struct cpuinfo_x86 *c)
 		       " all your (PV) guest kernels. ***\n");
 
 	if (c->x86 == 0x16 && c->x86_model <= 0xf) {
+		/*
+		 * Apply workaround for erratum 792
+		 * Description:
+		 * Processor does not ensure DRAM scrub read/write sequence
+		 * is atomic wrt accesses to CC6 save state area. Therefore
+		 * if a concurrent scrub read/write access is to same address
+		 * the entry may appear as if it is not written. This quirk
+		 * applies to Fam16h models 00h-0Fh
+		 *
+		 * See "Revision Guide" for AMD F16h models 00h-0fh,
+		 * document 51810 rev. 3.04, Nov 2013
+		 *
+		 * Equivalent Linux patch link:
+		 * http://marc.info/?l=linux-kernel&m=139066012217149&w=2
+		 */
+		if (smp_processor_id() == 0) {
+			l = pci_conf_read32(0, 0, 0x18, 0x3, 0x58);
+			h = pci_conf_read32(0, 0, 0x18, 0x3, 0x5c);
+			printk(KERN_WARNING
+			       "CPU%u: Applying workaround for erratum 792:%s %s %s\n",
+			       smp_processor_id(),
+			       (l & 0x1f)? "clearing bits 0-4 of D18F3x58" : "" ,
+			       ((l & 0x1f) && (h & 0x1)) ? "and" : "" , 
+			       (h & 0x1) ? "clearing bit 0 of D18F3x5C" : "");
+
+			if (l & 0x1f) {
+				l &= ~0x1f;
+				pci_conf_write32(0, 0, 0x18, 0x3, 0x58, l);
+			}
+
+			if (h & 0x1) {
+				h &= ~0x1;
+				pci_conf_write32(0, 0, 0x18, 0x3, 0x5c, h);
+			}
+		}
+
 		rdmsrl(MSR_AMD64_LS_CFG, value);
 		if (!(value & (1 << 15))) {
 			static bool_t warned;
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] x86/AMD: Apply workaround for AMD F16h Erratum792
  2014-02-06 19:33 [PATCH V3] x86/AMD: Apply workaround for AMD F16h Erratum792 Aravind Gopalakrishnan
@ 2014-02-07 10:14 ` Jan Beulich
  2014-02-07 16:06   ` Aravind Gopalakrishnan
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2014-02-07 10:14 UTC (permalink / raw)
  To: Aravind Gopalakrishnan
  Cc: andrew.cooper3, keir, suravee.suthikulpanit, xen-devel

>>> On 06.02.14 at 20:33, Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> wrote:
> Workaround for the Erratum will be in BIOSes spun only after
> Jan 2014 onwards. But initial production parts shipped in 2013
> itself. Since there is a coverage hole, we should carry this fix
> in software in case BIOS does not do the right thing or someone
> is using old BIOS.
> 
> Refer to 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 it works fine.
> 
> Changes in V2: (per Andrew.C comments)
> 	- Move pci_val into same scope
> 	- rework indentation to match linux style
> Changes in V3: (per Jan comments)
> 	- remove pci_val, use 'l' and 'h' instead
> 	- print warning message to hypervisor log
> 
> Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
> Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Applied after some more editing. Please double check.

Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] x86/AMD: Apply workaround for AMD F16h Erratum792
  2014-02-07 10:14 ` Jan Beulich
@ 2014-02-07 16:06   ` Aravind Gopalakrishnan
  0 siblings, 0 replies; 3+ messages in thread
From: Aravind Gopalakrishnan @ 2014-02-07 16:06 UTC (permalink / raw)
  To: Jan Beulich; +Cc: andrew.cooper3, keir, suravee.suthikulpanit, xen-devel

On Fri, Feb 07, 2014 at 10:14:23AM +0000, Jan Beulich wrote:
> >>> On 06.02.14 at 20:33, Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com> wrote:
> > Workaround for the Erratum will be in BIOSes spun only after
> > Jan 2014 onwards. But initial production parts shipped in 2013
> > itself. Since there is a coverage hole, we should carry this fix
> > in software in case BIOS does not do the right thing or someone
> > is using old BIOS.
> > 
> > Refer to 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 it works fine.
> > 
> > Changes in V2: (per Andrew.C comments)
> > 	- Move pci_val into same scope
> > 	- rework indentation to match linux style
> > Changes in V3: (per Jan comments)
> > 	- remove pci_val, use 'l' and 'h' instead
> > 	- print warning message to hypervisor log
> > 
> > Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
> > Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> > Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Applied after some more editing. Please double check.
> 

Tested staging branch on F16h to make sure; and works fine..

Thanks,
-Aravind.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-07 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 19:33 [PATCH V3] x86/AMD: Apply workaround for AMD F16h Erratum792 Aravind Gopalakrishnan
2014-02-07 10:14 ` Jan Beulich
2014-02-07 16:06   ` Aravind Gopalakrishnan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).