mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 09:09:36 +07:00
f875a832d2
We currently have fields in struct cpuinfo_mips for the core & VP(E) ID of a particular CPU, and various pieces of code directly access those fields. This patch abstracts such access by introducing accessor functions cpu_core(), cpu_set_core(), cpu_vpe_id() & cpu_set_vpe_id() and having code that needs to access these values call those functions rather than directly accessing the struct cpuinfo_mips fields. This prepares us for changes to the way in which those values are stored in later patches. The cpu_vpe_id() function is introduced even though we already had a cpu_vpe_id() macro for a couple of reasons: 1) It's more consistent with the core, and future cluster, accessors. 2) It ensures a sensible return type without explicit casts. 3) It's generally preferable to use functions rather than macros. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/17009/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
22 lines
619 B
C
22 lines
619 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2007 by Ralf Baechle
|
|
*/
|
|
#ifndef __ASM_TOPOLOGY_H
|
|
#define __ASM_TOPOLOGY_H
|
|
|
|
#include <topology.h>
|
|
#include <linux/smp.h>
|
|
|
|
#ifdef CONFIG_SMP
|
|
#define topology_physical_package_id(cpu) (cpu_data[cpu].package)
|
|
#define topology_core_id(cpu) (cpu_core(&cpu_data[cpu]))
|
|
#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
|
|
#define topology_sibling_cpumask(cpu) (&cpu_sibling_map[cpu])
|
|
#endif
|
|
|
|
#endif /* __ASM_TOPOLOGY_H */
|