From: "Michael S. Tsirkin" <mst@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] acpi-build: dirty memory on RSDP/linker update
Date: Mon, 16 Feb 2015 12:32:27 +0100 [thread overview]
Message-ID: <20150216113227.GA20667@redhat.com> (raw)
In-Reply-To: <20150216101935.7ae7f232@nial.brq.redhat.com>
On Mon, Feb 16, 2015 at 10:19:35AM +0100, Igor Mammedov wrote:
> On Sun, 15 Feb 2015 20:46:16 +0100
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > This is required to make sure they are migrated
> > correctly.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > hw/i386/acpi-build.c | 28 +++++++++++++++++++++-------
> > 1 file changed, 21 insertions(+), 7 deletions(-)
> >
> > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> > index 1dfdf35..fd6ef78 100644
> > --- a/hw/i386/acpi-build.c
> > +++ b/hw/i386/acpi-build.c
> > @@ -1271,6 +1271,8 @@ struct AcpiBuildState {
> > uint8_t patched;
> > PcGuestInfo *guest_info;
> > void *rsdp;
> > + ram_addr_t rsdp_ram;
> > + uint32_t rsdp_size;
> > ram_addr_t linker_ram;
> > uint32_t linker_size;
> > } AcpiBuildState;
> > @@ -1478,13 +1480,22 @@ 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);
> >
> > + if (build_state->rsdp) {
> > + memcpy(build_state->rsdp, tables.rsdp->data, acpi_data_len(tables.rsdp));
> > + } else {
> > + memcpy(qemu_get_ram_ptr(build_state->rsdp_ram), tables.linker->data,
> > + build_state->rsdp_size);
> > + cpu_physical_memory_set_dirty_range_nocode(build_state->rsdp_ram,
> > + build_state->rsdp_size);
> > + }
> > + 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->linker_ram,
> > + build_state->linker_size);
> > +
> > acpi_build_tables_cleanup(&tables, true);
> > }
> >
> > @@ -1564,10 +1575,13 @@ void acpi_setup(PcGuestInfo *guest_info)
> > acpi_build_update, build_state,
> > tables.rsdp->data, acpi_data_len(tables.rsdp));
> > build_state->rsdp = tables.rsdp->data;
> > + build_state->rsdp_ram = (ram_addr_t)-1;
> > + build_state->rsdp_size = 0;
> > } else {
> > - build_state->rsdp = qemu_get_ram_ptr(
> > - acpi_add_rom_blob(build_state, tables.rsdp, ACPI_BUILD_RSDP_FILE, 0)
> > - );
> > + build_state->rsdp = NULL;
> > + build_state->rsdp_ram = acpi_add_rom_blob(build_state, tables.rsdp,
> > + ACPI_BUILD_RSDP_FILE, 0);
> > + build_state->rsdp_size = acpi_data_len(tables.rsdp);
> there is no point in carrying rsdp_size state since it's fixed size table so
> just using acpi_data_len(tables.rsdp) or sizeof(AcpiRsdpDescriptor) is sufficient.
I guess I agree if we add assertions checking that size matches
sizeof(AcpiRsdpDescriptor).
I did testing with this one already, so I'll add a patch on top to drop
rsdp_size, ok?
> > }
> >
> > qemu_register_reset(acpi_build_reset, build_state);
next prev parent reply other threads:[~2015-02-16 11:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-15 19:46 [Qemu-devel] [PATCH] acpi-build: dirty memory on RSDP/linker update Michael S. Tsirkin
2015-02-16 9:19 ` Igor Mammedov
2015-02-16 11:32 ` Michael S. Tsirkin [this message]
2015-02-16 12:14 ` 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=20150216113227.GA20667@redhat.com \
--to=mst@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.