From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Richard Henderson <rth@twiddle.net>,
Anthony Liguori <aliguori@amazon.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH 4/4] acpi-build: simplify rsdp management for legacy
Date: Tue, 17 Feb 2015 11:05:45 +0100 [thread overview]
Message-ID: <1424167517-21866-5-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1424167517-21866-1-git-send-email-mst@redhat.com>
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 <mst@redhat.com>
---
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 ffa3f00..f712277 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1257,7 +1257,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);
}
@@ -1560,12 +1560,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
next prev parent reply other threads:[~2015-02-17 10:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 10:05 [Qemu-devel] [PATCH 0/4] acpi: fix RSDP and linker memory management Michael S. Tsirkin
2015-02-17 10:05 ` [Qemu-devel] [PATCH 1/4] exec: round up size on MR resize Michael S. Tsirkin
2015-02-17 13:45 ` Igor Mammedov
2015-02-17 14:12 ` Paolo Bonzini
2015-02-17 10:05 ` [Qemu-devel] [PATCH 2/4] acpi-build: fix ACPI RAM management Michael S. Tsirkin
2015-02-17 13:52 ` Igor Mammedov
2015-02-17 18:58 ` Michael S. Tsirkin
2015-02-17 10:05 ` [Qemu-devel] [PATCH 3/4] acpi: has_immutable_rsdp->!rsdp_in_ram Michael S. Tsirkin
2015-02-17 13:55 ` Igor Mammedov
2015-02-17 10:05 ` Michael S. Tsirkin [this message]
2015-02-17 14:16 ` [Qemu-devel] [PATCH 4/4] acpi-build: simplify rsdp management for legacy Igor Mammedov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424167517-21866-5-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=aliguori@amazon.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).