Re: [Xen-devel] [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table

2016-07-12 Thread Shannon Zhao
On 2016年07月12日 19:38, Wei Liu wrote:
> On Tue, Jul 12, 2016 at 11:50:32AM +0800, Shannon Zhao wrote:
>> > 
>> > 
>> > On 2016/7/7 23:52, Wei Liu wrote:
>>> > > On Tue, Jul 05, 2016 at 11:12:35AM +0800, Shannon Zhao wrote:
> > >> > From: Shannon Zhao 
> > >> > 
> > >> > It uses static DSDT table like the way x86 uses. Currently the DSDT
> > >> > table only contains processor device objects and it generates the
> > >> > maximal objects which so far is 128.
> > >> > 
> > >> > Signed-off-by: Shannon Zhao 
> > >> > ---
> > >> >  tools/libacpi/Makefile| 15 -
> > >> >  tools/libacpi/mk_dsdt.c   | 51 
> > >> > ---
> > >> >  tools/libxl/Makefile  |  5 -
> > >> >  tools/libxl/libxl_arm_acpi.c  |  5 +
> > >> >  xen/include/public/arch-arm.h |  3 +++
> > >> >  5 files changed, 64 insertions(+), 15 deletions(-)
> > >> > 
> > >> > diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
> > >> > index 4068d9a..0401810 100644
> > >> > --- a/tools/libacpi/Makefile
> > >> > +++ b/tools/libacpi/Makefile
> > >> > @@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
> > >> >  # Sources to be generated
> > >> >  C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c 
> > >> > $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
> > >> >  C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c 
> > >> > $(ACPI_BUILD_DIR)/dsdt_pvh.c
> > >> > +C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
> > >> >  H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h 
> > >> > $(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
> > >> >  
> > >> >  vpath iasl $(PATH)
> > >> > @@ -35,7 +36,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
> > >> >cd $(CURDIR)
> > >> >  
> > >> >  $(MK_DSDT): mk_dsdt.c
> > >> > -  $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
> > >> > +  $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o 
> > >> > $@ mk_dsdt.c
>>> > > Why is this needed? Which unstable hypervisor interface you need in
>>> > > order to build this?
>> > It needs GUEST_MAX_VCPUS in mk_dsdt.c while the GUEST_MAX_VCPUS is
>> > defined under #if defined(__XEN__) || defined(__XEN_TOOLS__) in
>> > xen/include/public/arch-arm.h
>> > 
> OK. Let me elaborate a bit on this.
> 
> The two macros basically imply everything enclosed in them is subject to
> change. I guess I can live with this because this is not a public facing
> interface for library users.
> 
> Can you ack or nack my assessment?
Yeah, the mk_dsdt is just a middle result of compilation which is used
to generate DSDT table.

Thanks,
-- 
Shannon

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


Re: [Xen-devel] [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table

2016-07-12 Thread Wei Liu
On Tue, Jul 12, 2016 at 11:50:32AM +0800, Shannon Zhao wrote:
> 
> 
> On 2016/7/7 23:52, Wei Liu wrote:
> > On Tue, Jul 05, 2016 at 11:12:35AM +0800, Shannon Zhao wrote:
> >> > From: Shannon Zhao 
> >> > 
> >> > It uses static DSDT table like the way x86 uses. Currently the DSDT
> >> > table only contains processor device objects and it generates the
> >> > maximal objects which so far is 128.
> >> > 
> >> > Signed-off-by: Shannon Zhao 
> >> > ---
> >> >  tools/libacpi/Makefile| 15 -
> >> >  tools/libacpi/mk_dsdt.c   | 51 
> >> > ---
> >> >  tools/libxl/Makefile  |  5 -
> >> >  tools/libxl/libxl_arm_acpi.c  |  5 +
> >> >  xen/include/public/arch-arm.h |  3 +++
> >> >  5 files changed, 64 insertions(+), 15 deletions(-)
> >> > 
> >> > diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
> >> > index 4068d9a..0401810 100644
> >> > --- a/tools/libacpi/Makefile
> >> > +++ b/tools/libacpi/Makefile
> >> > @@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
> >> >  # Sources to be generated
> >> >  C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
> >> >  C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c 
> >> > $(ACPI_BUILD_DIR)/dsdt_pvh.c
> >> > +C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
> >> >  H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h 
> >> > $(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
> >> >  
> >> >  vpath iasl $(PATH)
> >> > @@ -35,7 +36,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
> >> >  cd $(CURDIR)
> >> >  
> >> >  $(MK_DSDT): mk_dsdt.c
> >> > -$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
> >> > +$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o 
> >> > $@ mk_dsdt.c
> > Why is this needed? Which unstable hypervisor interface you need in
> > order to build this?
> It needs GUEST_MAX_VCPUS in mk_dsdt.c while the GUEST_MAX_VCPUS is
> defined under #if defined(__XEN__) || defined(__XEN_TOOLS__) in
> xen/include/public/arch-arm.h
> 

OK. Let me elaborate a bit on this.

The two macros basically imply everything enclosed in them is subject to
change. I guess I can live with this because this is not a public facing
interface for library users.

Can you ack or nack my assessment?

Wei.

> Thanks,
> -- 
> Shannon
> 

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


Re: [Xen-devel] [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table

2016-07-11 Thread Shannon Zhao


On 2016/7/7 23:52, Wei Liu wrote:
> On Tue, Jul 05, 2016 at 11:12:35AM +0800, Shannon Zhao wrote:
>> > From: Shannon Zhao 
>> > 
>> > It uses static DSDT table like the way x86 uses. Currently the DSDT
>> > table only contains processor device objects and it generates the
>> > maximal objects which so far is 128.
>> > 
>> > Signed-off-by: Shannon Zhao 
>> > ---
>> >  tools/libacpi/Makefile| 15 -
>> >  tools/libacpi/mk_dsdt.c   | 51 
>> > ---
>> >  tools/libxl/Makefile  |  5 -
>> >  tools/libxl/libxl_arm_acpi.c  |  5 +
>> >  xen/include/public/arch-arm.h |  3 +++
>> >  5 files changed, 64 insertions(+), 15 deletions(-)
>> > 
>> > diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
>> > index 4068d9a..0401810 100644
>> > --- a/tools/libacpi/Makefile
>> > +++ b/tools/libacpi/Makefile
>> > @@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
>> >  # Sources to be generated
>> >  C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
>> >  C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c 
>> > $(ACPI_BUILD_DIR)/dsdt_pvh.c
>> > +C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
>> >  H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h 
>> > $(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
>> >  
>> >  vpath iasl $(PATH)
>> > @@ -35,7 +36,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
>> >cd $(CURDIR)
>> >  
>> >  $(MK_DSDT): mk_dsdt.c
>> > -  $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
>> > +  $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ 
>> > mk_dsdt.c
> Why is this needed? Which unstable hypervisor interface you need in
> order to build this?
It needs GUEST_MAX_VCPUS in mk_dsdt.c while the GUEST_MAX_VCPUS is
defined under #if defined(__XEN__) || defined(__XEN_TOOLS__) in
xen/include/public/arch-arm.h

Thanks,
-- 
Shannon


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


Re: [Xen-devel] [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table

2016-07-07 Thread Wei Liu
On Tue, Jul 05, 2016 at 11:12:35AM +0800, Shannon Zhao wrote:
> From: Shannon Zhao 
> 
> It uses static DSDT table like the way x86 uses. Currently the DSDT
> table only contains processor device objects and it generates the
> maximal objects which so far is 128.
> 
> Signed-off-by: Shannon Zhao 
> ---
>  tools/libacpi/Makefile| 15 -
>  tools/libacpi/mk_dsdt.c   | 51 
> ---
>  tools/libxl/Makefile  |  5 -
>  tools/libxl/libxl_arm_acpi.c  |  5 +
>  xen/include/public/arch-arm.h |  3 +++
>  5 files changed, 64 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
> index 4068d9a..0401810 100644
> --- a/tools/libacpi/Makefile
> +++ b/tools/libacpi/Makefile
> @@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
>  # Sources to be generated
>  C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
>  C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c 
> $(ACPI_BUILD_DIR)/dsdt_pvh.c
> +C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
>  H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h 
> $(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
>  
>  vpath iasl $(PATH)
> @@ -35,7 +36,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
>   cd $(CURDIR)
>  
>  $(MK_DSDT): mk_dsdt.c
> - $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
> + $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ 
> mk_dsdt.c

Why is this needed? Which unstable hypervisor interface you need in
order to build this?

Wei.

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


[Xen-devel] [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table

2016-07-04 Thread Shannon Zhao
From: Shannon Zhao 

It uses static DSDT table like the way x86 uses. Currently the DSDT
table only contains processor device objects and it generates the
maximal objects which so far is 128.

Signed-off-by: Shannon Zhao 
---
 tools/libacpi/Makefile| 15 -
 tools/libacpi/mk_dsdt.c   | 51 ---
 tools/libxl/Makefile  |  5 -
 tools/libxl/libxl_arm_acpi.c  |  5 +
 xen/include/public/arch-arm.h |  3 +++
 5 files changed, 64 insertions(+), 15 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 4068d9a..0401810 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 # Sources to be generated
 C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
 C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c $(ACPI_BUILD_DIR)/dsdt_pvh.c
+C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
 H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h 
$(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
 
 vpath iasl $(PATH)
@@ -35,7 +36,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
cd $(CURDIR)
 
 $(MK_DSDT): mk_dsdt.c
-   $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+   $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ 
mk_dsdt.c
 
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl 
$(MK_DSDT)
awk 'NR > 1 {print s} {s=$$0}' $< > $@
@@ -69,6 +70,18 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl 
$(ACPI_BUILD_DIR)/dsdt_pvh.asl
rm -f $*.aml $*.hex
cd $(CURDIR)
 
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+   printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"XenARM\", \"Xen 
DSDT\", 1)\n{" > $@
+   $(MK_DSDT) --debug=$(debug) --arch arm >> $@
+
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+   cd $(ACPI_BUILD_DIR)
+   iasl -vs -p $* -tc $(ACPI_BUILD_DIR)/$*.asl
+   sed -e 's/AmlCode/$*/g' $*.hex >$@
+   echo "int $*_len=sizeof($*);" >>$@
+   rm -f $*.aml $*.hex
+   cd $(CURDIR)
+
 iasl:
@echo
@echo "ACPI ASL compiler (iasl) is needed"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 1322510..1d3ed0f 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static unsigned int indent_level;
 static bool debug = false;
@@ -87,6 +88,7 @@ static struct option options[] = {
 { "dm-version", 1, 0, 'q' },
 { "debug", 1, 0, 'd' },
 { "no-dm", 0, 0, 'n' },
+{ "arch", 1, 0, 'a' },
 { 0, 0, 0, 0 }
 };
 
@@ -94,7 +96,7 @@ int main(int argc, char **argv)
 {
 unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
 dm_version dm_version = QEMU_XEN_TRADITIONAL;
-bool no_dm = 0;
+bool no_dm = 0, arch_is_arm = false;
 
 for ( ; ; )
 {
@@ -133,6 +135,10 @@ int main(int argc, char **argv)
 case 'n':
 no_dm = 1;
 break;
+case 'a':
+if (strcmp(optarg, "arm") == 0)
+arch_is_arm = true;
+break;
 case 'd':
 if (*optarg == 'y')
 debug = true;
@@ -142,6 +148,9 @@ int main(int argc, char **argv)
 }
 }
 
+if (arch_is_arm)
+max_cpus = GUEST_MAX_VCPUS;
+
 / DSDT DefinitionBlock start /
 /* (we append to existing DSDT definition block) */
 indent_level++;
@@ -149,19 +158,21 @@ int main(int argc, char **argv)
 / Processor start /
 push_block("Scope", "\\_SB");
 
-/* MADT checksum */
-stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
-push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
-indent(); printf("MSU, 8\n");
-pop_block();
+if (!arch_is_arm) {
+/* MADT checksum */
+stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
+push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
+indent(); printf("MSU, 8\n");
+pop_block();
 
-/* Processor object helpers. */
-push_block("Method", "PMAT, 2");
-push_block("If", "LLess(Arg0, NCPU)");
-stmt("Return", "ToBuffer(Arg1)");
-pop_block();
-stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
-pop_block();
+/* Processor object helpers. */
+push_block("Method", "PMAT, 2");
+push_block("If", "LLess(Arg0, NCPU)");
+stmt("Return", "ToBuffer(Arg1)");
+pop_block();
+stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
+pop_block();
+}
 
 /* Define processor objects and control methods. */
 for ( cpu = 0; cpu < max_cpus; cpu++)
@@ -170,6 +181,12 @@ int main(int argc, char **argv)
 
 stmt("Name", "_HID, \"ACPI0007\"");
 
+if (arch_is_arm) {
+stmt("Name", "_UID, %d", cpu);
+pop_block();
+continue;
+