public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nico Boehr <nrb@linux.ibm.com>
To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com,
	imbrenda@linux.ibm.com,
	Christoph Schlameuss <schlameuss@linux.ibm.com>
Subject: [kvm-unit-tests GIT PULL 14/18] s390x: Move SIE assembly into new file
Date: Mon,  3 Feb 2025 09:35:22 +0100	[thread overview]
Message-ID: <20250203083606.22864-15-nrb@linux.ibm.com> (raw)
In-Reply-To: <20250203083606.22864-1-nrb@linux.ibm.com>

From: Janosch Frank <frankja@linux.ibm.com>

In contrast to the other functions in cpu.S it's quite lengthy so
let's split it off.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Link: https://lore.kernel.org/r/20240806084409.169039-4-frankja@linux.ibm.com
Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/Makefile  |  2 +-
 s390x/cpu-sie.S | 74 +++++++++++++++++++++++++++++++++++++++++++++++++
 s390x/cpu.S     | 64 ------------------------------------------
 3 files changed, 75 insertions(+), 65 deletions(-)
 create mode 100644 s390x/cpu-sie.S

diff --git a/s390x/Makefile b/s390x/Makefile
index 63e96d86..e5572cb6 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -122,7 +122,7 @@ cflatobjs += lib/s390x/fault.o
 
 OBJDIRS += lib/s390x
 
-asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o
+asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o $(TEST_DIR)/cpu-sie.o
 
 FLATLIBS = $(libcflat)
 
diff --git a/s390x/cpu-sie.S b/s390x/cpu-sie.S
new file mode 100644
index 00000000..9370b5c0
--- /dev/null
+++ b/s390x/cpu-sie.S
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * s390x SIE assembly library
+ *
+ * Copyright (c) 2019 IBM Corp.
+ *
+ * Authors:
+ *    Janosch Frank <frankja@linux.ibm.com>
+ */
+#include <asm/asm-offsets.h>
+
+/*
+ * sie64a calling convention:
+ * %r2 pointer to sie control block
+ * %r3 guest register save area
+ */
+.globl sie64a
+sie64a:
+	# Save host grs, fprs, fpc
+	stmg	%r0,%r14,SIE_SAVEAREA_HOST_GRS(%r3)	# save kernel registers
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	std	\i, \i * 8  + SIE_SAVEAREA_HOST_FPRS(%r3)
+	.endr
+	stfpc	SIE_SAVEAREA_HOST_FPC(%r3)
+
+	stctg	%c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r3)
+	lctlg	%c1, %c1, SIE_SAVEAREA_GUEST_ASCE(%r3)
+
+	# Store scb and save_area pointer into stack frame
+	stg	%r2,__SF_SIE_CONTROL(%r15)	# save control block pointer
+	stg	%r3,__SF_SIE_SAVEAREA(%r15)	# save guest register save area
+.globl sie_entry_gregs
+sie_entry_gregs:
+	# Load guest's gprs, fprs and fpc
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	ld	\i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3)
+	.endr
+	lfpc	SIE_SAVEAREA_GUEST_FPC(%r3)
+	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
+
+	# Move scb ptr into r14 for the sie instruction
+	lg	%r14,__SF_SIE_CONTROL(%r15)
+
+.globl sie_entry
+sie_entry:
+	sie	0(%r14)
+	nopr	7
+	nopr	7
+	nopr	7
+
+.globl sie_exit
+sie_exit:
+	# Load guest register save area
+	lg	%r14,__SF_SIE_SAVEAREA(%r15)
+
+	# Restore the host asce
+	lctlg	%c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r14)
+
+	# Store guest's gprs, fprs and fpc
+	stmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r14)	# save guest gprs 0-13
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	std	\i, \i * 8  + SIE_SAVEAREA_GUEST_FPRS(%r14)
+	.endr
+	stfpc	SIE_SAVEAREA_GUEST_FPC(%r14)
+
+	# Restore host's gprs, fprs and fpc
+	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
+	ld	\i, \i * 8 + SIE_SAVEAREA_HOST_FPRS(%r14)
+	.endr
+	lfpc	SIE_SAVEAREA_HOST_FPC(%r14)
+	lmg	%r0,%r14,SIE_SAVEAREA_HOST_GRS(%r14)	# restore kernel registers
+.globl sie_exit_gregs
+sie_exit_gregs:
+	br	%r14
diff --git a/s390x/cpu.S b/s390x/cpu.S
index 9155b044..2ff4b8e1 100644
--- a/s390x/cpu.S
+++ b/s390x/cpu.S
@@ -62,70 +62,6 @@ smp_cpu_setup_state:
 	/* If the function returns, just loop here */
 0:	j	0
 
