Re: [PATCH v1 1/9] target/i386: Sync AMD CPUID aliases for Hygon
Tina Zhang <[email protected]>
| Newsgroups | org.nongnu.qemu-devel,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/2026 3:02 PM, Zhao Liu wrote:
>> -GlobalProperty pc_compat_11_0[] = {};
>> +GlobalProperty pc_compat_11_0[] = {
>> + { TYPE_X86_CPU, "x-hygon-vendor-abi-fixes", "false" },
>> +};
> This needs rebase on v11.1 🙂
Right, I will rebase this on top of v11.1.
>> - if (IS_AMD_CPU(env)) {
>> + if (x86_cpu_has_amd_cpuid_aliases(cpu)) {
> Or we can omit this helper ("x86_cpu_has_amd_cpuid_aliases(cpu)") and
> instead do the check directly inline?
>
> I think we should have fewer helpers like this, unless the conditional
> checks are really lengthy... Since the helpers added for each ABI is
> similar, but we can’t consolidate them into a single generic helper
> (because while the AMD and Hygon ABIs are basically similar, there are
> still differences), having too many similar helpers makes the code seem
> fragmented.
Agreed. The helper is unnecessary for this short condition. I will
inline the Hygon-gated check in v2 to avoid adding another small
ABI-specific helper.
>
>> @@ -2461,6 +2467,12 @@ struct ArchCPU {
>> */
>> bool vendor_cpuid_only_v2;
>>
>> + /*
>> + * Enable Hygon vendor ABI fixes for new machine types. Old machine
>> + * types disable this to preserve guest-visible CPU ABI.
>> + */
>> + bool hygon_vendor_abi_fixes;
>> +
> Maybe the following comment to emphasize this is a compat option?
Yes, that wording is clearer. I will update the comment in v2.
Thanks,
Tina
>
> /*
> * Compatibility bits for old machine types: if true, apply Hygon
> * vendor-specific ABI fixes. Old machine types disable this to
> * preserve the guest-visible CPU ABI.
> */