thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
016a62
From 256d99ee0acedd9ca8f21c9ebec83eee5e905c9d Mon Sep 17 00:00:00 2001
016a62
From: Thomas Huth <thuth@redhat.com>
016a62
Date: Mon, 14 Oct 2019 10:06:35 +0100
016a62
Subject: [PATCH 10/21] s390-bios: Map low core memory
016a62
016a62
RH-Author: Thomas Huth <thuth@redhat.com>
016a62
Message-id: <20191014100645.22862-8-thuth@redhat.com>
016a62
Patchwork-id: 91786
016a62
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 07/17] s390-bios: Map low core memory
016a62
Bugzilla: 1664376
016a62
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
016a62
RH-Acked-by: David Hildenbrand <david@redhat.com>
016a62
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
016a62
016a62
From: "Jason J. Herne" <jjherne@linux.ibm.com>
016a62
016a62
Create a new header for basic architecture specific definitions and add a
016a62
mapping of low core memory. This mapping will be used by the real dasd boot
016a62
process.
016a62
016a62
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
016a62
Acked-by: Cornelia Huck <cohuck@redhat.com>
016a62
Reviewed-by: Thomas Huth <thuth@redhat.com>
016a62
Message-Id: <1554388475-18329-7-git-send-email-jjherne@linux.ibm.com>
016a62
Signed-off-by: Thomas Huth <thuth@redhat.com>
016a62
(cherry picked from commit c95df3d108028ff5a709ee3aefdb14401b07cb39)
016a62
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
016a62
---
016a62
 pc-bios/s390-ccw/main.c      |  2 +
016a62
 pc-bios/s390-ccw/s390-arch.h | 90 ++++++++++++++++++++++++++++++++++++++++++++
016a62
 2 files changed, 92 insertions(+)
016a62
 create mode 100644 pc-bios/s390-ccw/s390-arch.h
016a62
016a62
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
016a62
index 10f04c6..e403b5f 100644
016a62
--- a/pc-bios/s390-ccw/main.c
016a62
+++ b/pc-bios/s390-ccw/main.c
016a62
@@ -9,6 +9,7 @@
016a62
  */
016a62
 
016a62
 #include "libc.h"
016a62
+#include "s390-arch.h"
016a62
 #include "s390-ccw.h"
016a62
 #include "cio.h"
016a62
 #include "virtio.h"
