All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Babu Moger <babu.moger@amd.com>
Cc: ehabkost@redhat.com, mst@redhat.com, qemu-devel@nongnu.org,
	pbonzini@redhat.com, rth@twiddle.net
Subject: Re: [PATCH v6 11/13] target/i386: Enable new apic id encoding for EPYC based cpus models
Date: Wed, 11 Mar 2020 13:18:14 +0100	[thread overview]
Message-ID: <20200311131814.67c804df@redhat.com> (raw)
In-Reply-To: <158389407283.22020.13704666183488372052.stgit@naples-babu.amd.com>

On Tue, 10 Mar 2020 21:34:32 -0500
Babu Moger <babu.moger@amd.com> wrote:

> The APIC ID is decoded based on the sequence sockets->dies->cores->threads.
> This works fine for most standard AMD and other vendors' configurations,
> but this decoding sequence does not follow that of AMD's APIC ID enumeration
> strictly. In some cases this can cause CPU topology inconsistency.
> 
> When booting a guest VM, the kernel tries to validate the topology, and finds
> it inconsistent with the enumeration of EPYC cpu models. The more details are
> in the bug https://bugzilla.redhat.com/show_bug.cgi?id=1728166.
> 
> To fix the problem we need to build the topology as per the Processor
> Programming Reference (PPR) for AMD Family 17h Model 01h, Revision B1
> Processors. The documentation is available from the bugzilla Link below.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537
> It is also available at
> https://www.amd.com/system/files/TechDocs/55570-B1_PUB.zip
> 
> Here is the text from the PPR.
> Operating systems are expected to use Core::X86::Cpuid::SizeId[ApicIdSize], the
> number of least significant bits in the Initial APIC ID that indicate core ID
> within a processor, in constructing per-core CPUID masks.
> Core::X86::Cpuid::SizeId[ApicIdSize] determines the maximum number of cores
> (MNC) that the processor could theoretically support, not the actual number of
> cores that are actually implemented or enabled on the processor, as indicated
> by Core::X86::Cpuid::SizeId[NC].
> Each Core::X86::Apic::ApicId[ApicId] register is preset as follows:
> • ApicId[6] = Socket ID.
> • ApicId[5:4] = Node ID.
> • ApicId[3] = Logical CCX L3 complex ID
> • ApicId[2:0]= (SMT) ? {LogicalCoreID[1:0],ThreadId} : {1'b0,LogicalCoreID[1:0]}
> 
> The new apic id encoding is enabled for EPYC and EPYC-Rome models.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

Acked-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  target/i386/cpu.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 19de79d01c..5d5734af76 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -3921,6 +3921,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
>          .xlevel = 0x8000001E,
>          .model_id = "AMD EPYC Processor",
>          .cache_info = &epyc_cache_info,
> +        .use_epyc_apic_id_encoding = 1,
>          .versions = (X86CPUVersionDefinition[]) {
>              { .version = 1 },
>              {
> @@ -4048,6 +4049,7 @@ static X86CPUDefinition builtin_x86_defs[] = {
>          .xlevel = 0x8000001E,
>          .model_id = "AMD EPYC-Rome Processor",
>          .cache_info = &epyc_rome_cache_info,
> +        .use_epyc_apic_id_encoding = 1,
>      },
>  };
>  
> 



  reply	other threads:[~2020-03-11 12:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  2:33 [PATCH v6 00/13] APIC ID fixes for AMD EPYC CPU model Babu Moger
2020-03-11  2:33 ` [PATCH v6 01/13] hw/i386: Introduce X86CPUTopoInfo to contain topology info Babu Moger
2020-03-11 11:39   ` Igor Mammedov
2020-03-11 14:02     ` Babu Moger
2020-03-11  2:33 ` [PATCH v6 02/13] hw/i386: Consolidate topology functions Babu Moger
2020-03-11  2:33 ` [PATCH v6 03/13] machine: Add SMP Sockets in CpuTopology Babu Moger
2020-03-11  2:33 ` [PATCH v6 04/13] hw/i386: Remove unnecessary initialization in x86_cpu_new Babu Moger
2020-03-11  2:33 ` [PATCH v6 05/13] hw/i386: Update structures to save the number of nodes per package Babu Moger
2020-03-11  2:33 ` [PATCH v6 06/13] hw/i386: Rename apicid_from_topo_ids to x86_apicid_from_topo_ids Babu Moger
2020-03-11 11:44   ` Igor Mammedov
2020-03-11  2:34 ` [PATCH v6 07/13] hw/386: Add EPYC mode topology decoding functions Babu Moger
2020-03-11  2:34 ` [PATCH v6 08/13] target/i386: Cleanup and use the EPYC mode topology functions Babu Moger
2020-03-11 11:49   ` Igor Mammedov
2020-03-11  2:34 ` [PATCH v6 09/13] hw/i386: Introduce apicid functions inside X86MachineState Babu Moger
2020-03-11  2:34 ` [PATCH v6 10/13] i386: Check for apic id encoding Babu Moger
2020-03-11 12:17   ` Igor Mammedov
2020-03-11 14:50     ` Babu Moger
2020-03-11  2:34 ` [PATCH v6 11/13] target/i386: Enable new apic id encoding for EPYC based cpus models Babu Moger
2020-03-11 12:18   ` Igor Mammedov [this message]
2020-03-11  2:34 ` [PATCH v6 12/13] hw/i386: Move arch_id decode inside x86_cpus_init Babu Moger
2020-03-11 12:29   ` Igor Mammedov
2020-03-11 14:52     ` Babu Moger
2020-03-11  2:34 ` [PATCH v6 13/13] i386: Fix pkg_id offset for EPYC cpu models Babu Moger

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=20200311131814.67c804df@redhat.com \
    --to=imammedo@redhat.com \
    --cc=babu.moger@amd.com \
    --cc=ehabkost@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.