|
|
77c23f |
From da81f2b579987ea12929f0ec803716bc16a93df7 Mon Sep 17 00:00:00 2001
|
|
|
77c23f |
From: Thomas Huth <thuth@redhat.com>
|
|
|
77c23f |
Date: Fri, 29 May 2020 05:53:49 -0400
|
|
|
77c23f |
Subject: [PATCH 07/42] s390x: Beautify diag308 handling
|
|
|
77c23f |
MIME-Version: 1.0
|
|
|
77c23f |
Content-Type: text/plain; charset=UTF-8
|
|
|
77c23f |
Content-Transfer-Encoding: 8bit
|
|
|
77c23f |
|
|
|
77c23f |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
77c23f |
Message-id: <20200529055420.16855-8-thuth@redhat.com>
|
|
|
77c23f |
Patchwork-id: 97022
|
|
|
77c23f |
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 07/38] s390x: Beautify diag308 handling
|
|
|
77c23f |
Bugzilla: 1828317
|
|
|
77c23f |
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
77c23f |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
77c23f |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
77c23f |
|
|
|
77c23f |
From: Janosch Frank <frankja@linux.ibm.com>
|
|
|
77c23f |
|
|
|
77c23f |
Let's improve readability by:
|
|
|
77c23f |
* Using constants for the subcodes
|
|
|
77c23f |
* Moving parameter checking into a function
|
|
|
77c23f |
* Removing subcode > 6 check as the default case catches that
|
|
|
77c23f |
|
|
|
77c23f |
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
77c23f |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
77c23f |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
77c23f |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
77c23f |
Message-Id: <20191127175046.4911-6-frankja@linux.ibm.com>
|
|
|
77c23f |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
77c23f |
(cherry picked from commit 0b7fd817e0f383760e37ca9286150d5816cf0594)
|
|
|
77c23f |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
77c23f |
---
|
|
|
77c23f |
target/s390x/diag.c | 54 +++++++++++++++++++++++++++------------------
|
|
|
77c23f |
1 file changed, 32 insertions(+), 22 deletions(-)
|
|
|
77c23f |
|
|
|
77c23f |
diff --git a/target/s390x/diag.c b/target/s390x/diag.c
|
|
|
77c23f |
index 53c2f81f2a..b5aec06d6b 100644
|
|
|
77c23f |
--- a/target/s390x/diag.c
|
|
|
77c23f |
+++ b/target/s390x/diag.c
|
|
|
77c23f |
@@ -53,6 +53,29 @@ int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3)
|
|
|
77c23f |
#define DIAG_308_RC_NO_CONF 0x0102
|
|
|
77c23f |
#define DIAG_308_RC_INVALID 0x0402
|
|
|
77c23f |
|
|
|
77c23f |
+#define DIAG308_RESET_MOD_CLR 0
|
|
|
77c23f |
+#define DIAG308_RESET_LOAD_NORM 1
|
|
|
77c23f |
+#define DIAG308_LOAD_CLEAR 3
|
|
|
77c23f |
+#define DIAG308_LOAD_NORMAL_DUMP 4
|
|
|
77c23f |
+#define DIAG308_SET 5
|
|
|
77c23f |
+#define DIAG308_STORE 6
|
|
|
77c23f |
+
|
|
|
77c23f |
+static int diag308_parm_check(CPUS390XState *env, uint64_t r1, uint64_t addr,
|
|
|
77c23f |
+ uintptr_t ra, bool write)
|
|
|
77c23f |
+{
|
|
|
77c23f |
+ if ((r1 & 1) || (addr & ~TARGET_PAGE_MASK)) {
|
|
|
77c23f |
+ s390_program_interrupt(env, PGM_SPECIFICATION, ra);
|
|
|
77c23f |
+ return -1;
|
|
|
77c23f |
+ }
|
|
|
77c23f |
+ if (!address_space_access_valid(&address_space_memory, addr,
|
|
|
77c23f |
+ sizeof(IplParameterBlock), write,
|
|
|
77c23f |
+ MEMTXATTRS_UNSPECIFIED)) {
|
|
|
77c23f |
+ s390_program_interrupt(env, PGM_ADDRESSING, ra);
|
|
|
77c23f |
+ return -1;
|
|
|
77c23f |
+ }
|
|
|
77c23f |
+ return 0;
|
|
|
77c23f |
+}
|
|
|
77c23f |
+
|
|
|
77c23f |
void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
|
|
|
77c23f |
{
|
|
|
77c23f |
CPUState *cs = env_cpu(env);
|
|
|
77c23f |
@@ -65,30 +88,24 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
|
|
|
77c23f |
return;
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
- if ((subcode & ~0x0ffffULL) || (subcode > 6)) {
|
|
|
77c23f |
+ if (subcode & ~0x0ffffULL) {
|
|
|
77c23f |
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
|
|
|
77c23f |
return;
|
|
|
77c23f |
}
|
|
|
77c23f |
|
|
|
77c23f |
switch (subcode) {
|
|
|
77c23f |
- case 0:
|
|
|
77c23f |
+ case DIAG308_RESET_MOD_CLR:
|
|
|
77c23f |
s390_ipl_reset_request(cs, S390_RESET_MODIFIED_CLEAR);
|
|
|
77c23f |
break;
|
|
|
77c23f |
- case 1:
|
|
|
77c23f |
+ case DIAG308_RESET_LOAD_NORM:
|
|
|
77c23f |
s390_ipl_reset_request(cs, S390_RESET_LOAD_NORMAL);
|
|
|
77c23f |
break;
|
|
|
77c23f |
- case 3:
|
|
|
77c23f |
+ case DIAG308_LOAD_CLEAR:
|
|
|
77c23f |
+ /* Well we still lack the clearing bit... */
|
|
|
77c23f |
s390_ipl_reset_request(cs, S390_RESET_REIPL);
|
|
|
77c23f |
break;
|
|
|
77c23f |
- case 5:
|
|
|
77c23f |
- if ((r1 & 1) || (addr & 0x0fffULL)) {
|
|
|
77c23f |
- s390_program_interrupt(env, PGM_SPECIFICATION, ra);
|
|
|
77c23f |
- return;
|
|
|
77c23f |
- }
|
|
|
77c23f |
- if (!address_space_access_valid(&address_space_memory, addr,
|
|
|
77c23f |
- sizeof(IplParameterBlock), false,
|
|
|
77c23f |
- MEMTXATTRS_UNSPECIFIED)) {
|
|
|
77c23f |
- s390_program_interrupt(env, PGM_ADDRESSING, ra);
|
|
|
77c23f |
+ case DIAG308_SET:
|
|
|
77c23f |
+ if (diag308_parm_check(env, r1, addr, ra, false)) {
|
|
|
77c23f |
return;
|
|
|
77c23f |
}
|
|
|
77c23f |
iplb = g_new0(IplParameterBlock, 1);
|
|
|
77c23f |
@@ -110,15 +127,8 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3, uintptr_t ra)
|
|
|
77c23f |
out:
|
|
|
77c23f |
g_free(iplb);
|
|
|
77c23f |
return;
|
|
|
77c23f |
- case 6:
|
|
|
77c23f |
- if ((r1 & 1) || (addr & 0x0fffULL)) {
|
|
|
77c23f |
- s390_program_interrupt(env, PGM_SPECIFICATION, ra);
|
|
|
77c23f |
- return;
|
|
|
77c23f |
- }
|
|
|
77c23f |
- if (!address_space_access_valid(&address_space_memory, addr,
|
|
|
77c23f |
- sizeof(IplParameterBlock), true,
|
|
|
77c23f |
- MEMTXATTRS_UNSPECIFIED)) {
|
|
|
77c23f |
- s390_program_interrupt(env, PGM_ADDRESSING, ra);
|
|
|
77c23f |
+ case DIAG308_STORE:
|
|
|
77c23f |
+ if (diag308_parm_check(env, r1, addr, ra, true)) {
|
|
|
77c23f |
return;
|
|
|
77c23f |
}
|
|
|
77c23f |
iplb = s390_ipl_get_iplb();
|
|
|
77c23f |
--
|
|
|
77c23f |
2.27.0
|
|
|
77c23f |
|