On Wed, 11 Mar 2020 17:53:34 -0500 Babu Moger <babu.mo...@amd.com> wrote:
> These functions add support for building EPYC mode topology given the smp > details like numa nodes, cores, threads and sockets. > > The new apic id decoding is mostly similar to current apic id decoding > except that it adds a new field node_id when numa configured. Removes all > the hardcoded values. Subsequent patches will use these functions to build > the topology. > > Following functions are added. [...] > x86_topo_ids_from_idx_epyc you forgot to remove unused anymore function. No need to respin whole series for it though, you can post as reply to this patch v8 or do it as a patch on top. [...] > > The topology details are available in Processor Programming Reference (PPR) > for AMD Family 17h Model 01h, Revision B1 Processors. The revision guides are > available from the bugzilla Link below. > Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 > > Signed-off-by: Babu Moger <babu.mo...@amd.com> > Acked-by: Igor Mammedov <imamm...@redhat.com> > Acked-by: Michael S. Tsirkin <m...@redhat.com> [...] > +static inline void x86_topo_ids_from_idx_epyc(X86CPUTopoInfo *topo_info, > + unsigned cpu_index, > + X86CPUTopoIDs *topo_ids) > +{ > + unsigned nr_nodes = MAX(topo_info->nodes_per_pkg, 1); > + unsigned nr_dies = topo_info->dies_per_pkg; > + unsigned nr_cores = topo_info->cores_per_die; > + unsigned nr_threads = topo_info->threads_per_core; > + unsigned cores_per_node = DIV_ROUND_UP((nr_dies * nr_cores * nr_threads), > + nr_nodes); > + > + topo_ids->pkg_id = cpu_index / (nr_dies * nr_cores * nr_threads); > + topo_ids->node_id = (cpu_index / cores_per_node) % nr_nodes; > + topo_ids->die_id = cpu_index / (nr_cores * nr_threads) % nr_dies; > + topo_ids->core_id = cpu_index / nr_threads % nr_cores; > + topo_ids->smt_id = cpu_index % nr_threads; > +} > + > +/* [...]