hw/core: Make CPU topology enumeration arch-agnostic

Cache topology needs to be defined based on CPU topology levels. Thus,
define CPU topology enumeration in qapi/machine.json to make it generic
for all architectures.

To match the general topology naming style, rename CPU_TOPO_LEVEL_* to
CPU_TOPOLOGY_LEVEL_*, and rename SMT and package levels to thread and
socket.

Also, enumerate additional topology levels for non-i386 arches, and add
a CPU_TOPOLOGY_LEVEL_DEFAULT to help future smp-cache object to work
with compatibility requirement of arch-specific cache topology models.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Tested-by: Yongwei Ma <yongwei.ma@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241101083331.340178-3-zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Zhao Liu 2024-11-01 16:33:24 +08:00 committed by Philippe Mathieu-Daudé
parent 34230ce5a9
commit e823ebe77d
5 changed files with 123 additions and 96 deletions

View file

@ -5,7 +5,7 @@
# See the COPYING file in the top-level directory.
##
# = Machines S390 data types
# = Common machine types
##
##
@ -18,3 +18,45 @@
##
{ 'enum': 'S390CpuEntitlement',
'data': [ 'auto', 'low', 'medium', 'high' ] }
##
# @CpuTopologyLevel:
#
# An enumeration of CPU topology levels.
#
# @thread: thread level, which would also be called SMT level or
# logical processor level. The @threads option in
# SMPConfiguration is used to configure the topology of this
# level.
#
# @core: core level. The @cores option in SMPConfiguration is used
# to configure the topology of this level.
#
# @module: module level. The @modules option in SMPConfiguration is
# used to configure the topology of this level.
#
# @cluster: cluster level. The @clusters option in SMPConfiguration
# is used to configure the topology of this level.
#
# @die: die level. The @dies option in SMPConfiguration is used to
# configure the topology of this level.
#
# @socket: socket level, which would also be called package level.
# The @sockets option in SMPConfiguration is used to configure
# the topology of this level.
#
# @book: book level. The @books option in SMPConfiguration is used
# to configure the topology of this level.
#
# @drawer: drawer level. The @drawers option in SMPConfiguration is
# used to configure the topology of this level.
#
# @default: default level. Some architectures will have default
# topology settings (e.g., cache topology), and this special
# level means following the architecture-specific settings.
#
# Since: 9.2
##
{ 'enum': 'CpuTopologyLevel',
'data': [ 'thread', 'core', 'module', 'cluster', 'die',
'socket', 'book', 'drawer', 'default' ] }