yeahuh / rpms / qemu-kvm

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