i386/cpu: Support module level cache topology

Allow cache to be defined at the module level. This increases
flexibility for x86 users to customize their cache topology.

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>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20250110145115.1574345-3-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Zhao Liu 2025-01-10 22:51:12 +08:00 committed by Paolo Bonzini
parent d556226d69
commit 2152b4bfcd

View File

@ -247,6 +247,9 @@ static uint32_t max_thread_ids_for_cache(X86CPUTopoInfo *topo_info,
case CPU_TOPOLOGY_LEVEL_CORE: case CPU_TOPOLOGY_LEVEL_CORE:
num_ids = 1 << apicid_core_offset(topo_info); num_ids = 1 << apicid_core_offset(topo_info);
break; break;
case CPU_TOPOLOGY_LEVEL_MODULE:
num_ids = 1 << apicid_module_offset(topo_info);
break;
case CPU_TOPOLOGY_LEVEL_DIE: case CPU_TOPOLOGY_LEVEL_DIE:
num_ids = 1 << apicid_die_offset(topo_info); num_ids = 1 << apicid_die_offset(topo_info);
break; break;
@ -255,7 +258,7 @@ static uint32_t max_thread_ids_for_cache(X86CPUTopoInfo *topo_info,
break; break;
default: default:
/* /*
* Currently there is no use case for THREAD and MODULE, so use * Currently there is no use case for THREAD, so use
* assert directly to facilitate debugging. * assert directly to facilitate debugging.
*/ */
g_assert_not_reached(); g_assert_not_reached();