Skip to contentSkip to conversation

s390x: Switch to z/Arch if needed

PATCH Thomas Huth 1 participant 1 message Dec 18, 2018 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8RE8lhFmdlZtUWO2mtFPW1aqCXvPuGTDA
Content-Type: multipart/mixed; boundary="SzOKycOzM0NVLtg4oWWJREn3tDKIXrQY4";
protected-headers="v1"
From: Thomas Huth <[email protected]>
To: Janosch Frank <[email protected]>, [email protected]
Cc: [email protected], [email protected]
Message-ID: <[email protected]>
Subject: Re: [kvm-unit-tests PATCH v3 04/13] s390x: Switch to z/Arch if needed
References: <[email protected]>
<[email protected]> <[email protected]> <[email protected]>
In-Reply-To: <[email protected]>

--SzOKycOzM0NVLtg4oWWJREn3tDKIXrQY4
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: quoted-printable

Quoted 3 lines · Janosch Frank
Quoted 2 lines · Thomas Huth
Quoted 1 line · Janosch Frank

LPAR and z/VM start in esam mode depending on the hardware, so we nee=

d

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

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.

---
 s390x/cstart64.S | 8 ++++++++
 1 file changed, 8 insertions(+)
Quoted 9 lines
Quoted 9 lines

s390x/cstart64.S line 23

Quoted 9 lines
s390x/cstart64.S +1 -0
index d382497..7886f35 100644
@@ -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 esa=

m mode.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
s390x/cstart64.S +3 -0
  */
 	.globl start
 start:
+	/* Switch to z/Architecture mode and 64-bit */
+	slr     %r0, %r0		# Set cpuid to zero
+	lhi     %r1, 2			# mode 2 =3D esame
Quoted 8 lines

s390x/cstart64.S line 33

Quoted 4 lines
s390x/cstart64.S +4 -0
+	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

Do we really want to keep the lmh here? ... yes, I know the kernel is doing this, too, but I really fail to see why we would need it in the kvm-unit-tests, too... have you tried it also without this clearing?

Quoted 3 lines

=20
I think I had it without that for a few days.
What's your reasoning against it?

It just looks weird this way. Like we wanted to execute some 32-bit code in 64-bit mode afterwards, but we don't do that.

Quoted 3 lines

We loose more cycles when clearing BSS
under KVM where it's empty anyway. I'd rather expand it to a lm, to really have a fresh start.

Fine for me, just add a comment like that ("Clear all registers to make sure that we have a well-defined fresh start" or so).

I think I'd also rather write this as:

	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
	 xgr \i,\i
	.endr

=2E.. since that takes a little bit less space.

Thomas

--SzOKycOzM0NVLtg4oWWJREn3tDKIXrQY4--

--8RE8lhFmdlZtUWO2mtFPW1aqCXvPuGTDA
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJcGOVGAAoJEC7Z13T+cC21E0gQAIZEOFd3C9kQ+6AexjDvJn2X JyEZcIFGb9oNypmVOkzIpTpBPd2ckcAT1N0Yy3GEQbLiivQZwswBEgzxGVuOl+7p kxqI6I/yhI9jNkdQZqzzFFf1adF3tkLtekSjsxeD14bszIPL6MQng+Uv1KqfhGDV 8SLfuTfePWcSImNWawqJTEvERNaN/GcsZQA1+33qoB88d0r19sIkA8ZQZPNwMp/V utmnUFXyhxlJRlRAN1tUGtUd6jwsKfE/SpCdWpB8f8QG4vWcOxzUZK4KxOG0vmY9 //QvBVsqfWTUv2SWlREClV99b3ImfhD8mDVRhI0M7jEnBPJI4liu8p3r8t3euHxA 5/Thkr0EWA+XCOkU+1OEEejxqWyNitdvg8Z+/ehWVDns1E5NRqOtOCUAwExaCvRN sG01r/UPa9HXwlxTfh6tASamYX3j29NWqVH2uvVczyMJ/RA69TFctvju7xL0VnMx WGpjY+l0WBMPzqCLyTu+3K0enY12myycTA6CbiCgjcQNQcyjQQr0QHfaenkX+RUB tGzG//Gfc9rXW45mAWk5tsDngW/rvB4J2Vq0oj8CSzgo1HdiK/0+yWSEw8fus/AX Kv8ZiC8r5pBITPvfiWr57knbDwru6AgA3hBow3uN1CChVPlu++CoAzHmKbJ9fkZt hBEVOBBJUCvH/KhMhwaP
=29e5
-----END PGP SIGNATURE-----

--8RE8lhFmdlZtUWO2mtFPW1aqCXvPuGTDA--