On 20/09/2019 14:54, Jan Beulich wrote:
> @@ -395,11 +395,20 @@ static void amd_xc_cpuid_policy(const st
>  
>      case 0x80000008:
>          /*
> -         * ECX[15:12] is ApicIdCoreSize: ECX[7:0] is NumberOfCores (minus 
> one).
> -         * Update to reflect vLAPIC_ID = vCPU_ID * 2.
> +         * ECX[15:12] is ApicIdCoreSize.
> +         * ECX[7:0] is NumberOfCores (minus one).
> +         * Update to reflect vLAPIC_ID = vCPU_ID * 2.  But make sure to avoid
> +         * - overflow,
> +         * - going out of sync with leaf 1 EBX[23:16],
> +         * - incrementing ApicIdCoreSize when it's zero (which changes the
> +         *   meaning of bits 7:0).
>           */
> -        regs[2] = ((regs[2] + (1u << 12)) & 0xf000u) |
> -                  ((regs[2] & 0xffu) << 1) | 1u;
> +        if ( (regs[2] & 0x7fu) < 0x7fu )

In attempting to rebase my series, there is a bug here.  It should be &
0xff otherwise the top bit isn't included in the comparison, and a value
of 128 will still be doubled.

~Andrew

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

Reply via email to