On 09/08/2023 1:29 pm, Jan Beulich wrote:
> Since as a bug workaround (likely inapplicable to any 64-bit CPUs, but
> it probably doesn't hurt to keep this) we clear %ecx on input anyway,
> we can as well fall back to cpuid_count(). This allows getting rid of
> four risky casts and makes things type-safe. The latter aspect requires
> two type adjustments elsewhere. While adjusting init_intel_cacheinfo(),
> convert three other local variables there as well. For the struct
> cpuinfo_x86 change it is relevant to note that no 64-bit CPU comes
> without CPUID support, and hence cpuid_level is never set to -1; the
> comment there was simply stale.
>
> No functional change intended, yet of course generated code isn't
> identical.
>
> Signed-off-by: Jan Beulich <jbeul...@suse.com>

Hmm, far less invasive than when I last tried this, but that was years ago.

> --- a/xen/arch/x86/include/asm/processor.h
> +++ b/xen/arch/x86/include/asm/processor.h
> @@ -131,13 +131,8 @@ static inline int cpu_nr_siblings(unsign
>   * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
>   * resulting in stale register contents being returned.
>   */
> -#define cpuid(_op,_eax,_ebx,_ecx,_edx)          \
> -    asm volatile ( "cpuid"                      \
> -          : "=a" (*(int *)(_eax)),              \
> -            "=b" (*(int *)(_ebx)),              \
> -            "=c" (*(int *)(_ecx)),              \
> -            "=d" (*(int *)(_edx))               \
> -          : "0" (_op), "2" (0) )
> +#define cpuid(op, eax, ebx, ecx, edx)          \
> +        cpuid_count(op, 0, eax, ebx, ecx, edx)

Can we swap op for leaf seeing as both are changing?

Preferably with that changed, Acked-by: Andrew Cooper
<andrew.coop...@citrix.com>

Reply via email to