]> xenbits.xensource.com Git - xen.git/commitdiff
libxenguest/x86: ensure CPUID[1].EBX[32:16] is non-zero for HVM
authorJan Beulich <jbeulich@suse.com>
Mon, 30 Aug 2021 13:19:31 +0000 (15:19 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 30 Aug 2021 13:19:31 +0000 (15:19 +0200)
We unconditionally set HTT, so merely doubling the value read from
hardware isn't going to be correct if that value is zero.

Reported-by: Julien Grall <julien@xen.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Julien Grall <julien@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/libs/guest/xg_cpuid_x86.c

index 0c9c4fefc1efe60c140f306cf368d8d2ab69791d..198892ebdf45d7aeb37720995ceabff19bf7b027 100644 (file)
@@ -594,7 +594,9 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, bool restore,
          * Update to reflect vLAPIC_ID = vCPU_ID * 2, but make sure to avoid
          * overflow.
          */
-        if ( !(p->basic.lppp & 0x80) )
+        if ( !p->basic.lppp )
+            p->basic.lppp = 2;
+        else if ( !(p->basic.lppp & 0x80) )
             p->basic.lppp *= 2;
 
         switch ( p->x86_vendor )