]> git.proxmox.com Git - qemu.git/blame - target-arm/cpu-qom.h
target-arm: Initialize cpreg list from KVM when using KVM
[qemu.git] / target-arm / cpu-qom.h
CommitLineData
dec9c2d4
AF
1/*
2 * QEMU ARM CPU
3 *
4 * Copyright (c) 2012 SUSE LINUX Products GmbH
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 QEMU_ARM_CPU_QOM_H
21#define QEMU_ARM_CPU_QOM_H
22
14cccb61 23#include "qom/cpu.h"
dec9c2d4
AF
24
25#define TYPE_ARM_CPU "arm-cpu"
26
27#define ARM_CPU_CLASS(klass) \
28 OBJECT_CLASS_CHECK(ARMCPUClass, (klass), TYPE_ARM_CPU)
29#define ARM_CPU(obj) \
30 OBJECT_CHECK(ARMCPU, (obj), TYPE_ARM_CPU)
31#define ARM_CPU_GET_CLASS(obj) \
32 OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU)
33
34/**
35 * ARMCPUClass:
14969266 36 * @parent_realize: The parent class' realize handler.
dec9c2d4
AF
37 * @parent_reset: The parent class' reset handler.
38 *
39 * An ARM CPU model.
40 */
41typedef struct ARMCPUClass {
42 /*< private >*/
43 CPUClass parent_class;
44 /*< public >*/
45
14969266 46 DeviceRealize parent_realize;
dec9c2d4
AF
47 void (*parent_reset)(CPUState *cpu);
48} ARMCPUClass;
49
50/**
51 * ARMCPU:
52 * @env: #CPUARMState
53 *
54 * An ARM CPU core.
55 */
56typedef struct ARMCPU {
57 /*< private >*/
58 CPUState parent_obj;
59 /*< public >*/
60
61 CPUARMState env;
777dc784 62
4b6a83fb
PM
63 /* Coprocessor information */
64 GHashTable *cp_regs;
721fae12
PM
65 /* For marshalling (mostly coprocessor) register state between the
66 * kernel and QEMU (for KVM) and between two QEMUs (for migration),
67 * we use these arrays.
68 */
69 /* List of register indexes managed via these arrays; (full KVM style
70 * 64 bit indexes, not CPRegInfo 32 bit indexes)
71 */
72 uint64_t *cpreg_indexes;
73 /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */
74 uint64_t *cpreg_values;
75 /* Length of the indexes, values arrays */
76 int32_t cpreg_array_len;
77 /* These are used only for migration: incoming data arrives in
78 * these fields and is sanity checked in post_load before copying
79 * to the working data structures above.
80 */
81 uint64_t *cpreg_vmstate_indexes;
82 uint64_t *cpreg_vmstate_values;
83 int32_t cpreg_vmstate_array_len;
4b6a83fb 84
777dc784
PM
85 /* The instance init functions for implementation-specific subclasses
86 * set these fields to specify the implementation-dependent values of
87 * various constant registers and reset values of non-constant
88 * registers.
89 * Some of these might become QOM properties eventually.
90 * Field names match the official register names as defined in the
91 * ARMv7AR ARM Architecture Reference Manual. A reset_ prefix
92 * is used for reset values of non-constant registers; no reset_
93 * prefix means a constant register.
94 */
95 uint32_t midr;
325b3cef 96 uint32_t reset_fpsid;
bd35c355
PM
97 uint32_t mvfr0;
98 uint32_t mvfr1;
64e1671f 99 uint32_t ctr;
0ca7e01c 100 uint32_t reset_sctlr;
2e4d7e3e
PM
101 uint32_t id_pfr0;
102 uint32_t id_pfr1;
103 uint32_t id_dfr0;
104 uint32_t id_afr0;
105 uint32_t id_mmfr0;
106 uint32_t id_mmfr1;
107 uint32_t id_mmfr2;
108 uint32_t id_mmfr3;
109 uint32_t id_isar0;
110 uint32_t id_isar1;
111 uint32_t id_isar2;
112 uint32_t id_isar3;
113 uint32_t id_isar4;
114 uint32_t id_isar5;
85df3786
PM
115 uint32_t clidr;
116 /* The elements of this array are the CCSIDR values for each cache,
117 * in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
118 */
119 uint32_t ccsidr[16];
c5fad12f 120 uint32_t reset_cbar;
2771db27 121 uint32_t reset_auxcr;
dec9c2d4
AF
122} ARMCPU;
123
124static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
125{
126 return ARM_CPU(container_of(env, ARMCPU, env));
127}
128
129#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
130
fadf9825
AF
131#define ENV_OFFSET offsetof(ARMCPU, env)
132
3cc1d208
JQ
133#ifndef CONFIG_USER_ONLY
134extern const struct VMStateDescription vmstate_arm_cpu;
135#endif
136
2ceb98c0 137void register_cp_regs_for_features(ARMCPU *cpu);
721fae12 138void init_cpreg_list(ARMCPU *cpu);
dec9c2d4 139
97a8ea5a 140void arm_cpu_do_interrupt(CPUState *cpu);
e6f010cc 141void arm_v7m_cpu_do_interrupt(CPUState *cpu);
97a8ea5a 142
dec9c2d4 143#endif