diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2014-11-17 07:49:21 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-11-24 20:57:10 +0200 |
commit | ad5b88b1f198182642b6cbf3dacb4cade0c80fb9 (patch) | |
tree | 9a476fecc99c7ac1179cf88af462a3c2bc50a978 /hw/i386 | |
parent | 109e90e47029f415783cd6e9a0eb9d0f10954c18 (diff) |
acpi-build: mark RAM dirty on table update
acpi build modifies internal FW CFG RAM on first access
but we forgot to mark it dirty.
If this RAM has been migrated already, it won't be
migrated again, returning corrupted tables to guest.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r-- | hw/i386/acpi-build.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4003b6bf9b..92a36e3b9b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -56,6 +56,7 @@ #include "qapi/qmp/qint.h" #include "qom/qom-qobject.h" +#include "exec/ram_addr.h" /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows @@ -1511,7 +1512,7 @@ static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre) typedef struct AcpiBuildState { /* Copy of table in RAM (for patching). */ - uint8_t *table_ram; + ram_addr_t table_ram; uint32_t table_size; /* Is table patched? */ uint8_t patched; @@ -1716,9 +1717,12 @@ static void acpi_build_update(void *build_opaque, uint32_t offset) acpi_build(build_state->guest_info, &tables); assert(acpi_data_len(tables.table_data) == build_state->table_size); - memcpy(build_state->table_ram, tables.table_data->data, + memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data, build_state->table_size); + cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram, + build_state->table_size); + acpi_build_tables_cleanup(&tables, true); } @@ -1728,7 +1732,7 @@ static void acpi_build_reset(void *build_opaque) build_state->patched = 0; } -static void *acpi_add_rom_blob(AcpiBuildState *build_state, GArray *blob, +static ram_addr_t acpi_add_rom_blob(AcpiBuildState *build_state, GArray *blob, const char *name) { return rom_add_blob(name, blob->data, acpi_data_len(blob), -1, name, @@ -1777,6 +1781,7 @@ void acpi_setup(PcGuestInfo *guest_info) /* Now expose it all to Guest */ build_state->table_ram = acpi_add_rom_blob(build_state, tables.table_data, ACPI_BUILD_TABLE_FILE); + assert(build_state->table_ram != RAM_ADDR_MAX); build_state->table_size = acpi_data_len(tables.table_data); acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader"); |