[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/3] x86/amd: Consider only Fam10h affected by erratum 383


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Thu, 19 Nov 2026 15:44:48 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zsfT5QhBsaHde56OKGmLGZxmru6vmTKcyrMVFYt00mM=; b=x0JbxIy1rWZnjjc1SBhOJjff9CV8OxH2UrlSurUriHa2tEgQIwQb3evhEaf7ndufl0bkip1XrsZ8xNlPYoZ7fLROLGBOyQ4w0M+cup+ZoGVJuaVGWAeLVSgCKO+b7nhstrMNfvAn4gLZUbtbr75einIRQtYkGJ+LFc560sbgLmUFqtUGNcZjSg+soF41xQ/fUd/nLDfvhEeUizuern2lylWTjHToH541ANTDgRZQRXfhcOgQzt/q1PwiDhNSPp+cH244+OkGIq9ybi8gI2QrBWiEaBb+Znmp7zHRq97H+OgNcJn2sqovp3fqOjuHqhIQXB2MOb3hzGeN1Wma2g1FVg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o7KR7qKto7kWQsMVGYlKPJmfF1efvSomzrgp7Xbf7bgxJnDgBHLSg04W3YgKCt9RtpHCQPh9rnVkz5Y1eE9ddVrstxE0UjNl5ssEPxtkkWWC3l3zBWdJQuBjt3wOnROcLmCbL0s6MBltZJbSJDqXwdMxKqjzTslcCepdAf3Y7BJ3hPzdjQ/xyS8DSAZBbN0b+cPREtLMz60vbaGz7J4YvfewUXAgP5YMhiZJkWZZR1RzYRN5OW1jJS/X8uKp9qwGe9Yoxw8VNHNgSiZuDLRhQpTFu3Ll+jRYKZryxa5cPh5DLHUcO8nFZyK4JdLOOitIy7wF+CEgeart44YIbRrm8A==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Thu, 19 Nov 2026 14:45:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

2604adda4f81 introduced the cpu_has_amd_erratum() machinary while adding
erratum 383. The commit message claims it was based on Linux's, but in
addition to cosmetic changes it also added Fam12h as affected. It is not
acknowledged as so the relevant Fam12h revision guide, and Linux itself
never considered it. My best guess is that OSVW always returns early and
doesn't let the "legacy" mechanism ever match Fam12h (the relevant bit
is always 0, according to its Revision Guide).

Seeing how all K10 is affected, and Xen only matches OSVW for this
erratum, drop OSVW altogether while trimming the list to K10.

Fixes: 2604adda4f81 ("AMD OSVW (OS Visible Workaround) for Xen")
Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
Fam12h CPUs where firmware wasn't exposing OSVW would change by not
(wrongly) applying the workaround. I'm not sure if there may be any such
machines. I'm also not sure anyone cares. I wouldn't backport this, thus
why I subsumed the Fam12h removal into the OSVW removal.
---
 xen/arch/x86/cpu/amd.c         | 21 +++------------------
 xen/arch/x86/include/asm/amd.h | 21 +++++++--------------
 2 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
index ff9fc0689f..0515a314dc 100644
--- a/xen/arch/x86/cpu/amd.c
+++ b/xen/arch/x86/cpu/amd.c
@@ -321,7 +321,7 @@ void amd_set_cpuid_user_dis(bool enable)
  * Check for the presence of an AMD erratum. Arguments are defined in amd.h 
  * for each known erratum. Return 1 if erratum is found.
  */
-int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...)
+int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, ...)
 {
        va_list ap;
        u32 range;
@@ -330,23 +330,8 @@ int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int 
osvw_id, ...)
        if (cpu->vendor != X86_VENDOR_AMD)
                return 0;
 
-       if (osvw_id >= 0 && cpu_has(cpu, X86_FEATURE_OSVW)) {
-               u64 osvw_len;
-
-               rdmsrl(MSR_AMD_OSVW_ID_LENGTH, osvw_len);
-
-               if (osvw_id < osvw_len) {
-                       u64 osvw_bits;
-
-                       rdmsrl(MSR_AMD_OSVW_STATUS + (osvw_id >> 6),
-                              osvw_bits);
-
-                       return (osvw_bits >> (osvw_id & 0x3f)) & 1;
-               }
-       }
-
-       /* OSVW unavailable or ID unknown, match family-model-stepping range */
-       va_start(ap, osvw_id);
+       /* Match family-model-stepping range */
+       va_start(ap, cpu);
 
        ms = (cpu->model << 4) | cpu->stepping;
        while ((range = va_arg(ap, int))) {
diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
index d21df0741a..762b1fbf7a 100644
--- a/xen/arch/x86/include/asm/amd.h
+++ b/xen/arch/x86/include/asm/amd.h
@@ -9,25 +9,19 @@
 
 /* AMD errata checking
  *
- * Errata are defined using the AMD_LEGACY_ERRATUM() or AMD_OSVW_ERRATUM()
- * macros. The latter is intended for newer errata that have an OSVW id
- * assigned, which it takes as first argument. Both take a variable number
- * of family-specific model-stepping ranges created by AMD_MODEL_RANGE().
+ * Errata are defined using the AMD_LEGACY_ERRATUM() macro, which takes a
+ * variable number of family-specific model-stepping ranges created by
+ * AMD_MODEL_RANGE().
  *
- * Example 1:
+ * Example:
  * #define AMD_ERRATUM_319                                              \
  *   AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0x4, 0x2),      \
  *                      AMD_MODEL_RANGE(0x10, 0x8, 0x0, 0x8, 0x0),      \
  *                      AMD_MODEL_RANGE(0x10, 0x9, 0x0, 0x9, 0x0))
- * Example 2:
- * #define AMD_ERRATUM_400                                              \
- *   AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),    \
- *                       AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf))
  *   
  */
 
-#define AMD_LEGACY_ERRATUM(...)         -1 /* legacy */, __VA_ARGS__, 0
-#define AMD_OSVW_ERRATUM(osvw_id, ...)  osvw_id, __VA_ARGS__, 0
+#define AMD_LEGACY_ERRATUM(...)         __VA_ARGS__, 0
 #define AMD_MODEL_RANGE(f, m_start, s_start, m_end, s_end)              \
     (((f) << 24) | ((m_start) << 16) | ((s_start) << 12) | \
      ((m_end) << 4) | (s_end))
@@ -42,8 +36,7 @@
     AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0x67, 0xf))
 
 #define AMD_ERRATUM_383                                                 \
-    AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf),    \
-                       AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0x1, 0x0))
+    AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x10, 0x0, 0x0, 0xff, 0xf))
 
 #define AMD_ERRATUM_573                                                        
\
     AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0xff, 0xf),     \
@@ -72,7 +65,7 @@
 #define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
-int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
+int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, ...);
 
 extern int8_t opt_allow_unsafe;
 
-- 
2.43.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.