Skip to contentSkip to conversation

libxl: Make an ACPI support build for ARM64 configurable.

PATCH In review Andrii Anisov 5 participants 16 messages Nov 23, 2016 – Nov 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Make an ACPI support build for ARM64 configurable.

Make the libxl ACPI support build configurable by the same config option as the hypervisor side support.

---
 tools/libxl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/Makefile +1 -1
index f5053a0..a4e9319 100644
@@ -90,7 +90,7 @@ 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)
+ifeq ($(CONFIG_ACPI),y)
 DSDT_FILES-y = dsdt_anycpu_arm.c
 LIBXL_OBJS-y += libxl_arm_acpi.o $(patsubst %.c,%.o,$(DSDT_FILES-y))
 dsdt_anycpu_arm.c:
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hello,

Quoted 2 lines · Andrii Anisov

Make the libxl ACPI support build configurable by the same config option as the hypervisor side support.

This will not work because Kconfig support only exists for the hypervisor.

Furthermore, people may want to disable ACPI for the host but still support ACPI for guest.

The way forward is to have an option in the configure to opt-out the support of guest ACPI and also remove the iasl check.

Regards,

Quoted 20 lines
---
 tools/libxl/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/Makefile +1 -1
index f5053a0..a4e9319 100644
@@ -90,7 +90,7 @@ 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)
+ifeq ($(CONFIG_ACPI),y)
 DSDT_FILES-y = dsdt_anycpu_arm.c
 LIBXL_OBJS-y += libxl_arm_acpi.o $(patsubst %.c,%.o,$(DSDT_FILES-y))
 dsdt_anycpu_arm.c:
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw
Quoted 4 lines · Andrii Anisov
Quoted 1 line

This will not work because Kconfig support only exists for the hypervisor.

So I totally confused where CONFIG_ARM_64 is defined for tools.

It is defined in config/arm64.mk, which is included by various makefiles.

Quoted 2 lines

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 2 lines

It is defined in config/arm64.mk, which is included by various makefiles.

As I got, it is included by Config.mk which consequently included by different makefiles in hypervisor, tools, docs, stubdom. It looks like a piece of legasy configuration code, I see moves of CONFIG_ options from it to Kconfig.

I guess extending that file is not acceptable, so I hope to be back soon with modifications suggested by Julien:

Quoted 1 line

The way forward is to have an option in the configure to opt-out the support of guest ACPI and also remove the iasl check.

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 8 lines · Andrii Anisov
Quoted 2 lines

It is defined in config/arm64.mk, which is included by various makefiles.

As I got, it is included by Config.mk which consequently included by different makefiles in hypervisor, tools, docs, stubdom. It looks like a piece of legasy configuration code, I see moves of CONFIG_ options from it to Kconfig.

I guess extending that file is not acceptable, so I hope to be back

I think it would be fine to add other CONFIG_* to those files.

Quoted 3 lines

soon with modifications suggested by Julien:

Quoted 2 lines

The way forward is to have an option in the configure to opt-out the support of guest ACPI and also remove the iasl check.

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Quoted 3 lines

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 3 lines

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Well, as I stated here [1], I'm pretty far from ACPI and understanding of what's going wrong with the compilation. But I have a strong feeling that this option should be optional.

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 8 lines · Andrii Anisov
Quoted 3 lines

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Well, as I stated here [1], I'm pretty far from ACPI and understanding of what's going wrong with the compilation. But I have a strong feeling that this option should be optional.

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html

What is the exact rune you got when compiling mk_dsdt ?

If everything it set up properly you should be using a cross-build gcc which should have the correct architecture?

Can you try this (untested) patch?

tools/libacpi/Makefile +1 -1
index ccc32c9..2b9d5b8 100644
@@ -44,7 +44,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 	rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
  
 $(MK_DSDT): mk_dsdt.c
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
+	$(CC) $(CFLAGS) $(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)
 	# Remove last bracket
Quoted 3 lines

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

Hi Wei,

