All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	ghammer@redhat.com, shannon.zhao@linaro.org, pbonzini@redhat.com,
	imammedo@redhat.com, lersek@redhat.com,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 4/4] acpi: unify rsdp generation
Date: Fri, 5 Jun 2015 10:47:16 +0800	[thread overview]
Message-ID: <55710DB4.4060001@huawei.com> (raw)
In-Reply-To: <1433434873-25200-5-git-send-email-mst@redhat.com>



On 2015/6/5 0:21, Michael S. Tsirkin wrote:
> Now that both i386 and arm use v2 tables,
> use common code for both.
> 
> Warning: untested.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  include/hw/acpi/aml-build.h |  2 ++
>  hw/acpi/aml-build.c         | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  hw/arm/virt-acpi-build.c    | 31 +------------------------------
>  hw/i386/acpi-build.c        | 41 -----------------------------------------
>  4 files changed, 48 insertions(+), 71 deletions(-)
> 
> diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h
> index 0a00402..ae169fa 100644
> --- a/include/hw/acpi/aml-build.h
> +++ b/include/hw/acpi/aml-build.h
> @@ -289,5 +289,7 @@ void
>  build_rsdt(GArray *table_data, GArray *linker, GArray *table_offsets);
>  void
>  build_xsdt(GArray *table_data, GArray *linker, GArray *table_offsets);
> +GArray *
> +build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt, unsigned xsdt);
>  
>  #endif
> diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
> index d0e52c4..d0bd953 100644
> --- a/hw/acpi/aml-build.c
> +++ b/hw/acpi/aml-build.c
> @@ -1237,3 +1237,48 @@ build_xsdt(GArray *table_data, GArray *linker, GArray *table_offsets)
>  {
>      build_sdt(table_data, linker, table_offsets, "XSDT", sizeof(uint64_t));
>  }
> +
> +GArray *
> +build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt, unsigned xsdt)
> +{
> +    AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
> +
> +    bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16,
> +                             true /* fseg memory */);
> +
> +    memcpy(&rsdp->signature, "RSD PTR ", 8);
> +    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, 6);
> +
> +    rsdp->revision = 0x02;
> +    rsdp->length = cpu_to_le32(sizeof *rsdp);
> +
> +    if (rsdt) {
> +        rsdp->rsdt_physical_address = cpu_to_le32(rsdt);
> +        /* Address to be filled by Guest linker */
> +        bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
> +                                       ACPI_BUILD_TABLE_FILE,
> +                                       rsdp_table, &rsdp->rsdt_physical_address,
> +                                       sizeof rsdp->rsdt_physical_address);
> +    }
> +
> +    if (xsdt) {
> +        rsdp->xsdt_physical_address = cpu_to_le32(xsdt);
> +        bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
> +                                       ACPI_BUILD_TABLE_FILE,
> +                                       rsdp_table, &rsdp->xsdt_physical_address,
> +                                       sizeof rsdp->xsdt_physical_address);
> +    }
> +    rsdp->checksum = 0;
> +    /* Checksum to be filled by Guest linker */
> +    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
> +                                    rsdp, rsdp, offsetof(AcpiRsdpDescriptor, length),
> +                                    &rsdp->checksum);
> +
> +    rsdp->extended_checksum = 0;
> +    /* Checksum to be filled by Guest linker */
> +    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
> +                                    rsdp, rsdp, sizeof *rsdp,
> +                                    &rsdp->extended_checksum);
> +
> +    return rsdp_table;
> +}
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 42c8dd9..c164f65 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -304,35 +304,6 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, int irq)
>      aml_append(scope, dev);
>  }
>  
> -/* RSDP */
> -static GArray *
> -build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt)
> -{
> -    AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
> -
> -    bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16,
> -                             true /* fseg memory */);
> -
> -    memcpy(&rsdp->signature, "RSD PTR ", sizeof(rsdp->signature));
> -    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, sizeof(rsdp->oem_id));
> -    rsdp->length = cpu_to_le32(sizeof(*rsdp));
> -    rsdp->revision = 0x02;
> -
> -    /* Point to RSDT */
> -    rsdp->rsdt_physical_address = cpu_to_le32(rsdt);
> -    /* Address to be filled by Guest linker */
> -    bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
> -                                   ACPI_BUILD_TABLE_FILE,
> -                                   rsdp_table, &rsdp->rsdt_physical_address,
> -                                   sizeof rsdp->rsdt_physical_address);
> -    rsdp->checksum = 0;
> -    /* Checksum to be filled by Guest linker */
> -    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
> -                                    rsdp, rsdp, sizeof *rsdp, &rsdp->checksum);
> -
> -    return rsdp_table;
> -}
> -
>  static void
>  build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info)
>  {
> @@ -532,7 +503,7 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables)
>      build_rsdt(tables_blob, tables->linker, table_offsets);
>  
>      /* RSDP is in FSEG memory, so allocate it separately */
> -    build_rsdp(tables->rsdp, tables->linker, rsdt);
> +    build_rsdp(tables->rsdp, tables->linker, rsdt, 0);
>  

