xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	sstabellini@kernel.org, wei.liu2@citrix.com,
	George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com,
	jbeulich@suse.com
Subject: [PATCH v11 2/3] xen: add new Xen cpuid node for max address width info
Date: Thu, 28 Sep 2017 12:02:25 +0200	[thread overview]
Message-ID: <20170928100226.15280-3-jgross@suse.com> (raw)
In-Reply-To: <20170928100226.15280-1-jgross@suse.com>

On very large hosts a pv-guest needs to know whether it will have to
handle frame numbers larger than 32 bits in order to select the
appropriate grant interface version.

Add a new Xen specific CPUID node to contain the maximum machine address
width similar to the x86 CPUID node 0x80000008 containing the maximum
physical address width. The maximum frame width needs to take memory
hotplug into account.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
V11:
- return max. subleaf number in EAX (Andrew Cooper)
- use flsl() instead of generic_flsl() (Jan Beulich)

V10:
- correct comment in cpuid.h (Jan Beulich)

V9:
- make leaf pv-only (Jan Beulich)
- use hex value for mask (Jan Beulich)
- guest address width -> machine address width (Jan Beulich)
---
 xen/arch/x86/traps.c                |  8 ++++++++
 xen/include/public/arch-x86/cpuid.h | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index d8feef2942..05b21c57cb 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -930,6 +930,14 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
         res->b = v->vcpu_id;
         break;
 
+    case 5: /* PV-specific parameters */
+        if ( is_hvm_domain(d) || subleaf > XEN_CPUID_MAX_NUM_SUBLEAVES_5 )
+            break;
+
+        res->a = XEN_CPUID_MAX_NUM_SUBLEAVES_5;
+        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
+        break;
+
     default:
         ASSERT_UNREACHABLE();
     }
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index d709340f18..3d88c15598 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -85,6 +85,17 @@
 #define XEN_HVM_CPUID_IOMMU_MAPPINGS   (1u << 2)
 #define XEN_HVM_CPUID_VCPU_ID_PRESENT  (1u << 3) /* vcpu id is present in EBX */
 
-#define XEN_CPUID_MAX_NUM_LEAVES 4
+/*
+ * Leaf 6 (0x40000x05)
+ * PV-specific parameters
+ * Sub-leaf 0: EAX: max. sub-leaf number
+ *             EBX: bits 0-7: max machine address width
+ */
+#define XEN_CPUID_MAX_NUM_SUBLEAVES_5  0
+
+/* Max. address width in bits taking memory hotplug into account. */
+#define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
+
+#define XEN_CPUID_MAX_NUM_LEAVES 5
 
 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */
-- 
2.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-09-28 10:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 10:02 [PATCH v11 0/3] xen: better grant v2 support Juergen Gross
2017-09-28 10:02 ` [PATCH v11 1/3] xen: make grant resource limits per domain Juergen Gross
2017-10-03 13:33   ` Julien Grall
2017-09-28 10:02 ` Juergen Gross [this message]
2017-09-28 10:02 ` [PATCH v11 3/3] xen: add some comments in include/public/arch-x86/cpuid.h Juergen Gross
2017-09-28 19:02 ` [PATCH v11 0/3] xen: better grant v2 support Andrew Cooper
2017-09-29  4:33   ` Juergen Gross

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=20170928100226.15280-3-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@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).