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