-/*
- * sie64a calling convention:
- * %r2 pointer to sie control block
- * %r3 guest register save area
- */
-.globl sie64a
-sie64a:
-	# Save host grs, fprs, fpc
-	stmg	%r0,%r14,SIE_SAVEAREA_HOST_GRS(%r3)	# save kernel registers
-	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-	std	\i, \i * 8  + SIE_SAVEAREA_HOST_FPRS(%r3)
-	.endr
-	stfpc	SIE_SAVEAREA_HOST_FPC(%r3)
-
-	stctg	%c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r3)
-	lctlg	%c1, %c1, SIE_SAVEAREA_GUEST_ASCE(%r3)
-
-	# Store scb and save_area pointer into stack frame
-	stg	%r2,__SF_SIE_CONTROL(%r15)	# save control block pointer
-	stg	%r3,__SF_SIE_SAVEAREA(%r15)	# save guest register save area
-.globl sie_entry_gregs
-sie_entry_gregs:
-	# Load guest's gprs, fprs and fpc
-	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-	ld	\i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3)
-	.endr
-	lfpc	SIE_SAVEAREA_GUEST_FPC(%r3)
-	lmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3)
-
-	# Move scb ptr into r14 for the sie instruction
-	lg	%r14,__SF_SIE_CONTROL(%r15)
-
-.globl sie_entry
-sie_entry:
-	sie	0(%r14)
-	nopr	7
-	nopr	7
-	nopr	7
-
-.globl sie_exit
-sie_exit:
-	# Load guest register save area
-	lg	%r14,__SF_SIE_SAVEAREA(%r15)
-
-	# Restore the host asce
-	lctlg	%c1, %c1, SIE_SAVEAREA_HOST_ASCE(%r14)
-
-	# Store guest's gprs, fprs and fpc
-	stmg	%r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r14)	# save guest gprs 0-13
-	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-	std	\i, \i * 8  + SIE_SAVEAREA_GUEST_FPRS(%r14)
-	.endr
-	stfpc	SIE_SAVEAREA_GUEST_FPC(%r14)
-
-	# Restore host's gprs, fprs and fpc
-	.irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-	ld	\i, \i * 8 + SIE_SAVEAREA_HOST_FPRS(%r14)
-	.endr
-	lfpc	SIE_SAVEAREA_HOST_FPC(%r14)
-	lmg	%r0,%r14,SIE_SAVEAREA_HOST_GRS(%r14)	# restore kernel registers
-.globl sie_exit_gregs
-sie_exit_gregs:
-	br	%r14
-
 	.align	8
 reset_psw:
 	.quad	0x0008000180000000
-- 
2.47.1


  parent reply	other threads:[~2025-02-03  8:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-03  8:35 [kvm-unit-tests GIT PULL 00/18] s390x: new edat, diag258 and STFLE tests; fixes for genprotimg >= 2.36.0; cleanups for snippets and makefiles Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 01/18] s390x: Split and rework cpacf query functions Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 02/18] s390x: edat: test 2G large page spanning end of memory Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 03/18] s390x: edat: move LC_SIZE to arch_def.h Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 04/18] s390x: add test for diag258 Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 05/18] s390x: lib: Remove double include Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 06/18] s390x: Add sie_is_pv Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 07/18] s390x: Add function for checking diagnose intercepts Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 08/18] s390x: Add library functions for exiting from snippet Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 09/18] s390x: Use library functions for snippet exit Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 10/18] s390x: Add test for STFLE interpretive execution (format-0) Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 11/18] s390x/Makefile: snippets: Add separate target for the ELF snippets Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 12/18] s390x/Makefile: Split snippet makefile rules into new file Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 13/18] s390x/Makefile: Add more comments Nico Boehr
2025-02-03  8:35 ` Nico Boehr [this message]
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 15/18] lib: s390x: Split SIE fw structs from lib structs Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 16/18] s390x: Support newer version of genprotimg Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 17/18] s390x/Makefile: Make sure the linker script is generated in the build directory Nico Boehr
2025-02-03  8:35 ` [kvm-unit-tests GIT PULL 18/18] s390x/Makefile: Add auxinfo.o to cflatobjs Nico Boehr
2025-02-03  9:11 ` [kvm-unit-tests GIT PULL 00/18] s390x: new edat, diag258 and STFLE tests; fixes for genprotimg >= 2.36.0; cleanups for snippets and makefiles Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250203083606.22864-15-nrb@linux.ibm.com \
    --to=nrb@linux.ibm.com \
    --cc=andrew.jones@linux.dev \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=schlameuss@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox