Lines Matching +full:s390x +full:- +full:linux +full:- +full:user

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
6 * Author(s): Pierre Morel <pmorel@linux.ibm.com>
10 * - The first part in this file is taking care of all common functions
13 * - The second part, building the topology information data for the
20 #include "qemu/error-report.h"
21 #include "hw/qdev-properties.h"
23 #include "target/s390x/cpu.h"
24 #include "hw/s390x/s390-virtio-ccw.h"
25 #include "hw/s390x/cpu-topology.h"
26 #include "qapi/qapi-commands-machine-target.h"
27 #include "qapi/qapi-events-machine-target.h"
43 * @cpu: s390x CPU
50 return (drawer_id * current_machine->smp.books + book_id) * in s390_socket_nb_from_ids()
51 current_machine->smp.sockets + socket_id; in s390_socket_nb_from_ids()
56 * @cpu: s390x CPU
63 return s390_socket_nb_from_ids(cpu->env.drawer_id, cpu->env.book_id, in s390_socket_nb()
64 cpu->env.socket_id); in s390_socket_nb()
89 CpuTopology *smp = &ms->smp; in s390_topology_init()
91 s390_topology.cores_per_socket = g_new0(uint8_t, smp->sockets * in s390_topology_init()
92 smp->books * smp->drawers); in s390_topology_init()
109 CPUS390XState *env = &cpu->env; in s390_handle_ptf()
110 uint64_t reg = env->regs[r1]; in s390_handle_ptf()
118 if (env->psw.mask & PSW_MASK_PSTATE) { in s390_handle_ptf()
135 env->regs[r1] |= S390_PTF_REASON_DONE; in s390_handle_ptf()
173 * (0, 0, 0) up to the last (smp->drawers, smp->books, smp->sockets).
184 CpuTopology *smp = &current_machine->smp; in s390_topology_cpu_default()
185 CPUS390XState *env = &cpu->env; in s390_topology_cpu_default()
188 if ((env->socket_id < 0 || env->book_id < 0 || env->drawer_id < 0) && in s390_topology_cpu_default()
189 (env->socket_id >= 0 || env->book_id >= 0 || env->drawer_id >= 0)) { in s390_topology_cpu_default()
195 /* If one value is unset all are unset -> calculate defaults */ in s390_topology_cpu_default()
196 if (env->socket_id < 0) { in s390_topology_cpu_default()
197 env->socket_id = s390_std_socket(env->core_id, smp); in s390_topology_cpu_default()
198 env->book_id = s390_std_book(env->core_id, smp); in s390_topology_cpu_default()
199 env->drawer_id = s390_std_drawer(env->core_id, smp); in s390_topology_cpu_default()
203 * When the user specifies the entitlement as 'auto' on the command line, in s390_topology_cpu_default()
208 if (env->entitlement == S390_CPU_ENTITLEMENT_AUTO) { in s390_topology_cpu_default()
209 if (env->dedicated) { in s390_topology_cpu_default()
210 env->entitlement = S390_CPU_ENTITLEMENT_HIGH; in s390_topology_cpu_default()
212 env->entitlement = S390_CPU_ENTITLEMENT_MEDIUM; in s390_topology_cpu_default()
237 CpuTopology *smp = &current_machine->smp; in s390_topology_check()
239 if (socket_id >= smp->sockets) { in s390_topology_check()
243 if (book_id >= smp->books) { in s390_topology_check()
247 if (drawer_id >= smp->drawers) { in s390_topology_check()
279 return cpu->env.drawer_id != drawer_id || in s390_topology_need_report()
280 cpu->env.book_id != book_id || in s390_topology_need_report()
281 cpu->env.socket_id != socket_id || in s390_topology_need_report()
282 cpu->env.entitlement != entitlement || in s390_topology_need_report()
283 cpu->env.dedicated != dedicated; in s390_topology_need_report()
296 props = &ms->possible_cpus->cpus[cpu->env.core_id].props; in s390_update_cpu_props()
298 props->socket_id = cpu->env.socket_id; in s390_update_cpu_props()
299 props->book_id = cpu->env.book_id; in s390_update_cpu_props()
300 props->drawer_id = cpu->env.drawer_id; in s390_update_cpu_props()
335 if (!s390_topology_check(cpu->env.socket_id, cpu->env.book_id, in s390_topology_setup_cpu()
336 cpu->env.drawer_id, cpu->env.entitlement, in s390_topology_setup_cpu()
337 cpu->env.dedicated, errp)) { in s390_topology_setup_cpu()
343 if (s390_topology.cores_per_socket[entry] >= ms->smp.cores) { in s390_topology_setup_cpu()
372 error_setg(errp, "Core-id %d does not exist!", core_id); in s390_change_topology()
378 socket_id = cpu->env.socket_id; in s390_change_topology()
381 book_id = cpu->env.book_id; in s390_change_topology()
384 drawer_id = cpu->env.drawer_id; in s390_change_topology()
387 dedicated = cpu->env.dedicated; in s390_change_topology()
391 * When the user specifies the entitlement as 'auto' on the command line, in s390_change_topology()
415 ms->smp.cores) { in s390_change_topology()
421 s390_topology.cores_per_socket[old_socket_entry] -= 1; in s390_change_topology()
430 cpu->env.drawer_id = drawer_id; in s390_change_topology()
431 cpu->env.book_id = book_id; in s390_change_topology()
432 cpu->env.socket_id = socket_id; in s390_change_topology()
433 cpu->env.dedicated = dedicated; in s390_change_topology()
434 cpu->env.entitlement = entitlement; in s390_change_topology()
467 info->polarization = s390_topology.polarization; in qmp_query_s390x_cpu_polarization()