All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>,
	Shannon Zhao <zhaoshenglong@huawei.com>
Cc: wei.liu2@citrix.com, peter.huangpeng@huawei.com,
	ian.jackson@eu.citrix.com, shannon.zhao@linaro.org,
	xen-devel@lists.xen.org
Subject: Re: [PATCH RESEND 05/14] libxl/arm: Construct ACPI GTDT table
Date: Mon, 6 Jun 2016 12:52:58 +0100	[thread overview]
Message-ID: <5755641A.9000206@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1606061229040.6721@sstabellini-ThinkPad-X260>

Hello,

On 06/06/16 12:40, Stefano Stabellini wrote:
> On Tue, 31 May 2016, Shannon Zhao wrote:
>> From: Shannon Zhao <shannon.zhao@linaro.org>
>>
>> Construct GTDT table with the interrupt information of timers.
>>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>>   tools/libxl/libxl_arm.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 74 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
>> index 9e99159..0fb4f69 100644
>> --- a/tools/libxl/libxl_arm.c
>> +++ b/tools/libxl/libxl_arm.c
>> @@ -3,6 +3,7 @@
>>   #include "libxl_libfdt_compat.h"
>>
>>   #include <xc_dom.h>
>> +#include <acpi_defs.h>
>>   #include <stdbool.h>
>>   #include <libfdt.h>
>>   #include <assert.h>
>> @@ -880,13 +881,85 @@ out:
>>       return rc;
>>   }
>>
>> +static void make_acpi_header(struct acpi_table_header *h, const char *sig,
>> +                             int len, uint8_t rev)
>> +{
>> +    memcpy(&h->signature, sig, 4);
>> +    h->length = len;
>> +    h->revision = rev;
>> +    memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6);
>> +    memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4);
>> +    memcpy(h->oem_table_id + 4, sig, 4);
>> +    h->oem_revision = 1;
>> +    memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4);
>> +    h->asl_compiler_revision = 1;
>> +    h->checksum = 0;
>> +}
>> +
>> +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom)
>> +{
>> +    struct acpi_gtdt_descriptor *gtdt;
>> +
>> +    gtdt = libxl__zalloc(gc, sizeof(*gtdt));
>> +
>> +    gtdt->secure_el1_interrupt = GUEST_TIMER_PHYS_S_PPI;
>> +    gtdt->secure_el1_flags = (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
>> +                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
>> +    gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI;
>> +    gtdt->non_secure_el1_flags =
>> +                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
>> +                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
>> +    gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI;
>> +    gtdt->virtual_timer_flags =
>> +                             (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE)
>> +                             |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY);
>> +
>> +    make_acpi_header(&gtdt->header, "GTDT", sizeof(*gtdt), 2);
>> +
>> +    dom->acpitable_blob->gtdt.table = (void *)gtdt;
>> +    /* Align to 64bit. */
>> +    dom->acpitable_blob->gtdt.size = sizeof(*gtdt);
>> +    dom->acpitable_size += dom->acpitable_blob->gtdt.size;
>> +}
>> +
>> +static int prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
>> +                        libxl__domain_build_state *state,
>> +                        struct xc_dom_image *dom)
>> +{
>> +    const libxl_version_info *vers;
>> +
>> +    /* convenience aliases */
>> +    xc_domain_configuration_t *xc_config = &state->config;
>> +
>> +    vers = libxl_get_version_info(CTX);
>> +    if (vers == NULL)
>> +        return ERROR_FAIL;
>> +
>> +    LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
>> +        vers->xen_version_major, vers->xen_version_minor);
>> +
>> +    /* Alloc memory for ACPI blob placeholders. */
>> +    dom->acpitable_blob = libxl__zalloc(gc, sizeof(struct acpitable_blob));
>> +    dom->acpitable_size = 0;
>> +
>> +    make_acpi_gtdt(gc, dom);
>> +
>> +    return 0;
>> +}
>> +
>>   int libxl__arch_domain_init_hw_description(libxl__gc *gc,
>>                                              libxl_domain_build_info *info,
>>                                              libxl__domain_build_state *state,
>>                                              struct xc_dom_image *dom)
>>   {
>> +    int rc;
>> +
>>       assert(info->type == LIBXL_DOMAIN_TYPE_PV);
>> -    return prepare_dtb(gc, info, state, dom);
>> +    rc = prepare_dtb(gc, info, state, dom);
>> +    if (rc)
>> +        return rc;
>> +
>> +    return prepare_acpi(gc, info, state, dom);
>>   }
>
> ACPI tables for ARM guests should be user configurable: acpi=1 in the VM
> config file enables them, with default off.

