All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Shannon Zhao <zhaoshenglong@huawei.com>, xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com, peter.huangpeng@huawei.com,
	shannon.zhao@linaro.org, boris.ostrovsky@oracle.com
Subject: Re: [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables
Date: Mon, 12 Sep 2016 15:41:59 +0100	[thread overview]
Message-ID: <04d27e0d-ad25-9d43-067e-e47d89a108dc@arm.com> (raw)
In-Reply-To: <1472784939-14404-3-git-send-email-zhaoshenglong@huawei.com>

Hi Shannon,

On 02/09/16 03:55, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@linaro.org>
>
> It only constructs the ACPI tables for 64-bit ARM DomU when user enables
> acpi because 32-bit DomU doesn't support ACPI. And the generation codes
> are only built for 64-bit toolstack.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>

Acked-by: Julien Grall <julien.grall@arm.com>

Regards,

> ---
>  tools/libxl/Makefile            |  7 +++++
>  tools/libxl/libxl_arm.c         | 24 +++++++++++++++-
>  tools/libxl/libxl_arm.h         | 33 ++++++++++++++++++++++
>  tools/libxl/libxl_arm_acpi.c    | 62 +++++++++++++++++++++++++++++++++++++++++
>  tools/libxl/libxl_arm_no_acpi.c | 34 ++++++++++++++++++++++
>  xen/include/public/arch-arm.h   |  4 +++
>  6 files changed, 163 insertions(+), 1 deletion(-)
>  create mode 100644 tools/libxl/libxl_arm.h
>  create mode 100644 tools/libxl/libxl_arm_acpi.c
>  create mode 100644 tools/libxl/libxl_arm_no_acpi.c
>
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index a148374..afd93de 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -90,6 +90,13 @@ acpi:
>
>  LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
>  LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
> +ifeq ($(CONFIG_ARM_64),y)
> +LIBXL_OBJS-y += libxl_arm_acpi.o
> +libxl_arm_acpi.o: libxl_arm_acpi.c
> +	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
> +else
> +LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_no_acpi.o
> +endif
>
>  ifeq ($(CONFIG_NetBSD),y)
>  LIBXL_OBJS-y += libxl_netbsd.o
> diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c
> index 8ec5cd5..333c9a1 100644
> --- a/tools/libxl/libxl_arm.c
> +++ b/tools/libxl/libxl_arm.c
> @@ -1,6 +1,7 @@
>  #include "libxl_internal.h"
>  #include "libxl_arch.h"
>  #include "libxl_libfdt_compat.h"
> +#include "libxl_arm.h"
>
>  #include <xc_dom.h>
>  #include <stdbool.h>
> @@ -885,8 +886,29 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
>                                             libxl__domain_build_state *state,
>                                             struct xc_dom_image *dom)
>  {
> +    int rc;
> +
>      assert(info->type == LIBXL_DOMAIN_TYPE_PV);
> -    return libxl__prepare_dtb(gc, info, state, dom);
> +    rc = libxl__prepare_dtb(gc, info, state, dom);
> +    if (rc) goto out;
> +
> +    if (!libxl_defbool_val(info->acpi)) {
> +        LOG(DEBUG, "Generating ACPI tables is disabled by user.");
> +        rc = 0;
> +        goto out;
> +    }
> +
> +    if (strcmp(dom->guest_type, "xen-3.0-aarch64")) {
> +        /* ACPI is only supported for 64-bit guest currently. */
> +        LOG(ERROR, "Can not enable libxl option 'acpi' for %s", dom->guest_type);
> +        rc = ERROR_FAIL;
> +        goto out;
> +    }
> +
> +    rc = libxl__prepare_acpi(gc, info, state, dom);
> +
> +out:
> +    return rc;
>  }
>
>  static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
> diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h
> new file mode 100644
> index 0000000..1c01177
> --- /dev/null
> +++ b/tools/libxl/libxl_arm.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_internal.h"
> +#include "libxl_arch.h"
> +
> +#include <xc_dom.h>
> +
> +_hidden
> +int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> +                        libxl__domain_build_state *state,
> +                        struct xc_dom_image *dom);
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> new file mode 100644
> index 0000000..810aed8
> --- /dev/null
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -0,0 +1,62 @@
> +/*
> + * ARM DomU ACPI generation
> + *
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_arm.h"
> +
> +#include <stdint.h>
> +
> +/* Below typedefs are useful for the headers under acpi/ */
> +typedef uint8_t u8;
> +typedef uint16_t u16;
> +typedef uint32_t u32;
> +typedef uint64_t u64;
> +
> +#include <acpi/acconfig.h>
> +#include <acpi/actbl.h>
> +
> +int libxl__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;
> +    int rc = 0;
> +
> +    vers = libxl_get_version_info(CTX);
> +    if (vers == NULL) {
> +        rc = ERROR_FAIL;
> +        goto out;
> +    }
> +
> +    LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
> +        vers->xen_version_major, vers->xen_version_minor);
> +
> +    dom->acpi_modules[0].data = NULL;
> +    dom->acpi_modules[0].length = 0;
> +    dom->acpi_modules[0].guest_addr_out = GUEST_ACPI_BASE;
> +
> +out:
> +    return rc;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxl/libxl_arm_no_acpi.c b/tools/libxl/libxl_arm_no_acpi.c
> new file mode 100644
> index 0000000..e7f7411
> --- /dev/null
> +++ b/tools/libxl/libxl_arm_no_acpi.c
> @@ -0,0 +1,34 @@
> +/*
> + * ARM DomU ACPI generation
> + *
> + * Copyright (C) 2016      Linaro Ltd.
> + *
> + * Author: Shannon Zhao <shannon.zhao@linaro.org>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU Lesser General Public License as published
> + * by the Free Software Foundation; version 2.1 only. with the special
> + * exception on linking described in file LICENSE.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU Lesser General Public License for more details.
> + */
> +
> +#include "libxl_arm.h"
> +
> +int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> +                        libxl__domain_build_state *state,
> +                        struct xc_dom_image *dom)
> +{
> +    return ERROR_FAIL;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-basic-offset: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 870bc3b..4b4c959 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -406,6 +406,10 @@ typedef uint64_t xen_callback_t;
>  #define GUEST_GICV3_GICR0_BASE     0x03020000ULL    /* vCPU0 - vCPU127 */
>  #define GUEST_GICV3_GICR0_SIZE     0x01000000ULL
>
> +/* ACPI tables physical address */
> +#define GUEST_ACPI_BASE 0x20000000ULL
> +#define GUEST_ACPI_SIZE 0x02000000ULL
> +
>  /*
>   * 16MB == 4096 pages reserved for guest to use as a region to map its
>   * grant table in.
>

-- 
Julien Grall

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

  parent reply	other threads:[~2016-09-12 14:41 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-12 14:41   ` Julien Grall [this message]
2016-09-02  2:55 ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-12 14:44   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-09-12 14:58   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-09-12 15:05   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-09-12 15:08   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-09-12 15:09   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-09-12 15:10   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-09-12 15:13   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 13/16] libxl/arm: Add ACPI module Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
2016-09-02  6:18   ` Jan Beulich
2016-09-02  7:23     ` Shannon Zhao
2016-09-02  8:17       ` Jan Beulich
2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-09-12 15:14   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
2016-09-12 15:18   ` Julien Grall
2016-09-13  7:03     ` Shannon Zhao
2016-09-13 10:38       ` Julien Grall
2016-09-15 10:46         ` Wei Liu
2016-09-19 14:53         ` Ian Jackson
2016-09-02 14:31 ` [PATCH v5 00/16] Xen ARM DomU ACPI support Wei Liu
2016-09-12 15:22 ` Julien Grall
2016-09-13  6:30   ` Shannon Zhao
2016-09-13 11:56 ` Julien Grall
2016-09-13 13:06   ` Shannon Zhao
2016-09-13 15:17     ` Julien Grall
2016-09-13 15:18       ` Julien Grall
2016-09-14  0:56       ` Shannon Zhao
2016-09-14  1:06         ` Stefano Stabellini
2016-09-14  7:14           ` Julien Grall
2016-09-14  7:32             ` Shannon Zhao
2016-09-14  7:40               ` Julien Grall
2016-09-14  8:01                 ` Shannon Zhao
2016-09-14 20:48             ` Stefano Stabellini
2016-09-14 21:26               ` 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=04d27e0d-ad25-9d43-067e-e47d89a108dc@arm.com \
    --to=julien.grall@arm.com \
    --cc=boris.ostrovsky@oracle.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.