From nobody Mon Nov 10 12:49:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556198636; cv=none; d=zoho.com; s=zohoarc; b=MBJfiFF9wLu229+Bb/9ZuYxwRRORIn5AJ3+01F6Y4bJZZIaRq/dF/0Uo+zMxCIV+xBS+6HNfh/tXTekGmzs6kjXEBp1RYLvT6lBS/g/D7N6em/kMeuJoBUyMFlRTakmdXN4Xh0SdO+EtS+1TbPY44+EM5oQcUToqnCoxV04B8NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556198636; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=7scBW+OFrBANp2NDEd80877oB+QXRFQusNFRXW1Y8ds=; b=RISpiu4N5m7JjKQzGzeUVyaf51Dd1GN4w5ucJpkmb5iCk/8qYGaGan2dW5VqAlhl38VIIFjB89Gs++yx3FkEHTrcAno4tqfwhbNdZy3sRVjS2qvB63Na73uu430n5cpCTSjcb8pnPeUmlX5qoCuH4qm7xV0GfAaj3jSNcH1HE6w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155619863690115.733762246766673; Thu, 25 Apr 2019 06:23:56 -0700 (PDT) Received: from localhost ([127.0.0.1]:57071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJeLt-0004Tz-My for importer@patchew.org; Thu, 25 Apr 2019 09:23:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJeJw-0003DY-Tc for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:21:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJeJv-0003e4-JV for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:21:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJeJv-0003dP-8r; Thu, 25 Apr 2019 09:21:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 80A625859C; Thu, 25 Apr 2019 13:21:46 +0000 (UTC) Received: from localhost (dhcp-192-187.str.redhat.com [10.33.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A4691001E6C; Thu, 25 Apr 2019 13:21:45 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Thu, 25 Apr 2019 15:21:20 +0200 Message-Id: <20190425132134.2839-6-cohuck@redhat.com> In-Reply-To: <20190425132134.2839-1-cohuck@redhat.com> References: <20190425132134.2839-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 25 Apr 2019 13:21:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/19] s390-bios: Decouple channel i/o logic from virtio X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J. Herne" , qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Jason J. Herne" Create a separate library for channel i/o related code. This decouples channel i/o operations from virtio and allows us to make use of them for the real dasd boot path. Signed-off-by: Jason J. Herne Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth Message-Id: <1554388475-18329-6-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/Makefile | 2 +- pc-bios/s390-ccw/cio.c | 44 ++++++++++++++++++++++++++++++++++++ pc-bios/s390-ccw/cio.h | 3 +++ pc-bios/s390-ccw/main.c | 1 + pc-bios/s390-ccw/netboot.mak | 2 +- pc-bios/s390-ccw/netmain.c | 1 + pc-bios/s390-ccw/s390-ccw.h | 1 - pc-bios/s390-ccw/virtio.c | 27 ++-------------------- 8 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 pc-bios/s390-ccw/cio.c diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 1eb316b02f1f..12ad9c1d5813 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -10,7 +10,7 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all =20 OBJECTS =3D start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ - virtio.o virtio-scsi.o virtio-blkdev.o libc.o + virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o =20 QEMU_CFLAGS :=3D $(filter -W%, $(QEMU_CFLAGS)) QEMU_CFLAGS +=3D -ffreestanding -fno-delete-null-pointer-checks -msoft-flo= at diff --git a/pc-bios/s390-ccw/cio.c b/pc-bios/s390-ccw/cio.c new file mode 100644 index 000000000000..87c6b34e88af --- /dev/null +++ b/pc-bios/s390-ccw/cio.c @@ -0,0 +1,44 @@ +/* + * S390 Channel I/O + * + * Copyright (c) 2013 Alexander Graf + * Copyright (c) 2019 IBM Corp. + * + * Author(s): Jason J. Herne + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#include "libc.h" +#include "s390-ccw.h" +#include "cio.h" + +static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); + +int enable_mss_facility(void) +{ + int ret; + ChscAreaSda *sda_area =3D (ChscAreaSda *) chsc_page; + + memset(sda_area, 0, PAGE_SIZE); + sda_area->request.length =3D 0x0400; + sda_area->request.code =3D 0x0031; + sda_area->operation_code =3D 0x2; + + ret =3D chsc(sda_area); + if ((ret =3D=3D 0) && (sda_area->response.code =3D=3D 0x0001)) { + return 0; + } + return -EIO; +} + +void enable_subchannel(SubChannelId schid) +{ + Schib schib; + + stsch_err(schid, &schib); + schib.pmcw.ena =3D 1; + msch(schid, &schib); +} diff --git a/pc-bios/s390-ccw/cio.h b/pc-bios/s390-ccw/cio.h index ed5b2cbf72db..218fd96ea3a6 100644 --- a/pc-bios/s390-ccw/cio.h +++ b/pc-bios/s390-ccw/cio.h @@ -213,6 +213,9 @@ typedef struct irb { __u32 emw[8]; } __attribute__ ((packed, aligned(4))) Irb; =20 +int enable_mss_facility(void); +void enable_subchannel(SubChannelId schid); + /* * Some S390 specific IO instructions as inline */ diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 67df42191b94..10f04c69068f 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -10,6 +10,7 @@ =20 #include "libc.h" #include "s390-ccw.h" +#include "cio.h" #include "virtio.h" =20 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak index 14e96b2aa611..5eefb7c28939 100644 --- a/pc-bios/s390-ccw/netboot.mak +++ b/pc-bios/s390-ccw/netboot.mak @@ -1,7 +1,7 @@ =20 SLOF_DIR :=3D $(SRC_PATH)/roms/SLOF =20 -NETOBJS :=3D start.o sclp.o virtio.o virtio-net.o jump2ipl.o netmain.o \ +NETOBJS :=3D start.o sclp.o cio.o virtio.o virtio-net.o jump2ipl.o netmain= .o \ libnet.a libc.a =20 LIBC_INC :=3D -nostdinc -I$(SLOF_DIR)/lib/libc/include diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index 0392131c27b3..5189c0fc39e5 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -33,6 +33,7 @@ #include =20 #include "s390-ccw.h" +#include "cio.h" #include "virtio.h" =20 #define DEFAULT_BOOT_RETRIES 10 diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 241c6d0b69be..b39ee5d32314 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -72,7 +72,6 @@ unsigned long virtio_load_direct(ulong rec_list1, ulong r= ec_list2, bool virtio_is_supported(SubChannelId schid); void virtio_blk_setup_device(SubChannelId schid); int virtio_read(ulong sector, void *load_addr); -int enable_mss_facility(void); u64 get_clock(void); ulong get_second(void); =20 diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index cdb66f459e15..aa9da7253fb2 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -10,6 +10,7 @@ =20 #include "libc.h" #include "s390-ccw.h" +#include "cio.h" #include "virtio.h" #include "virtio-scsi.h" #include "bswap.h" @@ -20,8 +21,6 @@ static VRing block[VIRTIO_MAX_VQS]; static char ring_area[VIRTIO_RING_SIZE * VIRTIO_MAX_VQS] __attribute__((__aligned__(PAGE_SIZE))); =20 -static char chsc_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); - static VDev vdev =3D { .nr_vqs =3D 1, .vrings =3D block, @@ -94,14 +93,9 @@ static int run_ccw(VDev *vdev, int cmd, void *ptr, int l= en) { Ccw1 ccw =3D {}; CmdOrb orb =3D {}; - Schib schib; int r; =20 - /* start command processing */ - stsch_err(vdev->schid, &schib); - /* enable the subchannel for IPL device */ - schib.pmcw.ena =3D 1; - msch(vdev->schid, &schib); + enable_subchannel(vdev->schid); =20 /* start subchannel command */ orb.fmt =3D 1; @@ -343,20 +337,3 @@ bool virtio_is_supported(SubChannelId schid) } return false; } - -int enable_mss_facility(void) -{ - int ret; - ChscAreaSda *sda_area =3D (ChscAreaSda *) chsc_page; - - memset(sda_area, 0, PAGE_SIZE); - sda_area->request.length =3D 0x0400; - sda_area->request.code =3D 0x0031; - sda_area->operation_code =3D 0x2; - - ret =3D chsc(sda_area); - if ((ret =3D=3D 0) && (sda_area->response.code =3D=3D 0x0001)) { - return 0; - } - return -EIO; -} --=20 2.17.2