qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, marcel.a@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 2/3] pc: acpi-build: update linker on guest access
Date: Sun, 15 Feb 2015 20:45:07 +0100	[thread overview]
Message-ID: <20150215194507.GA22518@redhat.com> (raw)
In-Reply-To: <1423490395-22054-3-git-send-email-imammedo@redhat.com>

On Mon, Feb 09, 2015 at 01:59:54PM +0000, Igor Mammedov wrote:
> Linker table is build only once, so if later during
> tables rebuild sizes of other ACPI tables change
> pointers will be patched incorrectly due to wrong
> offsets in linker. Resulting in guest not being able
> to find ACPI tables.
> Fix it by updating 'linker' table with the rest of
> tables when firmware reads it.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  hw/i386/acpi-build.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 5b2b017..21ea3db 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1527,6 +1527,8 @@ struct AcpiBuildState {
>      uint8_t patched;
>      PcGuestInfo *guest_info;
>      void *rsdp;
> +    ram_addr_t linker_ram;
> +    uint32_t linker_size;
>  } AcpiBuildState;
>  
>  static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
> @@ -1733,6 +1735,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));
> +    memcpy(qemu_get_ram_ptr(build_state->linker_ram), tables.linker->data,
> +           build_state->linker_size);
>  
>      cpu_physical_memory_set_dirty_range_nocode(build_state->table_ram,
>                                                 build_state->table_size);

OK, but it looks like linker data needs to be marked dirty
as well. I'll send a patch to do this.

> @@ -1799,7 +1803,9 @@ void acpi_setup(PcGuestInfo *guest_info)
>      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", 0);
> +    build_state->linker_ram =
> +        acpi_add_rom_blob(build_state, tables.linker, "etc/table-loader", 0);
> +    build_state->linker_size = acpi_data_len(tables.linker);
>  
>      fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
>                      tables.tcpalog->data, acpi_data_len(tables.tcpalog));
> -- 
> 1.8.3.1

  parent reply	other threads:[~2015-02-15 19:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 13:59 [Qemu-devel] [PATCH v4 0/3] pc: acpi-build: make linker & RSDP tables dynamic Igor Mammedov
2015-02-09 13:59 ` [Qemu-devel] [PATCH v4 1/3] acpi: update RSDP on guest access Igor Mammedov
2015-02-09 14:11   ` Marcel Apfelbaum
2015-02-09 13:59 ` [Qemu-devel] [PATCH v4 2/3] pc: acpi-build: update linker " Igor Mammedov
2015-02-09 14:11   ` Marcel Apfelbaum
2015-02-15 19:45   ` Michael S. Tsirkin [this message]
2015-02-09 13:59 ` [Qemu-devel] [PATCH v4 3/3] pc: acpi-build: migrate RSDP table Igor Mammedov
2015-02-09 14:19   ` Marcel Apfelbaum
2015-02-15 19:45   ` Michael S. Tsirkin

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=20150215194507.GA22518@redhat.com \
    --to=mst@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=marcel.a@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).