On 08/09/2021 16:06, Jan Beulich wrote:
> On 08.09.2021 15:59, Andrew Cooper wrote:
>> AMD/Hygon processors before the Zen2 microarchitecture don't clear the base 
>> or
>> limit fields when loading a NULL segment.
>>
>> Express the logic in terms of cpu_bug_null_seg, and adjust the workaround in
>> do_set_segment_base().
>>
>> Signed-off-by: Andrew Cooper <[email protected]>
> Reviewed-by: Jan Beulich <[email protected]>

Thanks.

> albeit with a question (perhaps to Pu):
>
>> --- a/xen/arch/x86/cpu/hygon.c
>> +++ b/xen/arch/x86/cpu/hygon.c
>> @@ -40,6 +40,13 @@ static void init_hygon(struct cpuinfo_x86 *c)
>>          c->x86 == 0x18)
>>              detect_zen2_null_seg_behaviour();
>>  
>> +    /*
>> +     * Hygon CPUs before Zen2 don't clear segment bases/limits when
>> +     * loading a NULL selector.
>> +     */
>> +        if (c == &boot_cpu_data && !cpu_has_nscb)
>> +            setup_force_cpu_cap(X86_BUG_NULL_SEG);
> Are there any affected CPUs in reality?

Yes - the Hygon Zen1 uarch CPUs are affected.

>
> And actually (only noticing when seeing the malformed context
> above) there look to be indentation issues in the changes to
> both this file and amd.c.

Ah yes - I'll fix on commit.

~Andrew

Reply via email to