diff mbox series

[kvm-unit-tests,1/5] s390x: Make tests bootable from disk

Message ID 20181204134838.5841-2-frankja@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Add cross hypervisor and disk boot | expand

Commit Message

Janosch Frank Dec. 4, 2018, 1:48 p.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.

For later compatibility with other hypervisors the short psw has 31
bit addressing specified.

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

Comments

David Hildenbrand Dec. 4, 2018, 1:52 p.m. UTC | #1
On 04.12.18 14:48, 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.
> 
> For later compatibility with other hypervisors the short psw has 31
> bit addressing specified.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/cstart64.S | 9 +++++++--
>  s390x/flat.lds   | 8 +++++++-
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index dc7ddd6..abd6b58 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -14,12 +14,17 @@
>  
>  .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.
> + */
>  	.globl start
>  start:
> +	sam64				# Set addressing mode to 64 bit

I guess this was supposed to go into patch #2?

> +start64:
>  	/* setup stack */
>  	larl	%r15, stackptr
> -	/* setup initial PSW mask + control registers*/
> +	/* setup initial PSW mask + control registers */
>  	larl	%r1, initial_psw
>  	lpswe	0(%r1)
>  init_psw_cont:
> diff --git a/s390x/flat.lds b/s390x/flat.lds
> index b6e2172..7cfd9f9 100644
> --- a/s390x/flat.lds
> +++ b/s390x/flat.lds
> @@ -1,10 +1,16 @@
>  SECTIONS
>  {
> +	.lowcore : {
> +		. = 0;
> +		 LONG(0x00080000)
> +		 LONG(0x80010000)
> +	}
> +	. = 0x10000;
>  	.text : {
>  		*(.init)
>  		. = 0x480;
>  		ipl_args = .;
> -		. = 0x600;
> +		.  = 0x1000;
>  		*(.text)
>  		*(.text.*)
>  	}
>
Janosch Frank Dec. 4, 2018, 1:58 p.m. UTC | #2
On 04.12.18 14:52, David Hildenbrand wrote:
> On 04.12.18 14:48, 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.
>>
>> For later compatibility with other hypervisors the short psw has 31
>> bit addressing specified.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  s390x/cstart64.S | 9 +++++++--
>>  s390x/flat.lds   | 8 +++++++-
>>  2 files changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>> index dc7ddd6..abd6b58 100644
>> --- a/s390x/cstart64.S
>> +++ b/s390x/cstart64.S
>> @@ -14,12 +14,17 @@
>>  
>>  .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.
>> + */
>>  	.globl start
>>  start:
>> +	sam64				# Set addressing mode to 64 bit
> 
> I guess this was supposed to go into patch #2?

No, the short PSW has only BA set because we want to boot on lpar and
zvm  later on and they start with esam, not esame.

So when booting from disk we need to sam64, as we'll run with 31 at this
point in time.

> 
>> +start64:
>>  	/* setup stack */
>>  	larl	%r15, stackptr
>> -	/* setup initial PSW mask + control registers*/
>> +	/* setup initial PSW mask + control registers */
>>  	larl	%r1, initial_psw
>>  	lpswe	0(%r1)
>>  init_psw_cont:
>> diff --git a/s390x/flat.lds b/s390x/flat.lds
>> index b6e2172..7cfd9f9 100644
>> --- a/s390x/flat.lds
>> +++ b/s390x/flat.lds
>> @@ -1,10 +1,16 @@
>>  SECTIONS
>>  {
>> +	.lowcore : {
>> +		. = 0;
>> +		 LONG(0x00080000)
>> +		 LONG(0x80010000)
>> +	}
>> +	. = 0x10000;
>>  	.text : {
>>  		*(.init)
>>  		. = 0x480;
>>  		ipl_args = .;
>> -		. = 0x600;
>> +		.  = 0x1000;
>>  		*(.text)
>>  		*(.text.*)
>>  	}
>>
> 
>
David Hildenbrand Dec. 4, 2018, 2:06 p.m. UTC | #3
On 04.12.18 14:58, Janosch Frank wrote:
> On 04.12.18 14:52, David Hildenbrand wrote:
>> On 04.12.18 14:48, 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.
>>>
>>> For later compatibility with other hypervisors the short psw has 31
>>> bit addressing specified.
>>>
>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>> ---
>>>  s390x/cstart64.S | 9 +++++++--
>>>  s390x/flat.lds   | 8 +++++++-
>>>  2 files changed, 14 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>>> index dc7ddd6..abd6b58 100644
>>> --- a/s390x/cstart64.S
>>> +++ b/s390x/cstart64.S
>>> @@ -14,12 +14,17 @@
>>>  
>>>  .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.
>>> + */
>>>  	.globl start
>>>  start:
>>> +	sam64				# Set addressing mode to 64 bit
>>
>> I guess this was supposed to go into patch #2?
> 
> No, the short PSW has only BA set because we want to boot on lpar and
> zvm  later on and they start with esam, not esame.
> 
> So when booting from disk we need to sam64, as we'll run with 31 at this
> point in time.

Please add that to the description (and remove it from the description
of patch #2). Thanks!
Janosch Frank Dec. 5, 2018, 10:17 a.m. UTC | #4
On 04.12.18 15:06, David Hildenbrand wrote:
> On 04.12.18 14:58, Janosch Frank wrote:
>> On 04.12.18 14:52, David Hildenbrand wrote:
>>> On 04.12.18 14:48, 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.
>>>>
>>>> For later compatibility with other hypervisors the short psw has 31
>>>> bit addressing specified.
>>>>
>>>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>>>> ---
>>>>  s390x/cstart64.S | 9 +++++++--
>>>>  s390x/flat.lds   | 8 +++++++-
>>>>  2 files changed, 14 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>>>> index dc7ddd6..abd6b58 100644
>>>> --- a/s390x/cstart64.S
>>>> +++ b/s390x/cstart64.S
>>>> @@ -14,12 +14,17 @@
>>>>  
>>>>  .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.
>>>> + */
>>>>  	.globl start
>>>>  start:
>>>> +	sam64				# Set addressing mode to 64 bit
>>>
>>> I guess this was supposed to go into patch #2?
>>
>> No, the short PSW has only BA set because we want to boot on lpar and
>> zvm  later on and they start with esam, not esame.
>>
>> So when booting from disk we need to sam64, as we'll run with 31 at this
>> point in time.
> 
> Please add that to the description (and remove it from the description
> of patch #2). Thanks!
> 

Sure, I'll also try to add some more comments to the assembly.
diff mbox series

Patch

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index dc7ddd6..abd6b58 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -14,12 +14,17 @@ 
 
 .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.
+ */
 	.globl start
 start:
+	sam64				# Set addressing mode to 64 bit
+start64:
 	/* setup stack */
 	larl	%r15, stackptr
-	/* setup initial PSW mask + control registers*/
+	/* setup initial PSW mask + control registers */
 	larl	%r1, initial_psw
 	lpswe	0(%r1)
 init_psw_cont:
diff --git a/s390x/flat.lds b/s390x/flat.lds
index b6e2172..7cfd9f9 100644
--- a/s390x/flat.lds
+++ b/s390x/flat.lds
@@ -1,10 +1,16 @@ 
 SECTIONS
 {
+	.lowcore : {
+		. = 0;
+		 LONG(0x00080000)
+		 LONG(0x80010000)
+	}
+	. = 0x10000;
 	.text : {
 		*(.init)
 		. = 0x480;
 		ipl_args = .;
-		. = 0x600;
+		.  = 0x1000;
 		*(.text)
 		*(.text.*)
 	}