The VM system specification for ARM [1] mandates that both ACPI and DT 
should be provided and described the entire VM and its peripheral (see 
the section "Hardware Description").

Furthermore, the user may not know if the guest OS will use ACPI or DT 
For instance Redhat is using ACPI whilst Debian is using DT.

So we have to provide both by default. However, 32-bit domain should 
only have Device-Tree table created.

Anyway, the reason should have been described in the commit message. I 
would split this patch in two: introducing prepare ACPI and then GTDT 
table. So we can provide details in the commit message.

Regards,

[1] 
http://people.linaro.org/~christoffer.dall/VMSystemSpecificationForARM-v2.0-rc1.pdf

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-06 11:52 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  5:02 [PATCH RESEND 00/14] Xen ARM DomU ACPI support Shannon Zhao
2016-05-31  5:02 ` [PATCH RESEND 01/14] libxl/arm: Fix the function name in error log Shannon Zhao
2016-06-03 19:25   ` Wei Liu
2016-06-17 10:46     ` Wei Liu
2016-06-20  1:12       ` Shannon Zhao
2016-05-31  5:02 ` [PATCH RESEND 02/14] libxl/arm: Factor out codes for generating DTB Shannon Zhao
2016-06-03 19:25   ` Wei Liu
2016-05-31  5:02 ` [PATCH RESEND 03/14] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
2016-06-06 10:00   ` Stefano Stabellini
2016-06-06 12:16     ` Wei Liu
2016-06-06 14:20       ` Shannon Zhao
2016-06-07 11:05   ` Julien Grall
2016-06-07 11:13     ` Shannon Zhao
2016-06-07 11:27       ` Julien Grall
2016-06-07 11:35         ` Shannon Zhao
2016-06-07 11:42           ` Julien Grall
2016-06-07 11:59             ` Shannon Zhao
2016-06-07 12:06               ` Julien Grall
2016-06-07 12:32                 ` Shannon Zhao
2016-06-07 13:06                   ` Julien Grall
2016-06-16  6:53                     ` Shannon Zhao
2016-06-16 10:21                       ` Julien Grall
2016-06-16 10:45                         ` Shannon Zhao
2016-06-16 11:04                           ` Julien Grall
2016-06-16 10:49                   ` Wei Liu
2016-06-16 10:53                     ` Shannon Zhao
2016-06-16 11:04                       ` Wei Liu
2016-06-07 12:02             ` Julien Grall
2016-06-07 12:27               ` Shannon Zhao
2016-05-31  5:02 ` [PATCH RESEND 04/14] tools: add ACPI tables relevant definitions Shannon Zhao
2016-06-06 10:04   ` Stefano Stabellini
2016-06-06 10:11     ` Julien Grall
2016-06-06 10:27       ` Shannon Zhao
2016-06-06 12:16         ` Wei Liu
2016-06-06 14:19           ` Shannon Zhao
2016-06-22  3:24           ` Shannon Zhao
2016-06-22  8:35             ` Julien Grall
2016-06-22  8:50               ` Shannon Zhao
2016-06-22  8:55                 ` Julien Grall
2016-06-22  9:38             ` [PATCH RESEND 04/14] tools: add ACPI tables relevant definitions (and more) Wei Liu
2016-06-22 10:06               ` Shannon Zhao
2016-05-31  5:02 ` [PATCH RESEND 05/14] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-06-06 11:40   ` Stefano Stabellini
2016-06-06 11:52     ` Julien Grall [this message]
2016-06-06 12:04       ` Stefano Stabellini
2016-06-06 14:31         ` Shannon Zhao
2016-06-06 14:50           ` Stefano Stabellini
2016-06-06 15:42             ` Julien Grall
2016-06-07  9:41               ` Stefano Stabellini
2016-06-06 15:35         ` Julien Grall
2016-06-07  9:48           ` Stefano Stabellini
2016-06-07 11:55             ` Wei Liu
2016-06-17  3:29     ` Shannon Zhao
2016-06-17  8:17       ` Julien Grall
2016-06-17  9:15         ` Stefano Stabellini
2016-06-17 13:27           ` Julien Grall
2016-06-06 12:18   ` Wei Liu
2016-06-07 11:02     ` Julien Grall
2016-06-07 11:19   ` Julien Grall
2016-06-07 11:30     ` Shannon Zhao
2016-06-07 11:36       ` Julien Grall
2016-06-07 11:39         ` Shannon Zhao
2016-06-07 11:43           ` Julien Grall
2016-05-31  5:02 ` [PATCH RESEND 06/14] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-06-07 13:17   ` Julien Grall
2016-06-07 14:13     ` Shannon Zhao
2016-06-07 14:14       ` Julien Grall
2016-05-31  5:02 ` [PATCH RESEND 07/14] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-06-07 13:42   ` Julien Grall
2016-06-16  6:25     ` Shannon Zhao
2016-06-16  9:44       ` Julien Grall
2016-06-16 10:01         ` Stefano Stabellini
2016-05-31  5:03 ` [PATCH RESEND 08/14] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-06-07 13:40   ` Julien Grall
2016-05-31  5:03 ` [PATCH RESEND 09/14] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-05-31  5:03 ` [PATCH RESEND 10/14] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-05-31  5:03 ` [PATCH RESEND 11/14] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-05-31  5:03 ` [PATCH RESEND 12/14] libxl/arm: Add ACPI module Shannon Zhao
2016-06-07 13:47   ` Julien Grall
2016-05-31  5:03 ` [PATCH RESEND 13/14] libxl/arm: initialize memory information of ACPI blob Shannon Zhao
2016-06-06 11:40   ` Stefano Stabellini
2016-06-06 14:35     ` Shannon Zhao
2016-05-31  5:03 ` [PATCH RESEND 14/14] libxc/xc_dom_core: Copy ACPI tables to guest memory space Shannon Zhao
2016-05-31 10:47 ` [PATCH RESEND 00/14] Xen ARM DomU ACPI support Julien Grall
2016-05-31 14:19   ` Shannon Zhao
2016-06-03 19:24 ` Wei Liu
2016-06-03 20:02   ` Konrad Rzeszutek Wilk
2016-06-03 20:20     ` Boris Ostrovsky
2016-06-03 20:27       ` Wei Liu
2016-06-03 20:36         ` Boris Ostrovsky
2016-06-06 11:41 ` Stefano Stabellini
2016-06-06 12:26 ` Wei Liu
2016-06-06 15:37   ` Boris Ostrovsky
2016-06-06 16:50     ` Boris Ostrovsky
2016-06-07 10:54       ` Julien Grall
2016-06-07 14:24         ` Boris Ostrovsky
2016-06-06 15:48   ` Julien Grall
2016-06-07  1:07     ` Shannon Zhao
2016-06-07 11:00       ` Julien Grall
2016-06-16 11:20         ` Wei Liu
2016-06-16 13:25           ` Boris Ostrovsky
2016-06-17 10:14             ` Wei Liu
2016-06-17  2:03           ` Shannon Zhao
2016-06-17  8:18           ` Julien Grall

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=5755641A.9000206@arm.com \
    --to=julien.grall@arm.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 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.