spapr_numa.c: FORM2 table handle nodes with no distance info
[qemu/rayw.git] / target / microblaze / machine.c
blobd24def3992e2776e2e14ef9809d66b968bb81872
1 /*
2 * Microblaze VMState for qemu.
4 * Copyright (c) 2020 Linaro, Ltd.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "cpu.h"
22 #include "migration/cpu.h"
25 static VMStateField vmstate_mmu_fields[] = {
26 VMSTATE_UINT64_2DARRAY(rams, MicroBlazeMMU, 2, TLB_ENTRIES),
27 VMSTATE_UINT8_ARRAY(tids, MicroBlazeMMU, TLB_ENTRIES),
28 VMSTATE_UINT32_ARRAY(regs, MicroBlazeMMU, 3),
29 VMSTATE_END_OF_LIST()
32 static const VMStateDescription vmstate_mmu = {
33 .name = "mmu",
34 .version_id = 0,
35 .minimum_version_id = 0,
36 .fields = vmstate_mmu_fields,
39 static int get_msr(QEMUFile *f, void *opaque, size_t size,
40 const VMStateField *field)
42 CPUMBState *env = container_of(opaque, CPUMBState, msr);
44 mb_cpu_write_msr(env, qemu_get_be32(f));
45 return 0;
48 static int put_msr(QEMUFile *f, void *opaque, size_t size,
49 const VMStateField *field, JSONWriter *vmdesc)
51 CPUMBState *env = container_of(opaque, CPUMBState, msr);
53 qemu_put_be32(f, mb_cpu_read_msr(env));
54 return 0;
57 static const VMStateInfo vmstate_msr = {
58 .name = "msr",
59 .get = get_msr,
60 .put = put_msr,
63 static VMStateField vmstate_env_fields[] = {
64 VMSTATE_UINT32_ARRAY(regs, CPUMBState, 32),
66 VMSTATE_UINT32(pc, CPUMBState),
67 VMSTATE_SINGLE(msr, CPUMBState, 0, vmstate_msr, uint32_t),
68 VMSTATE_UINT32(esr, CPUMBState),
69 VMSTATE_UINT32(fsr, CPUMBState),
70 VMSTATE_UINT32(btr, CPUMBState),
71 VMSTATE_UINT32(edr, CPUMBState),
72 VMSTATE_UINT32(slr, CPUMBState),
73 VMSTATE_UINT32(shr, CPUMBState),
74 VMSTATE_UINT64(ear, CPUMBState),
76 VMSTATE_UINT32(btarget, CPUMBState),
77 VMSTATE_UINT32(imm, CPUMBState),
78 VMSTATE_UINT32(iflags, CPUMBState),
80 VMSTATE_UINT32(res_val, CPUMBState),
81 VMSTATE_UINTTL(res_addr, CPUMBState),
83 VMSTATE_STRUCT(mmu, CPUMBState, 0, vmstate_mmu, MicroBlazeMMU),
85 VMSTATE_END_OF_LIST()
88 static const VMStateDescription vmstate_env = {
89 .name = "env",
90 .version_id = 0,
91 .minimum_version_id = 0,
92 .fields = vmstate_env_fields,
95 static VMStateField vmstate_cpu_fields[] = {
96 VMSTATE_CPU(),
97 VMSTATE_STRUCT(env, MicroBlazeCPU, 1, vmstate_env, CPUMBState),
98 VMSTATE_END_OF_LIST()
101 const VMStateDescription vmstate_mb_cpu = {
102 .name = "cpu",
103 .version_id = 0,
104 .minimum_version_id = 0,
105 .fields = vmstate_cpu_fields,