Lines Matching full:cpu
3 * CPU Topology
14 * guest with CPU and KVM specificity will be implemented inside
23 #include "target/s390x/cpu.h"
25 #include "hw/s390x/cpu-topology.h"
36 /* will be initialized after the CPU model is realized */
43 * @cpu: s390x CPU
56 * @cpu: s390x CPU
59 * for a cpu.
61 static int s390_socket_nb(S390CPU *cpu) in s390_socket_nb() argument
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()
100 * Function codes 0 (horizontal) and 1 (vertical) define the CPU
106 void s390_handle_ptf(S390CPU *cpu, uint8_t r1, uintptr_t ra) in s390_handle_ptf() argument
109 CPUS390XState *env = &cpu->env; in s390_handle_ptf()
136 setcc(cpu, 2); in s390_handle_ptf()
141 setcc(cpu, 0); in s390_handle_ptf()
153 * Generic reset for CPU topology, calls s390_topology_reset()
164 * @cpu: pointer to a S390CPU
168 * Passing a CPU with some, but not all, attributes set is considered
175 * CPU type and dedication have defaults values set in the
182 static bool s390_topology_cpu_default(S390CPU *cpu, Error **errp) in s390_topology_cpu_default() argument
185 CPUS390XState *env = &cpu->env; in s390_topology_cpu_default()
205 * Medium when the CPU is not dedicated. in s390_topology_cpu_default()
257 error_setg(errp, "A dedicated CPU implies high entitlement"); in s390_topology_check()
265 * @cpu: Current cpu
275 static bool s390_topology_need_report(S390CPU *cpu, int drawer_id, in s390_topology_need_report() argument
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()
289 * @cpu: the CPU for which to update the properties from the environment.
292 static void s390_update_cpu_props(MachineState *ms, S390CPU *cpu) in s390_update_cpu_props() argument
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()
307 * @cpu: the new S390CPU to insert in the topology structure
310 * Called from CPU hotplug to check and setup the CPU attributes
311 * before the CPU is inserted in the topology.
313 * will be updated by KVM on creation of the new CPU.
315 void s390_topology_setup_cpu(MachineState *ms, S390CPU *cpu, Error **errp) in s390_topology_setup_cpu() argument
320 * We do not want to initialize the topology if the CPU model in s390_topology_setup_cpu()
322 * the first CPU to be realized, which realizes the CPU model in s390_topology_setup_cpu()
325 * s390_topology_setup_cpu() is called from the CPU hotplug. in s390_topology_setup_cpu()
331 if (!s390_topology_cpu_default(cpu, errp)) { in s390_topology_setup_cpu()
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()
342 entry = s390_socket_nb(cpu); in s390_topology_setup_cpu()
352 s390_update_cpu_props(ms, cpu); in s390_topology_setup_cpu()
368 S390CPU *cpu; in s390_change_topology() local
370 cpu = s390_cpu_addr2state(core_id); in s390_change_topology()
371 if (!cpu) { in s390_change_topology()
376 /* Get attributes not provided from cpu and verify the new topology */ 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()
393 * Medium when the CPU is not dedicated. in s390_change_topology()
410 old_socket_entry = s390_socket_nb(cpu); in s390_change_topology()
425 report_needed = s390_topology_need_report(cpu, drawer_id, book_id, 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()
437 s390_update_cpu_props(ms, cpu); in s390_change_topology()