qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] acpi: update RSDP on guest access
@ 2015-02-04  9:32 Michael S. Tsirkin
  0 siblings, 0 replies; only message in thread
From: Michael S. Tsirkin @ 2015-02-04  9:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, Richard Henderson, Paolo Bonzini

As Igor pointed out, when RSDT offset changes,
RSDP needs to change as well.
We really should have put it in a ROM region, but
we can't change that for old machine types,
let's just set the callback and update it explicitly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/acpi-build.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 74586f3..dfbf690 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1529,6 +1529,7 @@ struct AcpiBuildState {
     /* Is table patched? */
     uint8_t patched;
     PcGuestInfo *guest_info;
+    void *rsdp;
 } AcpiBuildState;
 
 static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
@@ -1737,6 +1738,8 @@ static void acpi_build_update(void *build_opaque, uint32_t offset)
     memcpy(qemu_get_ram_ptr(build_state->table_ram), tables.table_data->data,
            build_state->table_size);
 
+    memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp));
+
     cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram,
                                                build_state->table_size);
 
@@ -1811,8 +1814,11 @@ void acpi_setup(PcGuestInfo *guest_info)
      * RSDP is small so it's easy to keep it immutable, no need to
      * bother with ROM blobs.
      */
-    fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE,
-                    tables.rsdp->data, acpi_data_len(tables.rsdp));
+    fw_cfg_add_file_callback(guest_info->fw_cfg, ACPI_BUILD_RSDP_FILE,
+                             acpi_build_update, NULL,
+                             tables.rsdp->data, acpi_data_len(tables.rsdp));
+
+    build_state->rsdp = tables.rsdp->data;
 
     qemu_register_reset(acpi_build_reset, build_state);
     acpi_build_reset(build_state);
-- 
MST

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-04  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04  9:32 [Qemu-devel] [PATCH] acpi: update RSDP on guest access Michael S. Tsirkin

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).