From nobody Sat Nov 23 23:48:34 2024 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1728350398; cv=none; d=zohomail.com; s=zohoarc; b=KU65CZ4Ej0B1adv9UDs0jXAaOMgc02FDZ5SJuvMMQVdIpZjdS8ZIkxPrdBzFDY3JjJJVTYc5R+wfUsE6kIjTAjqPGtkI/SP9R8PIG4Zb9HrBTP28sowVBCs7On0BeisLhGkky5HRCEn3pGMNGCjRIvB/+lKmRc4HAaKhSvQK5qU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728350398; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xrqYhGsRfzkIgI7UJhFw6xZfDl5QI7dFuNb11Xf9od4=; b=NBhSnJ/8el7A9AQ/cUGXQ2WTdd1OlJfGewm5wjEygLgKHh5ne/UDxmQn7dqgQikSG4pZiS4QIRf7HjmUF3UbP3mv4pTP6xFMSfumBx50r+PPjBpLrcXgO5qpN3mIh2LdioWeFJGIHX3EQ+JA57axQOGS5aOi8LAqeIBrwuAGxV0= 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=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728350398569533.9634371868876; Mon, 7 Oct 2024 18:19:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sxyq5-0004Ft-Bl; Mon, 07 Oct 2024 21:16:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxypk-000475-TZ; Mon, 07 Oct 2024 21:16:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sxypj-0008J9-AZ; Mon, 07 Oct 2024 21:16:16 -0400 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4980oLYQ008829; Tue, 8 Oct 2024 01:16:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 424thq02ke-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Oct 2024 01:16:13 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 4981GDPW026912; Tue, 8 Oct 2024 01:16:13 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 424thq02kb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Oct 2024 01:16:13 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 497N6YTp022835; Tue, 8 Oct 2024 01:16:12 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 423jg0s7p7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Oct 2024 01:16:12 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4981GBdf38863230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 Oct 2024 01:16:12 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2FD358043; Tue, 8 Oct 2024 01:16:11 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E0BE58055; Tue, 8 Oct 2024 01:16:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.61.51.58]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 8 Oct 2024 01:16:11 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=xrqYhGsRfzkIg I7UJhFw6xZfDl5QI7dFuNb11Xf9od4=; b=ilfNX6GMQV5YszhSb7WoT2i0vZG6L uHLglsDFoh8V42ua7B6c8/doCZTRM9G5lAqPkA6knpg3iwruLoqUXSjkzYH5P/52 +VEIXBzWpts/lO5QzY3DuoEbqnzdBSjCI2FXBm+E/5tI7VboTvCo1u0HA9mqLNL4 WpKWsnItPI0m0JuOvq9P0KRWDi4NcXu2KDgVGTtsJ+HUwxA6JyJywP3zaJn6h4b4 qTWMVhww+ebRq6voO8wm1GdEkwQG2HLw8GCLnN6zbJXxBx+UO0MM5xp94w3uUK0p yvMFulAHQEW1HTZfq1vcbTuvpN7PJ9H0MV2NAHf4C8LSkMZofHkrOYs2w== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com Cc: frankja@linux.ibm.com, jrossi@linux.ibm.com Subject: [PATCH v3 11/19] pc-bios/s390-ccw: Remove panics from Netboot IPL path Date: Mon, 7 Oct 2024 21:15:44 -0400 Message-ID: <20241008011552.2645520-12-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241008011552.2645520-1-jrossi@linux.ibm.com> References: <20241008011552.2645520-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: _0AVYJyGP-7hVnUWVHxvIuTOh_hxPFD5 X-Proofpoint-GUID: MqcmMynhp5Pj7M9suwlgoPjLMCa_846q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-07_16,2024-10-07_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 adultscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 bulkscore=0 clxscore=1015 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410080006 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=148.163.158.5; envelope-from=jrossi@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1728350399513116600 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Remove panic-on-error from Netboot specific functions so that error recovery may be possible in the future. Functions that would previously panic now provide a return code. Signed-off-by: Jared Rossi --- pc-bios/s390-ccw/s390-ccw.h | 2 +- pc-bios/s390-ccw/bootmap.c | 1 + pc-bios/s390-ccw/netmain.c | 17 +++++++++++------ pc-bios/s390-ccw/virtio-net.c | 7 +++++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 7516e96a14..496dccb2aa 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -58,7 +58,7 @@ unsigned int get_loadparm_index(void); void main(void); =20 /* netmain.c */ -void netmain(void); +int netmain(void); =20 /* sclp.c */ void sclp_print(const char *string); diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 534d900f9e..1874d4bf5e 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -1065,6 +1065,7 @@ void zipl_load(void) =20 if (virtio_get_device_type() =3D=3D VIRTIO_ID_NET) { netmain(); + panic("\n! Cannot IPL from this network !\n"); } =20 if (ipl_scsi()) { diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index bc6ad8695f..0c2329c752 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -464,7 +464,7 @@ static bool find_net_dev(Schib *schib, int dev_no) return false; } =20 -static void virtio_setup(void) +static int virtio_setup(void) { Schib schib; int ssid; @@ -495,10 +495,10 @@ static void virtio_setup(void) } } =20 - IPL_assert(found, "No virtio net device found"); + return found; } =20 -void netmain(void) +int netmain(void) { filename_ip_t fn_ip; int rc, fnlen; @@ -506,11 +506,15 @@ void netmain(void) sclp_setup(); puts("Network boot starting..."); =20 - virtio_setup(); + if (!virtio_setup()) { + puts("No virtio net device found."); + return 1; + } =20 rc =3D net_init(&fn_ip); if (rc) { - panic("Network initialization failed. Halting."); + puts("Network initialization failed."); + return 1; } =20 fnlen =3D strlen(fn_ip.filename); @@ -528,5 +532,6 @@ void netmain(void) jump_to_low_kernel(); } =20 - panic("Failed to load OS from network."); + puts("Failed to load OS from network."); + return 1; } diff --git a/pc-bios/s390-ccw/virtio-net.c b/pc-bios/s390-ccw/virtio-net.c index 2fcb0a58c5..f9854a22c3 100644 --- a/pc-bios/s390-ccw/virtio-net.c +++ b/pc-bios/s390-ccw/virtio-net.c @@ -54,8 +54,11 @@ int virtio_net_init(void *mac_addr) vdev->guest_features[0] =3D VIRTIO_NET_F_MAC_BIT; virtio_setup_ccw(vdev); =20 - IPL_assert(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT, - "virtio-net device does not support the MAC address feature= "); + if (!(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT)) { + puts("virtio-net device does not support the MAC address feature"); + return -1; + } + memcpy(mac_addr, vdev->config.net.mac, ETH_ALEN); =20 for (i =3D 0; i < 64; i++) { --=20 2.45.1