|
|
016a62 |
From 9fa5a139c303dd7cedabafda03bcd79807b01086 Mon Sep 17 00:00:00 2001
|
|
|
016a62 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
Date: Mon, 14 Oct 2019 10:06:34 +0100
|
|
|
016a62 |
Subject: [PATCH 09/21] s390-bios: Decouple channel i/o logic from virtio
|
|
|
016a62 |
|
|
|
016a62 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
Message-id: <20191014100645.22862-7-thuth@redhat.com>
|
|
|
016a62 |
Patchwork-id: 91779
|
|
|
016a62 |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 06/17] s390-bios: Decouple channel i/o logic from virtio
|
|
|
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 separate library for channel i/o related code. This decouples
|
|
|
016a62 |
channel i/o operations from virtio and allows us to make use of them for
|
|
|
016a62 |
the real dasd boot path.
|
|
|
016a62 |
|
|
|
016a62 |
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
|
|
|
016a62 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
016a62 |
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
Message-Id: <1554388475-18329-6-git-send-email-jjherne@linux.ibm.com>
|
|
|
016a62 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
(cherry picked from commit 120d04103e3f870d0fcd2a23c2ada0a4a4f036cc)
|
|
|
016a62 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
016a62 |
---
|
|
|
016a62 |
pc-bios/s390-ccw/Makefile | 2 +-
|
|
|
016a62 |
pc-bios/s390-ccw/cio.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
|
016a62 |
pc-bios/s390-ccw/cio.h | 3 +++
|
|
|
016a62 |
pc-bios/s390-ccw/main.c | 1 +
|
|
|
016a62 |
pc-bios/s390-ccw/netboot.mak | 2 +-
|
|
|
016a62 |
pc-bios/s390-ccw/netmain.c | 1 +
|
|
|
016a62 |
pc-bios/s390-ccw/s390-ccw.h | 1 -
|
|
|
016a62 |
pc-bios/s390-ccw/virtio.c | 27 ++-------------------------
|
|
|
016a62 |
8 files changed, 53 insertions(+), 28 deletions(-)
|
|
|
016a62 |
create mode 100644 pc-bios/s390-ccw/cio.c
|
|
|
016a62 |
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
|
|
|
016a62 |
index 439e3cc..acca961 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/Makefile
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/Makefile
|
|
|
016a62 |
@@ -10,7 +10,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw)
|
|
|
016a62 |
.PHONY : all clean build-all
|
|
|
016a62 |
|
|
|
016a62 |
OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
|
|
|
016a62 |
- virtio.o virtio-scsi.o virtio-blkdev.o libc.o
|
|
|
016a62 |
+ virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o
|
|
|
016a62 |
|
|
|
016a62 |
QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS))
|
|
|
016a62 |
QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c
|
|
|
016a62 |
new file mode 100644
|
|
|
016a62 |
index 0000000..87c6b34
|
|
|
016a62 |
--- /dev/null
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/cio.c
|
|
|
016a62 |
@@ -0,0 +1,44 @@
|
|
|
016a62 |
+/*
|
|
|
016a62 |
+ * S390 Channel I/O
|
|
|
016a62 |
+ *
|
|
|
016a62 |
+ * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
|
|
|
016a62 |
+ * Copyright (c) 2019 IBM Corp.
|
|
|
016a62 |
+ *
|
|
|
016a62 |
+ * Author(s): 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 |
+#include "libc.h"
|
|
|
016a62 |
+#include "s390-ccw.h"
|
|
|
016a62 |
+#include "cio.h"
|
|
|
016a62 |
+
|
|
|
016a62 |
+static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
|
|
|
016a62 |
+
|
|
|
016a62 |
+int enable_mss_facility(void)
|
|
|
016a62 |
+{
|
|
|
016a62 |
+ int ret;
|
|
|
016a62 |
+ ChscAreaSda *sda_area = (ChscAreaSda *) chsc_page;
|
|
|
016a62 |
+
|
|
|
016a62 |
+ memset(sda_area, 0, PAGE_SIZE);
|
|
|
016a62 |
+ sda_area->request.length = 0x0400;
|
|
|
016a62 |
+ sda_area->request.code = 0x0031;
|
|
|
016a62 |
+ sda_area->operation_code = 0x2;
|
|
|
016a62 |
+
|
|
|
016a62 |
+ ret = chsc(sda_area);
|
|
|
016a62 |
+ if ((ret == 0) && (sda_area->response.code == 0x0001)) {
|
|
|
016a62 |
+ return 0;
|
|
|
016a62 |
+ }
|
|
|
016a62 |
+ return -EIO;
|
|
|
016a62 |
+}
|
|
|
016a62 |
+
|
|
|
016a62 |
+void enable_subchannel(SubChannelId schid)
|
|
|
016a62 |
+{
|
|
|
016a62 |
+ Schib schib;
|
|
|
016a62 |
+
|
|
|
016a62 |
+ stsch_err(schid, &schib);
|
|
|
016a62 |
+ schib.pmcw.ena = 1;
|
|
|
016a62 |
+ msch(schid, &schib);
|
|
|
016a62 |
+}
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h
|
|
|
016a62 |
index ed5b2cb..218fd96 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/cio.h
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/cio.h
|
|
|
016a62 |
@@ -213,6 +213,9 @@ typedef struct irb {
|
|
|
016a62 |
__u32 emw[8];
|
|
|
016a62 |
} __attribute__ ((packed, aligned(4))) Irb;
|
|
|
016a62 |
|
|
|
016a62 |
+int enable_mss_facility(void);
|
|
|
016a62 |
+void enable_subchannel(SubChannelId schid);
|
|
|
016a62 |
+
|
|
|
016a62 |
/*
|
|
|
016a62 |
* Some S390 specific IO instructions as inline
|
|
|
016a62 |
*/
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
index 67df421..10f04c6 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
@@ -10,6 +10,7 @@
|
|
|
016a62 |
|
|
|
016a62 |
#include "libc.h"
|
|
|
016a62 |
#include "s390-ccw.h"
|
|
|
016a62 |
+#include "cio.h"
|
|
|
016a62 |
#include "virtio.h"
|
|
|
016a62 |
|
|
|
016a62 |
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak
|
|
|
016a62 |
index 4f64128..d17b424 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/netboot.mak
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/netboot.mak
|
|
|
016a62 |
@@ -1,7 +1,7 @@
|
|
|
016a62 |
|
|
|
016a62 |
SLOF_DIR := $(SRC_PATH)/roms/SLOF
|
|
|
016a62 |
|
|
|
016a62 |
-NETOBJS := start.o sclp.o virtio.o virtio-net.o jump2ipl.o netmain.o \
|
|
|
016a62 |
+NETOBJS := start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain.o \
|
|
|
016a62 |
libnet.a libc.a
|
|
|
016a62 |
|
|
|
016a62 |
LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
|
|
|
016a62 |
index d60e84f..4e1b8cf 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/netmain.c
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/netmain.c
|
|
|
016a62 |
@@ -32,6 +32,7 @@
|
|
|
016a62 |
#include <time.h>
|
|
|
016a62 |
|
|
|
016a62 |
#include "s390-ccw.h"
|
|
|
016a62 |
+#include "cio.h"
|
|
|
016a62 |
#include "virtio.h"
|
|
|
016a62 |
|
|
|
016a62 |
#define DEFAULT_BOOT_RETRIES 10
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h
|
|
|
016a62 |
index 241c6d0..b39ee5d 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/s390-ccw.h
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/s390-ccw.h
|
|
|
016a62 |
@@ -72,7 +72,6 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2,
|
|
|
016a62 |
bool virtio_is_supported(SubChannelId schid);
|
|
|
016a62 |
void virtio_blk_setup_device(SubChannelId schid);
|
|
|
016a62 |
int virtio_read(ulong sector, void *load_addr);
|
|
|
016a62 |
-int enable_mss_facility(void);
|
|
|
016a62 |
u64 get_clock(void);
|
|
|
016a62 |
ulong get_second(void);
|
|
|
016a62 |
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
|
|
|
016a62 |
index cdb66f4..aa9da72 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/virtio.c
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/virtio.c
|
|
|
016a62 |
@@ -10,6 +10,7 @@
|
|
|
016a62 |
|
|
|
016a62 |
#include "libc.h"
|
|
|
016a62 |
#include "s390-ccw.h"
|
|
|
016a62 |
+#include "cio.h"
|
|
|
016a62 |
#include "virtio.h"
|
|
|
016a62 |
#include "virtio-scsi.h"
|
|
|
016a62 |
#include "bswap.h"
|
|
|
016a62 |
@@ -20,8 +21,6 @@ static VRing block[VIRTIO_MAX_VQS];
|
|
|
016a62 |
static char ring_area[VIRTIO_RING_SIZE * VIRTIO_MAX_VQS]
|
|
|
016a62 |
__attribute__((__aligned__(PAGE_SIZE)));
|
|
|
016a62 |
|
|
|
016a62 |
-static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
|
|
|
016a62 |
-
|
|
|
016a62 |
static VDev vdev = {
|
|
|
016a62 |
.nr_vqs = 1,
|
|
|
016a62 |
.vrings = block,
|
|
|
016a62 |
@@ -94,14 +93,9 @@ static int run_ccw(VDev *vdev, int cmd, void *ptr, int len)
|
|
|
016a62 |
{
|
|
|
016a62 |
Ccw1 ccw = {};
|
|
|
016a62 |
CmdOrb orb = {};
|
|
|
016a62 |
- Schib schib;
|
|
|
016a62 |
int r;
|
|
|
016a62 |
|
|
|
016a62 |
- /* start command processing */
|
|
|
016a62 |
- stsch_err(vdev->schid, &schib);
|
|
|
016a62 |
- /* enable the subchannel for IPL device */
|
|
|
016a62 |
- schib.pmcw.ena = 1;
|
|
|
016a62 |
- msch(vdev->schid, &schib);
|
|
|
016a62 |
+ enable_subchannel(vdev->schid);
|
|
|
016a62 |
|
|
|
016a62 |
/* start subchannel command */
|
|
|
016a62 |
orb.fmt = 1;
|
|
|
016a62 |
@@ -343,20 +337,3 @@ bool virtio_is_supported(SubChannelId schid)
|
|
|
016a62 |
}
|
|
|
016a62 |
return false;
|
|
|
016a62 |
}
|
|
|
016a62 |
-
|
|
|
016a62 |
-int enable_mss_facility(void)
|
|
|
016a62 |
-{
|
|
|
016a62 |
- int ret;
|
|
|
016a62 |
- ChscAreaSda *sda_area = (ChscAreaSda *) chsc_page;
|
|
|
016a62 |
-
|
|
|
016a62 |
- memset(sda_area, 0, PAGE_SIZE);
|
|
|
016a62 |
- sda_area->request.length = 0x0400;
|
|
|
016a62 |
- sda_area->request.code = 0x0031;
|
|
|
016a62 |
- sda_area->operation_code = 0x2;
|
|
|
016a62 |
-
|
|
|
016a62 |
- ret = chsc(sda_area);
|
|
|
016a62 |
- if ((ret == 0) && (sda_area->response.code == 0x0001)) {
|
|
|
016a62 |
- return 0;
|
|
|
016a62 |
- }
|
|
|
016a62 |
- return -EIO;
|
|
|
016a62 |
-}
|
|
|
016a62 |
--
|
|
|
016a62 |
1.8.3.1
|
|
|
016a62 |
|