Skip to contentSkip to conversation

s390x: sie and uv cleanups

PATCH In review Janosch Frank 2 participants 9 messages Jul 6, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover s390x: sie and uv cleanups

The UV and SIE additions brought in some minor problems which I want to address now.

v2:
* Dropped UV int type patch
* Fixed uv_query reserved field name
* Fixed sie info print if
* Added patch to remove an old print in the pgm handler

Janosch Frank (5):
s390x: sie: Add missing includes
s390x: sie: Fix sie.h integer types
lib: s390x: uv: Add offset comments to uv_query and extend it
lib: s390x: Print if a pgm happened while in SIE
lib: s390x: Remove left behing PGM report

 lib/s390x/asm/uv.h    | 33 +++++++++++++++++----------------
 lib/s390x/interrupt.c | 14 ++++++++------
 lib/s390x/sie.h       | 11 +++++++----
 3 files changed, 32 insertions(+), 26 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/5 s390x: sie: Add missing includes

arch_def.h is needed for struct psw. stdint.h is needed for the uint*_t types.

---
 lib/s390x/sie.h | 3 +++
 1 file changed, 3 insertions(+)
lib/s390x/sie.h +3 -0
index db30d61..b4bb78c 100644
@@ -2,6 +2,9 @@
 #ifndef _S390X_SIE_H_
 #define _S390X_SIE_H_
 
+#include <stdint.h>
+#include <asm/arch_def.h>
+
 #define CPUSTAT_STOPPED    0x80000000
 #define CPUSTAT_WAIT       0x10000000
 #define CPUSTAT_ECALL_PEND 0x08000000
Signature · 1 line
2.30.2
#2 lore raw

PATCH v2 2/5 s390x: sie: Fix sie.h integer types

In reply to Janosch Frank

Let's only use the uint*_t types.

---
 lib/s390x/sie.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/s390x/sie.h +4 -4
index b4bb78c..6ba858a 100644
@@ -173,9 +173,9 @@ struct kvm_s390_sie_block {
 } __attribute__((packed));
 
 struct vm_save_regs {
-	u64 grs[16];
-	u64 fprs[16];
-	u32 fpc;
+	uint64_t grs[16];
+	uint64_t fprs[16];
+	uint32_t fpc;
 };
 
 /* We might be able to nestle all of this into the stack frame. But
@@ -191,7 +191,7 @@ struct vm {
 	struct kvm_s390_sie_block *sblk;
 	struct vm_save_area save_area;
 	/* Ptr to first guest page */
-	u8 *guest_mem;
+	uint8_t *guest_mem;
 };
 
 extern void sie_entry(void);
Signature · 1 line
2.30.2
#3 lore raw

PATCH v2 3/5 lib: s390x: uv: Add offset comments to uv_query and extend it

In reply to Janosch Frank

The struct is getting longer, let's add offset comments so we know where we change things when we add struct members.

---
 lib/s390x/asm/uv.h | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
