From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933899; cv=none; d=zohomail.com; s=zohoarc; b=LVGsDr3x3wl6jlZuIEkbqeHrWmPKSoJWXbFR2/2dPLb+8jQ2Vs0K6/SRoValhQ6iXrkOOo4izsQODI1ZmXCz68T7FXtt2E0zWdAEVeHLYuW5FQUFcRL3C47HI5fjXUmlxiX864Tc35CFEZHwXdoZYhisHEEYYAmiLbZpJW3fwf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933899; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4t7VEPa/ojJsQiA2PTgSSCJRhKVCEL5QrklLOgEsmro=; b=Ge0+petEaN4O3/PcWxnUSE30IFLz6zOPildY3XGOnMkwb3PB9vktGvEfii+xg2yefUvQFQcWRGgnKcX5yusmznGf6+WyfXQ2j8gipUEdUD3BogVHNy1DxVM2uCMBJtMOl7ahj4P2FW44RUZxcu4RKHJGdYq9DfI7BfXS5MKbT7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933899122855.4761075919205; Mon, 4 Jul 2022 04:24:59 -0700 (PDT) Received: from localhost ([::1]:33680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KCH-0004R1-Ub for importer@patchew.org; Mon, 04 Jul 2022 07:24:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37574) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6k-0004gS-Sp for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6i-00067V-Nq for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-QG37Z-U4MN620lzILNtaTA-1; Mon, 04 Jul 2022 07:19:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0E263800C22; Mon, 4 Jul 2022 11:19:08 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6903918EB7; Mon, 4 Jul 2022 11:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4t7VEPa/ojJsQiA2PTgSSCJRhKVCEL5QrklLOgEsmro=; b=eAzMNU9xF15WiRAGmk5InmFWQp/Ez9ngkF2We/tybMsNHMNa7IpS1VeMYTMljZ8vL4uyf0 C2Sx78AYayQnvR6OgnGKYAOgFnDBMcsYBBvstSY0YlgMySu1l6DPNMk5w1u+dsxmIOqMM3 MMIpc6GsRA1FgwXbPuSt82qbsDiddeA= X-MC-Unique: QG37Z-U4MN620lzILNtaTA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 01/12] pc-bios/s390-ccw: Add a proper prototype for main() Date: Mon, 4 Jul 2022 13:18:52 +0200 Message-Id: <20220704111903.62400-2-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933900260100001 Content-Type: text/plain; charset="utf-8" Older versions of Clang complain if there is no prototype for main(). Add one, and while we're at it, make sure that we use the same type for main.c and netmain.c - since the return value does not matter, declare the return type of main() as "void". Reviewed-by: Cornelia Huck Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/s390-ccw.h | 1 + pc-bios/s390-ccw/main.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 79db69ff54..b88e0550ab 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -57,6 +57,7 @@ void write_subsystem_identification(void); void write_iplb_location(void); extern char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); unsigned int get_loadparm_index(void); +void main(void); =20 /* sclp.c */ void sclp_print(const char *string); diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 5d2b7ba94d..835341457d 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -281,7 +281,7 @@ static void probe_boot_device(void) sclp_print("Could not find a suitable boot device (none specified)\n"); } =20 -int main(void) +void main(void) { sclp_setup(); css_setup(); @@ -294,5 +294,4 @@ int main(void) } =20 panic("Failed to load OS from hard disk\n"); - return 0; /* make compiler happy */ } --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933691; cv=none; d=zohomail.com; s=zohoarc; b=QW+e670WYrgVRgB/kdCX1XIsResiV1UmhELp6lEA/KMWkSGivQML3x5lKzze/yJov3JQU7QcgssrqCbIzhg3DkhmWLCEtdzlwzsq4GeD8vZxj8leaDWzkVM3uHbd/Rt2X8KHhlPVNb1U6r4g+hLYdjG5fiPmgYOwAb5DOF01bRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933691; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TTp4lGUtkHqYHBhS8voihx3ydO/ZWv4mIqTL6n8WAfU=; b=PoLkEXtcl0wYMqd0HQQz+tgW9rdWgNCHLyLH/wjvAW/RC54fmWIFADHx5FIQW07d3CtQygsT8ch18YK8L6XcKujdDRAMSnJCTIPPIKrt9ouFzN2J918UA01tSILfQuR8FjFXpndLAWmb4dqUiBA+isZON5SKzGYJa4vXJunGPnI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933691878806.0748240405732; Mon, 4 Jul 2022 04:21:31 -0700 (PDT) Received: from localhost ([::1]:54364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8K8v-0007bW-Po for importer@patchew.org; Mon, 04 Jul 2022 07:21:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6k-0004gU-Qu for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6i-00067X-Qg for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-534-yXOcFa-cOGaQXenwtqEN0g-1; Mon, 04 Jul 2022 07:19:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BE260185A7B2; Mon, 4 Jul 2022 11:19:10 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 582DF9D63; Mon, 4 Jul 2022 11:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TTp4lGUtkHqYHBhS8voihx3ydO/ZWv4mIqTL6n8WAfU=; b=WZzA98jmTxFQ2u/CzVo0Fd2FWE7sqpi0gav+H2AE8hIiDdIW9jxBwmm9W5MATU/R0DHA+/ 1qw1uk5fJDT6EAog/8dUK0QmAXJ/kRb0c6g+vxiZJJkUjHzthVD5kMZwX8kwGc9FW1ETVo YQDVnI+zOIu95wCqWMD70XZBb1wmM+g= X-MC-Unique: yXOcFa-cOGaQXenwtqEN0g-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 02/12] pc-bios/s390-ccw/virtio: Introduce a macro for the DASD block size Date: Mon, 4 Jul 2022 13:18:53 +0200 Message-Id: <20220704111903.62400-3-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933693360100002 Content-Type: text/plain; charset="utf-8" Use VIRTIO_DASD_DEFAULT_BLOCK_SIZE instead of the magic value 4096. Reviewed-by: Eric Farman Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck --- pc-bios/s390-ccw/virtio.h | 1 + pc-bios/s390-ccw/virtio-blkdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h index 19fceb6495..9e410bde6f 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -198,6 +198,7 @@ extern int virtio_read_many(ulong sector, void *load_ad= dr, int sec_num); #define VIRTIO_SECTOR_SIZE 512 #define VIRTIO_ISO_BLOCK_SIZE 2048 #define VIRTIO_SCSI_BLOCK_SIZE 512 +#define VIRTIO_DASD_DEFAULT_BLOCK_SIZE 4096 =20 static inline ulong virtio_sector_adjust(ulong sector) { diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index 7d35050292..6483307630 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -155,7 +155,7 @@ void virtio_assume_eckd(void) vdev->config.blk.physical_block_exp =3D 0; switch (vdev->senseid.cu_model) { case VIRTIO_ID_BLOCK: - vdev->config.blk.blk_size =3D 4096; + vdev->config.blk.blk_size =3D VIRTIO_DASD_DEFAULT_BLOCK_SIZE; break; case VIRTIO_ID_SCSI: vdev->config.blk.blk_size =3D vdev->scsi_block_size; --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933903; cv=none; d=zohomail.com; s=zohoarc; b=QaCupCoOYpqugoU5iFkN1tth9GFpNtgYuA/uIdDpethPD1lQW6jQiqRKl/kTnjDsBBSMk9oaaBe2lKdFJrcyOPfB8gBK1SNh2rTGIAbxsiCqBPUpONAAY3XaJgqHf1iHkMa6rOMyYctnfWuCbdcWoB9rr46m4XfQcDmI4pgXNKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933903; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ByMnW4l1k7X4SZBR6TXHkLPzBPkYHsoxMzTmlcqZgsw=; b=Cdy1G8i96oRwY8cGdgu7Cq8LxOovziCW+slm5n5+sTqDuEDxs4R9rDSu22x1cVn0H4Bn7Su8Ig0Ujjrv1EYtqr+plezo9mci2DiJcM3fl7E4e6FEzIJPu7axWvLDq1ZolwJxhJYa/EAEHZeNJVzSyVy2P0V0gAO9yO6ZtQ+voE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933903863752.6412394916138; Mon, 4 Jul 2022 04:25:03 -0700 (PDT) Received: from localhost ([::1]:33952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KCM-0004bx-1D for importer@patchew.org; Mon, 04 Jul 2022 07:25:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6q-0004jK-9u for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6o-00068s-MF for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-Y9X9KsUKOVyBsPwH-UvlTA-1; Mon, 04 Jul 2022 07:19:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77062185A7A4; Mon, 4 Jul 2022 11:19:12 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33B4718EB7; Mon, 4 Jul 2022 11:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933558; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ByMnW4l1k7X4SZBR6TXHkLPzBPkYHsoxMzTmlcqZgsw=; b=JCmisKqN5VcXSldBlQ+h9Oi6MIJmXyVb4YAs3taC4OVyWRhvU184ZVXwjVsCvh6foxrJkv QwsUPCFhZDUb8SWKhQl5Uqaoc9Sky+ESJfFaoMqOB8tGioRxhCuQSRFTyf5UHVXXAcndCb W/954GvAWLvS6JXnHJe5es4aCFyoLQM= X-MC-Unique: Y9X9KsUKOVyBsPwH-UvlTA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 03/12] pc-bios/s390-ccw/bootmap: Improve the guessing logic in zipl_load_vblk() Date: Mon, 4 Jul 2022 13:18:54 +0200 Message-Id: <20220704111903.62400-4-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933904159100001 Content-Type: text/plain; charset="utf-8" The logic of trying an final ISO or ECKD boot on virtio-block devices is very weird: Since the geometry hardly ever matches in virtio_disk_is_scsi(), virtio_blk_setup_device() always sets a "guessed" disk geometry via virtio_assume_scsi() (which is certainly also wrong in a lot of cases). zipl_load_vblk() then sees that there's been a "virtio_guessed_disk_nature" and tries to fix up the geometry again via virtio_assume_iso9660() before always trying to do ipl_iso_el_torito(). That's a very brain-twisting way of attempting to boot from ISO images, which won't work anymore after the following patches that will clean up the virtio_assume_scsi() mess (and thus get rid of the "virtio_guessed_disk_nature" here). Let's try a better approach instead: ISO files always have a magic string "CD001" at offset 0x8001 (see e.g. the ECMA-119 specification) which we can use to decide whether we should try to boot in ISO 9660 mode (which we should also try if we see a sector size of 2048). And if we were not able to boot in ISO mode here, the final boot attempt before panicking is to boot in ECKD mode. Since this is our last boot attempt anyway, simply always assume the ECKD geometry here (if the sector size was not 4096 yet), so that we also do not depend on the guessed disk geometry from virtio_blk_setup_device() here anymore. Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 56411ab3b6..994e59c0b0 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -780,18 +780,37 @@ static void ipl_iso_el_torito(void) } } =20 +/** + * Detect whether we're trying to boot from an .ISO image. + * These always have a signature string "CD001" at offset 0x8001. + */ +static bool has_iso_signature(void) +{ + int blksize =3D virtio_get_block_size(); + + if (!blksize || virtio_read(0x8000 / blksize, sec)) { + return false; + } + + return !memcmp("CD001", &sec[1], 5); +} + /*********************************************************************** * Bus specific IPL sequences */ =20 static void zipl_load_vblk(void) { - if (virtio_guessed_disk_nature()) { - virtio_assume_iso9660(); + int blksize =3D virtio_get_block_size(); + + if (blksize =3D=3D VIRTIO_ISO_BLOCK_SIZE || has_iso_signature()) { + if (blksize !=3D VIRTIO_ISO_BLOCK_SIZE) { + virtio_assume_iso9660(); + } + ipl_iso_el_torito(); } - ipl_iso_el_torito(); =20 - if (virtio_guessed_disk_nature()) { + if (blksize !=3D VIRTIO_DASD_DEFAULT_BLOCK_SIZE) { sclp_print("Using guessed DASD geometry.\n"); virtio_assume_eckd(); } --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933698; cv=none; d=zohomail.com; s=zohoarc; b=OLN/UWzpAz70sAM0TdDR1dFVb4apsVKcetuk1/cEm8EBp8iiAKv8DzPWiKhenNCY/z6hHV0ljy1zQyylmz+s7UysjBHdHeeQBYuRCPxGedrL2VLcdPsM05nBfKCkDsgSXbLvdOQfTNYcU5CSTos6a6GXbGAP/R13GUjYyTdbs4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933698; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=54TPWvO5F0oPpO0aR0CjILu6g93M39HEYjjsuIG8ePE=; b=GaSAr4jhD8myXem0LCFsutVIA1eMl1AKM3SWXZSllLkRbT+uYauyLCfp1NZqpAouFe3MKs6WQvq68R/6I4687CndyHRHB7BvvxxgeWb+xwbvPB1HFMPTprZdlHkiWQPLUaIn8j16+8EGM1d6reZ3BD6ckmyb2tFNpeNtZJM1SlU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933698793708.7282052595443; Mon, 4 Jul 2022 04:21:38 -0700 (PDT) Received: from localhost ([::1]:54794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8K92-0007tD-Nj for importer@patchew.org; Mon, 04 Jul 2022 07:21:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6n-0004h5-N2 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42798) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6m-00068J-4T for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:17 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-Ihmmu23pOOOstsSNA6KrIw-1; Mon, 04 Jul 2022 07:19:14 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1310D3800C29; Mon, 4 Jul 2022 11:19:14 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id D239F111F5; Mon, 4 Jul 2022 11:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933555; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=54TPWvO5F0oPpO0aR0CjILu6g93M39HEYjjsuIG8ePE=; b=NjjOL/+dCQ/ecIRkpjh0y6hn/iWCGT3IuWYlALU0MUjIFTubwBVwKvFEG/CM1WD2isjH7n IfgvhwOn3wl6dqpie7tbiUgGpLcq8lAlFWr2AiGqGpuWYjVqJsbBXqQ6WyHTLJ9wxRK87t TUI9KW2d+z4N0e+x0BKTq860HMmq8jU= X-MC-Unique: Ihmmu23pOOOstsSNA6KrIw-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 04/12] pc-bios/s390-ccw/virtio-blkdev: Simplify/fix virtio_ipl_disk_is_valid() Date: Mon, 4 Jul 2022 13:18:55 +0200 Message-Id: <20220704111903.62400-5-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933699268100001 Content-Type: text/plain; charset="utf-8" The s390-ccw bios fails to boot if the boot disk is a virtio-blk disk with a sector size of 4096. For example: dasdfmt -b 4096 -d cdl -y -p -M quick /dev/dasdX fdasd -a /dev/dasdX install a guest onto /dev/dasdX1 using virtio-blk qemu-system-s390x -nographic -hda /dev/dasdX1 The bios then bails out with: ! Cannot read block 0 ! Looking at virtio_ipl_disk_is_valid() and especially the function virtio_disk_is_scsi(), it does not really make sense that we expect only such a limited disk geometry (like a block size of 512) for our boot disks. Let's relax the check and allow everything that remotely looks like a sane disk. Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.h | 2 -- pc-bios/s390-ccw/virtio-blkdev.c | 41 ++++++-------------------------- 2 files changed, 7 insertions(+), 36 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h index 9e410bde6f..241730effe 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -186,8 +186,6 @@ void virtio_assume_scsi(void); void virtio_assume_eckd(void); void virtio_assume_iso9660(void); =20 -extern bool virtio_disk_is_scsi(void); -extern bool virtio_disk_is_eckd(void); extern bool virtio_ipl_disk_is_valid(void); extern int virtio_get_block_size(void); extern uint8_t virtio_get_heads(void); diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index 6483307630..7e13155589 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -166,46 +166,19 @@ void virtio_assume_eckd(void) virtio_eckd_sectors_for_block_size(vdev->config.blk.blk_size); } =20 -bool virtio_disk_is_scsi(void) -{ - VDev *vdev =3D virtio_get_device(); - - if (vdev->guessed_disk_nature =3D=3D VIRTIO_GDN_SCSI) { - return true; - } - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_BLOCK: - return (vdev->config.blk.geometry.heads =3D=3D 255) - && (vdev->config.blk.geometry.sectors =3D=3D 63) - && (virtio_get_block_size() =3D=3D VIRTIO_SCSI_BLOCK_SIZE); - case VIRTIO_ID_SCSI: - return true; - } - return false; -} - -bool virtio_disk_is_eckd(void) +bool virtio_ipl_disk_is_valid(void) { + int blksize =3D virtio_get_block_size(); VDev *vdev =3D virtio_get_device(); - const int block_size =3D virtio_get_block_size(); =20 - if (vdev->guessed_disk_nature =3D=3D VIRTIO_GDN_DASD) { + if (vdev->guessed_disk_nature =3D=3D VIRTIO_GDN_SCSI || + vdev->guessed_disk_nature =3D=3D VIRTIO_GDN_DASD) { return true; } - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_BLOCK: - return (vdev->config.blk.geometry.heads =3D=3D 15) - && (vdev->config.blk.geometry.sectors =3D=3D - virtio_eckd_sectors_for_block_size(block_size)); - case VIRTIO_ID_SCSI: - return false; - } - return false; -} =20 -bool virtio_ipl_disk_is_valid(void) -{ - return virtio_disk_is_scsi() || virtio_disk_is_eckd(); + return (vdev->senseid.cu_model =3D=3D VIRTIO_ID_BLOCK || + vdev->senseid.cu_model =3D=3D VIRTIO_ID_SCSI) && + blksize >=3D 512 && blksize <=3D 4096; } =20 int virtio_get_block_size(void) --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934132; cv=none; d=zohomail.com; s=zohoarc; b=RMdDe+7mz8M2fRBkZD2JbezrHvA4gORLgi4VBMLFrTG3Th6e9sBcPizXUGbcKji4kNt8gvhlvbuBTZID0Q9x2qwle9SxpI5lSZKHiby/LC9BT+9M9A1rNcJv+bKcAaPYu2f93KNn6431djeCaf7lObXZHSdBI9y3tJ9dy/4Vepc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934132; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0L6GcYZUTPokVBF5m9l4BIhXRyXP3ZFbcpPICVVzolU=; b=VJluEtUX9epKSQMm/KXfWsk9JMebHfHzDZhovhWBEeQi0IrR+Ytq3ej4bsDm5+0pQDCAICO6+22hHiqmhGZ8RhhzwljeFbEFc4nOtJ6nklWEpQLaybhS/m2GZtniDracoM7IknVTKR0voJBvKgQ9wBMD50jJL0iahETJJdcAPPs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934132957102.78178883863427; Mon, 4 Jul 2022 04:28:52 -0700 (PDT) Received: from localhost ([::1]:40308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KG3-0000dp-23 for importer@patchew.org; Mon, 04 Jul 2022 07:28:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6s-0004rL-J1 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43764) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6q-00069P-UY for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:22 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-SeKpHe5TOFKRNIq_b-ky3w-1; Mon, 04 Jul 2022 07:19:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB01B380673B; Mon, 4 Jul 2022 11:19:16 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5880918EB7; Mon, 4 Jul 2022 11:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0L6GcYZUTPokVBF5m9l4BIhXRyXP3ZFbcpPICVVzolU=; b=cP2UInVywIdaAmHjnA7yEHd0pzKNypaLlHb3zAhZxe4cHmV8h3e7ydl07fjzRHUhc9S4bH w4GmaHvHrH5u3yq7I0QvIMT8HVLt/WuSrxv/OvDIjAZJFIyd5C37nAVKZ0o7IGV4hrTOBS CRkIDHBLUwYaA8yG0z5FezUZ+wjtfeM= X-MC-Unique: SeKpHe5TOFKRNIq_b-ky3w-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 05/12] pc-bios/s390-ccw/virtio-blkdev: Remove virtio_assume_scsi() Date: Mon, 4 Jul 2022 13:18:56 +0200 Message-Id: <20220704111903.62400-6-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934134667100001 Content-Type: text/plain; charset="utf-8" The virtio_assume_scsi() function is very questionable: First, it is only called for virtio-blk, and not for virtio-scsi, so the naming is already quite confusing. Second, it is called if we detected a "invalid" IPL disk, trying to fix it by blindly setting a sector size of 512. This of course won't work in most cases since disks might have a different sector size for a reason. Thus let's remove this strange function now. The calling code can also be removed completely, since there is another spot in main.c that does "IPL_assert(virtio_ipl_disk_is_valid(), ...)" to make sure that we do not try to IPL from an invalid device. Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.h | 1 - pc-bios/s390-ccw/virtio-blkdev.c | 24 ------------------------ 2 files changed, 25 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h index 241730effe..600ba5052b 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -182,7 +182,6 @@ enum guessed_disk_nature_type { typedef enum guessed_disk_nature_type VirtioGDN; =20 VirtioGDN virtio_guessed_disk_nature(void); -void virtio_assume_scsi(void); void virtio_assume_eckd(void); void virtio_assume_iso9660(void); =20 diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index 7e13155589..db1f7f44aa 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -112,23 +112,6 @@ VirtioGDN virtio_guessed_disk_nature(void) return virtio_get_device()->guessed_disk_nature; } =20 -void virtio_assume_scsi(void) -{ - VDev *vdev =3D virtio_get_device(); - - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_BLOCK: - vdev->guessed_disk_nature =3D VIRTIO_GDN_SCSI; - vdev->config.blk.blk_size =3D VIRTIO_SCSI_BLOCK_SIZE; - vdev->config.blk.physical_block_exp =3D 0; - vdev->blk_factor =3D 1; - break; - case VIRTIO_ID_SCSI: - vdev->scsi_block_size =3D VIRTIO_SCSI_BLOCK_SIZE; - break; - } -} - void virtio_assume_iso9660(void) { VDev *vdev =3D virtio_get_device(); @@ -247,13 +230,6 @@ int virtio_blk_setup_device(SubChannelId schid) switch (vdev->senseid.cu_model) { case VIRTIO_ID_BLOCK: sclp_print("Using virtio-blk.\n"); - if (!virtio_ipl_disk_is_valid()) { - /* make sure all getters but blocksize return 0 for - * invalid IPL disk - */ - memset(&vdev->config.blk, 0, sizeof(vdev->config.blk)); - virtio_assume_scsi(); - } break; case VIRTIO_ID_SCSI: IPL_assert(vdev->config.scsi.sense_size =3D=3D VIRTIO_SCSI_SENSE_S= IZE, --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934143; cv=none; d=zohomail.com; s=zohoarc; b=I5/cu03BvuxmZNeU82l+1/B6t0nH3kVh9reKT9FuN27sD3UuEm/q7bJZi4XUOtMwpdd/tmxpTWVEYQWIZ8kQ/ZR1i2dL5nTdr9VBkUrvri//P5218RW778rRmeNz/k6LZqQqQKE7yb1uDs4DtW3O40LXV79crWsL+vmJAEpe02o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934143; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BnIq8K47yRUPyVjixpm1UOHdRgzZNEmdcXAHpHp++ig=; b=GBevDtQN6brne0dq8PqoE9pio6fe71uuBOl3Uhwfz3vFKk4BY+vbiJmLThW2kElrWxKyM+UWWT1mCWUxjqfO6ROcG3WsAEA16rPvclMTlQ/486p85hEsrLoMa6UyiAQQJtCm5h9L9AHgyEytuyhO+8t4Z6AcqoTNd0pmoH4Ezpg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934143857981.5444969676943; Mon, 4 Jul 2022 04:29:03 -0700 (PDT) Received: from localhost ([::1]:40734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KGE-0000vE-Eh for importer@patchew.org; Mon, 04 Jul 2022 07:29:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6u-0004xP-AR for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6s-00069o-Ka for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:23 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-tFCr_UNGOZ6Lb7oyZXunjQ-1; Mon, 04 Jul 2022 07:19:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75607811E80; Mon, 4 Jul 2022 11:19:18 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B3679D63; Mon, 4 Jul 2022 11:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BnIq8K47yRUPyVjixpm1UOHdRgzZNEmdcXAHpHp++ig=; b=a6hurD32VdQVUc4Z5dpU85IMSXBTA6d0RQtmAiSAGK7sxvLYbRbZz622MBk57HMrQckklk iBaFDRT676465FvXUSQF9zn+owcToSE80DNpKydOJ3OtOtouNX/VC9MEbIremVN6cfsI7h IgHrFPRuVyua6Xvsj3G/oLB/xrPazow= X-MC-Unique: tFCr_UNGOZ6Lb7oyZXunjQ-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 06/12] pc-bios/s390-ccw/virtio: Set missing status bits while initializing Date: Mon, 4 Jul 2022 13:18:57 +0200 Message-Id: <20220704111903.62400-7-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934144586100001 Content-Type: text/plain; charset="utf-8" According chapter "3.1.1 Driver Requirements: Device Initialization" of the Virtio specification (v1.1), a driver for a device has to set the ACKNOWLEDGE and DRIVER bits in the status field after resetting the device. The s390-ccw bios skipped these steps so far and seems like QEMU never cared. Anyway, it's better to follow the spec, so let's set these bits now in the right spots, too. Acked-by: Christian Borntraeger Reviewed-by: Cornelia Huck Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 5d2c6e3381..4e85a2eb82 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -220,7 +220,7 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd) void virtio_setup_ccw(VDev *vdev) { int i, rc, cfg_size =3D 0; - unsigned char status =3D VIRTIO_CONFIG_S_DRIVER_OK; + uint8_t status; struct VirtioFeatureDesc { uint32_t features; uint8_t index; @@ -234,6 +234,10 @@ void virtio_setup_ccw(VDev *vdev) =20 run_ccw(vdev, CCW_CMD_VDEV_RESET, NULL, 0, false); =20 + status =3D VIRTIO_CONFIG_S_ACKNOWLEDGE; + rc =3D run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), fa= lse); + IPL_assert(rc =3D=3D 0, "Could not write ACKNOWLEDGE status to host"); + switch (vdev->senseid.cu_model) { case VIRTIO_ID_NET: vdev->nr_vqs =3D 2; @@ -253,6 +257,11 @@ void virtio_setup_ccw(VDev *vdev) default: panic("Unsupported virtio device\n"); } + + status |=3D VIRTIO_CONFIG_S_DRIVER; + rc =3D run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), fa= lse); + IPL_assert(rc =3D=3D 0, "Could not write DRIVER status to host"); + IPL_assert( run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false) = =3D=3D 0, "Could not get block device configuration"); @@ -291,9 +300,10 @@ void virtio_setup_ccw(VDev *vdev) run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false) =3D= =3D 0, "Cannot set VQ info"); } - IPL_assert( - run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false= ) =3D=3D 0, - "Could not write status to host"); + + status |=3D VIRTIO_CONFIG_S_DRIVER_OK; + rc =3D run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), fa= lse); + IPL_assert(rc =3D=3D 0, "Could not write DRIVER_OK status to host"); } =20 bool virtio_is_supported(SubChannelId schid) --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933700; cv=none; d=zohomail.com; s=zohoarc; b=Hcmx6fVg2iwzKhuH5QjCCf6dbQFJ0bZSTshxqjvCx0cDv9ei+MSB55CjwPr7WJ7mUNDjN2XyVTsdXMsJlTDRGb+CpcMfyYv05r54ljEP4VbACRmWPUOPT4uZGewAUzoKFk6cv23XdolBnpENjYdD6SJ3gEgjHE60Om045r5qRIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933700; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vemXszL/zZhFrS+Oe+Xd07vzIB6xTWRAJ2VMxvCnVvM=; b=APDH/Tjn5INDTHzmB9BFY0KUVtPBJeVX9i52g7HJpjD9PKTUhDM1Vbq87Qcplso/Wa96fLo6N8H5GrWXr2AzLGYiYnT6aItgQfJmmNWYDt026pJjTrvBQnRVFxbkEsvuoNFeQ1noZbIje+qMOf+wfHWHmcn6u2IVNVCw6aUsp5Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933700096727.5369204795728; Mon, 4 Jul 2022 04:21:40 -0700 (PDT) Received: from localhost ([::1]:54964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8K94-00081C-MB for importer@patchew.org; Mon, 04 Jul 2022 07:21:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6v-00051w-JS for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6u-0006AE-1I for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-lYWeiXjgMoO11T8Swm3fsw-1; Mon, 04 Jul 2022 07:19:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA53282A684; Mon, 4 Jul 2022 11:19:19 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7C6D111F5; Mon, 4 Jul 2022 11:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vemXszL/zZhFrS+Oe+Xd07vzIB6xTWRAJ2VMxvCnVvM=; b=fOkOVju+a7eLUJZw6/5MsAAs1osm/Vgww/iUdjq5fJZJ0eKoTUCuzIEUTQeOExkueGuD9T YFIg3eYw9su0FRKZdSs52f6iM7UPZCRcCSrKyB74F2ogG1KLqQu/zfLl46+jkJL7Nx4230 4cquZBD1t8N1rbiZlxj6fyIDYJl2CzE= X-MC-Unique: lYWeiXjgMoO11T8Swm3fsw-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 07/12] pc-bios/s390-ccw/virtio: Read device config after feature negotiation Date: Mon, 4 Jul 2022 13:18:58 +0200 Message-Id: <20220704111903.62400-8-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933701200100003 Content-Type: text/plain; charset="utf-8" Feature negotiation should be done first, since some fields in the config area can depend on the negotiated features and thus should rather be read afterwards. While we're at it, also adjust the error message here a little bit (the code is nowadays used for non-block virtio devices, too). Reviewed-by: Eric Farman Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 4e85a2eb82..d8c2b52710 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -262,10 +262,6 @@ void virtio_setup_ccw(VDev *vdev) rc =3D run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), fa= lse); IPL_assert(rc =3D=3D 0, "Could not write DRIVER status to host"); =20 - IPL_assert( - run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false) = =3D=3D 0, - "Could not get block device configuration"); - /* Feature negotiation */ for (i =3D 0; i < ARRAY_SIZE(vdev->guest_features); i++) { feats.features =3D 0; @@ -278,6 +274,9 @@ void virtio_setup_ccw(VDev *vdev) IPL_assert(rc =3D=3D 0, "Could not set features bits"); } =20 + rc =3D run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false= ); + IPL_assert(rc =3D=3D 0, "Could not get virtio device configuration"); + for (i =3D 0; i < vdev->nr_vqs; i++) { VqInfo info =3D { .queue =3D (unsigned long long) ring_area + (i * VIRTIO_RING_S= IZE), --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656933907; cv=none; d=zohomail.com; s=zohoarc; b=mOeDDTRsFU3cP+VeahbDdDk4eKX9QmodSEI3gkmCxpOIAHGNbQCLhadXE5BiEUVIFw69xljcDO63g9lFbNbp/B4Lw77BOZ1ntuQjkuHXh9drY3XARF954L8WyvS0qTlx+ad5U/W9fMGEs/Ttpexc2z9/++tXM7Dth3Jn/BdKkww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656933907; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eegZhr/wPhKo6h+TROf3G4UtgT1+NVlDN9MpcLBp8G8=; b=cTnjhLXV2g3uzNBXF5KxSzpzK5kB70VLIdeTMwFQReP+SoJx9RcYtkzIU+tLT5BPJa6BeM/hk3fFtkjCYoMlZzzn1btbcIuwGP6JtiiwNmOUfaiOe2SH8nX/WHY1oVwpsapAGkiHSsjXlho8MDC124/IvhAssoLv5+NhHRP/9QY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656933907662904.1482844182906; Mon, 4 Jul 2022 04:25:07 -0700 (PDT) Received: from localhost ([::1]:34236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KCP-0004ng-KC for importer@patchew.org; Mon, 04 Jul 2022 07:25:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6x-00057w-6b for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6v-0006Aq-MS for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:26 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-445-tc-3gAdcM7e7LXAegIvPqg-1; Mon, 04 Jul 2022 07:19:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9206B29ABA13; Mon, 4 Jul 2022 11:19:21 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 376E918EB7; Mon, 4 Jul 2022 11:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eegZhr/wPhKo6h+TROf3G4UtgT1+NVlDN9MpcLBp8G8=; b=J3ZT2DhRtnRqalkFQZEl86lTi6PgE1DFifw0S/g1eNjwofy3lhXe8M7ND87n76rwbTE7if C88zExrgFuO3D7T0WSLcd9XB5jGA/stIpKwXd8zEUk3ORy64W+AyRzas9Wb8IqjBtoqDfF aoHH3ew9Jf6UKpYQSTRqwZFQ8TT0SsI= X-MC-Unique: tc-3gAdcM7e7LXAegIvPqg-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 08/12] pc-bios/s390-ccw/virtio: Beautify the code for reading virtqueue configuration Date: Mon, 4 Jul 2022 13:18:59 +0200 Message-Id: <20220704111903.62400-9-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656933908211100001 Content-Type: text/plain; charset="utf-8" It looks nicer if we separate the run_ccw() from the IPL_assert() statement, and the error message should talk about "virtio device" instead of "block device", since this code is nowadays used for non-block (i.e. network) devices, too. Reviewed-by: Cornelia Huck Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index d8c2b52710..f37510f312 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -289,9 +289,8 @@ void virtio_setup_ccw(VDev *vdev) .num =3D 0, }; =20 - IPL_assert( - run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config), f= alse) =3D=3D 0, - "Could not get block device VQ configuration"); + rc =3D run_ccw(vdev, CCW_CMD_READ_VQ_CONF, &config, sizeof(config)= , false); + IPL_assert(rc =3D=3D 0, "Could not get virtio device VQ configurat= ion"); info.num =3D config.num; vring_init(&vdev->vrings[i], &info); vdev->vrings[i].schid =3D vdev->schid; --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934136; cv=none; d=zohomail.com; s=zohoarc; b=gAyGB0Tv89xDxYb7ut+Lp4OPJT4hNymEb8t+B7OwLqDaVzfwQ5RSeOcahCXtcbjYKW2yaKXVWTVEvvogf7YTCvpMiL8aNobul1IOkcXyR/cSqphwXlq7AKECLcidgjlF0W4mdoDATauKqxDYkEN5KgUBnGRHauGCO1loMHlbRtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934136; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EzqsnGIpHv07tJnyrX5tGMG5fTka9bwsmFinZTnmDCM=; b=nARTMsm2cYeHdK4CBKzKfpyWWIHndYXUqYo81XObjvFql/466Zjgn32qHALo4fA4JacrilKyliARuw9OZvbafZrilgTBGfj6PeBJIrYYJhN1fGelJgrLBQTHEKIl2x/lmYeH1foYLKK2ah4TQYmwORUGQgm2y24Mj/6XwCSFRq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934136949947.8194539544833; Mon, 4 Jul 2022 04:28:56 -0700 (PDT) Received: from localhost ([::1]:40656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KG7-0000s8-NP for importer@patchew.org; Mon, 04 Jul 2022 07:28:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6z-0005Dt-9K for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:57302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6x-0006BH-GV for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-379-PgdfGTUjNH69PrvujiOsdQ-1; Mon, 04 Jul 2022 07:19:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7201A101A586; Mon, 4 Jul 2022 11:19:23 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5ABC9D63; Mon, 4 Jul 2022 11:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EzqsnGIpHv07tJnyrX5tGMG5fTka9bwsmFinZTnmDCM=; b=Pb5jcBnDIP8QW0uvJ3QNcWdydg1NMSN4Z0yFmKISg61v7Lz1h3ZMB1mjroAo0VH4p8Jq3O 5XlXEDj8GebADHv5LCtPfTB9BdDlGmdL4FjSCo6uMs6QJ+YtnCbSc2Xj+/DQxdIu5g1hss aiZIuuJpowYLzQNjKt7WYdyddEyU4FA= X-MC-Unique: PgdfGTUjNH69PrvujiOsdQ-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 09/12] pc-bios/s390-ccw: Split virtio-scsi code from virtio_blk_setup_device() Date: Mon, 4 Jul 2022 13:19:00 +0200 Message-Id: <20220704111903.62400-10-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934138509100001 Content-Type: text/plain; charset="utf-8" The next patch is going to add more virtio-block specific code to virtio_blk_setup_device(), and if the virtio-scsi code is also in there, this is more cumbersome. And the calling function virtio_setup() in main.c looks at the device type already anyway, so it's more logical to separate the virtio-scsi stuff into a new function in virtio-scsi.c instead. Reviewed-by: Eric Farman Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio-scsi.h | 2 +- pc-bios/s390-ccw/main.c | 24 +++++++++++++++++------- pc-bios/s390-ccw/virtio-blkdev.c | 20 ++------------------ pc-bios/s390-ccw/virtio-scsi.c | 19 ++++++++++++++++++- 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/pc-bios/s390-ccw/virtio-scsi.h b/pc-bios/s390-ccw/virtio-scsi.h index 4b14c2c2f9..e6b6cd4815 100644 --- a/pc-bios/s390-ccw/virtio-scsi.h +++ b/pc-bios/s390-ccw/virtio-scsi.h @@ -67,8 +67,8 @@ static inline bool virtio_scsi_response_ok(const VirtioSc= siCmdResp *r) return r->response =3D=3D VIRTIO_SCSI_S_OK && r->status =3D=3D CDB= _STATUS_GOOD; } =20 -int virtio_scsi_setup(VDev *vdev); int virtio_scsi_read_many(VDev *vdev, ulong sector, void *load_addr, int sec_num); +int virtio_scsi_setup_device(SubChannelId schid); =20 #endif /* VIRTIO_SCSI_H */ diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 835341457d..a2def83e82 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -14,6 +14,7 @@ #include "s390-ccw.h" #include "cio.h" #include "virtio.h" +#include "virtio-scsi.h" #include "dasd-ipl.h" =20 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE))); @@ -218,6 +219,7 @@ static int virtio_setup(void) { VDev *vdev =3D virtio_get_device(); QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; + int ret; =20 memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); =20 @@ -225,18 +227,26 @@ static int virtio_setup(void) menu_setup(); } =20 - if (virtio_get_device_type() =3D=3D VIRTIO_ID_NET) { + switch (vdev->senseid.cu_model) { + case VIRTIO_ID_NET: sclp_print("Network boot device detected\n"); vdev->netboot_start_addr =3D qipl.netboot_start_addr; - } else { - int ret =3D virtio_blk_setup_device(blk_schid); - if (ret) { - return ret; - } + return 0; + case VIRTIO_ID_BLOCK: + ret =3D virtio_blk_setup_device(blk_schid); + break; + case VIRTIO_ID_SCSI: + ret =3D virtio_scsi_setup_device(blk_schid); + break; + default: + panic("\n! No IPL device available !\n"); + } + + if (!ret) { IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detect= ed"); } =20 - return 0; + return ret; } =20 static void ipl_boot_device(void) diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index db1f7f44aa..c175b66a47 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -222,27 +222,11 @@ uint64_t virtio_get_blocks(void) int virtio_blk_setup_device(SubChannelId schid) { VDev *vdev =3D virtio_get_device(); - int ret =3D 0; =20 vdev->schid =3D schid; virtio_setup_ccw(vdev); =20 - switch (vdev->senseid.cu_model) { - case VIRTIO_ID_BLOCK: - sclp_print("Using virtio-blk.\n"); - break; - case VIRTIO_ID_SCSI: - IPL_assert(vdev->config.scsi.sense_size =3D=3D VIRTIO_SCSI_SENSE_S= IZE, - "Config: sense size mismatch"); - IPL_assert(vdev->config.scsi.cdb_size =3D=3D VIRTIO_SCSI_CDB_SIZE, - "Config: CDB size mismatch"); + sclp_print("Using virtio-blk.\n"); =20 - sclp_print("Using virtio-scsi.\n"); - ret =3D virtio_scsi_setup(vdev); - break; - default: - panic("\n! No IPL device available !\n"); - } - - return ret; + return 0; } diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index 2c8d0f3097..3b7069270c 100644 --- a/pc-bios/s390-ccw/virtio-scsi.c +++ b/pc-bios/s390-ccw/virtio-scsi.c @@ -329,7 +329,7 @@ static void scsi_parse_capacity_report(void *data, } } =20 -int virtio_scsi_setup(VDev *vdev) +static int virtio_scsi_setup(VDev *vdev) { int retry_test_unit_ready =3D 3; uint8_t data[256]; @@ -430,3 +430,20 @@ int virtio_scsi_setup(VDev *vdev) =20 return 0; } + +int virtio_scsi_setup_device(SubChannelId schid) +{ + VDev *vdev =3D virtio_get_device(); + + vdev->schid =3D schid; + virtio_setup_ccw(vdev); + + IPL_assert(vdev->config.scsi.sense_size =3D=3D VIRTIO_SCSI_SENSE_SIZE, + "Config: sense size mismatch"); + IPL_assert(vdev->config.scsi.cdb_size =3D=3D VIRTIO_SCSI_CDB_SIZE, + "Config: CDB size mismatch"); + + sclp_print("Using virtio-scsi.\n"); + + return virtio_scsi_setup(vdev); +} --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934338; cv=none; d=zohomail.com; s=zohoarc; b=l47nFGhHok4iC849Wul8WFoiqSLX25dBaBc1q8IYc9/5TwS2kpf3YaDDH9ZYpNKtmPoRlPX8q2EeXw2k8i2nKbqos0BMQGOKsJeDaEPpjXaeJ4KyXb5jbqlQ5FSLv6zpWE68rJBmLMRR4MXnD+kn65ieZcNNLJQ4kB2JFPc5kyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934338; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SlRGPnIUys9DZlFlBUzlEZyOS18xHUancL7tVyGiXDE=; b=CVrTO6ZYB6JBaFuIHfJM5XHA+UPG41HpqXOQfysFhd5iLSBfGK9DCcosaLZuDsluNI7NblFLwjWUARQFKJZsMQxdjt1Z4y4+thRQkQl34I7iqbQSRF/QBwZxh9fILbvC7FEhW/iq38QydIPHglwgXsPEnKwFXYATHM34Fqwkk+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934338271371.1367819511978; Mon, 4 Jul 2022 04:32:18 -0700 (PDT) Received: from localhost ([::1]:46922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KJM-0005Aa-UW for importer@patchew.org; Mon, 04 Jul 2022 07:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K71-0005Ki-GO for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34071) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K6z-0006Bd-Ur for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:31 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-364-PEisRZZpOsqzhifgM4LNjA-1; Mon, 04 Jul 2022 07:19:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0746D3800C26; Mon, 4 Jul 2022 11:19:25 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7D0B111F5; Mon, 4 Jul 2022 11:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SlRGPnIUys9DZlFlBUzlEZyOS18xHUancL7tVyGiXDE=; b=Gc6dysZkabue0TfiUb2X/nY+WdTv+Nug4OAulevwc9RSJg6xGjUuk8ATGSRPLdHspGLH2G WZNU6bfABmA0HL6vzjMlVuYDHF2QDMrQ3hGhSkPvofV/pVXpPfbtB3VPB8Qr0E82pU+hFH UgW0DAM0i79/FpXYKNQU40hdC3FCd00= X-MC-Unique: PEisRZZpOsqzhifgM4LNjA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 10/12] pc-bios/s390-ccw/virtio-blkdev: Request the right feature bits Date: Mon, 4 Jul 2022 13:19:01 +0200 Message-Id: <20220704111903.62400-11-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934340037100001 Content-Type: text/plain; charset="utf-8" The virtio-blk code uses the block size and geometry fields in the config area. According to the virtio-spec, these have to be negotiated with the right feature bits during initialization, otherwise they might not be available. QEMU is so far very forgiving and always provides them, but we should not rely on this behavior, so let's better request them properly via the VIRTIO_BLK_F_GEOMETRY and VIRTIO_BLK_F_BLK_SIZE feature bits. Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio-blkdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index c175b66a47..8271c47296 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -13,6 +13,9 @@ #include "virtio.h" #include "virtio-scsi.h" =20 +#define VIRTIO_BLK_F_GEOMETRY (1 << 4) +#define VIRTIO_BLK_F_BLK_SIZE (1 << 6) + static int virtio_blk_read_many(VDev *vdev, ulong sector, void *load_addr, int sec_num) { @@ -223,6 +226,7 @@ int virtio_blk_setup_device(SubChannelId schid) { VDev *vdev =3D virtio_get_device(); =20 + vdev->guest_features[0] =3D VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_BLK_S= IZE; vdev->schid =3D schid; virtio_setup_ccw(vdev); =20 --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934350; cv=none; d=zohomail.com; s=zohoarc; b=VuD/JOUINs80qStxKt6wig7aWXwhnW9/b+QA9pwPOaXynWjWZS7yprifofhbhkvMlzxohWQ96ZWKsTGowjKLRqYjDQkwn+GFrklYPp+Il5qSjGn0XAlVQmP1mKPRZZWvWZ803+xwL7gwsADVyhYT6vFB8eGMC2q8m1dKGCwVY48= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934350; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bmLNbLifLzhq735IgMEN63m8oALUC85unF8AlfSIXPo=; b=TH/a8yQklnpNVEQX9qK3a2ockGrw3ooX5zd46uJvhjHA/Mxl74qyuchzHFW9bNYDWyCZXc2NGPKriRLjueYB4Z/oyfVirOfNlFMHpZZlVCOtEPMtFxL/PbSXTzHrTbPI7Fo25WK7kMc/wPI2wbv/PdXu+M0HGC3ffKuEQ812/x8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934350679581.9792886560855; Mon, 4 Jul 2022 04:32:30 -0700 (PDT) Received: from localhost ([::1]:47362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KJZ-0005Tf-Jv for importer@patchew.org; Mon, 04 Jul 2022 07:32:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K73-0005Qk-3U for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K71-0006By-In for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:32 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-xWFzAYpWMyaZPdNbjC46-g-1; Mon, 04 Jul 2022 07:19:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 911F53C0F365; Mon, 4 Jul 2022 11:19:26 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49FC59D63; Mon, 4 Jul 2022 11:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bmLNbLifLzhq735IgMEN63m8oALUC85unF8AlfSIXPo=; b=Q0usl3josdd9P2tRdv9zGULnj1HJz/j05zfZGy/ZqUlpYSlf9V7zG9YHM5PokHpg1oSr1/ Yq9iQicKJfibFdmyIVeYPgAbR7Hxa4WumhEGpDSYFbpzHJ0q12afcYkDkcKSMQ597gTkee ctEcrpe8fhiWluRV4bhFAu2ioBNIP98= X-MC-Unique: xWFzAYpWMyaZPdNbjC46-g-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 11/12] pc-bios/s390-ccw/virtio: Remove "extern" keyword from prototypes Date: Mon, 4 Jul 2022 13:19:02 +0200 Message-Id: <20220704111903.62400-12-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934352010100001 Content-Type: text/plain; charset="utf-8" All the other protytpes in the headers here do not use the "extern" keyword, so let's unify this by removing the "extern" from the misfits, too. Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/virtio.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h index 600ba5052b..e657d381ec 100644 --- a/pc-bios/s390-ccw/virtio.h +++ b/pc-bios/s390-ccw/virtio.h @@ -185,12 +185,12 @@ VirtioGDN virtio_guessed_disk_nature(void); void virtio_assume_eckd(void); void virtio_assume_iso9660(void); =20 -extern bool virtio_ipl_disk_is_valid(void); -extern int virtio_get_block_size(void); -extern uint8_t virtio_get_heads(void); -extern uint8_t virtio_get_sectors(void); -extern uint64_t virtio_get_blocks(void); -extern int virtio_read_many(ulong sector, void *load_addr, int sec_num); +bool virtio_ipl_disk_is_valid(void); +int virtio_get_block_size(void); +uint8_t virtio_get_heads(void); +uint8_t virtio_get_sectors(void); +uint64_t virtio_get_blocks(void); +int virtio_read_many(ulong sector, void *load_addr, int sec_num); =20 #define VIRTIO_SECTOR_SIZE 512 #define VIRTIO_ISO_BLOCK_SIZE 2048 --=20 2.31.1 From nobody Sun Feb 8 21:34:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656934516; cv=none; d=zohomail.com; s=zohoarc; b=cUae0uX0UCUiDUyS29VVBjnDrzrqxvev4nvS1gnH0tdjeH+hInjpP+MLD1ZV3JT6B/EIWUHNBOa7zycUEtbJf67AuDiMCFYp2SzMHUPYkrtb9cnmKX0vZGD24XQd4XHHbzEwXfQxPsCrDNIDZzLMG7L3nfx2drT+REu6f41fXUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656934516; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wZkB4YCKbEOQ3cVW3xIzgZwiKYKdMLoqEvIeInN6QKc=; b=IoIc4pdsDLZP3GYhrDi/YYVGpyc22ONEJMV+wuxkALTTbkAe7fhMyiZSDhNX6jXyr3FoHrcibEGYc5KewbKxC/Cof0/BvmwUrYARNN+Yk1oo+2CKmyQZk4/ccHj6LQAdWxSftQIs5AuN8p/h1vFzUx+zWwPAA8pz87Ly7+pEZpU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656934516087298.4463452491435; Mon, 4 Jul 2022 04:35:16 -0700 (PDT) Received: from localhost ([::1]:51322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8KMD-00089y-OQ for importer@patchew.org; Mon, 04 Jul 2022 07:35:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K75-0005YB-VG for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42523) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8K73-0006CC-Bd for qemu-devel@nongnu.org; Mon, 04 Jul 2022 07:19:35 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-151-h-I-A2SzN1qiUWGsn2wr9w-1; Mon, 04 Jul 2022 07:19:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C8273806729; Mon, 4 Jul 2022 11:19:28 +0000 (UTC) Received: from thuth.com (unknown [10.39.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF95E18EB7; Mon, 4 Jul 2022 11:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656933571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wZkB4YCKbEOQ3cVW3xIzgZwiKYKdMLoqEvIeInN6QKc=; b=FY9LU3qhwoFKuF5DGhHIqPBwV5e21qGayUxABXxdvUCbOkeWl2lIhU/7qhrQsU+cvZLcBF Pe22ntSlaVK8dIhv/8W1poqKwSLz6KndaMCJt+xS/rylpTgFRH9XrXQM+qSXaRoTaN/ra0 MXxEwI6afNhbdHewAU6CtYVNNMzF/Ic= X-MC-Unique: h-I-A2SzN1qiUWGsn2wr9w-1 From: Thomas Huth To: qemu-s390x@nongnu.org, Eric Farman Cc: qemu-devel@nongnu.org, Christian Borntraeger , Cornelia Huck Subject: [PATCH v2 12/12] pc-bios/s390-ccw/netboot.mak: Ignore Clang's warnings about GNU extensions Date: Mon, 4 Jul 2022 13:19:03 +0200 Message-Id: <20220704111903.62400-13-thuth@redhat.com> In-Reply-To: <20220704111903.62400-1-thuth@redhat.com> References: <20220704111903.62400-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656934517034100001 Content-Type: text/plain; charset="utf-8" When compiling the s390-ccw bios with Clang (v14.0), there is currently an unuseful warning like this: CC pc-bios/s390-ccw/ipv6.o ../../roms/SLOF/lib/libnet/ipv6.c:447:18: warning: variable length array folded to constant array as an extension [-Wgnu-folding-constant] unsigned short raw[ip6size]; ^ SLOF is currently GCC-only and cannot be compiled with Clang yet, so it is expected that such extensions sneak in there - and as long as we don't want to compile the code with a compiler that is neither GCC or Clang, it is also not necessary to avoid such extensions. Thus these GNU-extension related warnings are completely useless in the s390-ccw bios, especially in the code that is coming from SLOF, so we should simply disable the related warnings here now. Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/netboot.mak | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak index 1a06befa4b..057f13bdb4 100644 --- a/pc-bios/s390-ccw/netboot.mak +++ b/pc-bios/s390-ccw/netboot.mak @@ -16,9 +16,12 @@ s390-netboot.elf: $(NETOBJS) libnet.a libc.a s390-netboot.img: s390-netboot.elf $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET= _DIR)$@") =20 +# SLOF is GCC-only, so ignore warnings about GNU extensions with Clang here +NO_GNU_WARN :=3D $(call cc-option,-Werror $(QEMU_CFLAGS),-Wno-gnu) + # libc files: =20 -LIBC_CFLAGS =3D $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +LIBC_CFLAGS =3D $(QEMU_CFLAGS) $(CFLAGS) $(NO_GNU_WARN) $(LIBC_INC) $(LIBN= ET_INC) \ -MMD -MP -MT $@ -MF $(@:%.o=3D%.d) =20 CTYPE_OBJS =3D isdigit.o isxdigit.o toupper.o @@ -52,7 +55,7 @@ libc.a: $(LIBCOBJS) =20 LIBNETOBJS :=3D args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \ dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o -LIBNETCFLAGS =3D $(QEMU_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \ +LIBNETCFLAGS =3D $(QEMU_CFLAGS) $(CFLAGS) $(NO_GNU_WARN) $(LIBC_INC) $(LIB= NET_INC) \ -DDHCPARCH=3D0x1F -MMD -MP -MT $@ -MF $(@:%.o=3D%.d) =20 %.o : $(SLOF_DIR)/lib/libnet/%.c --=20 2.31.1