All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Correctly report max number of hypervisor leaves
@ 2014-05-30 20:11 Boris Ostrovsky
  2014-06-02  9:29 ` Roger Pau Monné
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Ostrovsky @ 2014-05-30 20:11 UTC (permalink / raw)
  To: jbeulich; +Cc: boris.ostrovsky, xen-devel, roger.pau

Commit def0bbd31 provided support for changing max number of
hypervisor cpuid leaves (in leaf 0x4000xx00). It also made the
hypervisor incorrectly report this number for guests that
use default value (i.e. don't specify leaf 0x4000xx00 in config
file)

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reported-by: Roger Pau Monne <roger.pau@citrix.com>
---
 xen/arch/x86/traps.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 1722912..b82b1b3 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -692,13 +692,19 @@ int cpuid_hypervisor_leaves( uint32_t idx, uint32_t sub_idx,
     if ( idx > XEN_CPUID_MAX_NUM_LEAVES )
         return 0; /* Avoid unnecessary pass through domain_cpuid() */
 
-    /* Number of leaves may be user-specified */
     domain_cpuid(d, base, 0, &limit, &dummy, &dummy, &dummy);
-    limit &= 0xff;
-    if ( limit < 2 )
-        limit = 2;
-    else if ( limit > XEN_CPUID_MAX_NUM_LEAVES )
+    if ( limit == 0 )
+        /* Default number of leaves */
         limit = XEN_CPUID_MAX_NUM_LEAVES;
+    else
+    {
+        /* User-specified number of leaves */
+        limit &= 0xff;
+        if ( limit < 2 )
+            limit = 2;
+        else if ( limit > XEN_CPUID_MAX_NUM_LEAVES )
+            limit = XEN_CPUID_MAX_NUM_LEAVES;
+    }
 
     if ( idx > limit ) 
         return 0;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-02 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-30 20:11 [PATCH] x86: Correctly report max number of hypervisor leaves Boris Ostrovsky
2014-06-02  9:29 ` Roger Pau Monné
2014-06-02 10:36   ` Jan Beulich

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.