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>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 2/6] x86/viridian: don't put Xen version information in CPUID leaf 2
Date: Mon, 20 Mar 2017 17:08:17 +0000 [thread overview]
Message-ID: <1490029701-4311-3-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com>
The Hypervisor Top Level Functional Specification v5.0a states in section
2.5:
"The hypervisor version information is encoded in leaf 0x40000002. Two
version numbers are provided: the main version and the service version.
The main version includes a major and minor version number and a build
number. These correspond to Microsoft Windows release numbers."
It also goes on to advise clients (i.e. guest versions of Windows) to use
the following algorithm to determine compatibility with the hypervisor
enlightenments:
if <your-main-version> greater than <hypervisor-main-version>
{
your version is compatible
}
else if <your-main-version> equal to <hypervisor-main-version> and
<your-service-version> greater than or equal to <hypervisor-service-version>
{
your version is compatible
}
else
{
your version is NOT compatible
}
So, clearly putting Xen hypervisor version information in that leaf is
spurious, but we probably get away with it because Xen's major version
is lower than the major version of Windows in which Hyper-V first
appeared (Server 2008).
This patch changes the leaf to use the kernel major and minor
versions, and build number from Windows Server 2008 (64-bit) by default.
These default values can be overriden from the Xen command line using new
'viridian_major_version', 'viridian_minor_version' and
'viridian_build_number' parameters.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
v2:
- Use full version information (including build number) from Windows
Server 2008
- Add command line parameters to allow version information to be
overridden
---
docs/misc/xen-command-line.markdown | 21 +++++++++++++++++++++
xen/arch/x86/hvm/viridian.c | 20 ++++++++++++++++++--
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index bad20db..44da4bd 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -1616,6 +1616,27 @@ The optional `keep` parameter causes Xen to continue using the vga
console even after dom0 has been started. The default behaviour is to
relinquish control to dom0.
+### viridian\_major\_version
+> `= <integer>`
+
+> Default: `6`
+
+The hypervisor major version number encoded in CPUID 0x40000002:EBX.
+
+### viridian\_minor\_version
+> `= <integer>`
+
+> Default: `0`
+
+The hypervisor minor version number encoded in CPUID 0x40000002:EBX.
+
+### viridian\_build\_number
+> `= <integer>`
+
+> Default: `0x1772`
+
+The hypervisor build number encoded in CPUID 0x40000002:EAX.
+
### vpid (Intel)
> `= <boolean>`
diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c
index 3a2611b..0d208c3 100644
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -106,6 +106,21 @@ typedef struct {
#define CPUID6A_MSR_BITMAPS (1 << 1)
#define CPUID6A_NESTED_PAGING (1 << 3)
+/*
+ * Version and build number reported by CPUID leaf 2
+ *
+ * These numbers are chosen to match the version numbers reported by
+ * Windows Server 2008.
+ */
+static uint16_t __read_mostly viridian_major_version = 6;
+integer_param("viridian_major_version", viridian_major_version);
+
+static uint16_t __read_mostly viridian_minor_version = 0;
+integer_param("viridian_minor_version", viridian_minor_version);
+
+static uint32_t __read_mostly viridian_build_number = 0x1772;
+integer_param("viridian_build_number", viridian_build_number);
+
void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
uint32_t subleaf, struct cpuid_leaf *res)
{
@@ -134,8 +149,9 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32_t leaf,
own version number. */
if ( d->arch.hvm_domain.viridian.guest_os_id.raw == 0 )
break;
- res->a = 1; /* Build number */
- res->b = (xen_major_version() << 16) | xen_minor_version();
+ res->a = viridian_build_number;
+ res->b = ((uint32_t)viridian_major_version << 16) |
+ viridian_minor_version;
res->c = 0; /* SP */
res->d = 0; /* Service branch and number */
break;
--
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-20 17:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 17:08 [PATCH v2 0/6] viridian updates Paul Durrant
2017-03-20 17:08 ` [PATCH v2 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present Paul Durrant
2017-03-21 15:26 ` Jan Beulich
2017-03-21 15:28 ` Paul Durrant
2017-03-20 17:08 ` Paul Durrant [this message]
2017-03-21 15:29 ` [PATCH v2 2/6] x86/viridian: don't put Xen version information in CPUID leaf 2 Jan Beulich
2017-03-21 15:45 ` Paul Durrant
2017-03-21 16:18 ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 3/6] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2 Paul Durrant
2017-03-21 15:30 ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 4/6] x86/viridian: add warnings for unimplemented hypercalls and MSRs Paul Durrant
2017-03-21 15:32 ` Jan Beulich
2017-03-21 15:48 ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 5/6] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable Paul Durrant
2017-03-21 15:35 ` Jan Beulich
2017-03-21 15:46 ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 6/6] x86/viridian: implement the crash MSRs Paul Durrant
2017-03-21 15:41 ` Jan Beulich
2017-03-21 15:50 ` Paul Durrant
2017-03-21 17:05 ` Wei Liu
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=1490029701-4311-3-git-send-email-paul.durrant@citrix.com \
--to=paul.durrant@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.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).