26
#include "qemu/osdep.h"
27
#include "hw/acpi/acpi-defs.h"
28
#include "hw/acpi/acpi.h"
29
#include "hw/acpi/aml-build.h"
30
#include "hw/acpi/pci.h"
31
#include "hw/acpi/utils.h"
32
#include "hw/intc/riscv_aclint.h"
33
#include "hw/nvram/fw_cfg_acpi.h"
34
#include "hw/pci-host/gpex.h"
35
#include "hw/riscv/virt.h"
36
#include "hw/riscv/numa.h"
37
#include "hw/virtio/virtio-acpi.h"
38
#include "migration/vmstate.h"
39
#include "qapi/error.h"
40
#include "qemu/error-report.h"
41
#include "sysemu/reset.h"
43
#define ACPI_BUILD_TABLE_SIZE 0x20000
44
#define ACPI_BUILD_INTC_ID(socket, index) ((socket << 24) | (index))
46
typedef struct AcpiBuildState {
48
MemoryRegion *table_mr;
49
MemoryRegion *rsdp_mr;
50
MemoryRegion *linker_mr;
55
static void acpi_align_size(GArray *blob, unsigned align)
61
g_array_set_size(blob, ROUND_UP(acpi_data_len(blob), align));
64
static void riscv_acpi_madt_add_rintc(uint32_t uid,
65
const CPUArchIdList *arch_ids,
69
uint8_t guest_index_bits = imsic_num_bits(s->aia_guests + 1);
70
uint64_t hart_id = arch_ids->cpus[uid].arch_id;
71
uint32_t imsic_size, local_cpu_id, socket_id;
72
uint64_t imsic_socket_addr, imsic_addr;
73
MachineState *ms = MACHINE(s);
75
socket_id = arch_ids->cpus[uid].props.node_id;
76
local_cpu_id = (arch_ids->cpus[uid].arch_id -
77
riscv_socket_first_hartid(ms, socket_id)) %
78
riscv_socket_hart_count(ms, socket_id);
79
imsic_socket_addr = s->memmap[VIRT_IMSIC_S].base +
80
(socket_id * VIRT_IMSIC_GROUP_MAX_SIZE);
81
imsic_size = IMSIC_HART_SIZE(guest_index_bits);
82
imsic_addr = imsic_socket_addr + local_cpu_id * imsic_size;
83
build_append_int_noprefix(entry, 0x18, 1);
84
build_append_int_noprefix(entry, 36, 1);
85
build_append_int_noprefix(entry, 1, 1);
86
build_append_int_noprefix(entry, 0, 1);
87
build_append_int_noprefix(entry, 0x1, 4);
88
build_append_int_noprefix(entry, hart_id, 8);
89
build_append_int_noprefix(entry, uid, 4);
91
if (s->aia_type == VIRT_AIA_TYPE_APLIC) {
92
build_append_int_noprefix(entry,
94
arch_ids->cpus[uid].props.node_id,
97
} else if (s->aia_type == VIRT_AIA_TYPE_NONE) {
98
build_append_int_noprefix(entry,
100
arch_ids->cpus[uid].props.node_id,
101
2 * local_cpu_id + 1),
104
build_append_int_noprefix(entry, 0, 4);
107
if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
109
build_append_int_noprefix(entry, imsic_addr, 8);
111
build_append_int_noprefix(entry, imsic_size, 4);
113
build_append_int_noprefix(entry, 0, 8);
114
build_append_int_noprefix(entry, 0, 4);
118
static void acpi_dsdt_add_cpus(Aml *scope, RISCVVirtState *s)
120
MachineClass *mc = MACHINE_GET_CLASS(s);
121
MachineState *ms = MACHINE(s);
122
const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(ms);
124
for (int i = 0; i < arch_ids->len; i++) {
126
GArray *madt_buf = g_array_new(0, 1, 1);
128
dev = aml_device("C%.03X", i);
129
aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
130
aml_append(dev, aml_name_decl("_UID",
131
aml_int(arch_ids->cpus[i].arch_id)));
134
riscv_acpi_madt_add_rintc(i, arch_ids, madt_buf, s);
135
aml_append(dev, aml_name_decl("_MAT",
136
aml_buffer(madt_buf->len,
137
(uint8_t *)madt_buf->data)));
138
g_array_free(madt_buf, true);
140
aml_append(scope, dev);
144
static void acpi_dsdt_add_plic_aplic(Aml *scope, uint8_t socket_count,
145
uint64_t mmio_base, uint64_t mmio_size,
148
uint64_t plic_aplic_addr;
152
for (socket = 0; socket < socket_count; socket++) {
153
plic_aplic_addr = mmio_base + mmio_size * socket;
154
gsi_base = VIRT_IRQCHIP_NUM_SOURCES * socket;
155
Aml *dev = aml_device("IC%.02X", socket);
156
aml_append(dev, aml_name_decl("_HID", aml_string("%s", hid)));
157
aml_append(dev, aml_name_decl("_UID", aml_int(socket)));
158
aml_append(dev, aml_name_decl("_GSB", aml_int(gsi_base)));
160
Aml *crs = aml_resource_template();
161
aml_append(crs, aml_memory32_fixed(plic_aplic_addr, mmio_size,
163
aml_append(dev, aml_name_decl("_CRS", crs));
164
aml_append(scope, dev);
169
acpi_dsdt_add_uart(Aml *scope, const MemMapEntry *uart_memmap,
172
Aml *dev = aml_device("COM0");
173
aml_append(dev, aml_name_decl("_HID", aml_string("RSCV0003")));
174
aml_append(dev, aml_name_decl("_UID", aml_int(0)));
176
Aml *crs = aml_resource_template();
177
aml_append(crs, aml_memory32_fixed(uart_memmap->base,
178
uart_memmap->size, AML_READ_WRITE));
180
aml_interrupt(AML_CONSUMER, AML_LEVEL, AML_ACTIVE_HIGH,
181
AML_EXCLUSIVE, &uart_irq, 1));
182
aml_append(dev, aml_name_decl("_CRS", crs));
184
Aml *pkg = aml_package(2);
185
aml_append(pkg, aml_string("clock-frequency"));
186
aml_append(pkg, aml_int(3686400));
188
Aml *UUID = aml_touuid("DAFFD814-6EBA-4D8C-8A91-BC9BBF4AA301");
190
Aml *pkg1 = aml_package(1);
191
aml_append(pkg1, pkg);
193
Aml *package = aml_package(2);
194
aml_append(package, UUID);
195
aml_append(package, pkg1);
197
aml_append(dev, aml_name_decl("_DSD", package));
198
aml_append(scope, dev);
207
spcr_setup(GArray *table_data, BIOSLinker *linker, RISCVVirtState *s)
209
AcpiSpcrData serial = {
211
.base_addr.id = AML_AS_SYSTEM_MEMORY,
212
.base_addr.width = 32,
213
.base_addr.offset = 0,
215
.base_addr.addr = s->memmap[VIRT_UART0].base,
216
.interrupt_type = (1 << 4),
218
.interrupt = UART0_IRQ,
225
.pci_device_id = 0xffff,
226
.pci_vendor_id = 0xffff,
234
build_spcr(table_data, linker, &serial, 2, s->oem_id, s->oem_table_id);
238
#define RHCT_NODE_ARRAY_OFFSET 56
247
static void build_rhct(GArray *table_data,
251
MachineClass *mc = MACHINE_GET_CLASS(s);
252
MachineState *ms = MACHINE(s);
253
const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(ms);
254
size_t len, aligned_len;
255
uint32_t isa_offset, num_rhct_nodes, cmo_offset = 0;
256
RISCVCPU *cpu = &s->soc[0].harts[0];
257
uint32_t mmu_offset = 0;
258
uint8_t satp_mode_max;
259
g_autofree char *isa = NULL;
261
AcpiTable table = { .sig = "RHCT", .rev = 1, .oem_id = s->oem_id,
262
.oem_table_id = s->oem_table_id };
264
acpi_table_begin(&table, table_data);
266
build_append_int_noprefix(table_data, 0x0, 4);
269
build_append_int_noprefix(table_data,
270
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ, 8);
273
num_rhct_nodes = 1 + ms->smp.cpus;
274
if (cpu->cfg.ext_zicbom || cpu->cfg.ext_zicboz) {
278
if (cpu->cfg.satp_mode.supported != 0) {
283
build_append_int_noprefix(table_data, num_rhct_nodes, 4);
286
build_append_int_noprefix(table_data, RHCT_NODE_ARRAY_OFFSET, 4);
289
isa_offset = table_data->len - table.table_offset;
290
build_append_int_noprefix(table_data, 0, 2);
292
isa = riscv_isa_string(cpu);
293
len = 8 + strlen(isa) + 1;
294
aligned_len = (len % 2) ? (len + 1) : len;
296
build_append_int_noprefix(table_data, aligned_len, 2);
297
build_append_int_noprefix(table_data, 0x1, 2);
300
build_append_int_noprefix(table_data, strlen(isa) + 1, 2);
301
g_array_append_vals(table_data, isa, strlen(isa) + 1);
303
if (aligned_len != len) {
304
build_append_int_noprefix(table_data, 0x0, 1);
308
if (cpu->cfg.ext_zicbom || cpu->cfg.ext_zicboz) {
309
cmo_offset = table_data->len - table.table_offset;
310
build_append_int_noprefix(table_data, 1, 2);
311
build_append_int_noprefix(table_data, 10, 2);
312
build_append_int_noprefix(table_data, 0x1, 2);
313
build_append_int_noprefix(table_data, 0, 1);
316
if (cpu->cfg.cbom_blocksize) {
317
build_append_int_noprefix(table_data,
318
__builtin_ctz(cpu->cfg.cbom_blocksize),
321
build_append_int_noprefix(table_data, 0, 1);
325
build_append_int_noprefix(table_data, 0, 1);
328
if (cpu->cfg.cboz_blocksize) {
329
build_append_int_noprefix(table_data,
330
__builtin_ctz(cpu->cfg.cboz_blocksize),
333
build_append_int_noprefix(table_data, 0, 1);
338
if (cpu->cfg.satp_mode.supported != 0) {
339
satp_mode_max = satp_mode_max_from_map(cpu->cfg.satp_mode.map);
340
mmu_offset = table_data->len - table.table_offset;
341
build_append_int_noprefix(table_data, 2, 2);
342
build_append_int_noprefix(table_data, 8, 2);
343
build_append_int_noprefix(table_data, 0x1, 2);
344
build_append_int_noprefix(table_data, 0, 1);
346
if (satp_mode_max == VM_1_10_SV57) {
347
build_append_int_noprefix(table_data, 2, 1);
348
} else if (satp_mode_max == VM_1_10_SV48) {
349
build_append_int_noprefix(table_data, 1, 1);
350
} else if (satp_mode_max == VM_1_10_SV39) {
351
build_append_int_noprefix(table_data, 0, 1);
358
for (int i = 0; i < arch_ids->len; i++) {
361
build_append_int_noprefix(table_data, 0xFFFF, 2);
374
build_append_int_noprefix(table_data, len, 2);
375
build_append_int_noprefix(table_data, 0x1, 2);
377
build_append_int_noprefix(table_data, num_offsets, 2);
378
build_append_int_noprefix(table_data, i, 4);
380
build_append_int_noprefix(table_data, isa_offset, 4);
382
build_append_int_noprefix(table_data, cmo_offset, 4);
386
build_append_int_noprefix(table_data, mmu_offset, 4);
390
acpi_table_end(linker, &table);
394
static void build_fadt_rev6(GArray *table_data,
397
unsigned dsdt_tbl_offset)
399
AcpiFadtData fadt = {
402
.flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI,
403
.xdsdt_tbl_offset = &dsdt_tbl_offset,
406
build_fadt(table_data, linker, &fadt, s->oem_id, s->oem_table_id);
410
static void build_dsdt(GArray *table_data,
415
MachineState *ms = MACHINE(s);
416
uint8_t socket_count;
417
const MemMapEntry *memmap = s->memmap;
418
AcpiTable table = { .sig = "DSDT", .rev = 2, .oem_id = s->oem_id,
419
.oem_table_id = s->oem_table_id };
422
acpi_table_begin(&table, table_data);
423
dsdt = init_aml_allocator();
431
scope = aml_scope("\\_SB");
432
acpi_dsdt_add_cpus(scope, s);
434
fw_cfg_acpi_dsdt_add(scope, &memmap[VIRT_FW_CFG]);
436
socket_count = riscv_socket_count(ms);
438
if (s->aia_type == VIRT_AIA_TYPE_NONE) {
439
acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_PLIC].base,
440
memmap[VIRT_PLIC].size, "RSCV0001");
442
acpi_dsdt_add_plic_aplic(scope, socket_count, memmap[VIRT_APLIC_S].base,
443
memmap[VIRT_APLIC_S].size, "RSCV0002");
446
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART0], UART0_IRQ);
448
if (socket_count == 1) {
449
virtio_acpi_dsdt_add(scope, memmap[VIRT_VIRTIO].base,
450
memmap[VIRT_VIRTIO].size,
451
VIRTIO_IRQ, 0, VIRTIO_COUNT);
452
acpi_dsdt_add_gpex_host(scope, PCIE_IRQ);
453
} else if (socket_count == 2) {
454
virtio_acpi_dsdt_add(scope, memmap[VIRT_VIRTIO].base,
455
memmap[VIRT_VIRTIO].size,
456
VIRTIO_IRQ + VIRT_IRQCHIP_NUM_SOURCES, 0,
458
acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + VIRT_IRQCHIP_NUM_SOURCES);
460
virtio_acpi_dsdt_add(scope, memmap[VIRT_VIRTIO].base,
461
memmap[VIRT_VIRTIO].size,
462
VIRTIO_IRQ + VIRT_IRQCHIP_NUM_SOURCES, 0,
464
acpi_dsdt_add_gpex_host(scope, PCIE_IRQ + VIRT_IRQCHIP_NUM_SOURCES * 2);
467
aml_append(dsdt, scope);
470
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
472
acpi_table_end(linker, &table);
473
free_aml_allocator();
483
static void build_madt(GArray *table_data,
487
MachineClass *mc = MACHINE_GET_CLASS(s);
488
MachineState *ms = MACHINE(s);
489
const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids(ms);
490
uint8_t group_index_bits = imsic_num_bits(riscv_socket_count(ms));
491
uint8_t guest_index_bits = imsic_num_bits(s->aia_guests + 1);
492
uint16_t imsic_max_hart_per_socket = 0;
493
uint8_t hart_index_bits;
498
for (socket = 0; socket < riscv_socket_count(ms); socket++) {
499
if (imsic_max_hart_per_socket < s->soc[socket].num_harts) {
500
imsic_max_hart_per_socket = s->soc[socket].num_harts;
504
hart_index_bits = imsic_num_bits(imsic_max_hart_per_socket);
506
AcpiTable table = { .sig = "APIC", .rev = 6, .oem_id = s->oem_id,
507
.oem_table_id = s->oem_table_id };
509
acpi_table_begin(&table, table_data);
511
build_append_int_noprefix(table_data, 0, 4);
512
build_append_int_noprefix(table_data, 0, 4);
515
for (int i = 0; i < arch_ids->len; i++) {
516
riscv_acpi_madt_add_rintc(i, arch_ids, table_data, s);
520
if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
522
build_append_int_noprefix(table_data, 0x19, 1);
523
build_append_int_noprefix(table_data, 16, 1);
524
build_append_int_noprefix(table_data, 1, 1);
525
build_append_int_noprefix(table_data, 0, 1);
526
build_append_int_noprefix(table_data, 0, 4);
528
build_append_int_noprefix(table_data, VIRT_IRQCHIP_NUM_MSIS, 2);
530
build_append_int_noprefix(table_data, VIRT_IRQCHIP_NUM_MSIS, 2);
532
build_append_int_noprefix(table_data, guest_index_bits, 1);
534
build_append_int_noprefix(table_data, hart_index_bits, 1);
536
build_append_int_noprefix(table_data, group_index_bits, 1);
538
build_append_int_noprefix(table_data, IMSIC_MMIO_GROUP_MIN_SHIFT, 1);
541
if (s->aia_type != VIRT_AIA_TYPE_NONE) {
543
for (socket = 0; socket < riscv_socket_count(ms); socket++) {
544
aplic_addr = s->memmap[VIRT_APLIC_S].base +
545
s->memmap[VIRT_APLIC_S].size * socket;
546
gsi_base = VIRT_IRQCHIP_NUM_SOURCES * socket;
547
build_append_int_noprefix(table_data, 0x1A, 1);
548
build_append_int_noprefix(table_data, 36, 1);
549
build_append_int_noprefix(table_data, 1, 1);
550
build_append_int_noprefix(table_data, socket, 1);
551
build_append_int_noprefix(table_data, 0, 4);
552
build_append_int_noprefix(table_data, 0, 8);
554
if (s->aia_type == VIRT_AIA_TYPE_APLIC) {
555
build_append_int_noprefix(table_data,
556
s->soc[socket].num_harts,
559
build_append_int_noprefix(table_data, 0, 2);
562
build_append_int_noprefix(table_data, VIRT_IRQCHIP_NUM_SOURCES, 2);
564
build_append_int_noprefix(table_data, gsi_base, 4);
566
build_append_int_noprefix(table_data, aplic_addr, 8);
568
build_append_int_noprefix(table_data,
569
s->memmap[VIRT_APLIC_S].size, 4);
573
for (socket = 0; socket < riscv_socket_count(ms); socket++) {
574
aplic_addr = s->memmap[VIRT_PLIC].base +
575
s->memmap[VIRT_PLIC].size * socket;
576
gsi_base = VIRT_IRQCHIP_NUM_SOURCES * socket;
577
build_append_int_noprefix(table_data, 0x1B, 1);
578
build_append_int_noprefix(table_data, 36, 1);
579
build_append_int_noprefix(table_data, 1, 1);
580
build_append_int_noprefix(table_data, socket, 1);
581
build_append_int_noprefix(table_data, 0, 8);
583
build_append_int_noprefix(table_data,
584
VIRT_IRQCHIP_NUM_SOURCES - 1, 2);
585
build_append_int_noprefix(table_data, 0, 2);
586
build_append_int_noprefix(table_data, 0, 4);
588
build_append_int_noprefix(table_data, s->memmap[VIRT_PLIC].size, 4);
590
build_append_int_noprefix(table_data, aplic_addr, 8);
592
build_append_int_noprefix(table_data, gsi_base, 4);
596
acpi_table_end(linker, &table);
606
build_srat(GArray *table_data, BIOSLinker *linker, RISCVVirtState *vms)
610
MachineClass *mc = MACHINE_GET_CLASS(vms);
611
MachineState *ms = MACHINE(vms);
612
const CPUArchIdList *cpu_list = mc->possible_cpu_arch_ids(ms);
613
AcpiTable table = { .sig = "SRAT", .rev = 3, .oem_id = vms->oem_id,
614
.oem_table_id = vms->oem_table_id };
616
acpi_table_begin(&table, table_data);
617
build_append_int_noprefix(table_data, 1, 4);
618
build_append_int_noprefix(table_data, 0, 8);
620
for (i = 0; i < cpu_list->len; ++i) {
621
uint32_t nodeid = cpu_list->cpus[i].props.node_id;
625
build_append_int_noprefix(table_data, 7, 1);
626
build_append_int_noprefix(table_data, 20, 1);
627
build_append_int_noprefix(table_data, 0, 2);
628
build_append_int_noprefix(table_data, nodeid, 4);
629
build_append_int_noprefix(table_data, i, 4);
631
build_append_int_noprefix(table_data, 1 , 4);
632
build_append_int_noprefix(table_data, 0, 4);
635
mem_base = vms->memmap[VIRT_DRAM].base;
636
for (i = 0; i < ms->numa_state->num_nodes; ++i) {
637
if (ms->numa_state->nodes[i].node_mem > 0) {
638
build_srat_memory(table_data, mem_base,
639
ms->numa_state->nodes[i].node_mem, i,
640
MEM_AFFINITY_ENABLED);
641
mem_base += ms->numa_state->nodes[i].node_mem;
645
acpi_table_end(linker, &table);
648
static void virt_acpi_build(RISCVVirtState *s, AcpiBuildTables *tables)
650
GArray *table_offsets;
652
GArray *tables_blob = tables->table_data;
653
MachineState *ms = MACHINE(s);
655
table_offsets = g_array_new(false, true,
658
bios_linker_loader_alloc(tables->linker,
659
ACPI_BUILD_TABLE_FILE, tables_blob,
663
dsdt = tables_blob->len;
664
build_dsdt(tables_blob, tables->linker, s);
667
acpi_add_table(table_offsets, tables_blob);
668
build_fadt_rev6(tables_blob, tables->linker, s, dsdt);
670
acpi_add_table(table_offsets, tables_blob);
671
build_madt(tables_blob, tables->linker, s);
673
acpi_add_table(table_offsets, tables_blob);
674
build_rhct(tables_blob, tables->linker, s);
676
acpi_add_table(table_offsets, tables_blob);
677
spcr_setup(tables_blob, tables->linker, s);
679
acpi_add_table(table_offsets, tables_blob);
681
AcpiMcfgInfo mcfg = {
682
.base = s->memmap[VIRT_PCIE_ECAM].base,
683
.size = s->memmap[VIRT_PCIE_ECAM].size,
685
build_mcfg(tables_blob, tables->linker, &mcfg, s->oem_id,
689
if (ms->numa_state->num_nodes > 0) {
690
acpi_add_table(table_offsets, tables_blob);
691
build_srat(tables_blob, tables->linker, s);
692
if (ms->numa_state->have_numa_distance) {
693
acpi_add_table(table_offsets, tables_blob);
694
build_slit(tables_blob, tables->linker, ms, s->oem_id,
700
xsdt = tables_blob->len;
701
build_xsdt(tables_blob, tables->linker, table_offsets, s->oem_id,
706
AcpiRsdpData rsdp_data = {
709
.xsdt_tbl_offset = &xsdt,
710
.rsdt_tbl_offset = NULL,
712
build_rsdp(tables->rsdp, tables->linker, &rsdp_data);
719
if (tables_blob->len > ACPI_BUILD_TABLE_SIZE / 2) {
720
warn_report("ACPI table size %u exceeds %d bytes,"
721
" migration may not work",
722
tables_blob->len, ACPI_BUILD_TABLE_SIZE / 2);
723
error_printf("Try removing some objects.");
726
acpi_align_size(tables_blob, ACPI_BUILD_TABLE_SIZE);
729
g_array_free(table_offsets, true);
732
static void acpi_ram_update(MemoryRegion *mr, GArray *data)
734
uint32_t size = acpi_data_len(data);
740
memory_region_ram_resize(mr, size, &error_abort);
742
memcpy(memory_region_get_ram_ptr(mr), data->data, size);
743
memory_region_set_dirty(mr, 0, size);
746
static void virt_acpi_build_update(void *build_opaque)
748
AcpiBuildState *build_state = build_opaque;
749
AcpiBuildTables tables;
752
if (!build_state || build_state->patched) {
756
build_state->patched = true;
758
acpi_build_tables_init(&tables);
760
virt_acpi_build(RISCV_VIRT_MACHINE(qdev_get_machine()), &tables);
762
acpi_ram_update(build_state->table_mr, tables.table_data);
763
acpi_ram_update(build_state->rsdp_mr, tables.rsdp);
764
acpi_ram_update(build_state->linker_mr, tables.linker->cmd_blob);
766
acpi_build_tables_cleanup(&tables, true);
769
static void virt_acpi_build_reset(void *build_opaque)
771
AcpiBuildState *build_state = build_opaque;
772
build_state->patched = false;
775
static const VMStateDescription vmstate_virt_acpi_build = {
776
.name = "virt_acpi_build",
778
.minimum_version_id = 1,
779
.fields = (const VMStateField[]) {
780
VMSTATE_BOOL(patched, AcpiBuildState),
781
VMSTATE_END_OF_LIST()
785
void virt_acpi_setup(RISCVVirtState *s)
787
AcpiBuildTables tables;
788
AcpiBuildState *build_state;
790
build_state = g_malloc0(sizeof *build_state);
792
acpi_build_tables_init(&tables);
793
virt_acpi_build(s, &tables);
796
build_state->table_mr = acpi_add_rom_blob(virt_acpi_build_update,
797
build_state, tables.table_data,
798
ACPI_BUILD_TABLE_FILE);
799
assert(build_state->table_mr != NULL);
801
build_state->linker_mr = acpi_add_rom_blob(virt_acpi_build_update,
803
tables.linker->cmd_blob,
804
ACPI_BUILD_LOADER_FILE);
806
build_state->rsdp_mr = acpi_add_rom_blob(virt_acpi_build_update,
807
build_state, tables.rsdp,
808
ACPI_BUILD_RSDP_FILE);
810
qemu_register_reset(virt_acpi_build_reset, build_state);
811
virt_acpi_build_reset(build_state);
812
vmstate_register(NULL, 0, &vmstate_virt_acpi_build, build_state);
818
acpi_build_tables_cleanup(&tables, false);