linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] boot-wrapper: arm64: Xen support
@ 2016-11-22 15:09 Andre Przywara
  2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Andre Przywara @ 2016-11-22 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

These patches allow to include a Xen hypervisor binary into a boot-wrapper
ELF file, so that a Foundation Platform or a Fast Model can boot a Xen
system (including a Dom0 kernel).
The original patches have been around for a while, so this series is
merely an update to apply on the latest boot-wrapper HEAD. Also I fixed
minor things here and there (like increasing Xen's load address to
accomodate for Dom0 kernels bigger than 16 MB) and addressed Julien's
review comments.

For testing this just add: "--with-xen=/path/to/src/xen/xen" to the
./configure command line and feed the resulting xen-system.axf file to
the model.

Cheers,
Andre.

Changelog v1 .. v2:
- use "xen-cmdline" instead of bootargs as parameter and variable name
- move hunk in patch 1/4 to make patch 2/4 smaller
- replace AC_FILE_CHECK macro usage to fix cross compilation

Christoffer Dall (3):
  Support for building in a Xen binary
  Xen: Support adding DT nodes
  Explicitly clean linux-system.axf and xen-system.axf

Ian Campbell (1):
  Xen: Select correct dom0 console

 .gitignore    |  1 +
 Makefile.am   | 35 +++++++++++++++++++++++------------
 boot_common.c |  4 ++--
 configure.ac  | 29 ++++++++++++++++++++++++++++-
 model.lds.S   | 14 ++++++++++++++
 5 files changed, 68 insertions(+), 15 deletions(-)

-- 
2.9.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/4] Support for building in a Xen binary
  2016-11-22 15:09 [PATCH v2 0/4] boot-wrapper: arm64: Xen support Andre Przywara