016a62
@@ -19,6 +20,7 @@ static char loadparm_str[LOADPARM_LEN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
016a62
 QemuIplParameters qipl;
016a62
 IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
016a62
 static bool have_iplb;
016a62
+LowCore const *lowcore; /* Yes, this *is* a pointer to address 0 */
016a62
 
016a62
 #define LOADPARM_PROMPT "PROMPT  "
016a62
 #define LOADPARM_EMPTY  "        "
016a62
diff --git a/pc-bios/s390-ccw/s390-arch.h b/pc-bios/s390-ccw/s390-arch.h
016a62
new file mode 100644
016a62
index 0000000..5e92c7a
016a62
--- /dev/null
016a62
+++ b/pc-bios/s390-ccw/s390-arch.h
016a62
@@ -0,0 +1,90 @@
016a62
+/*
016a62
+ * S390 Basic Architecture
016a62
+ *
016a62
+ * Copyright (c) 2019 Jason J. Herne <jjherne@us.ibm.com>
016a62
+ *
016a62
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
016a62
+ * your option) any later version. See the COPYING file in the top-level
016a62
+ * directory.
016a62
+ */
016a62
+
016a62
+#ifndef S390_ARCH_H
016a62
+#define S390_ARCH_H
016a62
+
016a62
+typedef struct PSW {
016a62
+    uint64_t mask;
016a62
+    uint64_t addr;
016a62
+} __attribute__ ((aligned(8))) PSW;
016a62
+_Static_assert(sizeof(struct PSW) == 16, "PSW size incorrect");
016a62
+
016a62
+/* Older PSW format used by LPSW instruction */
016a62
+typedef struct PSWLegacy {
016a62
+    uint32_t mask;
016a62
+    uint32_t addr;
016a62
+} __attribute__ ((aligned(8))) PSWLegacy;
016a62
+_Static_assert(sizeof(struct PSWLegacy) == 8, "PSWLegacy size incorrect");
016a62
+
016a62
+/* s390 psw bit masks */
016a62
+#define PSW_MASK_IOINT      0x0200000000000000ULL
016a62
+#define PSW_MASK_WAIT       0x0002000000000000ULL
016a62
+#define PSW_MASK_EAMODE     0x0000000100000000ULL
016a62
+#define PSW_MASK_BAMODE     0x0000000080000000ULL
016a62
+#define PSW_MASK_ZMODE      (PSW_MASK_EAMODE | PSW_MASK_BAMODE)
016a62
+
016a62
+/* Low core mapping */
016a62
+typedef struct LowCore {
016a62
+    /* prefix area: defined by architecture */
016a62
+    PSWLegacy       ipl_psw;                  /* 0x000 */
016a62
+    uint32_t        ccw1[2];                  /* 0x008 */
016a62
+    uint32_t        ccw2[2];                  /* 0x010 */
016a62
+    uint8_t         pad1[0x80 - 0x18];        /* 0x018 */
016a62
+    uint32_t        ext_params;               /* 0x080 */
016a62
+    uint16_t        cpu_addr;                 /* 0x084 */
016a62
+    uint16_t        ext_int_code;             /* 0x086 */
016a62
+    uint16_t        svc_ilen;                 /* 0x088 */
016a62
+    uint16_t        svc_code;                 /* 0x08a */
016a62
+    uint16_t        pgm_ilen;                 /* 0x08c */
016a62
+    uint16_t        pgm_code;                 /* 0x08e */
016a62
+    uint32_t        data_exc_code;            /* 0x090 */
016a62
+    uint16_t        mon_class_num;            /* 0x094 */
016a62
+    uint16_t        per_perc_atmid;           /* 0x096 */
016a62
+    uint64_t        per_address;              /* 0x098 */
016a62
+    uint8_t         exc_access_id;            /* 0x0a0 */
016a62
+    uint8_t         per_access_id;            /* 0x0a1 */
016a62
+    uint8_t         op_access_id;             /* 0x0a2 */
016a62
+    uint8_t         ar_access_id;             /* 0x0a3 */
016a62
+    uint8_t         pad2[0xA8 - 0xA4];        /* 0x0a4 */
016a62
+    uint64_t        trans_exc_code;           /* 0x0a8 */
016a62
+    uint64_t        monitor_code;             /* 0x0b0 */
016a62
+    uint16_t        subchannel_id;            /* 0x0b8 */
016a62
+    uint16_t        subchannel_nr;            /* 0x0ba */
016a62
+    uint32_t        io_int_parm;              /* 0x0bc */
016a62
+    uint32_t        io_int_word;              /* 0x0c0 */
016a62
+    uint8_t         pad3[0xc8 - 0xc4];        /* 0x0c4 */
016a62
+    uint32_t        stfl_fac_list;            /* 0x0c8 */
016a62
+    uint8_t         pad4[0xe8 - 0xcc];        /* 0x0cc */
016a62
+    uint64_t        mcic;                     /* 0x0e8 */
016a62
+    uint8_t         pad5[0xf4 - 0xf0];        /* 0x0f0 */
016a62
+    uint32_t        external_damage_code;     /* 0x0f4 */
016a62
+    uint64_t        failing_storage_address;  /* 0x0f8 */
016a62
+    uint8_t         pad6[0x110 - 0x100];      /* 0x100 */
016a62
+    uint64_t        per_breaking_event_addr;  /* 0x110 */
016a62
+    uint8_t         pad7[0x120 - 0x118];      /* 0x118 */
016a62
+    PSW             restart_old_psw;          /* 0x120 */
016a62
+    PSW             external_old_psw;         /* 0x130 */
016a62
+    PSW             svc_old_psw;              /* 0x140 */
016a62
+    PSW             program_old_psw;          /* 0x150 */
016a62
+    PSW             mcck_old_psw;             /* 0x160 */
016a62
+    PSW             io_old_psw;               /* 0x170 */
016a62
+    uint8_t         pad8[0x1a0 - 0x180];      /* 0x180 */
016a62
+    PSW             restart_new_psw;          /* 0x1a0 */
016a62
+    PSW             external_new_psw;         /* 0x1b0 */
016a62
+    PSW             svc_new_psw;              /* 0x1c0 */
016a62
+    PSW             program_new_psw;          /* 0x1d0 */
016a62
+    PSW             mcck_new_psw;             /* 0x1e0 */
016a62
+    PSW             io_new_psw;               /* 0x1f0 */
016a62
+} __attribute__((packed, aligned(8192))) LowCore;
016a62
+
016a62
+extern LowCore const *lowcore;
016a62
+
016a62
+#endif
016a62
-- 
016a62
1.8.3.1
016a62