[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 30/96] acpi-build: simplify rsdp management for legac
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 30/96] acpi-build: simplify rsdp management for legacy |
Date: |
Wed, 18 Feb 2015 22:47:02 +0100 |
For legacy machine types, rsdp is not in RAM, so we need a copy of rsdp
for fw cfg. We previously used g_array_free with false parameter,
but this seems to confuse people.
This also wastes a bit of memory as the buffer is unused for new
machine types.
Let's just use plain g_memdup, and free original memory together with
the array.
TODO: rationalize tcpalog memory management, and get rid of the mfre
parameter.
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
---
hw/i386/acpi-build.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 409229f..9b11c92 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1354,7 +1354,7 @@ static inline void
acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
{
void *linker_data = bios_linker_loader_cleanup(tables->linker);
g_free(linker_data);
- g_array_free(tables->rsdp, mfre);
+ g_array_free(tables->rsdp, true);
g_array_free(tables->table_data, true);
g_array_free(tables->tcpalog, mfre);
}
@@ -1657,12 +1657,14 @@ void acpi_setup(PcGuestInfo *guest_info)
/*
* Keep for compatibility with old machine types.
* Though RSDP is small, its contents isn't immutable, so
- * update it along with the rest of tables on guest access.
+ * we'll update it along with the rest of tables on guest access.
*/
+ uint32_t rsdp_size = acpi_data_len(tables.rsdp);
+
+ build_state->rsdp = g_memdup(tables.rsdp->data, rsdp_size);
fw_cfg_add_file_callback(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE,
acpi_build_update, build_state,
- tables.rsdp->data,
acpi_data_len(tables.rsdp));
- build_state->rsdp = tables.rsdp->data;
+ build_state->rsdp, rsdp_size);
build_state->rsdp_ram = (ram_addr_t)-1;
} else {
build_state->rsdp = NULL;
--
MST
- [Qemu-devel] [PULL 20/96] acpi, ich9: Add unplug cb for ich9., (continued)
- [Qemu-devel] [PULL 20/96] acpi, ich9: Add unplug cb for ich9., Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 21/96] acpi, piix4: Add unplug cb for piix4., Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 22/96] vl.c: Fix error messages when parsing maxmem parameters, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 23/96] pc: memory: Validate alignment of maxram_size to page size, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 24/96] acpi: update RSDP on guest access, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 25/96] pc: acpi-build: update linker on guest access, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 26/96] pc: acpi-build: migrate RSDP table, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 27/96] exec: round up size on MR resize, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 28/96] acpi-build: fix ACPI RAM management, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 29/96] acpi: has_immutable_rsdp->!rsdp_in_ram, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 30/96] acpi-build: simplify rsdp management for legacy,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 31/96] scripts/update-linux-headers.sh: pull virtio hdrs, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 32/96] include: import virtio headers from linux 4.0, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 35/96] virtio-balloon: use standard headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 33/96] virtio: use standard virtio_ring.h, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 34/96] virtio: use standard-headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 36/96] virtio-9p: use standard headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 37/96] virtio-blk: switch to standard-headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 38/96] virtio-net,tap: use standard-headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 39/96] virtio-rng: use standard-headers, Michael S. Tsirkin, 2015/02/18
- [Qemu-devel] [PULL 40/96] virtio-scsi: use standard-headers, Michael S. Tsirkin, 2015/02/18