@ 2016-11-22 15:09 ` Andre Przywara
  2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
  2016-12-15 11:34   ` Julien Grall
  2016-11-22 15:09 ` [PATCH v2 2/4] Xen: Support adding DT nodes Andre Przywara
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Andre Przywara @ 2016-11-22 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Christoffer Dall <christoffer.dall@linaro.org>

Add support for building a Xen binary which includes a Dom0 image and
the Dom0 command-line.

If the user specifies --with-xen=<Xen>, where Xen is an appropriate
AArch64 Xen binary, the build system will generate a xen-system.axf
instead of a linux-system.axf.

Original patch from Ian Campbell, but I modified most of it so all bugs
are probably mine.
[Andre: adapt to newest boot-wrapper branch, increase load address,
	fixup Xen image file test]

Cc: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 .gitignore    |  1 +
 Makefile.am   | 10 +++++++---
 boot_common.c |  4 ++--
 configure.ac  | 17 +++++++++++++++++
 model.lds.S   | 14 ++++++++++++++
 5 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 8653852..80770c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ configure
 dtc
 fdt.dtb
 Image
+Xen
 install-sh
 Makefile
 Makefile.in
diff --git a/Makefile.am b/Makefile.am
index 692d2cc..f8b9ec9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -85,7 +85,6 @@ TEXT_LIMIT	:= 0x80080000
 endif
 
 LD_SCRIPT	:= model.lds.S
-IMAGE		:= linux-system.axf
 
 FS_OFFSET	:= 0x10000000
 FILESYSTEM_START:= $(shell echo $$(($(PHYS_OFFSET) + $(FS_OFFSET))))
@@ -94,6 +93,11 @@ FILESYSTEM_END	:= $(shell echo $$(($(FILESYSTEM_START) + $(FILESYSTEM_SIZE))))
 
 FDT_OFFSET	:= 0x08000000
 
+if XEN
+XEN		:= -DXEN=$(XEN_IMAGE)
+XEN_OFFSET	:= 0x08200000
+endif
+
 if INITRD
 INITRD_FLAGS	:= -DUSE_INITRD
 CHOSEN_NODE	:= chosen {						\
@@ -121,7 +125,7 @@ all: $(IMAGE)
 
 CLEANFILES = $(IMAGE) $(OFILES) model.lds fdt.dtb
 
-$(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM)
+$(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE)
 	$(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds
 
 %.o: %.S Makefile
@@ -131,7 +135,7 @@ $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM)
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $<
 
 model.lds: $(LD_SCRIPT) Makefile
-	$(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $<
+	$(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) $(XEN) -DXEN_OFFSET=$(XEN_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $<
 
 fdt.dtb: $(KERNEL_DTB) Makefile gen-cpu-nodes.sh
 	( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) $(CPUS_NODE) };" ) | $(DTC) -O dtb -o $@ -
diff --git a/boot_common.c b/boot_common.c
index 4947fe3..e7b8e1d 100644
--- a/boot_common.c
+++ b/boot_common.c
@@ -9,7 +9,7 @@
 #include <cpu.h>
 #include <spin.h>
 
-extern unsigned long kernel;
+extern unsigned long entrypoint;
 extern unsigned long dtb;
 
 void init_platform(void);
@@ -67,7 +67,7 @@ void __noreturn first_spin(unsigned int cpu, unsigned long *mbox,
 	if (cpu == 0) {
 		init_platform();
 
-		*mbox = (unsigned long)&kernel;
+		*mbox = (unsigned long)&entrypoint;
 		sevl();
 		spin(mbox, invalid, 1);
 	} else {
diff --git a/configure.ac b/configure.ac
index ab8f5b3..f7e24c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,18 @@ AC_ARG_WITH([dtb],
 	AS_HELP_STRING([--with-dtb], [Specify a particular DTB to use]),
 	[KERN_DTB="$withval"])
 
+AC_ARG_WITH([xen],
+	AS_HELP_STRING([--with-xen], [Compile for Xen, and Specify a particular Xen to use]),
+	X_IMAGE=$withval)
+
+AS_IF([test "x$X_IMAGE" == "x"], [],
+      [AS_IF([test ! -f "$X_IMAGE"],
+	     [AC_MSG_ERROR([Could not find Xen hypervisor binary: $X_IMAGE])]
+      )]
+)
+AC_SUBST([XEN_IMAGE], [$X_IMAGE])
+AM_CONDITIONAL([XEN], [test "x$X_IMAGE" != "x"])
+
 # Ensure that the user has provided us with a sane kernel dir.
 m4_define([CHECKFILES], [KERN_DIR,
 	KERN_DTB,
@@ -50,6 +62,10 @@ m4_foreach([checkfile], [CHECKFILES],
 
 AC_SUBST([KERNEL_IMAGE], [$KERN_IMAGE])
 AC_SUBST([KERNEL_DTB], [$KERN_DTB])
+AS_IF([test "x$X_IMAGE" != "x"],
+      [AC_SUBST([IMAGE], ["xen-system.axf"])],
+      [AC_SUBST([IMAGE], ["linux-system.axf"])]
+)
 
 # Allow a user to pass --enable-psci
 AC_ARG_ENABLE([psci],
@@ -119,4 +135,5 @@ echo "  CPU IDs:                           ${CPU_IDS}"
 echo "  Use GICv3?                         ${USE_GICV3}"
 echo "  Boot-wrapper execution state:      AArch${BOOTWRAPPER_ES}"
 echo "  Kernel execution state:            AArch${KERNEL_ES}"
+echo "  Xen image                          ${XEN_IMAGE:-NONE}"
 echo ""
diff --git a/model.lds.S b/model.lds.S
index 51c5684..511f552 100644
--- a/model.lds.S
+++ b/model.lds.S
@@ -16,6 +16,9 @@ OUTPUT_ARCH(aarch64)
 #endif
 TARGET(binary)
 
+#ifdef XEN
+INPUT(XEN)
+#endif
 INPUT(KERNEL)
 INPUT(./fdt.dtb)
 
@@ -36,6 +39,17 @@ SECTIONS
 		KERNEL
 	}
 
+#ifdef XEN
+	.xen (PHYS_OFFSET + XEN_OFFSET): {
+		xen = .;
+		XEN
+	}
+
+	entrypoint = xen;
+#else
+	entrypoint = kernel;
+#endif
+
 	.dtb (PHYS_OFFSET + FDT_OFFSET): {
 		dtb = .;
 		./fdt.dtb
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/4] Xen: Support adding DT nodes
  2016-11-22 15:09 [PATCH v2 0/4] boot-wrapper: arm64: Xen support Andre Przywara
  2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
@ 2016-11-22 15:09 ` Andre Przywara
  2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
  2016-12-15 11:41   ` Julien Grall
  2016-11-22 15:09 ` [PATCH v2 3/4] Xen: Select correct dom0 console Andre Przywara
  2016-11-22 15:09 ` [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf Andre Przywara
  3 siblings, 2 replies; 13+ messages in thread
From: Andre Przywara @ 2016-11-22 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Christoffer Dall <christoffer.dall@linaro.org>

Support adding xen,xen-bootargs node via --with-xen-bootargs to the
configure script and automatically add the Dom0 node to the DT as well.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 Makefile.am  | 23 +++++++++++++++--------
 configure.ac |  9 +++++++++
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f8b9ec9..db97f9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,21 +96,28 @@ FDT_OFFSET	:= 0x08000000
 if XEN
 XEN		:= -DXEN=$(XEN_IMAGE)
 XEN_OFFSET	:= 0x08200000
+KERNEL_SIZE	:= $(shell stat -Lc %s $(KERNEL_IMAGE) 2>/dev/null || echo 0)
+DOM0_OFFSET	:= $(shell echo $$(($(PHYS_OFFSET) + $(KERNEL_OFFSET))))
+XEN_BOOTARGS	:= xen,xen-bootargs = \"$(XEN_CMDLINE)\";		\
+		   \#address-cells = <2>;				\
+		   \#size-cells = <2>;					\
+		   module at 1 {						\
+			compatible = \"xen,linux-zimage\", \"xen,multiboot-module\"; \
+			reg = <0x0 $(DOM0_OFFSET) 0x0 $(KERNEL_SIZE)>;	\
+		   };
 endif
 
 if INITRD
 INITRD_FLAGS	:= -DUSE_INITRD
+INITRD_CHOSEN   := linux,initrd-start = <$(FILESYSTEM_START)>;	\
+		   linux,initrd-end = <$(FILESYSTEM_END)>;
+endif
+
 CHOSEN_NODE	:= chosen {						\
 			bootargs = \"$(CMDLINE)\";			\
-			linux,initrd-start = <$(FILESYSTEM_START)>;	\
-			linux,initrd-end = <$(FILESYSTEM_END)>;		\
-		   };
-else
-INITRD_FLAGS	:=
-CHOSEN_NODE	:= chosen {						\
-			bootargs = \"$(CMDLINE)\";			\
+			$(INITRD_CHOSEN)				\
+			$(XEN_BOOTARGS)					\
 		   };
-endif
 
 CPPFLAGS	+= $(INITRD_FLAGS)
 CFLAGS		+= -Iinclude/ -I$(ARCH_SRC)/include/
diff --git a/configure.ac b/configure.ac
index f7e24c7..aff4aad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,12 @@ AC_ARG_WITH([cmdline],
 	[C_CMDLINE=$withval])
 AC_SUBST([CMDLINE], [$C_CMDLINE])
 
+X_CMDLINE="console=dtuart dtuart=serial0 no-bootscrub"
+AC_ARG_WITH([xen-cmdline],
+	AS_HELP_STRING([--with-xen-cmdline], [set Xen command line]),
+	[X_CMDLINE=$withval])
+AC_SUBST([XEN_CMDLINE], [$X_CMDLINE])
+
 # Allow a user to pass --enable-gicv3
 AC_ARG_ENABLE([gicv3],
 	AS_HELP_STRING([--enable-gicv3], [enable GICv3 instead of GICv2]),
@@ -136,4 +142,7 @@ echo "  Use GICv3?                         ${USE_GICV3}"
 echo "  Boot-wrapper execution state:      AArch${BOOTWRAPPER_ES}"
 echo "  Kernel execution state:            AArch${KERNEL_ES}"
 echo "  Xen image                          ${XEN_IMAGE:-NONE}"
+if test "x${XEN_IMAGE}" != "x"; then
+echo "  Xen command line:                  ${XEN_CMDLINE}"
+fi
 echo ""
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/4] Xen: Select correct dom0 console
  2016-11-22 15:09 [PATCH v2 0/4] boot-wrapper: arm64: Xen support Andre Przywara
  2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
  2016-11-22 15:09 ` [PATCH v2 2/4] Xen: Support adding DT nodes Andre Przywara