Quoted 23 lines · Wei Liu
Quoted 8 lines · Andrii Anisov
Quoted 3 lines

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Well, as I stated here [1], I'm pretty far from ACPI and understanding of what's going wrong with the compilation. But I have a strong feeling that this option should be optional.

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html

What is the exact rune you got when compiling mk_dsdt ?

If everything it set up properly you should be using a cross-build gcc which should have the correct architecture?

Can you try this (untested) patch?

tools/libacpi/Makefile +0 -0
index ccc32c9..2b9d5b8 100644

tools/libacpi/Makefile $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl · line 47

Quoted 5 lines
tools/libacpi/Makefile +1 -1
@@ -44,7 +44,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 	rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
 
 $(MK_DSDT): mk_dsdt.c
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
+	$(CC) $(CFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c

That will not work, CC will build an ARM binary. However mk_dsdt is used to generate the static ACPI table integrated in the libxl, so mk_dsdt needs to be built with HOSTCC.

I think the code should use CONFIG_ARM_64/CONFIG_ARM_32 rather than __*__ one.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#9 lore raw
Quoted 28 lines · Julien Grall

Hi Wei,

Quoted 25 lines · Wei Liu
Quoted 8 lines · Andrii Anisov
Quoted 3 lines

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Well, as I stated here [1], I'm pretty far from ACPI and understanding of what's going wrong with the compilation. But I have a strong feeling that this option should be optional.

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html

What is the exact rune you got when compiling mk_dsdt ?

If everything it set up properly you should be using a cross-build gcc which should have the correct architecture?

Can you try this (untested) patch?

tools/libacpi/Makefile +0 -0
index ccc32c9..2b9d5b8 100644
@@ -44,7 +44,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 	rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
 
Quoted 7 lines

tools/libacpi/Makefile $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl · line 47

Quoted 3 lines

$(MK_DSDT): mk_dsdt.c

tools/libacpi/Makefile +1 -1
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
+	$(CC) $(CFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c

That will not work, CC will build an ARM binary. However mk_dsdt is used to generate the static ACPI table integrated in the libxl, so mk_dsdt needs to be built with HOSTCC.

Yes, you're right.

Quoted 4 lines

I think the code should use CONFIG_ARM_64/CONFIG_ARM_32 rather than __*__ one.

That might work -- provided they are defined even in a cross-build.

Quoted 4 lines

Regards,

Signature · 1 line
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw
In reply to Andrii Anisov

Hello Andrii,

Quoted 6 lines · Andrii Anisov
Quoted 3 lines

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

Well, as I stated here [1], I'm pretty far from ACPI and understanding of what's going wrong with the compilation. But I have a strong feeling that this option should be optional.

The ACPI support is pretty much contained in a single file and I am not sure you will win much space. Can you explain why the ACPI guest support should be optional?

Regards,

Quoted 6 lines

[1] https://lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html

Sincerely,
Andrii Anisov.

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#11 lore raw

Hello Julien,

Quoted 2 lines

The ACPI support is pretty much contained in a single file and I am not sure you will win much space. Can you explain why the ACPI guest support should be optional?

This would increase the system configurability and would let one shrink a system to a minimal footprint with required functionality only. Such possibility is very useful in embedded applications.

Unfortunately I don't know the exact space impact of this particular feature 'cause I can't build it. From other hand I do not need it in my system. So I would like to have a way to drop not needed functionality easily.
BTW, excessive functionality reduction is also a way to get more stable and predictable system.

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#12 lore raw
Quoted 1 line · Andrii Anisov

Hello Julien,

Hi Andrii,

Quoted 10 lines
Quoted 2 lines

The ACPI support is pretty much contained in a single file and I am not sure you will win much space. Can you explain why the ACPI guest support should be optional?

This would increase the system configurability and would let one shrink a system to a minimal footprint with required functionality only. Such possibility is very useful in embedded applications.

Unfortunately I don't know the exact space impact of this particular feature 'cause I can't build it. From other hand I do not need it in my system. So I would like to have a way to drop not needed functionality easily.

I agree with this argument however...

Quoted 2 lines

BTW, excessive functionality reduction is also a way to get more stable and predictable system.

this statement is not entirely true. There is no automatic test on all the possible configurations, although we have travis to test build (and not booting) a random Kconfig. Even if we try our best to see any problem when reviewing code, we cannot guarantee an error when using a different configuration.

And this is becoming a problem as today we have no way to know the configuration used when a problem is reported. This is because the Kconfig is not embedded in the Xen binary.

I got bitten quite a few times in my development because I had a binary but not the Kconfig. It was re-written because I forgot to add XEN_CONFIG_EXPERT on the command line.

I might be more inclined to make more feature optional when we will have a way to track the configuration of a hypervisor binary.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#13 lore raw
Quoted 34 lines · Julien Grall
Quoted 1 line · Andrii Anisov

Hello Julien,

Hi Andrii,

Quoted 11 lines
Quoted 3 lines

The ACPI support is pretty much contained in a single file and I am not sure you will win much space.
Can you explain why the ACPI guest support should be optional?

This would increase the system configurability and would let one shrink a system to a minimal footprint with required functionality only. Such possibility is very useful in embedded applications.

Unfortunately I don't know the exact space impact of this particular feature 'cause I can't build it. From other hand I do not need it in my system. So I would like to have a way to drop not needed functionality easily.

I agree with this argument however...

Quoted 2 lines

BTW, excessive functionality reduction is also a way to get more stable and predictable system.

this statement is not entirely true. There is no automatic test on all the possible configurations, although we have travis to test build (and not booting) a random Kconfig. Even if we try our best to see any problem when reviewing code, we cannot guarantee an error when using a different configuration.

And this is becoming a problem as today we have no way to know the configuration used when a problem is reported. This is because the Kconfig is not embedded in the Xen binary.

Quoted 6 lines

I got bitten quite a few times in my development because I had a binary but not the Kconfig. It was re-written because I forgot to add XEN_CONFIG_EXPERT on the command line.

I might be more inclined to make more feature optional when we will have a way to track the configuration of a hypervisor binary.

+10 to this idea.

It isn't hard to compress .config and stash it in .rodata during compilation, offering it back to the toolstack via a hypercall. We already do similar things for the XSM policy.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#14 lore raw
In reply to Julien Grall

Julien,

Quoted 2 lines

There is no automatic test on all the possible configurations, although we have travis to test build (and not booting) a random Kconfig.

I guess there is no need to test booting of a "random" Kconfig within the mainline anyway. The full-featured defconfig would be enough to be provided by the mainline.

Quoted 2 lines

Even if we try our best to see any problem when reviewing code, we cannot guarantee an error when using a different configuration.

From other hand, those who build their solution based on XEN, will take care about their specific configurations. And get back to the community with features and fixes if applicable.

Quoted 2 lines

I got bitten quite a few times in my development because I had a binary but not the Kconfig.

I think everyone faced similar issues in their experience.

Quoted 3 lines

I might be more inclined to make more feature optional when we will have a way to track the configuration of a hypervisor binary. +10 to this idea.

Having a .config built into the XEN binary is a cool feature. But IMO it is useful rather during development time. Knowing a production system configuration seems to be closer to an integration area of responsibility.

Quoted 1 line

This is because the Kconfig is not embedded in the Xen binary.

This thread was started from the configuration of the tools, which are not configured by Kconfig.
Is it already possible to get back tools configuration during runtime?

Sincerely,
Andrii Anisov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw
In reply to Wei Liu
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 23.11.16 at 15:05, <[email protected]> wrote:

But before you write any code, let me try to understand the real issue
first: you're trying to cross-build ARM tools on x86, but x86 iasl doesn't support ARM ACPI definition(s), right?

No, the problem is that Shannon has broken cross builds of libacpi's mk_dsdt.c (see my reply to Andrii's original problem report at lists.xenproject.org/archives/html/xen-devel/2016-11/msg01903.html).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel