qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>
Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com,
	a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com,
	qemu-devel@nongnu.org, peter.huangpeng@huawei.com,
	hanjun.guo@linaro.org, wanghaibin.wang@huawei.com,
	pbonzini@redhat.com, lersek@redhat.com,
	christoffer.dall@linaro.org
Subject: Re: [Qemu-devel] [RFC PATCH v2 09/11] hw/arm/virt-acpi-build: Generate XSDT table
Date: Tue, 3 Feb 2015 17:19:58 +0100	[thread overview]
Message-ID: <20150203171958.0ecb698b@nial.brq.redhat.com> (raw)
In-Reply-To: <1422520633-13456-10-git-send-email-zhaoshenglong@huawei.com>

On Thu, 29 Jan 2015 16:37:11 +0800
Shannon Zhao <zhaoshenglong@huawei.com> wrote:

> XDST points to other tables except FACS & DSDT.
Is there any reason to use XSDT instead of RSDT?
If ACPI tables are below 4Gb which probably would
be the case then RSDT could be used just fine and
we could share more code between x86 and ARM.

Laszlo,
Do you know if OVMF allocates memory below 4G address range?

> 
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> ---
>  hw/arm/virt-acpi-build.c    |   32 +++++++++++++++++++++++++++++++-
>  include/hw/acpi/acpi-defs.h |    9 +++++++++
>  2 files changed, 40 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index ac0a864..2a2b2ab 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -176,6 +176,32 @@ static void acpi_dsdt_add_virtio(AcpiAml *scope, const hwaddr *mmio_addrs,
>      }
>  }
>  
> +
> +/* XSDT */
> +static void
> +build_xsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
> +{
> +    AcpiXsdtDescriptor *xsdt;
> +    size_t xsdt_len;
> +    int i;
> +
> +    xsdt_len = sizeof(*xsdt) + sizeof(uint64_t) * table_offsets->len;
> +    xsdt = acpi_data_push(table_data, xsdt_len);
> +    memcpy(xsdt->table_offset_entry, table_offsets->data,
> +           sizeof(uint64_t) * table_offsets->len);
> +    for (i = 0; i < table_offsets->len; ++i) {
> +        /* xsdt->table_offset_entry to be filled by Guest linker */
> +        bios_linker_loader_add_pointer(linker,
> +                                       ACPI_BUILD_TABLE_FILE,
> +                                       ACPI_BUILD_TABLE_FILE,
> +                                       table_data, &xsdt->table_offset_entry[i],
> +                                       sizeof(uint64_t));
> +    }
> +    build_header(linker, table_data, (void *)xsdt, "XSDT",
> +                 ACPI_BUILD_APPNAME6, ACPI_BUILD_APPNAME4,
> +                 xsdt_len, 1);
> +}
> +
>  /* GTDT */
>  static void
>  build_gtdt(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
> @@ -311,7 +337,7 @@ static
>  void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
>  {
>      GArray *table_offsets;
> -    unsigned dsdt;
> +    unsigned dsdt, xsdt;
>      VirtAcpiCpuInfo cpuinfo;
>  
>      virt_acpi_get_cpu_info(&cpuinfo);
> @@ -346,6 +372,10 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
>      acpi_add_table(table_offsets, tables->table_data.buf);
>      build_gtdt(tables->table_data.buf, tables->linker, guest_info);
>  
> +    /* XSDT is pointed to by RSDP */
> +    xsdt = tables->table_data.buf->len;
> +    build_xsdt(tables->table_data.buf, tables->linker, table_offsets);
> +
>      /* Cleanup memory that's no longer used. */
>      g_array_free(table_offsets, true);
>  }
> diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h
> index ee40a5e..47c8c41 100644
> --- a/include/hw/acpi/acpi-defs.h
> +++ b/include/hw/acpi/acpi-defs.h
> @@ -88,6 +88,15 @@ struct AcpiTableHeader         /* ACPI common table header */
>  typedef struct AcpiTableHeader AcpiTableHeader;
>  
>  /*
> + * Extended System Description Table (XSDT)
> + */
> +struct AcpiXsdtDescriptor {
> +    ACPI_TABLE_HEADER_DEF
> +    uint64_t table_offset_entry[1]; /* Array of pointers to ACPI tables */
> +} QEMU_PACKED;
> +typedef struct AcpiXsdtDescriptor AcpiXsdtDescriptor;
> +
> +/*
>   * ACPI Fixed ACPI Description Table (FADT)
>   */
>  #define ACPI_FADT_COMMON_DEF         /* FADT common definition */ \

  reply	other threads:[~2015-02-03 16:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29  8:37 [Qemu-devel] [RFC PATCH v2 00/11] Generate ACPI v5.1 tables and expose it to guest over fw_cfg on ARM Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 01/11] hw/i386: Move ACPI header definitions in an arch-independent location Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 02/11] hw/i386/acpi-build: move generic acpi building helpers into dedictated file Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 03/11] hw/arm/virt-acpi-build: Basic framework for building ACPI tables on ARM Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 04/11] hw/acpi/acpi-build-utils: Add acpi_memory32_fixed() and acpi_interrupt() Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 05/11] hw/arm/virt-acpi-build: Generation of DSDT table for virt devices Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 06/11] hw/arm/virt-acpi-build: Generate FADT table and update ACPI headers Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 07/11] hw/arm/virt-acpi-build: Generate MADT table Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 08/11] hw/arm/virt-acpi-build: Generate GTDT table Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 09/11] hw/arm/virt-acpi-build: Generate XSDT table Shannon Zhao
2015-02-03 16:19   ` Igor Mammedov [this message]
2015-02-03 16:51     ` Laszlo Ersek
2015-02-07  2:04       ` Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 10/11] hw/arm/virt-acpi-build: Generate RSDP table Shannon Zhao
2015-01-29  8:37 ` [Qemu-devel] [RFC PATCH v2 11/11] hw/arm/virt: Enable dynamic generation of ACPI v5.1 tables Shannon Zhao

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=20150203171958.0ecb698b@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=a.spyridakis@virtualopensystems.com \
    --cc=christoffer.dall@linaro.org \
    --cc=claudio.fontana@huawei.com \
    --cc=hangaohuai@huawei.com \
    --cc=hanjun.guo@linaro.org \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wanghaibin.wang@huawei.com \
    --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).