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 v2 11/17] libxl/arm: Construct ACPI DSDT table
Date: Thu, 23 Jun 2016 18:03:59 +0100 [thread overview]
Message-ID: <576C167F.8000903@arm.com> (raw)
In-Reply-To: <1466651824-6964-12-git-send-email-zhaoshenglong@huawei.com>
Hi Shannon,
On 23/06/16 04:16, Shannon Zhao wrote:
[...]
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index 264b6ef..5347480 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -77,7 +77,29 @@ endif
>
> LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o
> LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
> -LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_acpi.o
> +LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_acpi.o libxl_dsdt_anycpu_arm.o
> +
> +vpath iasl $(PATH)
> +libxl_mk_dsdt_arm: libxl_mk_dsdt_arm.c
> + $(CC) $(CFLAGS) -o $@ libxl_mk_dsdt_arm.c
> +
> +libxl_dsdt_anycpu_arm.asl: libxl_empty_dsdt_arm.asl libxl_mk_dsdt_arm
> + awk 'NR > 1 {print s} {s=$$0}' $< > $@
> + ./libxl_mk_dsdt_arm >> $@
> +
> +libxl_dsdt_anycpu_arm.c: %.c: iasl %.asl
> + iasl -vs -p $* -tc $*.asl
> + sed -e 's/AmlCode/$*/g' $*.hex >$@
> + echo "int $*_len=sizeof($*);" >>$@
> + rm -f $*.aml $*.hex
> +
I don't like the idea to add iasl as a dependency for all ARM platforms.
For instance ARMv7 platform will not use ACPI, but we still ask users to
install iasl. So I think we should allow the user to opt-in/opt-out for
ACPI.
Any opinions?
> +iasl:
> + @echo
> + @echo "ACPI ASL compiler (iasl) is needed"
> + @echo "Download and install Intel ACPI CA from"
> + @echo "http://acpica.org/downloads/"
> + @echo
> + @exit 1
It is really a pain to discover the dependency in the middle of a build.
The presence of iasl should be done by the configure.
>
> libxl_arm_acpi.o: libxl_arm_acpi.c
> $(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index 353d774..45fc354 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -54,6 +54,9 @@ enum {
> NUMS,
> };
>
> +extern unsigned char libxl_dsdt_anycpu_arm[];
> +extern int libxl_dsdt_anycpu_arm_len;
Not sure this is the right place to mention it, but I don't find the
actual declaration.
Both variables should be const and _hidden. Also, the *_len should be at
least const int.
> +
> struct acpitable {
> void *table;
> size_t size;
> @@ -256,6 +259,17 @@ static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom)
> dom->acpitable_size += ROUNDUP(acpitables[FADT].size, 3);
> }
>
> +static void make_acpi_dsdt(libxl__gc *gc, struct xc_dom_image *dom)
> +{
> + acpitables[DSDT].table = libxl__zalloc(gc, libxl_dsdt_anycpu_arm_len);
> + memcpy(acpitables[DSDT].table, libxl_dsdt_anycpu_arm,
> + libxl_dsdt_anycpu_arm_len);
> +
> + acpitables[DSDT].size = libxl_dsdt_anycpu_arm_len;
> + /* Align to 64bit. */
> + dom->acpitable_size += ROUNDUP(acpitables[DSDT].size, 3);
> +}
> +
> int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> libxl__domain_build_state *state,
> struct xc_dom_image *dom)
> @@ -284,6 +298,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> return rc;
>
> make_acpi_fadt(gc, dom);
> + make_acpi_dsdt(gc, dom);
>
> return 0;
> }
> diff --git a/tools/libxl/libxl_arm_acpi.h b/tools/libxl/libxl_arm_acpi.h
> index 9b58de6..b0fd9ce 100644
> --- a/tools/libxl/libxl_arm_acpi.h
> +++ b/tools/libxl/libxl_arm_acpi.h
> @@ -19,6 +19,8 @@
>
> #include <xc_dom.h>
>
> +#define DOMU_MAX_VCPUS 128
> +
I would rather define the maximum number of VCPUS in public/arch_arm.h
to avoid defining the current number of vCPUs supported in multiple places.
> int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
> libxl__domain_build_state *state,
> struct xc_dom_image *dom);
> diff --git a/tools/libxl/libxl_empty_dsdt_arm.asl b/tools/libxl/libxl_empty_dsdt_arm.asl
> new file mode 100644
> index 0000000..005fa6a
> --- /dev/null
> +++ b/tools/libxl/libxl_empty_dsdt_arm.asl
> @@ -0,0 +1,22 @@
> +/******************************************************************************
> + * DSDT for Xen ARM DomU
> + *
> + * Copyright (c) 2004, Intel Corporation.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +DefinitionBlock ("DSDT.aml", "DSDT", 3, "XenARM", "Xen DSDT", 1)
> +{
> +
> +}
> diff --git a/tools/libxl/libxl_mk_dsdt_arm.c b/tools/libxl/libxl_mk_dsdt_arm.c
> new file mode 100644
> index 0000000..96fadbd
> --- /dev/null
> +++ b/tools/libxl/libxl_mk_dsdt_arm.c
Can we share the code from tools/firmware/acpi/mk_dsdt.c?
> @@ -0,0 +1,94 @@
> +#include <stdio.h>
> +#include <stdarg.h>
> +#include <stdint.h>
> +#include <string.h>
> +#include <stdlib.h>
> +#include "libxl_arm_acpi.h"
> +
> +static unsigned int indent_level;
> +
> +static void indent(void)
> +{
> + unsigned int i;
> + for ( i = 0; i < indent_level; i++ )
> + printf(" ");
> +}
> +
> +static __attribute__((format(printf, 2, 3)))
> +void _stmt(const char *name, const char *fmt, ...)
> +{
> + va_list args;
> +
> + indent();
> + printf("%s", name);
> +
> + if ( !fmt )
> + return;
> +
> + printf(" ( ");
> + va_start(args, fmt);
> + vprintf(fmt, args);
> + va_end(args);
> + printf(" )");
> +}
> +
> +#define stmt(n, f, a...) \
> + do { \
> + _stmt(n, f , ## a ); \
> + printf("\n"); \
> + } while (0)
> +
> +#define push_block(n, f, a...) \
> + do { \
> + _stmt(n, f , ## a ); \
> + printf(" {\n"); \
> + indent_level++; \
> + } while (0)
> +
> +static void pop_block(void)
> +{
> + indent_level--;
> + indent();
> + printf("}\n");
> +}
> +
> +int main(int argc, char **argv)
> +{
> + unsigned int cpu, max_cpus = DOMU_MAX_VCPUS;
> +
> + /**** DSDT DefinitionBlock start ****/
> + /* (we append to existing DSDT definition block) */
> + indent_level++;
> +
> + /**** Processor start ****/
> + push_block("Scope", "\\_SB");
> +
> + /* Define processor objects and control methods. */
> + for ( cpu = 0; cpu < max_cpus; cpu++)
> + {
> + push_block("Processor", "PR%02X, %d, 0x0000b010, 0x06", cpu, cpu);
> +
> + stmt("Name", "_HID, \"ACPI0007\"");
> + stmt("Name", "_UID, %d", cpu);
> +
> + pop_block();
> + }
> +
> + pop_block();
> + /**** Processor end ****/
> +
> + pop_block();
> + /**** DSDT DefinitionBlock end ****/
> +
> + return 0;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-file-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
>
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-23 17:03 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-23 3:16 [PATCH v2 00/17] Xen ARM DomU ACPI support Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 01/17] libxl/arm: Factor out codes for generating DTB Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 02/17] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 03/17] libxl/arm: Add a configuration option for ARM DomU ACPI Shannon Zhao
2016-06-23 13:39 ` Stefano Stabellini
2016-06-23 14:34 ` Shannon Zhao
2016-06-27 10:40 ` Julien Grall
2016-07-07 15:30 ` Wei Liu
2016-07-12 3:40 ` Shannon Zhao
2016-07-12 9:22 ` Julien Grall
2016-07-12 11:33 ` Wei Liu
2016-07-12 14:17 ` Shannon Zhao
2016-07-12 14:33 ` Wei Liu
2016-07-12 14:45 ` Shannon Zhao
2016-07-13 7:54 ` Shannon Zhao
2016-07-13 9:20 ` Julien Grall
2016-07-13 9:48 ` Shannon Zhao
2016-07-13 10:03 ` Julien Grall
2016-07-15 8:00 ` Shannon Zhao
2016-07-15 8:07 ` Shannon Zhao
2016-07-18 19:40 ` Stefano Stabellini
2016-07-19 10:40 ` Wei Liu
2016-07-19 10:44 ` Ian Jackson
2016-06-23 15:53 ` Julien Grall
2016-06-23 3:16 ` [PATCH v2 04/17] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
2016-06-23 13:37 ` Stefano Stabellini
2016-06-23 14:23 ` Shannon Zhao
2016-06-23 14:27 ` Stefano Stabellini
2016-06-23 16:18 ` Julien Grall
2016-06-23 3:16 ` [PATCH v2 05/17] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 06/17] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 07/17] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-06-23 15:00 ` Stefano Stabellini
2016-06-23 16:19 ` Julien Grall
2016-06-23 16:26 ` Julien Grall
2016-06-23 16:58 ` Julien Grall
2016-06-27 1:44 ` Shannon Zhao
2016-06-27 10:17 ` Julien Grall
2016-06-29 9:29 ` Shannon Zhao
2016-06-29 9:42 ` Julien Grall
2016-06-29 13:41 ` Shannon Zhao
2016-07-05 16:42 ` Stefano Stabellini
2016-07-06 9:50 ` Julien Grall
2016-07-06 10:16 ` Stefano Stabellini
2016-06-23 3:16 ` [PATCH v2 08/17] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
2016-06-23 16:29 ` Julien Grall
2016-06-23 3:16 ` [PATCH v2 09/17] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-06-23 16:36 ` Julien Grall
2016-06-23 3:16 ` [PATCH v2 10/17] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-06-23 3:16 ` [PATCH v2 11/17] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-06-23 14:50 ` Stefano Stabellini
2016-06-23 16:42 ` Julien Grall
2016-06-27 1:50 ` Shannon Zhao
2016-06-23 17:03 ` Julien Grall [this message]
2016-06-27 6:01 ` Shannon Zhao
2016-06-27 10:29 ` Julien Grall
2016-06-27 12:05 ` Boris Ostrovsky
2016-06-28 11:03 ` Shannon Zhao
2016-06-28 13:41 ` Boris Ostrovsky
2016-06-29 18:58 ` Boris Ostrovsky
2016-07-01 7:58 ` Shannon Zhao
2016-07-01 10:18 ` Julien Grall
2016-07-01 14:42 ` Boris Ostrovsky
2016-07-01 15:14 ` Julien Grall
2016-06-23 3:16 ` [PATCH v2 12/17] libxl/arm: Add a helper to calculate the ACPI table checksum Shannon Zhao
2016-06-23 17:05 ` Julien Grall
2016-06-23 3:17 ` [PATCH v2 13/17] libxl/arm: Link all ACPI tables into one buffer Shannon Zhao
2016-06-23 17:10 ` Julien Grall
2016-06-23 3:17 ` [PATCH v2 14/17] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
2016-06-23 3:17 ` [PATCH v2 15/17] libxl/arm: Add ACPI module Shannon Zhao
2016-06-23 18:35 ` Julien Grall
2016-06-25 3:22 ` Shannon Zhao
2016-06-27 9:48 ` Julien Grall
2016-06-23 3:17 ` [PATCH v2 16/17] libxc/xc_dom_arm: Copy ACPI tables to guest space Shannon Zhao
2016-06-23 18:46 ` Julien Grall
2016-06-27 6:25 ` Shannon Zhao
2016-06-27 10:49 ` Julien Grall
2016-06-27 12:11 ` Boris Ostrovsky
2016-07-05 17:13 ` Stefano Stabellini
2016-07-06 9:46 ` Julien Grall
2016-07-06 10:12 ` Stefano Stabellini
2016-07-12 3:47 ` Shannon Zhao
2016-07-12 9:25 ` Julien Grall
2016-07-12 11:35 ` Wei Liu
2016-07-12 14:42 ` Shannon Zhao
2016-07-12 14:50 ` Wei Liu
2016-07-12 14:57 ` Shannon Zhao
2016-07-12 15:08 ` Boris Ostrovsky
2016-07-12 15:13 ` Wei Liu
2016-07-12 15:21 ` Boris Ostrovsky
2016-07-12 16:05 ` Wei Liu
2016-07-12 16:10 ` Julien Grall
2016-07-12 16:58 ` Boris Ostrovsky
2016-07-13 15:22 ` Julien Grall
2016-07-13 17:08 ` Boris Ostrovsky
2016-07-14 11:15 ` Wei Liu
2016-07-15 9:39 ` Shannon Zhao
2016-07-19 10:38 ` Wei Liu
2016-07-20 6:52 ` Shannon Zhao
2016-07-20 9:32 ` Wei Liu
2016-07-25 7:56 ` Shannon Zhao
2016-07-28 11:10 ` Julien Grall
2016-07-14 11:29 ` Julien Grall
2016-07-14 13:37 ` Stefano Stabellini
2016-07-20 12:33 ` Julien Grall
2016-07-20 13:33 ` Boris Ostrovsky
2016-07-20 13:41 ` Julien Grall
2016-07-20 14:09 ` Boris Ostrovsky
2016-07-20 17:28 ` Stefano Stabellini
2016-07-20 19:51 ` Boris Ostrovsky
2016-07-21 17:53 ` Stefano Stabellini
2016-07-21 18:23 ` Julien Grall
2016-07-21 18:54 ` Stefano Stabellini
2016-07-21 19:14 ` Julien Grall
2016-07-21 21:15 ` Stefano Stabellini
2016-07-25 8:38 ` George Dunlap
2016-07-25 9:46 ` Julien Grall
2016-07-25 22:06 ` Stefano Stabellini
2016-07-25 22:46 ` Boris Ostrovsky
2016-07-25 23:40 ` Stefano Stabellini
2016-07-26 1:17 ` Boris Ostrovsky
2016-07-28 11:06 ` Julien Grall
2016-07-28 12:42 ` Shannon Zhao
2016-08-02 11:01 ` Wei Liu
2016-08-03 19:20 ` Julien Grall
2016-08-04 10:17 ` Wei Liu
2016-08-02 11:01 ` Wei Liu
2016-07-07 15:35 ` Wei Liu
2016-06-23 3:17 ` [PATCH v2 17/17] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-06-23 18:48 ` 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=576C167F.8000903@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.