All of lore.kernel.org
 help / color / mirror / Atom feed
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 2/3] mwait-idle: add support for AMD processors
Date: Mon, 25 Feb 2019 20:23:59 +0000	[thread overview]
Message-ID: <20190225202233.68340-3-brian.woods@amd.com> (raw)
In-Reply-To: <20190225202233.68340-1-brian.woods@amd.com>

Newer AMD processors (F17h) have mwait support.  Add some checks to make
sure vendor specific code is run correctly and some infrastructure to
facilitate adding AMD processors.

Signed-off-by: Brian Woods <brian.woods@amd.com>
---
 xen/arch/x86/cpu/mwait-idle.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index a063e39d60..1036c8b101 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -979,6 +979,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)
  *
@@ -1115,6 +1122,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_AMD)
+		return;
+
 	switch (boot_cpu_data.x86_model) {
 	case 0x3e: /* IVT */
 		ivt_idle_state_table_update();
@@ -1126,13 +1136,24 @@ static void __init mwait_idle_state_table_update(void)
 	case 0x5e: /* SKL-H */
 		sklh_idle_state_table_update();
 		break;
- 	}
+	}
 }
 
 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;
+
+	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;
+	default:
+		id = NULL;
+	}
 
 	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

  parent reply	other threads:[~2019-02-25 20:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 20:23 [PATCH 0/3] mwait support for AMD processors Woods, Brian
2019-02-25 20:23 ` [PATCH 1/3] mwait-idle: add support for using halt Woods, Brian
2019-02-27 13:47   ` Wei Liu
2019-02-27 18:23     ` Woods, Brian
2019-03-05 17:12       ` Wei Liu
2019-03-11 15:10         ` Woods, Brian
2019-03-13  9:35   ` Jan Beulich
2019-03-14 19:00     ` Woods, Brian
2019-03-15  8:37       ` Jan Beulich
2019-03-19 16:12         ` Woods, Brian
2019-03-19 16:58           ` Jan Beulich
2019-03-26 15:54           ` Jan Beulich
2019-03-26 21:56             ` Woods, Brian
2019-03-27 14:48               ` Jan Beulich
2019-03-27 17:28                 ` Woods, Brian
2019-03-28  8:26                   ` Jan Beulich
2019-03-28 15:02                     ` Woods, Brian
2019-03-28 15:50                       ` Jan Beulich
2019-03-28 16:26                         ` Woods, Brian
2019-02-25 20:23 ` Woods, Brian [this message]
2019-03-13  9:42   ` [PATCH 2/3] mwait-idle: add support for AMD processors Jan Beulich
2019-03-14 19:14     ` Woods, Brian
2019-02-25 20:24 ` [PATCH 3/3] mwait-idle: add enablement for AMD Naples and Rome Woods, Brian
2019-03-13  9:51   ` Jan Beulich
2019-03-14 19:29     ` Woods, Brian
2019-03-15  8:54       ` Jan Beulich
2019-03-19 15:59         ` Woods, Brian
2019-03-19 17:01           ` Jan Beulich
2019-02-26 10:49 ` [PATCH 0/3] mwait support for AMD processors Jan Beulich
2019-02-26 16:25   ` Woods, Brian
2019-02-26 16:37     ` Jan Beulich
2019-02-26 16:54       ` Woods, Brian
2019-02-27  8:51         ` Jan Beulich
2019-02-27 16:54           ` Woods, Brian

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=20190225202233.68340-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.