So ARM virt can use xsdt as well. Maybe could do by another patch on top
of this.

>      /* Cleanup memory that's no longer used. */
>      g_array_free(table_offsets, true);
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 3551a08..8c6d7f5 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1592,47 +1592,6 @@ build_dsdt(GArray *table_data, GArray *linker, AcpiMiscInfo *misc)
>                   misc->dsdt_size, 1);
>  }
>  
> -static GArray *
> -build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt, unsigned xsdt)
> -{
> -    AcpiRsdpDescriptor *rsdp = acpi_data_push(rsdp_table, sizeof *rsdp);
> -
> -    bios_linker_loader_alloc(linker, ACPI_BUILD_RSDP_FILE, 16,
> -                             true /* fseg memory */);
> -
> -    memcpy(&rsdp->signature, "RSD PTR ", 8);
> -    memcpy(rsdp->oem_id, ACPI_BUILD_APPNAME6, 6);
> -
> -    rsdp->revision = 0x02;
> -    rsdp->length = cpu_to_le32(sizeof *rsdp);
> -
> -    rsdp->rsdt_physical_address = cpu_to_le32(rsdt);
> -    /* Address to be filled by Guest linker */
> -    bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
> -                                   ACPI_BUILD_TABLE_FILE,
> -                                   rsdp_table, &rsdp->rsdt_physical_address,
> -                                   sizeof rsdp->rsdt_physical_address);
> -
> -    rsdp->xsdt_physical_address = cpu_to_le32(xsdt);
> -    bios_linker_loader_add_pointer(linker, ACPI_BUILD_RSDP_FILE,
> -                                   ACPI_BUILD_TABLE_FILE,
> -                                   rsdp_table, &rsdp->xsdt_physical_address,
> -                                   sizeof rsdp->xsdt_physical_address);
> -    rsdp->checksum = 0;
> -    /* Checksum to be filled by Guest linker */
> -    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
> -                                    rsdp, rsdp, offsetof(AcpiRsdpDescriptor, length),
> -                                    &rsdp->checksum);
> -
> -    rsdp->extended_checksum = 0;
> -    /* Checksum to be filled by Guest linker */
> -    bios_linker_loader_add_checksum(linker, ACPI_BUILD_RSDP_FILE,
> -                                    rsdp, rsdp, sizeof *rsdp,
> -                                    &rsdp->extended_checksum);
> -
> -    return rsdp_table;
> -}
> -
>  typedef
>  struct AcpiBuildState {
>      /* Copy of table in RAM (for patching). */
> 

-- 
Shannon

  reply	other threads:[~2015-06-05  2:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 16:21 [Qemu-devel] [PATCH 0/4] acpi: xsdt support Michael S. Tsirkin
2015-06-04 16:21 ` [Qemu-devel] [PATCH 1/4] acpi: add API for 64 bit offsets Michael S. Tsirkin
2015-06-05  2:38   ` Shannon Zhao
2015-06-04 16:21 ` [Qemu-devel] [PATCH 2/4] i386/acpi: collect 64 bit offsets for xsdt Michael S. Tsirkin
2015-06-04 16:21 ` [Qemu-devel] [PATCH 3/4] i386/acpi: add XSDT Michael S. Tsirkin
2015-06-05  2:38   ` Shannon Zhao
2015-06-07  9:42     ` Michael S. Tsirkin
2015-06-08  1:49       ` Shannon Zhao
2015-06-04 16:21 ` [Qemu-devel] [PATCH 4/4] acpi: unify rsdp generation Michael S. Tsirkin
2015-06-05  2:47   ` Shannon Zhao [this message]
2015-06-07  9:45     ` Michael S. Tsirkin
2015-06-08  1:52       ` Shannon Zhao
2015-06-08  7:24         ` Michael S. Tsirkin
2015-06-08 12:59           ` Stefan Hajnoczi
2015-06-08 13:02           ` Stefan Hajnoczi
2015-06-05  2:48 ` [Qemu-devel] [PATCH 0/4] acpi: xsdt support 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=55710DB4.4060001@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=ehabkost@redhat.com \
    --cc=ghammer@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=shannon.zhao@linaro.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 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.