@ 2016-11-22 15:09 ` Andre Przywara
  2016-12-12 14:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
  2016-11-22 15:09 ` [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf Andre Przywara
  3 siblings, 1 reply; 13+ messages in thread
From: Andre Przywara @ 2016-11-22 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ian Campbell <ian.campbell@citrix.com>

If Xen is enabled, tell Dom0 to use the 'hvc0' console, and fall back to
the usual ttyAMA0 otherwise.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
---
 configure.ac | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index aff4aad..c959ab8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,7 +92,8 @@ AC_ARG_WITH([initrd],
 AC_SUBST([FILESYSTEM], [$USE_INITRD])
 AM_CONDITIONAL([INITRD], [test "x$USE_INITRD" != "x"])
 
-C_CMDLINE="console=ttyAMA0 earlyprintk=pl011,0x1c090000"
+AS_IF([test "x$X_IMAGE" = "x"],[C_CONSOLE="ttyAMA0"],[C_CONSOLE="hvc0"])
+C_CMDLINE="console=$C_CONSOLE earlyprintk=pl011,0x1c090000"
 AC_ARG_WITH([cmdline],
 	AS_HELP_STRING([--with-cmdline], [set a command line for the kernel]),
 	[C_CMDLINE=$withval])
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf
  2016-11-22 15:09 [PATCH v2 0/4] boot-wrapper: arm64: Xen support Andre Przywara
                   ` (2 preceding siblings ...)
  2016-11-22 15:09 ` [PATCH v2 3/4] Xen: Select correct dom0 console Andre Przywara
@ 2016-11-22 15:09 ` Andre Przywara
  2016-12-12 14:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
  3 siblings, 1 reply; 13+ messages in thread
From: Andre Przywara @ 2016-11-22 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Christoffer Dall <christoffer.dall@linaro.org>

When doing a make clean, only the output image currently configured to
build is being removed.  However, one would expect all build artifacts
to be removed when doing a 'make clean' and when switching between Xen
and Linux builds, it is easy to accidentally run an older build than
intended.  Simply hardcode the axf image file names.

Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index db97f9c..506a1d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -130,7 +130,7 @@ OFILES		+= $(addprefix $(ARCH_SRC),boot.o stack.o $(BOOTMETHOD) utils.o)
 
 all: $(IMAGE)
 
-CLEANFILES = $(IMAGE) $(OFILES) model.lds fdt.dtb
+CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dtb
 
 $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE)
 	$(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 1/4] Support for building in a Xen binary
  2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
@ 2016-12-12 14:46   ` Konrad Rzeszutek Wilk
  2016-12-15 11:34   ` Julien Grall
  1 sibling, 0 replies; 13+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-12-12 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 22, 2016 at 03:09:14PM +0000, Andre Przywara wrote:
> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> Add support for building a Xen binary which includes a Dom0 image and
> the Dom0 command-line.
> 
> If the user specifies --with-xen=<Xen>, where Xen is an appropriate
> AArch64 Xen binary, the build system will generate a xen-system.axf
> instead of a linux-system.axf.
> 
> Original patch from Ian Campbell, but I modified most of it so all bugs
> are probably mine.
> [Andre: adapt to newest boot-wrapper branch, increase load address,
> 	fixup Xen image file test]
> 
> Cc: Ian Campbell <ijc@hellion.org.uk>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

And also
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  .gitignore    |  1 +
>  Makefile.am   | 10 +++++++---
>  boot_common.c |  4 ++--
>  configure.ac  | 17 +++++++++++++++++
>  model.lds.S   | 14 ++++++++++++++
>  5 files changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git a/.gitignore b/.gitignore
> index 8653852..80770c0 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -14,6 +14,7 @@ configure
>  dtc
>  fdt.dtb
>  Image
> +Xen
>  install-sh
>  Makefile
>  Makefile.in
> diff --git a/Makefile.am b/Makefile.am
> index 692d2cc..f8b9ec9 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -85,7 +85,6 @@ TEXT_LIMIT	:= 0x80080000
>  endif
>  
>  LD_SCRIPT	:= model.lds.S
> -IMAGE		:= linux-system.axf
>  
>  FS_OFFSET	:= 0x10000000
>  FILESYSTEM_START:= $(shell echo $$(($(PHYS_OFFSET) + $(FS_OFFSET))))
> @@ -94,6 +93,11 @@ FILESYSTEM_END	:= $(shell echo $$(($(FILESYSTEM_START) + $(FILESYSTEM_SIZE))))
>  
>  FDT_OFFSET	:= 0x08000000
>  
> +if XEN
> +XEN		:= -DXEN=$(XEN_IMAGE)
> +XEN_OFFSET	:= 0x08200000
> +endif
> +
>  if INITRD
>  INITRD_FLAGS	:= -DUSE_INITRD
>  CHOSEN_NODE	:= chosen {						\
> @@ -121,7 +125,7 @@ all: $(IMAGE)
>  
>  CLEANFILES = $(IMAGE) $(OFILES) model.lds fdt.dtb
>  
> -$(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM)
> +$(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE)
>  	$(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds
>  
>  %.o: %.S Makefile
> @@ -131,7 +135,7 @@ $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM)
>  	$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $<
>  
>  model.lds: $(LD_SCRIPT) Makefile
> -	$(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $<
> +	$(CPP) $(CPPFLAGS) -ansi -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) $(XEN) -DXEN_OFFSET=$(XEN_OFFSET) -DKERNEL=$(KERNEL_IMAGE) -DFILESYSTEM=$(FILESYSTEM) -DTEXT_LIMIT=$(TEXT_LIMIT) -P -C -o $@ $<
>  
>  fdt.dtb: $(KERNEL_DTB) Makefile gen-cpu-nodes.sh
>  	( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) $(CPUS_NODE) };" ) | $(DTC) -O dtb -o $@ -
> diff --git a/boot_common.c b/boot_common.c
> index 4947fe3..e7b8e1d 100644
> --- a/boot_common.c
> +++ b/boot_common.c
> @@ -9,7 +9,7 @@
>  #include <cpu.h>
>  #include <spin.h>
>  
> -extern unsigned long kernel;
> +extern unsigned long entrypoint;
>  extern unsigned long dtb;
>  
>  void init_platform(void);
> @@ -67,7 +67,7 @@ void __noreturn first_spin(unsigned int cpu, unsigned long *mbox,
>  	if (cpu == 0) {
>  		init_platform();
>  
> -		*mbox = (unsigned long)&kernel;
> +		*mbox = (unsigned long)&entrypoint;
>  		sevl();
>  		spin(mbox, invalid, 1);
>  	} else {
> diff --git a/configure.ac b/configure.ac
> index ab8f5b3..f7e24c7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -40,6 +40,18 @@ AC_ARG_WITH([dtb],
>  	AS_HELP_STRING([--with-dtb], [Specify a particular DTB to use]),
>  	[KERN_DTB="$withval"])
>  
> +AC_ARG_WITH([xen],
> +	AS_HELP_STRING([--with-xen], [Compile for Xen, and Specify a particular Xen to use]),
> +	X_IMAGE=$withval)
> +
> +AS_IF([test "x$X_IMAGE" == "x"], [],
> +      [AS_IF([test ! -f "$X_IMAGE"],
> +	     [AC_MSG_ERROR([Could not find Xen hypervisor binary: $X_IMAGE])]
> +      )]
> +)
> +AC_SUBST([XEN_IMAGE], [$X_IMAGE])
> +AM_CONDITIONAL([XEN], [test "x$X_IMAGE" != "x"])
> +
>  # Ensure that the user has provided us with a sane kernel dir.
>  m4_define([CHECKFILES], [KERN_DIR,
>  	KERN_DTB,
> @@ -50,6 +62,10 @@ m4_foreach([checkfile], [CHECKFILES],
>  
>  AC_SUBST([KERNEL_IMAGE], [$KERN_IMAGE])
>  AC_SUBST([KERNEL_DTB], [$KERN_DTB])
> +AS_IF([test "x$X_IMAGE" != "x"],
> +      [AC_SUBST([IMAGE], ["xen-system.axf"])],
> +      [AC_SUBST([IMAGE], ["linux-system.axf"])]
> +)
>  
>  # Allow a user to pass --enable-psci
>  AC_ARG_ENABLE([psci],
> @@ -119,4 +135,5 @@ echo "  CPU IDs:                           ${CPU_IDS}"
>  echo "  Use GICv3?                         ${USE_GICV3}"
>  echo "  Boot-wrapper execution state:      AArch${BOOTWRAPPER_ES}"
>  echo "  Kernel execution state:            AArch${KERNEL_ES}"
> +echo "  Xen image                          ${XEN_IMAGE:-NONE}"
>  echo ""
> diff --git a/model.lds.S b/model.lds.S
> index 51c5684..511f552 100644
> --- a/model.lds.S
> +++ b/model.lds.S
> @@ -16,6 +16,9 @@ OUTPUT_ARCH(aarch64)
>  #endif
>  TARGET(binary)
>  
> +#ifdef XEN
> +INPUT(XEN)
> +#endif
>  INPUT(KERNEL)
>  INPUT(./fdt.dtb)
>  
> @@ -36,6 +39,17 @@ SECTIONS
>  		KERNEL
>  	}
>  
> +#ifdef XEN
> +	.xen (PHYS_OFFSET + XEN_OFFSET): {
> +		xen = .;
> +		XEN
> +	}
> +
> +	entrypoint = xen;
> +#else
> +	entrypoint = kernel;
> +#endif
> +
>  	.dtb (PHYS_OFFSET + FDT_OFFSET): {
>  		dtb = .;
>  		./fdt.dtb
> -- 
> 2.9.0
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel at lists.xen.org
> https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 2/4] Xen: Support adding DT nodes
  2016-11-22 15:09 ` [PATCH v2 2/4] Xen: Support adding DT nodes Andre Przywara
@ 2016-12-12 14:46   ` Konrad Rzeszutek Wilk
  2016-12-15 11:41   ` Julien Grall
  1 sibling, 0 replies; 13+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-12-12 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 22, 2016 at 03:09:15PM +0000, Andre Przywara wrote:
> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> Support adding xen,xen-bootargs node via --with-xen-bootargs to the
> configure script and automatically add the Dom0 node to the DT as well.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  Makefile.am  | 23 +++++++++++++++--------
>  configure.ac |  9 +++++++++
>  2 files changed, 24 insertions(+), 8 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index f8b9ec9..db97f9c 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -96,21 +96,28 @@ FDT_OFFSET	:= 0x08000000
>  if XEN
>  XEN		:= -DXEN=$(XEN_IMAGE)
>  XEN_OFFSET	:= 0x08200000
> +KERNEL_SIZE	:= $(shell stat -Lc %s $(KERNEL_IMAGE) 2>/dev/null || echo 0)
> +DOM0_OFFSET	:= $(shell echo $$(($(PHYS_OFFSET) + $(KERNEL_OFFSET))))
> +XEN_BOOTARGS	:= xen,xen-bootargs = \"$(XEN_CMDLINE)\";		\
> +		   \#address-cells = <2>;				\
> +		   \#size-cells = <2>;					\
> +		   module at 1 {						\
> +			compatible = \"xen,linux-zimage\", \"xen,multiboot-module\"; \
> +			reg = <0x0 $(DOM0_OFFSET) 0x0 $(KERNEL_SIZE)>;	\
> +		   };
>  endif
>  
>  if INITRD
>  INITRD_FLAGS	:= -DUSE_INITRD
> +INITRD_CHOSEN   := linux,initrd-start = <$(FILESYSTEM_START)>;	\
> +		   linux,initrd-end = <$(FILESYSTEM_END)>;
> +endif
> +
>  CHOSEN_NODE	:= chosen {						\
>  			bootargs = \"$(CMDLINE)\";			\
> -			linux,initrd-start = <$(FILESYSTEM_START)>;	\
> -			linux,initrd-end = <$(FILESYSTEM_END)>;		\
> -		   };
> -else
> -INITRD_FLAGS	:=
> -CHOSEN_NODE	:= chosen {						\
> -			bootargs = \"$(CMDLINE)\";			\
> +			$(INITRD_CHOSEN)				\
> +			$(XEN_BOOTARGS)					\
>  		   };
> -endif
>  
>  CPPFLAGS	+= $(INITRD_FLAGS)
>  CFLAGS		+= -Iinclude/ -I$(ARCH_SRC)/include/
> diff --git a/configure.ac b/configure.ac
> index f7e24c7..aff4aad 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -98,6 +98,12 @@ AC_ARG_WITH([cmdline],
>  	[C_CMDLINE=$withval])
>  AC_SUBST([CMDLINE], [$C_CMDLINE])
>  
> +X_CMDLINE="console=dtuart dtuart=serial0 no-bootscrub"
> +AC_ARG_WITH([xen-cmdline],
> +	AS_HELP_STRING([--with-xen-cmdline], [set Xen command line]),
> +	[X_CMDLINE=$withval])
> +AC_SUBST([XEN_CMDLINE], [$X_CMDLINE])
> +
>  # Allow a user to pass --enable-gicv3
>  AC_ARG_ENABLE([gicv3],
>  	AS_HELP_STRING([--enable-gicv3], [enable GICv3 instead of GICv2]),
> @@ -136,4 +142,7 @@ echo "  Use GICv3?                         ${USE_GICV3}"
>  echo "  Boot-wrapper execution state:      AArch${BOOTWRAPPER_ES}"
>  echo "  Kernel execution state:            AArch${KERNEL_ES}"
>  echo "  Xen image                          ${XEN_IMAGE:-NONE}"
> +if test "x${XEN_IMAGE}" != "x"; then
> +echo "  Xen command line:                  ${XEN_CMDLINE}"
> +fi
>  echo ""
> -- 
> 2.9.0
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel at lists.xen.org
> https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 3/4] Xen: Select correct dom0 console
  2016-11-22 15:09 ` [PATCH v2 3/4] Xen: Select correct dom0 console Andre Przywara
@ 2016-12-12 14:47   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 13+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-12-12 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 22, 2016 at 03:09:16PM +0000, Andre Przywara wrote:
> From: Ian Campbell <ian.campbell@citrix.com>
> 
> If Xen is enabled, tell Dom0 to use the 'hvc0' console, and fall back to
> the usual ttyAMA0 otherwise.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Julien Grall <julien.grall@arm.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  configure.ac | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index aff4aad..c959ab8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -92,7 +92,8 @@ AC_ARG_WITH([initrd],
>  AC_SUBST([FILESYSTEM], [$USE_INITRD])
>  AM_CONDITIONAL([INITRD], [test "x$USE_INITRD" != "x"])
>  
> -C_CMDLINE="console=ttyAMA0 earlyprintk=pl011,0x1c090000"
> +AS_IF([test "x$X_IMAGE" = "x"],[C_CONSOLE="ttyAMA0"],[C_CONSOLE="hvc0"])
> +C_CMDLINE="console=$C_CONSOLE earlyprintk=pl011,0x1c090000"
>  AC_ARG_WITH([cmdline],
>  	AS_HELP_STRING([--with-cmdline], [set a command line for the kernel]),
>  	[C_CMDLINE=$withval])
> -- 
> 2.9.0
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel at lists.xen.org
> https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf
  2016-11-22 15:09 ` [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf Andre Przywara
@ 2016-12-12 14:47   ` Konrad Rzeszutek Wilk
  2016-12-12 14:50     ` Andre Przywara
  0 siblings, 1 reply; 13+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-12-12 14:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 22, 2016 at 03:09:17PM +0000, Andre Przywara wrote:
> From: Christoffer Dall <christoffer.dall@linaro.org>
> 
> When doing a make clean, only the output image currently configured to
> build is being removed.  However, one would expect all build artifacts
> to be removed when doing a 'make clean' and when switching between Xen
> and Linux builds, it is easy to accidentally run an older build than
> intended.  Simply hardcode the axf image file names.
> 
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Julien Grall <julien.grall@arm.com>

Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  Makefile.am | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index db97f9c..506a1d9 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -130,7 +130,7 @@ OFILES		+= $(addprefix $(ARCH_SRC),boot.o stack.o $(BOOTMETHOD) utils.o)
>  
>  all: $(IMAGE)
>  
> -CLEANFILES = $(IMAGE) $(OFILES) model.lds fdt.dtb
> +CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dtb
>  
>  $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE)
>  	$(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds
> -- 
> 2.9.0
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel at lists.xen.org
> https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf
  2016-12-12 14:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
@ 2016-12-12 14:50     ` Andre Przywara
  2016-12-15 11:50       ` Mark Rutland
  0 siblings, 1 reply; 13+ messages in thread
From: Andre Przywara @ 2016-12-12 14:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Konrad,

On 12/12/16 14:47, Konrad Rzeszutek Wilk wrote:
> On Tue, Nov 22, 2016 at 03:09:17PM +0000, Andre Przywara wrote:
>> From: Christoffer Dall <christoffer.dall@linaro.org>
>>
>> When doing a make clean, only the output image currently configured to
>> build is being removed.  However, one would expect all build artifacts
>> to be removed when doing a 'make clean' and when switching between Xen
>> and Linux builds, it is easy to accidentally run an older build than
>> intended.  Simply hardcode the axf image file names.
>>
>> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
>> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>> Reviewed-by: Julien Grall <julien.grall@arm.com>
> 
> Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

Thanks a lot!

I will try to poke Mark to see if we can get this merged eventually.

Cheers,
Andre.

>> ---
>>  Makefile.am | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index db97f9c..506a1d9 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -130,7 +130,7 @@ OFILES		+= $(addprefix $(ARCH_SRC),boot.o stack.o $(BOOTMETHOD) utils.o)
>>  
>>  all: $(IMAGE)
>>  
>> -CLEANFILES = $(IMAGE) $(OFILES) model.lds fdt.dtb
>> +CLEANFILES = $(IMAGE) linux-system.axf xen-system.axf $(OFILES) model.lds fdt.dtb
>>  
>>  $(IMAGE): $(OFILES) model.lds fdt.dtb $(KERNEL_IMAGE) $(FILESYSTEM) $(XEN_IMAGE)
>>  	$(LD) $(LDFLAGS) $(OFILES) -o $@ --script=model.lds
>> -- 
>> 2.9.0
>>
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel at lists.xen.org
>> https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/4] Support for building in a Xen binary
  2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
  2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
@ 2016-12-15 11:34   ` Julien Grall
  1 sibling, 0 replies; 13+ messages in thread
From: Julien Grall @ 2016-12-15 11:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andre,

On 22/11/16 15:09, Andre Przywara wrote:
> diff --git a/configure.ac b/configure.ac
> index ab8f5b3..f7e24c7 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -40,6 +40,18 @@ AC_ARG_WITH([dtb],
>  	AS_HELP_STRING([--with-dtb], [Specify a particular DTB to use]),
>  	[KERN_DTB="$withval"])
>
> +AC_ARG_WITH([xen],
> +	AS_HELP_STRING([--with-xen], [Compile for Xen, and Specify a particular Xen to use]),

NIT: s/Specify/specify/

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

Cheers,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 2/4] Xen: Support adding DT nodes
  2016-11-22 15:09 ` [PATCH v2 2/4] Xen: Support adding DT nodes Andre Przywara
  2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
@ 2016-12-15 11:41   ` Julien Grall
  1 sibling, 0 replies; 13+ messages in thread
From: Julien Grall @ 2016-12-15 11:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andre,

On 22/11/16 15:09, Andre Przywara wrote:
> From: Christoffer Dall <christoffer.dall@linaro.org>
>
> Support adding xen,xen-bootargs node via --with-xen-bootargs to the

Based the code, the configure option is --with-xen-cmdline.

> configure script and automatically add the Dom0 node to the DT as well.
>
> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

With the above request:

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

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Xen-devel] [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf
  2016-12-12 14:50     ` Andre Przywara
@ 2016-12-15 11:50       ` Mark Rutland
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Rutland @ 2016-12-15 11:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Dec 12, 2016 at 02:50:20PM +0000, Andre Przywara wrote:
> Hi Konrad,
> 
> On 12/12/16 14:47, Konrad Rzeszutek Wilk wrote:
> > On Tue, Nov 22, 2016 at 03:09:17PM +0000, Andre Przywara wrote:
> >> From: Christoffer Dall <christoffer.dall@linaro.org>
> >>
> >> When doing a make clean, only the output image currently configured to
> >> build is being removed.  However, one would expect all build artifacts
> >> to be removed when doing a 'make clean' and when switching between Xen
> >> and Linux builds, it is easy to accidentally run an older build than
> >> intended.  Simply hardcode the axf image file names.
> >>
> >> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> >> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> >> Reviewed-by: Julien Grall <julien.grall@arm.com>
> > 
> > Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> Thanks a lot!
> 
> I will try to poke Mark to see if we can get this merged eventually.

I'm happy to take these so long as this doesn't adversely affect non-Xen
usage. I assume they don't. :)

Could you fix this up as per Julien's comments, and fold in the tags?
I'm happy to take that from a v3 or a git repo.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-12-15 11:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-22 15:09 [PATCH v2 0/4] boot-wrapper: arm64: Xen support Andre Przywara
2016-11-22 15:09 ` [PATCH v2 1/4] Support for building in a Xen binary Andre Przywara
2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-12-15 11:34   ` Julien Grall
2016-11-22 15:09 ` [PATCH v2 2/4] Xen: Support adding DT nodes Andre Przywara
2016-12-12 14:46   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-12-15 11:41   ` Julien Grall
2016-11-22 15:09 ` [PATCH v2 3/4] Xen: Select correct dom0 console Andre Przywara
2016-12-12 14:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-11-22 15:09 ` [PATCH v2 4/4] Explicitly clean linux-system.axf and xen-system.axf Andre Przywara
2016-12-12 14:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-12-12 14:50     ` Andre Przywara
2016-12-15 11:50       ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).