From: Igor Mammedov <imammedo@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org,
lersek@redhat.com, phil@philjordan.eu, mst@redhat.com,
drjones@redhat.com, zhaoshenglong@huawei.com
Subject: Re: [Qemu-devel] [PATCH v2] hw/arm/virt: generate 64-bit addressable ACPI objects
Date: Wed, 19 Apr 2017 13:26:03 +0200 [thread overview]
Message-ID: <20170419132603.369ebb50@nial.brq.redhat.com> (raw)
In-Reply-To: <20170407144138.12871-1-ard.biesheuvel@linaro.org>
On Fri, 7 Apr 2017 15:41:38 +0100
Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> Our current ACPI table generation code limits the placement of ACPI
> tables to 32-bit addressable memory, in order to be able to emit the
> root pointer (RSDP) and root table (RSDT) using table types from the
> ACPI 1.0 days.
>
> Since ARM was not supported by ACPI before version 5.0, it makes sense
> to lift this restriction. This is not crucial for mach-virt, which is
> guaranteed to have some memory available below the 4 GB mark, but it
> is a nice to have for QEMU machines that do not have any 32-bit
> addressable memory, which is not uncommon for real world 64-bit ARM
> systems.
>
> Since we already emit a version of the RSDP root pointer that has a
> secondary 64-bit wide address field for the 64-bit root table (XSDT),
> all we need to do is replace the RSDT generation with the generation
> of an XSDT table, and use a different slot in the FADT table to refer
> to the DSDT.
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> ---
> v2: - move new build_xsdt() function to hw/acpi/aml-build.c
> - tweak commit log text
> - add Drew's and Laszlo's acks
>
> hw/acpi/aml-build.c | 27 ++++++++++++++++++++
> hw/arm/virt-acpi-build.c | 26 +++++++++----------
> include/hw/acpi/acpi-defs.h | 11 ++++++++
> include/hw/acpi/aml-build.h | 3 +++
> 4 files changed, 54 insertions(+), 13 deletions(-)
>
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index c6f2032decb1..4ddfb68b247f 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1599,6 +1599,33 @@ build_rsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
> (void *)rsdt, "RSDT", rsdt_len, 1, oem_id, oem_table_id);
> }
>
> +/* Build xsdt table */
> +void
> +build_xsdt(GArray *table_data, BIOSLinker *linker, GArray *table_offsets,
> + const char *oem_id, const char *oem_table_id)
> +{
> + int i;
> + unsigned xsdt_entries_offset;
> + AcpiXsdtDescriptorRev2 *xsdt;
> + const unsigned table_data_len = (sizeof(uint64_t) * table_offsets->len);
> + const unsigned xsdt_entry_size = sizeof(xsdt->table_offset_entry[0]);
nit, I know it was mostly copy/paste but how about:
const unsigned xsdt_entry_size = sizeof(xsdt->table_offset_entry[0]);
const unsigned table_data_len = xsdt_entry_size * table_offsets->len;
> + const size_t xsdt_len = sizeof(*xsdt) + table_data_len;
> +
> + xsdt = acpi_data_push(table_data, xsdt_len);
> + xsdt_entries_offset = (char *)xsdt->table_offset_entry - table_data->data;
> + for (i = 0; i < table_offsets->len; ++i) {
> + uint64_t ref_tbl_offset = g_array_index(table_offsets, uint32_t, i);
> + uint64_t xsdt_entry_offset = xsdt_entries_offset + xsdt_entry_size * i;
> +
> + /* xsdt->table_offset_entry to be filled by Guest linker */
> + bios_linker_loader_add_pointer(linker,
> + ACPI_BUILD_TABLE_FILE, xsdt_entry_offset, xsdt_entry_size,
> + ACPI_BUILD_TABLE_FILE, ref_tbl_offset);
> + }
> + build_header(linker, table_data,
> + (void *)xsdt, "XSDT", xsdt_len, 1, oem_id, oem_table_id);
> +}
> +
The rest looks fine to me, so with above fixup
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
prev parent reply other threads:[~2017-04-19 11:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 14:41 [Qemu-devel] [PATCH v2] hw/arm/virt: generate 64-bit addressable ACPI objects Ard Biesheuvel
2017-04-07 18:27 ` Michael S. Tsirkin
2017-04-12 23:53 ` no-reply
2017-04-19 11:26 ` Igor Mammedov [this message]
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=20170419132603.369ebb50@nial.brq.redhat.com \
--to=imammedo@redhat.com \
--cc=ard.biesheuvel@linaro.org \
--cc=drjones@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=phil@philjordan.eu \
--cc=qemu-devel@nongnu.org \
--cc=zhaoshenglong@huawei.com \
/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).