x86/amd: Work around CLFLUSH ordering on older parts
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 9 Jun 2022 13:29:13 +0000 (15:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 9 Jun 2022 13:29:13 +0000 (15:29 +0200)
commitc4815be949aae6583a9a22897beb96b095b4f1a2
tree8c7db75299a1ea614c2631ecbdc0d9ba0f879d34
parent8eafa2d871ae51d461256e4a14175e24df330c70
x86/amd: Work around CLFLUSH ordering on older parts

On pre-CLFLUSHOPT AMD CPUs, CLFLUSH is weakely ordered with everything,
including reads and writes to the address, and LFENCE/SFENCE instructions.

This creates a multitude of problematic corner cases, laid out in the manual.
Arrange to use MFENCE on both sides of the CLFLUSH to force proper ordering.

This is part of XSA-402.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 062868a5a8b428b85db589fa9a6d6e43969ffeb9
master date: 2022-06-09 14:23:07 +0200
xen/arch/x86/cpu/amd.c
xen/arch/x86/flushtlb.c
xen/include/asm-x86/cpufeatures.h