qemu-devel
[Top][All Lists]
Advanced

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

RE: [PATCH v2 1/3] hw/i386: Initialize topo_ids from CpuInstanceProperti


From: Babu Moger
Subject: RE: [PATCH v2 1/3] hw/i386: Initialize topo_ids from CpuInstanceProperties
Date: Mon, 13 Jul 2020 10:02:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0


> -----Original Message-----
> From: Igor Mammedov <imammedo@redhat.com>
> Sent: Monday, July 13, 2020 4:08 AM
> To: Moger, Babu <Babu.Moger@amd.com>
> Cc: pbonzini@redhat.com; rth@twiddle.net; ehabkost@redhat.com; qemu-
> devel@nongnu.org
> Subject: Re: [PATCH v2 1/3] hw/i386: Initialize topo_ids from
> CpuInstanceProperties
> 
> On Wed, 01 Jul 2020 12:31:01 -0500
> Babu Moger <babu.moger@amd.com> wrote:
> 
> > This is in preparation to build the apic_id from user provided
> > topology information.
> >
> > Signed-off-by: Babu Moger <babu.moger@amd.com>
> > ---
> >  include/hw/i386/topology.h |   19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h
> > index 07239f95f4..7cb21e9c82 100644
> > --- a/include/hw/i386/topology.h
> > +++ b/include/hw/i386/topology.h
> > @@ -40,6 +40,7 @@
> >
> >
> >  #include "qemu/bitops.h"
> > +#include "qapi/qapi-types-machine.h"
> >
> >  /* APIC IDs can be 32-bit, but beware: APIC IDs > 255 require x2APIC 
> > support
> >   */
> > @@ -196,6 +197,24 @@ static inline void
> x86_topo_ids_from_apicid_epyc(apic_id_t apicid,
> >      topo_ids->pkg_id = apicid >> apicid_pkg_offset_epyc(topo_info);
> >  }
> >
> > +
> > +/*
> > + * Initialize topo_ids from CpuInstanceProperties
> > + * node_id in CpuInstanceProperties(or in CPU device) is a sequential
> > + * number, but while building the topology
> 
> >we need to separate it for
> > + * each socket(mod nodes_per_pkg).
> could you clarify a bit more on why this is necessary?

If you have two sockets and 4 numa nodes, node_id in CpuInstanceProperties
will be number sequentially as 0, 1, 2, 3.  But in EPYC topology, it will
be  0, 1, 0, 1( Basically mod % number of nodes per socket).


> > + */
> > +static inline void x86_init_topo_ids(X86CPUTopoInfo *topo_info,
> > +                                     CpuInstanceProperties props,
> > +                                     X86CPUTopoIDs *topo_ids) {
> > +    topo_ids->smt_id = props.has_thread_id ? props.thread_id : 0;
> > +    topo_ids->core_id = props.has_core_id ? props.core_id : 0;
> > +    topo_ids->die_id = props.has_die_id ? props.die_id : 0;
> > +    topo_ids->node_id = props.has_node_id ?
> > +                        props.node_id % MAX(topo_info->nodes_per_pkg, 1) : 
> > 0;
> > +    topo_ids->pkg_id = props.has_socket_id ? props.socket_id : 0; }
> >  /*
> >   * Make APIC ID for the CPU 'cpu_index'
> >   *
> >




reply via email to

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