From: "Wang, Lei" <lei4.wang@intel.com>
To: Ilya Oleinik <ilyaoleinik1@gmail.com>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, yang.zhong@intel.com, f4bug@amsat.org,
richard.henderson@linaro.org
Subject: Re: [PATCH] i386/cpu: Adjust cpuid addresable id count to match the spec
Date: Fri, 28 Oct 2022 08:53:55 +0800 [thread overview]
Message-ID: <ca7518d2-4715-3d21-ee51-2c21f5878b0f@intel.com> (raw)
In-Reply-To: <20221010024934.2517-1-ilyaoleinik1@gmail.com>
On 10/10/2022 10:49 AM, Ilya Oleinik wrote:
> For EBX bits 23 - 16 in CPUID[01] Intel's manual states:
> "
> * The nearest power-of-2 integer that is not smaller than EBX[23:16]
> is the number of unique initial APICIDs reserved for addressing
> different logical processors in a physical package. This field is
> only valid if CPUID.1.EDX.HTT[bit 28]= 1.
> "
> Ensure this condition is met.
>
> Additionally, apply efb3934adf9ee7794db7e0ade9f576c634592891 to
> non passthrough cache mode.
>
> Signed-off-by: Ilya Oleinik <ilyaoleinik1@gmail.com>
> ---
> target/i386/cpu.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index ad623d91e4..e793bcc03f 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -245,8 +245,8 @@ static void encode_cache_cpuid4(CPUCacheInfo *cache,
> *eax = CACHE_TYPE(cache->type) |
> CACHE_LEVEL(cache->level) |
> (cache->self_init ? CACHE_SELF_INIT_LEVEL : 0) |
> - ((num_cores - 1) << 26) |
> - ((num_apic_ids - 1) << 14);
> + ((pow2ceil(num_cores) - 1) << 26) |
> + ((pow2ceil(num_apic_ids) - 1) << 14);
>
> assert(cache->line_size > 0);
> assert(cache->partitions > 0);
> @@ -5258,7 +5258,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
> }
> *edx = env->features[FEAT_1_EDX];
> if (cs->nr_cores * cs->nr_threads > 1) {
> - *ebx |= (cs->nr_cores * cs->nr_threads) << 16;
> + *ebx |= (pow2ceil(cs->nr_cores * cs->nr_threads)) << 16;
> *edx |= CPUID_HT;
> }
> if (!cpu->enable_pmu) {
> @@ -5313,12 +5313,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
> switch (count) {
> case 0: /* L1 dcache info */
> encode_cache_cpuid4(env->cache_info_cpuid4.l1d_cache,
> - 1, cs->nr_cores,
Hi Ilya,
Just curious why the origin implementation is hard-coded to 1 and is there any
bug reported related to this?
> + cs->nr_threads, cs->nr_cores,
> eax, ebx, ecx, edx);
> break;
> case 1: /* L1 icache info */
> encode_cache_cpuid4(env->cache_info_cpuid4.l1i_cache,
> - 1, cs->nr_cores,
> + cs->nr_threads, cs->nr_cores,
> eax, ebx, ecx, edx);
> break;
> case 2: /* L2 cache info */
next prev parent reply other threads:[~2022-10-28 0:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 2:49 [PATCH] i386/cpu: Adjust cpuid addresable id count to match the spec Ilya Oleinik
2022-10-28 0:53 ` Wang, Lei [this message]
2022-11-03 8:11 ` Ilya Oleinik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca7518d2-4715-3d21-ee51-2c21f5878b0f@intel.com \
--to=lei4.wang@intel.com \
--cc=f4bug@amsat.org \
--cc=ilyaoleinik1@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=yang.zhong@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).