Patchwork [kvm-unit-tests,v2,3/6] s390x: Switch to z/Arch if needed

login
register
mail settings
Submitter Janosch Frank
Date Dec. 5, 2018, 3:39 p.m.
Message ID <20181205153918.29480-4-frankja@linux.ibm.com>
Download mbox | patch
Permalink /patch/673223/
State New
Headers show

Comments

Janosch Frank - Dec. 5, 2018, 3:39 p.m.
LPAR and z/VM start in esam mode depending on the hardware, so we need
to switch to z/Arch and set 64 bit addressing.

Under Qemu/KVM we already start out with both when being run with the
Qemu --kernel argument or we lack 64 bit when booting from disk
because of the initial psw specifying 31 bit for z/VM and lpar
compatibility.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/cstart64.S | 8 ++++++++
 1 file changed, 8 insertions(+)
David Hildenbrand - Dec. 7, 2018, 4:12 p.m.
On 05.12.18 16:39, Janosch Frank wrote:
> LPAR and z/VM start in esam mode depending on the hardware, so we need
> to switch to z/Arch and set 64 bit addressing.
> 
> Under Qemu/KVM we already start out with both when being run with the
> Qemu --kernel argument or we lack 64 bit when booting from disk
> because of the initial psw specifying 31 bit for z/VM and lpar
> compatibility.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  s390x/cstart64.S | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index d382497..7886f35 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -20,9 +20,17 @@
>   *
>   * 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.
> + * When running under LPAR or z/VM, we might start in 31 bit and esam mode.
>   */
>  	.globl start
>  start:
> +	/* Switch to z/Architecture mode and 64-bit */
> +	slr     %r0, %r0		# Set cpuid to zero
> +	lhi     %r1, 2			# mode 2 = esame
> +	sigp    %r1, %r0, 0x12		# sigp set arch
> +	bras	%r13,0f			# Jump over zero area
> +	.fill	16,4,0x0		# Zero area for lmh
> +0:	lmh	%r0,%r15,0(%r13)	# Clear high-order half of gprs
>  	sam64				# Set addressing mode to 64 bit
>  	/* setup stack */
>  	larl	%r15, stackptr
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

Patch

diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index d382497..7886f35 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -20,9 +20,17 @@ 
  *
  * 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.
+ * When running under LPAR or z/VM, we might start in 31 bit and esam mode.
  */
 	.globl start
 start:
+	/* Switch to z/Architecture mode and 64-bit */
+	slr     %r0, %r0		# Set cpuid to zero
+	lhi     %r1, 2			# mode 2 = esame
+	sigp    %r1, %r0, 0x12		# sigp set arch
+	bras	%r13,0f			# Jump over zero area
+	.fill	16,4,0x0		# Zero area for lmh
+0:	lmh	%r0,%r15,0(%r13)	# Clear high-order half of gprs
 	sam64				# Set addressing mode to 64 bit
 	/* setup stack */
 	larl	%r15, stackptr