From: "Woods, Brian" <Brian.Woods@amd.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wei.liu2@citrix.com>,
"Woods, Brian" <Brian.Woods@amd.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v2 2/3] mwait-idle: add support for AMD processors
Date: Thu, 28 Mar 2019 15:04:58 +0000 [thread overview]
Message-ID: <20190328150426.7295-3-brian.woods@amd.com> (raw)
In-Reply-To: <20190328150426.7295-1-brian.woods@amd.com>
From: Brian Woods <brian.woods@amd.com>
Newer AMD processors (F17h) have mwait support which is compatible with
Intel. Add some checks to make sure vendor specific code is run
correctly and some infrastructure to facilitate adding AMD processors.
This is done so that Xen will not be reliant on dom0 passing the parsed
ACPI tables back since Xen doesn't have an AML interpreter. This can be
unreliable or broken in some cases.
Signed-off-by: Brian Woods <brian.woods@amd.com>
---
xen/arch/x86/cpu/mwait-idle.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index b9c7f75882..58629f1c29 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -964,6 +964,13 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
{}
};
+#define ACPU(family, model, cpu) \
+ { X86_VENDOR_AMD, family, model, X86_FEATURE_ALWAYS, &idle_cpu_##cpu}
+
+static const struct x86_cpu_id amd_idle_ids[] __initconstrel = {
+ {}
+};
+
/*
* ivt_idle_state_table_update(void)
*
@@ -1100,6 +1107,9 @@ static void __init sklh_idle_state_table_update(void)
*/
static void __init mwait_idle_state_table_update(void)
{
+ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
+ return;
+
switch (boot_cpu_data.x86_model) {
case 0x3e: /* IVT */
ivt_idle_state_table_update();
@@ -1117,7 +1127,16 @@ static void __init mwait_idle_state_table_update(void)
static int __init mwait_idle_probe(void)
{
unsigned int eax, ebx, ecx;
- const struct x86_cpu_id *id = x86_match_cpu(intel_idle_ids);
+ const struct x86_cpu_id *id = NULL;
+
+ switch (boot_cpu_data.x86_vendor) {
+ case X86_VENDOR_INTEL:
+ id = x86_match_cpu(intel_idle_ids);
+ break;
+ case X86_VENDOR_AMD:
+ id = x86_match_cpu(amd_idle_ids);
+ break;
+ }
if (!id) {
pr_debug(PREFIX "does not run on family %d model %d\n",
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-03-28 15:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 15:04 [PATCH v2 0/3] mwait support for AMD processors Woods, Brian
2019-03-28 15:04 ` [PATCH v2 1/3] mwait-idle: add support for using halt Woods, Brian
2019-03-28 15:04 ` Woods, Brian [this message]
2019-03-28 15:05 ` [PATCH v2 3/3] mwait-idle: add enablement for AMD Naples and Rome Woods, Brian
2019-04-08 16:26 ` [PATCH v2 0/3] mwait support for AMD processors Woods, Brian
2019-05-09 22:00 ` Woods, Brian
2019-05-30 19:27 ` Woods, Brian
2019-05-31 2:08 ` Rich Persaud
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=20190328150426.7295-3-brian.woods@amd.com \
--to=brian.woods@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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.