From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Alejandro Vallejo <alejandro.garciavallejo@amd.com>,
xen-devel@lists.xenproject.org
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>,
"Jason Andryuk" <jason.andryuk@amd.com>
Subject: Re: [PATCH v2 2/3] x86/amd: Drop cpu_has_amd_erratum()
Date: Mon, 23 Nov 2026 17:08:09 +0000 [thread overview]
Message-ID: <3ad769e5-aaba-438d-8288-3e4f2994d344@citrix.com> (raw)
In-Reply-To: <20261119144453.529009-3-alejandro.garciavallejo@amd.com>
On 19/11/2026 2:44 pm, Alejandro Vallejo wrote:
> diff --git a/xen/arch/x86/include/asm/amd.h b/xen/arch/x86/include/asm/amd.h
> index 762b1fbf7a..3ed133fcd5 100644
> --- a/xen/arch/x86/include/asm/amd.h
> +++ b/xen/arch/x86/include/asm/amd.h
> @@ -6,43 +6,31 @@
> #define __AMD_H__
>
> #include <asm/cpufeature.h>
> +#include <asm/x86-vendors.h>
>
> -/* AMD errata checking
> - *
> - * 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:
> - * #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))
> - *
> +/*
> + * AMD errata Xen works around, each named after its number in the Revision
> + * Guide for the families it affects.
> */
These could really do with some information about what they are.
/* Sequential execution across the non-canonical boundary causes hang. */
> +static inline bool cpu_has_amd_erratum_121(const struct cpuinfo_x86 *c)
> +{
> + return c->vendor == X86_VENDOR_AMD && c->family == 0xf && c->model <= 0x3f;
> +}
>
> -#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))
> -#define AMD_MODEL_RANGE_FAMILY(range) (((range) >> 24) & 0xff)
> -#define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff)
> -#define AMD_MODEL_RANGE_END(range) ((range) & 0xfff)
/* Incorrect code bytes fetched after a world switch. */
> +static inline bool cpu_has_amd_erratum_170(const struct cpuinfo_x86 *c)
> +{
> + return c->vendor == X86_VENDOR_AMD && c->family == 0xf && c->model <= 0x67;
> +}
>
> -#define AMD_ERRATUM_121 \
> - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0x3f, 0xf))
/* L1 TLB multi-hit causes #MC. */
> +static inline bool cpu_has_amd_erratum_383(const struct cpuinfo_x86 *c)
> +{
> + return c->vendor == X86_VENDOR_AMD && c->family == 0x10;
> +}
>
> -#define AMD_ERRATUM_170 \
> - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x0f, 0x0, 0x0, 0x67, 0xf))
> -
> -#define AMD_ERRATUM_383 \
> - 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), \
> - AMD_MODEL_RANGE(0x10, 0x0, 0x0, 0xff, 0xf), \
> - AMD_MODEL_RANGE(0x11, 0x0, 0x0, 0xff, 0xf), \
> - AMD_MODEL_RANGE(0x12, 0x0, 0x0, 0xff, 0xf))
/* FSINCOS instruction may corrupt %rip. */
> +static inline bool cpu_has_amd_erratum_573(const struct cpuinfo_x86 *c)
> +{
> + return c->vendor == X86_VENDOR_AMD && c->family >= 0xf && c->family <= 0x12;
> +}
>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, subject to rebasing
over the correction in patch 1.
~Andrew
next prev parent reply other threads:[~2026-11-23 17:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 14:44 [PATCH v2 0/3] x86: Add in-scope files under cpu/ to MISRA scans Alejandro Vallejo
2026-11-19 14:44 ` [PATCH v2 1/3] x86/amd: Consider only Fam10h affected by erratum 383 Alejandro Vallejo
2026-11-23 16:53 ` Andrew Cooper
2026-11-26 15:34 ` Alejandro Vallejo
2026-11-19 14:44 ` [PATCH v2 2/3] x86/amd: Drop cpu_has_amd_erratum() Alejandro Vallejo
2026-11-23 17:08 ` Andrew Cooper [this message]
2026-11-19 14:44 ` [PATCH v2 3/3] eclair/x86: Scan in-scope files inside cpu/ Alejandro Vallejo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ad769e5-aaba-438d-8288-3e4f2994d344@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=alejandro.garciavallejo@amd.com \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=roger@xenproject.org \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.