[kvm-unit-tests,v3,03/13] s390x: Make tests bootable from disk
diff mbox series

Message ID 20181218092657.46466-4-frankja@linux.ibm.com
State New
Headers show
Series
  • 390x: Add cross hypervisor and disk boot
Related show

Commit Message

Janosch Frank Dec. 18, 2018, 9:26 a.m. UTC
Currently tests are run with the --kernel option of Qemu, which will
load the ELF file and jump to the start address. When booting from
disk, we need to specify a start address. This is done by setting the
initial short PSW at 0x0.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/cstart64.S |  9 ++++++++-
 s390x/flat.lds   | 13 ++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Thomas Huth Dec. 18, 2018, 9:53 a.m. UTC | #1
On 2018-12-18 10:26, Janosch Frank wrote:
> Currently tests are run with the --kernel option of Qemu, which will
> load the ELF file and jump to the start address. When booting from
> disk, we need to specify a start address. This is done by setting the
> initial short PSW at 0x0.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/cstart64.S |  9 ++++++++-
>  s390x/flat.lds   | 13 ++++++++++++-
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index dc7ddd6..d382497 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -14,9 +14,16 @@
>  
>  .section .init
>  
> -/* entry point - for KVM + TCG we directly start in 64 bit mode */
> +/*
> + * Short init between 0x10000 and 0x10480 and then jump to 0x11000.
> + * 0x10480 - 0x11000 are written to by bootloader.
> + *
> + * For KVM and TCG kernel boot we are in 64 bit z/Arch mode.
> + * When booting from disk the initial short psw is in 31 bit mode.
> + */
>  	.globl start
>  start:
> +	sam64				# Set addressing mode to 64 bit
>  	/* setup stack */
>  	larl	%r15, stackptr
>  	/* setup initial PSW mask + control registers*/
> diff --git a/s390x/flat.lds b/s390x/flat.lds
> index b6e2172..977af7c 100644
> --- a/s390x/flat.lds
> +++ b/s390x/flat.lds
> @@ -1,10 +1,21 @@
>  SECTIONS
>  {
> +	/*
> +	 * Initial short psw for disk boot, with 31 bit addressing for
> +	 * non z/Arch environment compatibility and the instruction
> +	 * address 0x10000 (cstart64.S .init).
> +	 */
> +	.lowcore : {
> +		. = 0;
> +		 LONG(0x00080000)
> +		 LONG(0x80010000)
> +	}
> +	. = 0x10000;
>  	.text : {
>  		*(.init)
>  		. = 0x480;
>  		ipl_args = .;
> -		. = 0x600;
> +		.  = 0x1000;
>  		*(.text)
>  		*(.text.*)
>  	}
> 

Looks reasonable.

Reviewed-by: Thomas Huth <thuth@redhat.com>
David Hildenbrand Dec. 18, 2018, 9:55 a.m. UTC | #2
On 18.12.18 10:26, Janosch Frank wrote:
> Currently tests are run with the --kernel option of Qemu, which will
> load the ELF file and jump to the start address. When booting from
> disk, we need to specify a start address. This is done by setting the
> initial short PSW at 0x0.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/cstart64.S |  9 ++++++++-
>  s390x/flat.lds   | 13 ++++++++++++-
>  2 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index dc7ddd6..d382497 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -14,9 +14,16 @@
>  
>  .section .init
>  
> -/* entry point - for KVM + TCG we directly start in 64 bit mode */
> +/*
> + * Short init between 0x10000 and 0x10480 and then jump to 0x11000.
> + * 0x10480 - 0x11000 are written to by bootloader.
> + *
> + * For KVM and TCG kernel boot we are in 64 bit z/Arch mode.
> + * When booting from disk the initial short psw is in 31 bit mode.
> + */
>  	.globl start
>  start:
> +	sam64				# Set addressing mode to 64 bit
>  	/* setup stack */
>  	larl	%r15, stackptr
>  	/* setup initial PSW mask + control registers*/
> diff --git a/s390x/flat.lds b/s390x/flat.lds
> index b6e2172..977af7c 100644
> --- a/s390x/flat.lds
> +++ b/s390x/flat.lds
> @@ -1,10 +1,21 @@
>  SECTIONS
>  {
> +	/*
> +	 * Initial short psw for disk boot, with 31 bit addressing for
> +	 * non z/Arch environment compatibility and the instruction
> +	 * address 0x10000 (cstart64.S .init).
> +	 */
> +	.lowcore : {
> +		. = 0;
> +		 LONG(0x00080000)
> +		 LONG(0x80010000)
> +	}
> +	. = 0x10000;
>  	.text : {
>  		*(.init)
>  		. = 0x480;
>  		ipl_args = .;
> -		. = 0x600;
> +		.  = 0x1000;

Can you add a comment to the description why this change is performed?

Apart from that, looks good.

>  		*(.text)
>  		*(.text.*)
>  	}
>

Patch
diff mbox series

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index dc7ddd6..d382497 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -14,9 +14,16 @@ 
 
 .section .init
 
-/* entry point - for KVM + TCG we directly start in 64 bit mode */
+/*
+ * Short init between 0x10000 and 0x10480 and then jump to 0x11000.
+ * 0x10480 - 0x11000 are written to by bootloader.
+ *
+ * For KVM and TCG kernel boot we are in 64 bit z/Arch mode.
+ * When booting from disk the initial short psw is in 31 bit mode.
+ */
 	.globl start
 start:
+	sam64				# Set addressing mode to 64 bit
 	/* setup stack */
 	larl	%r15, stackptr
 	/* setup initial PSW mask + control registers*/
diff --git a/s390x/flat.lds b/s390x/flat.lds
index b6e2172..977af7c 100644
--- a/s390x/flat.lds
+++ b/s390x/flat.lds
@@ -1,10 +1,21 @@ 
 SECTIONS
 {
+	/*
+	 * Initial short psw for disk boot, with 31 bit addressing for
+	 * non z/Arch environment compatibility and the instruction
+	 * address 0x10000 (cstart64.S .init).
+	 */
+	.lowcore : {
+		. = 0;
+		 LONG(0x00080000)
+		 LONG(0x80010000)
+	}
+	. = 0x10000;
 	.text : {
 		*(.init)
 		. = 0x480;
 		ipl_args = .;
-		. = 0x600;
+		.  = 0x1000;
 		*(.text)
 		*(.text.*)
 	}