qemu-stable
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6] i386/cpu: fixup number of addressable IDs for logical pro


From: Zhao Liu
Subject: Re: [PATCH v6] i386/cpu: fixup number of addressable IDs for logical processors in the physical package
Date: Sat, 12 Oct 2024 16:56:08 +0800

> > > > +            if (cpu->vendor_cpuid_only && IS_AMD_CPU(env)) {
> > > > +                *ebx |= threads_per_pkg << 16;
> > > > +            } else {
> > > > +                *ebx |= 1 << apicid_pkg_offset(&topo_info) << 16;
> > > > +            }
> > > 
> > > you need to handle the overflow case when the number of logical
> > > processors > 255.
> > > 
> > It seems other cpuid cases of bit shifting don't condiser the overflow
> > case too..
> > 
> > Since intel only reserves 8bits for this field, do you have any
> > suggestions to make sure this field emulated
> > 
> > correctly?
> 
> the usual option can be masking the value to only 8 bits before shifting,
> like
> 
>       ((1 << apicid_pkg_offset(&topo_info)) & 0xff) << 16
> 
> but when the value is greater than 255, it will be truncated, so we need
> something like below to reflect the hardware behavior:
> 
>       MIN((1 << apicid_pkg_offset(&topo_info)), 255) << 16
> 
> This is what Qian's patch [1] wanted to fix last year, but that patch never
> gets merged.
> 
> [1] 
> https://lore.kernel.org/qemu-devel/20230829042405.932523-2-qian.wen@intel.com/
> 

That's on my list. I had the plan to help Qian pick up it again and
rebase that series on Chuang's change.

-Zhao




reply via email to

[Prev in Thread] Current Thread [Next in Thread]