lib/s390x/asm/uv.h +17 -16
index dc3e02d..ec10d1c 100644
@@ -84,22 +84,23 @@ struct uv_cb_init {
 } __attribute__((packed))  __attribute__((aligned(8)));
 
 struct uv_cb_qui {
-	struct uv_cb_header header;
-	u64 reserved08;
-	u64 inst_calls_list[4];
-	u64 reserved30[2];
-	u64 uv_base_stor_len;
-	u64 reserved48;
-	u64 conf_base_phys_stor_len;
-	u64 conf_base_virt_stor_len;
-	u64 conf_virt_var_stor_len;
-	u64 cpu_stor_len;
-	u32 reserved70[3];
-	u32 max_num_sec_conf;
-	u64 max_guest_stor_addr;
-	u8  reserved88[158 - 136];
-	u16 max_guest_cpus;
-	u8  reserveda0[200 - 160];
+	struct uv_cb_header header;	/* 0x0000 */
+	u64 reserved08;			/* 0x0008 */
+	u64 inst_calls_list[4];		/* 0x0010 */
+	u64 reserved30[2];		/* 0x0030 */
+	u64 uv_base_stor_len;		/* 0x0040 */
+	u64 reserved48;			/* 0x0048 */
+	u64 conf_base_phys_stor_len;	/* 0x0050 */
+	u64 conf_base_virt_stor_len;	/* 0x0058 */
+	u64 conf_virt_var_stor_len;	/* 0x0060 */
+	u64 cpu_stor_len;		/* 0x0068 */
+	u32 reserved70[3];		/* 0x0070 */
+	u32 max_num_sec_conf;		/* 0x007c */
+	u64 max_guest_stor_addr;	/* 0x0080 */
+	u8  reserved88[158 - 136];	/* 0x0088 */
+	uint16_t max_guest_cpus;	/* 0x009e */
+	u64 uv_feature_indications;	/* 0x00a0 */
+	u8  reserveda8[200 - 168];	/* 0x00a8 */
 }  __attribute__((packed))  __attribute__((aligned(8)));
 
 struct uv_cb_cgc {
Signature · 1 line
2.30.2
Reviewed-by on v2 3/5
#4 lore raw

Re: [kvm-unit-tests PATCH v2 3/5] lib: s390x: uv: Add offset comments to uv_query and extend it

Quoted 7 lines · Janosch Frank

The struct is getting longer, let's add offset comments so we know where we change things when we add struct members.

---
 lib/s390x/asm/uv.h | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
#5 lore raw

PATCH v2 4/5 lib: s390x: Print if a pgm happened while in SIE

In reply to Janosch Frank

For debugging it helps if you know if the PGM happened while being in SIE or not.

---
 lib/s390x/interrupt.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
lib/s390x/interrupt.c +8 -3
index b627942..109f290 100644
@@ -141,10 +141,15 @@ static void print_int_regs(struct stack_frame_int *stack)
 static void print_pgm_info(struct stack_frame_int *stack)
 
 {
+	bool in_sie;
+
+	in_sie = (lc->pgm_old_psw.addr >= (uintptr_t)sie_entry &&
+		  lc->pgm_old_psw.addr <= (uintptr_t)sie_exit);
+
 	printf("\n");
-	printf("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
-	       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
-	       lc->pgm_int_id);
+	printf("Unexpected program interrupt %s: %d on cpu %d at %#lx, ilen %d\n",
+	       in_sie ? "in SIE" : "",
+	       lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, lc->pgm_int_id);
 	print_int_regs(stack);
 	dump_stack();
 	report_summary();
Signature · 1 line
2.30.2
Reviewed-by on v2 4/5
#6 lore raw

Re: [kvm-unit-tests PATCH v2 4/5] lib: s390x: Print if a pgm happened while in SIE

Quoted 7 lines · Janosch Frank

For debugging it helps if you know if the PGM happened while being in SIE or not.

---
 lib/s390x/interrupt.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
#7 lore raw

PATCH v2 5/5 lib: s390x: Remove left behing PGM report

In reply to Janosch Frank

When I added the backtrace support I forgot to remove the PGM report.

---
 lib/s390x/interrupt.c | 3 ---
 1 file changed, 3 deletions(-)
lib/s390x/interrupt.c +0 -3
index 109f290..785b735 100644
@@ -162,9 +162,6 @@ void handle_pgm_int(struct stack_frame_int *stack)
 		/* Force sclp_busy to false, otherwise we will loop forever */
 		sclp_handle_ext();
 		print_pgm_info(stack);
-		report_abort("Unexpected program interrupt: %d on cpu %d at %#lx, ilen %d\n",
-			     lc->pgm_int_code, stap(), lc->pgm_old_psw.addr,
-			     lc->pgm_int_id);
 	}
 
 	pgm_int_expected = false;
Signature · 1 line
2.30.2