]>
Commit | Line | Data |
---|---|---|
335d52f4 LM |
1 | /* |
2 | * QEMU CPU cluster | |
3 | * | |
4 | * Copyright (c) 2018 GreenSocs SAS | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version 2 | |
9 | * of the License, or (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, see | |
18 | * <http://www.gnu.org/licenses/gpl-2.0.html> | |
19 | */ | |
20 | #ifndef HW_CPU_CLUSTER_H | |
21 | #define HW_CPU_CLUSTER_H | |
22 | ||
23 | #include "qemu/osdep.h" | |
24 | #include "hw/qdev.h" | |
25 | ||
26 | /* | |
27 | * CPU Cluster type | |
28 | * | |
29 | * A cluster is a group of CPUs which are all identical and have the same view | |
30 | * of the rest of the system. It is mainly an internal QEMU representation and | |
31 | * does not necessarily match with the notion of clusters on the real hardware. | |
32 | * | |
33 | * If CPUs are not identical (for example, Cortex-A53 and Cortex-A57 CPUs in an | |
34 | * Arm big.LITTLE system) they should be in different clusters. If the CPUs do | |
35 | * not have the same view of memory (for example the main CPU and a management | |
36 | * controller processor) they should be in different clusters. | |
7ea7b9ad PM |
37 | * |
38 | * A cluster is created by creating an object of TYPE_CPU_CLUSTER, and then | |
39 | * adding the CPUs to it as QOM child objects (e.g. using the | |
40 | * object_initialize_child() or object_property_add_child() functions). | |
41 | * The CPUs may be either direct children of the cluster object, or indirect | |
42 | * children (e.g. children of children of the cluster object). | |
43 | * | |
44 | * All CPUs must be added as children before the cluster is realized. | |
45 | * (Regrettably QOM provides no way to prevent adding children to a realized | |
46 | * object and no way for the parent to be notified when a new child is added | |
47 | * to it, so this restriction is not checked for, but the system will not | |
48 | * behave correctly if it is not adhered to. The cluster will assert that | |
49 | * it contains at least one CPU, which should catch most inadvertent | |
50 | * violations of this constraint.) | |
51 | * | |
52 | * A CPU which is not put into any cluster will be considered implicitly | |
53 | * to be in a cluster with all the other "loose" CPUs, so all CPUs that are | |
54 | * not assigned to clusters must be identical. | |
335d52f4 LM |
55 | */ |
56 | ||
57 | #define TYPE_CPU_CLUSTER "cpu-cluster" | |
58 | #define CPU_CLUSTER(obj) \ | |
59 | OBJECT_CHECK(CPUClusterState, (obj), TYPE_CPU_CLUSTER) | |
60 | ||
7ea7b9ad PM |
61 | /* |
62 | * This limit is imposed by TCG, which puts the cluster ID into an | |
63 | * 8 bit field (and uses all-1s for the default "not in any cluster"). | |
64 | */ | |
65 | #define MAX_CLUSTERS 255 | |
66 | ||
335d52f4 LM |
67 | /** |
68 | * CPUClusterState: | |
69 | * @cluster_id: The cluster ID. This value is for internal use only and should | |
70 | * not be exposed directly to the user or to the guest. | |
71 | * | |
72 | * State of a CPU cluster. | |
73 | */ | |
74 | typedef struct CPUClusterState { | |
75 | /*< private >*/ | |
76 | DeviceState parent_obj; | |
77 | ||
78 | /*< public >*/ | |
79 | uint32_t cluster_id; | |
80 | } CPUClusterState; | |
81 | ||
82 | #endif |