From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <paul.durrant@citrix.com>
Subject: [PATCH v3 3/6] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2
Date: Tue, 21 Mar 2017 18:17:19 +0000 [thread overview]
Message-ID: <1490120242-3587-4-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1490120242-3587-1-git-send-email-paul.durrant@citrix.com>
The numbers correspond to ASCII characters so just use appropriate
character strings directly.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
v2:
- Use memcpy() rather than cast-and-assign
---
xen/arch/x86/hvm/viridian.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
index 8a5c831..41f550c 100644
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -132,14 +132,16 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
switch ( leaf )
{
case 0:
+ /* See section 2.4.1 of the specification */
res->a = 0x40000006; /* Maximum leaf */
- res->b = 0x7263694d; /* Magic numbers */
- res->c = 0x666F736F;
- res->d = 0x76482074;
+ memcpy(&res->b, "Micr", 4);
+ memcpy(&res->c, "osof", 4);
+ memcpy(&res->d, "t Hv", 4);
break;
case 1:
- res->a = 0x31237648; /* Version number */
+ /* See section 2.4.2 of the specification */
+ memcpy(&res->a, "Hv#1", 4);
break;
case 2:
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-03-21 18:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 18:17 [PATCH v3 0/6] viridian updates Paul Durrant
2017-03-21 18:17 ` [PATCH v3 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present Paul Durrant
2017-03-22 9:57 ` Jan Beulich
2017-03-21 18:17 ` [PATCH v3 2/6] x86/viridian: don't put Xen version information in CPUID leaf 2 Paul Durrant
2017-03-22 10:09 ` Jan Beulich
2017-03-22 10:20 ` Paul Durrant
2017-03-22 10:39 ` Jan Beulich
2017-03-21 18:17 ` Paul Durrant [this message]
2017-03-21 18:17 ` [PATCH v3 4/6] x86/viridian: add warnings for unimplemented hypercalls and MSRs Paul Durrant
2017-03-21 18:17 ` [PATCH v3 5/6] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable Paul Durrant
2017-03-21 18:17 ` [PATCH v3 6/6] x86/viridian: implement the crash MSRs Paul Durrant
2017-03-22 11:07 ` Jan Beulich
2017-03-22 11:09 ` Wei Liu
2017-03-22 11:10 ` Paul Durrant
2017-03-22 11:37 ` Jan Beulich
2017-03-22 11:44 ` Paul Durrant
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=1490120242-3587-4-git-send-email-paul.durrant@citrix.com \
--to=paul.durrant@citrix.com \
--cc=andrew.cooper3@citrix.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).