Lines Matching +full:next +full:- +full:level +full:- +full:cache

2  * QEMU Machine core (related to -smp parsing)
23 #include "qemu/error-report.h"
36 if (mc->smp_props.drawers_supported) { in cpu_hierarchy_to_string()
37 g_string_append_printf(s, "drawers (%u) * ", ms->smp.drawers); in cpu_hierarchy_to_string()
40 if (mc->smp_props.books_supported) { in cpu_hierarchy_to_string()
41 g_string_append_printf(s, "books (%u) * ", ms->smp.books); in cpu_hierarchy_to_string()
44 g_string_append_printf(s, "sockets (%u)", ms->smp.sockets); in cpu_hierarchy_to_string()
46 if (mc->smp_props.dies_supported) { in cpu_hierarchy_to_string()
47 g_string_append_printf(s, " * dies (%u)", ms->smp.dies); in cpu_hierarchy_to_string()
50 if (mc->smp_props.clusters_supported) { in cpu_hierarchy_to_string()
51 g_string_append_printf(s, " * clusters (%u)", ms->smp.clusters); in cpu_hierarchy_to_string()
54 if (mc->smp_props.modules_supported) { in cpu_hierarchy_to_string()
55 g_string_append_printf(s, " * modules (%u)", ms->smp.modules); in cpu_hierarchy_to_string()
58 g_string_append_printf(s, " * cores (%u)", ms->smp.cores); in cpu_hierarchy_to_string()
59 g_string_append_printf(s, " * threads (%u)", ms->smp.threads); in cpu_hierarchy_to_string()
89 unsigned cpus = config->has_cpus ? config->cpus : 0; in machine_parse_smp_config()
90 unsigned drawers = config->has_drawers ? config->drawers : 0; in machine_parse_smp_config()
91 unsigned books = config->has_books ? config->books : 0; in machine_parse_smp_config()
92 unsigned sockets = config->has_sockets ? config->sockets : 0; in machine_parse_smp_config()
93 unsigned dies = config->has_dies ? config->dies : 0; in machine_parse_smp_config()
94 unsigned clusters = config->has_clusters ? config->clusters : 0; in machine_parse_smp_config()
95 unsigned modules = config->has_modules ? config->modules : 0; in machine_parse_smp_config()
96 unsigned cores = config->has_cores ? config->cores : 0; in machine_parse_smp_config()
97 unsigned threads = config->has_threads ? config->threads : 0; in machine_parse_smp_config()
98 unsigned maxcpus = config->has_maxcpus ? config->maxcpus : 0; in machine_parse_smp_config()
105 if ((config->has_cpus && config->cpus == 0) || in machine_parse_smp_config()
106 (config->has_drawers && config->drawers == 0) || in machine_parse_smp_config()
107 (config->has_books && config->books == 0) || in machine_parse_smp_config()
108 (config->has_sockets && config->sockets == 0) || in machine_parse_smp_config()
109 (config->has_dies && config->dies == 0) || in machine_parse_smp_config()
110 (config->has_clusters && config->clusters == 0) || in machine_parse_smp_config()
111 (config->has_modules && config->modules == 0) || in machine_parse_smp_config()
112 (config->has_cores && config->cores == 0) || in machine_parse_smp_config()
113 (config->has_threads && config->threads == 0) || in machine_parse_smp_config()
114 (config->has_maxcpus && config->maxcpus == 0)) { in machine_parse_smp_config()
124 if (!mc->smp_props.modules_supported && in machine_parse_smp_config()
125 config->has_modules && config->modules > 1) { in machine_parse_smp_config()
132 if (!mc->smp_props.clusters_supported && in machine_parse_smp_config()
133 config->has_clusters && config->clusters > 1) { in machine_parse_smp_config()
140 if (!mc->smp_props.dies_supported && in machine_parse_smp_config()
141 config->has_dies && config->dies > 1) { in machine_parse_smp_config()
148 if (!mc->smp_props.books_supported && in machine_parse_smp_config()
149 config->has_books && config->books > 1) { in machine_parse_smp_config()
156 if (!mc->smp_props.drawers_supported && in machine_parse_smp_config()
157 config->has_drawers && config->drawers > 1) { in machine_parse_smp_config()
172 if (mc->smp_props.prefer_sockets) { in machine_parse_smp_config()
215 ms->smp.cpus = cpus; in machine_parse_smp_config()
216 ms->smp.drawers = drawers; in machine_parse_smp_config()
217 ms->smp.books = books; in machine_parse_smp_config()
218 ms->smp.sockets = sockets; in machine_parse_smp_config()
219 ms->smp.dies = dies; in machine_parse_smp_config()
220 ms->smp.clusters = clusters; in machine_parse_smp_config()
221 ms->smp.modules = modules; in machine_parse_smp_config()
222 ms->smp.cores = cores; in machine_parse_smp_config()
223 ms->smp.threads = threads; in machine_parse_smp_config()
224 ms->smp.max_cpus = maxcpus; in machine_parse_smp_config()
226 mc->smp_props.has_clusters = config->has_clusters; in machine_parse_smp_config()
228 /* sanity-check of the computed topology */ in machine_parse_smp_config()
247 if (ms->smp.cpus < mc->min_cpus) { in machine_parse_smp_config()
250 ms->smp.cpus, in machine_parse_smp_config()
251 mc->name, mc->min_cpus); in machine_parse_smp_config()
255 if (ms->smp.max_cpus > mc->max_cpus) { in machine_parse_smp_config()
258 ms->smp.max_cpus, in machine_parse_smp_config()
259 mc->name, mc->max_cpus); in machine_parse_smp_config()
270 if ((topo == CPU_TOPOLOGY_LEVEL_MODULE && !mc->smp_props.modules_supported) || in machine_check_topo_support()
271 (topo == CPU_TOPOLOGY_LEVEL_CLUSTER && !mc->smp_props.clusters_supported) || in machine_check_topo_support()
272 (topo == CPU_TOPOLOGY_LEVEL_DIE && !mc->smp_props.dies_supported) || in machine_check_topo_support()
273 (topo == CPU_TOPOLOGY_LEVEL_BOOK && !mc->smp_props.books_supported) || in machine_check_topo_support()
274 (topo == CPU_TOPOLOGY_LEVEL_DRAWER && !mc->smp_props.drawers_supported)) { in machine_check_topo_support()
276 "Invalid topology level: %s. " in machine_check_topo_support()
277 "The topology level is not supported by this machine", in machine_check_topo_support()
294 for (node = caches; node; node = node->next) { in machine_parse_smp_cache()
296 if (test_bit(node->value->cache, caches_bitmap)) { in machine_parse_smp_cache()
298 "Invalid cache properties: %s. " in machine_parse_smp_cache()
299 "The cache properties are duplicated", in machine_parse_smp_cache()
300 CacheLevelAndType_str(node->value->cache)); in machine_parse_smp_cache()
304 machine_set_cache_topo_level(ms, node->value->cache, in machine_parse_smp_cache()
305 node->value->topology); in machine_parse_smp_cache()
306 set_bit(node->value->cache, caches_bitmap); in machine_parse_smp_cache()
310 const SmpCacheProperties *props = &ms->smp_cache.props[i]; in machine_parse_smp_cache()
313 * Reject non "default" topology level if the cache isn't in machine_parse_smp_cache()
316 if (props->topology != CPU_TOPOLOGY_LEVEL_DEFAULT && in machine_parse_smp_cache()
317 !mc->smp_props.cache_supported[props->cache]) { in machine_parse_smp_cache()
319 "%s cache topology not supported by this machine", in machine_parse_smp_cache()
320 CacheLevelAndType_str(props->cache)); in machine_parse_smp_cache()
324 if (props->topology == CPU_TOPOLOGY_LEVEL_THREAD) { in machine_parse_smp_cache()
326 "%s level cache not supported by this machine", in machine_parse_smp_cache()
327 CpuTopologyLevel_str(props->topology)); in machine_parse_smp_cache()
331 if (!machine_check_topo_support(ms, props->topology, errp)) { in machine_parse_smp_cache()
336 mc->smp_props.has_caches = true; in machine_parse_smp_cache()
342 return ms->smp.cores * ms->smp.modules * ms->smp.clusters * ms->smp.dies; in machine_topo_get_cores_per_socket()
347 return ms->smp.threads * machine_topo_get_cores_per_socket(ms); in machine_topo_get_threads_per_socket()
351 CacheLevelAndType cache) in machine_get_cache_topo_level() argument
353 return ms->smp_cache.props[cache].topology; in machine_get_cache_topo_level()
356 void machine_set_cache_topo_level(MachineState *ms, CacheLevelAndType cache, in machine_set_cache_topo_level() argument
357 CpuTopologyLevel level) in machine_set_cache_topo_level() argument
359 ms->smp_cache.props[cache].topology = level; in machine_set_cache_topo_level()
364 * (not default level), is cache1's topology level higher than cache2?
371 * Before comparing, the "default" topology level should be replaced in smp_cache_topo_cmp()
372 * with the specific level. in smp_cache_topo_cmp()
374 assert(smp_cache->props[cache1].topology != CPU_TOPOLOGY_LEVEL_DEFAULT); in smp_cache_topo_cmp()
376 return smp_cache->props[cache1].topology > smp_cache->props[cache2].topology; in smp_cache_topo_cmp()
380 * Currently, we have no way to expose the arch-specific default cache model
381 * because the cache model is sometimes related to the CPU model (e.g., i386).
383 * We can only check the correctness of the cache topology after the arch loads
384 * the user-configured cache model from MachineState and consumes the special
385 * "default" level by replacing it with the specific level.
389 if (smp_cache_topo_cmp(&ms->smp_cache, CACHE_LEVEL_AND_TYPE_L1D, in machine_check_smp_cache()
391 smp_cache_topo_cmp(&ms->smp_cache, CACHE_LEVEL_AND_TYPE_L1I, in machine_check_smp_cache()
394 "Invalid smp cache topology. " in machine_check_smp_cache()
395 "L2 cache topology level shouldn't be lower than L1 cache"); in machine_check_smp_cache()
399 if (smp_cache_topo_cmp(&ms->smp_cache, CACHE_LEVEL_AND_TYPE_L2, in machine_check_smp_cache()
402 "Invalid smp cache topology. " in machine_check_smp_cache()
403 "L3 cache topology level shouldn't be lower than L2 cache"); in machine_check_smp_cache()