From nobody Sat Apr 11 23:03:20 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1773016636; cv=none; d=zohomail.com; s=zohoarc; b=jO+pKFWocRvFq5FrTLLrBQdlEQ9MsZ5+RqoNnaSMiJ8cNBEg59iZy0I2gjLoj+y55cE8KSP+YHlSQY6TuyLPHPKXmO2CUKryv3gXbu3Vzxhn4mbnXgPMQmyKoQcuzvc4bsnjQSSnYYEQrmsAlZTI2HMOn0BTkvQD3oxfzp5/Ro8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773016636; 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=tYT647uJjQj0loqeIMFQbMYPLziwk199+/Z7uRcbt+g=; b=TpRbM4BlUsxAQz1kT3tJFqmwEua2yRi5TKc33ADV2HT/8lCsIcipfNdG2eyRZ2r3N1Pl9SbFfIIPGYuW90/IE7lUCGj7vwe+bdCICg6mrcW/hhN0+4Ga0con4t2MZUC5u88gCkY1CN0P6PDFgxY3kR/KhBBQqD/qXrPYs2R0/P8= 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 1773016636306820.7603717320274; Sun, 8 Mar 2026 17:37:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vzObx-0006TU-VR; Sun, 08 Mar 2026 20:36:41 -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 1vzObr-0006Pc-8A; Sun, 08 Mar 2026 20:36:35 -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 1vzObp-0001gg-KM; Sun, 08 Mar 2026 20:36:34 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 628IqplV1177331; Mon, 9 Mar 2026 00:36:32 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4crcvr4emt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Mar 2026 00:36:32 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 628Kt5I5009091; Mon, 9 Mar 2026 00:36:31 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4crxqy32xm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Mar 2026 00:36:31 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6290aUll24249010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 9 Mar 2026 00:36:30 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E7565805E; Mon, 9 Mar 2026 00:36:30 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5061858045; Mon, 9 Mar 2026 00:36:29 +0000 (GMT) Received: from t15.ibmuc.com (unknown [9.61.180.105]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 9 Mar 2026 00:36:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=tYT647uJjQj0loqeI MFQbMYPLziwk199+/Z7uRcbt+g=; b=hELw8pnIZWHgH59fM13QDMyPmlv7EJ1m+ KNmagKG4efnl9317gucZ3l9LeptJlRzg3fLPXd6IVIRntHcbg0wmeWfbJPg1hn4k PK820q75XDx01XSL4+0mNLlUp4W7/edSZRXAJ5/HXKfzvsIvvQb6YoL334VwbrCI FJRbu7qQW6b+7WhRZdObOGBq9bUS+EDCJusfvYcVKIn5ZoGsb+05+gMoMTDKhEK0 m9vb7A91jAkCDWa69YzUuNi2R8x4k2ynE8Nl7d+c12vhs6nTyuLvcZATR8RjdhkY G3DKxpvECp5tCGDYO+S/fPrcZzUy8N2Y+VxyVCzSkrKlqph2ZE62w== From: jrossi@linux.ibm.com To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, thuth@redhat.com, mst@redhat.com Cc: jjherne@linux.ibm.com, alifm@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, jrossi@linux.ibm.com, zycai@linux.ibm.com Subject: [PATCH v5 13/15] s390x: Build IPLB for virtio-pci devices Date: Sun, 8 Mar 2026 20:35:59 -0400 Message-ID: <20260309003601.242634-14-jrossi@linux.ibm.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260309003601.242634-1-jrossi@linux.ibm.com> References: <20260309003601.242634-1-jrossi@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDAwMyBTYWx0ZWRfX8ZaJwFejQ6Rb wHlh6/LKU3vTOT/Un+N2Yphc+u2TLApHn4y4ank5INDldE0nZh81CC4EZDKFGnagSKCYkFxfTnI cSN9zdJrFw+UTik8hfE6oJbl2Jn90aQj1anEqi7yxgoi28rVao/PRwGC1sarYtsDTYiHwK1tRHE KEbNHCt/WVaTL73H4nLUpmIC79bUiWT7NC0EpVDLmIOSuoJYid9Oti4awIZpuyqAQLoMR4hkLue bWTUwsofuaaa/snM7pCqj0BF130Kjhj3dW/KGNvSE+ntnFnO4ZJeSksYtu5C63jx4UK3HP9SFmz cybsR0W/OdJM/yHf5FHKD0+HdlkllkGW71EddDHpZLPDKHFPFrpGPkdTcDcL48g3Cd9g+pny7/z CZ9LFFO26F8KKqAz013CNk8D20FwqTxCHRIueAYIEY1DmwZ31kRfPjA1IJh4Wuq/Cu9lYm7NoVg hen1S1KvnHLOf9J8oXw== X-Proofpoint-GUID: 07vTK0OqLy82wKIBZFF7-p9iAUWK2oQN X-Proofpoint-ORIG-GUID: 07vTK0OqLy82wKIBZFF7-p9iAUWK2oQN X-Authority-Analysis: v=2.4 cv=QoFTHFyd c=1 sm=1 tr=0 ts=69ae1610 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8 a=2vq5nSo2ypbVcaHj6lgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-08_07,2026-03-06_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 malwarescore=0 suspectscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090003 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: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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: 1773016638132154100 Content-Type: text/plain; charset="utf-8" From: Jared Rossi Search for a corresponding S390PCIBusDevice and build an IPLB if a device h= as been indexed for boot but does not identify as a CCW device, PCI devices are not yet included in boot probing (they must have a boot ind= ex). Reviewed-by: Thomas Huth Reviewed-by: Eric Farman Signed-off-by: Jared Rossi --- hw/s390x/ipl.c | 56 ++++++++++++++++++++++++++++++--- hw/s390x/ipl.h | 3 ++ hw/s390x/s390-pci-bus.c | 3 +- include/hw/s390x/s390-pci-bus.h | 2 ++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index d34adb5522..53dd3deafa 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -28,6 +28,8 @@ #include "hw/s390x/ebcdic.h" #include "hw/scsi/scsi.h" #include "hw/virtio/virtio-net.h" +#include "hw/virtio/virtio-pci.h" +#include "hw/s390x/s390-pci-bus.h" #include "exec/cpu-common.h" #include "ipl.h" #include "qemu/error-report.h" @@ -340,7 +342,8 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) ipl->qipl.boot_menu_timeout =3D cpu_to_be32(splash_time); } =20 -#define CCW_DEVTYPE_NONE 0x00 +#define S390_DEVTYPE_NONE 0x00 + #define CCW_DEVTYPE_VIRTIO 0x01 #define CCW_DEVTYPE_VIRTIO_NET 0x02 #define CCW_DEVTYPE_SCSI 0x03 @@ -349,7 +352,7 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl) static CcwDevice *s390_get_ccw_device(DeviceState *dev_st, int *devtype) { CcwDevice *ccw_dev =3D NULL; - int tmp_dt =3D CCW_DEVTYPE_NONE; + int tmp_dt =3D S390_DEVTYPE_NONE; =20 if (dev_st) { VirtIONet *virtio_net_dev =3D (VirtIONet *) @@ -396,6 +399,31 @@ static CcwDevice *s390_get_ccw_device(DeviceState *dev= _st, int *devtype) return ccw_dev; } =20 +#define PCI_DEVTYPE_VIRTIO 0x05 + +static S390PCIBusDevice *s390_get_pci_device(DeviceState *dev_st, int *dev= type) +{ + S390PCIBusDevice *pbdev =3D NULL; + int tmp_dt =3D S390_DEVTYPE_NONE; + + if (dev_st) { + PCIDevice *pci_dev =3D (PCIDevice *) + object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent= ), + TYPE_VIRTIO_PCI); + if (pci_dev) { + pbdev =3D s390_pci_find_dev_by_pci(s390_get_phb(), pci_dev); + if (pbdev) { + tmp_dt =3D PCI_DEVTYPE_VIRTIO; + } + } + } + if (devtype) { + *devtype =3D tmp_dt; + } + + return pbdev; +} + static uint64_t s390_ipl_map_iplb_chain(IplParameterBlock *iplb_chain) { S390IPLState *ipl =3D get_ipl_device(); @@ -428,14 +456,12 @@ void s390_ipl_convert_loadparm(char *ascii_lp, uint8_= t *ebcdic_lp) static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb) { CcwDevice *ccw_dev =3D NULL; + S390PCIBusDevice *pbdev =3D NULL; SCSIDevice *sd; int devtype; uint8_t *lp; g_autofree void *scsi_lp =3D NULL; =20 - /* - * Currently allow IPL only from CCW devices. - */ ccw_dev =3D s390_get_ccw_device(dev_st, &devtype); if (ccw_dev) { lp =3D ccw_dev->loadparm; @@ -485,6 +511,26 @@ static bool s390_build_iplb(DeviceState *dev_st, IplPa= rameterBlock *iplb) return true; } =20 + pbdev =3D s390_get_pci_device(dev_st, &devtype); + if (pbdev) { + switch (devtype) { + case PCI_DEVTYPE_VIRTIO: + iplb->len =3D S390_IPLB_MIN_PCI_LEN; + iplb->pbt =3D S390_IPL_TYPE_PCI; + iplb->pci.fid =3D pbdev->fid; + break; + default: + return false; + } + + /* Per-device loadparm not yet supported for non-ccw IPL */ + lp =3D S390_CCW_MACHINE(qdev_get_machine())->loadparm; + s390_ipl_convert_loadparm((char *)lp, iplb->loadparm); + iplb->flags |=3D DIAG308_FLAGS_LP_VALID; + + return true; + } + return false; } =20 diff --git a/hw/s390x/ipl.h b/hw/s390x/ipl.h index c542d30ce2..403cd08450 100644 --- a/hw/s390x/ipl.h +++ b/hw/s390x/ipl.h @@ -107,6 +107,7 @@ QEMU_BUILD_BUG_MSG(offsetof(S390IPLState, iplb) & 3, "a= lignment of iplb wrong"); #define S390_IPLB_MIN_PV_LEN 148 #define S390_IPLB_MIN_CCW_LEN 200 #define S390_IPLB_MIN_FCP_LEN 384 +#define S390_IPLB_MIN_PCI_LEN 376 #define S390_IPLB_MIN_QEMU_SCSI_LEN 200 =20 static inline bool iplb_valid_len(IplParameterBlock *iplb) @@ -179,6 +180,8 @@ static inline bool iplb_valid(IplParameterBlock *iplb) return len >=3D S390_IPLB_MIN_FCP_LEN; case S390_IPL_TYPE_CCW: return len >=3D S390_IPLB_MIN_CCW_LEN; + case S390_IPL_TYPE_PCI: + return len >=3D S390_IPLB_MIN_PCI_LEN; case S390_IPL_TYPE_QEMU_SCSI: default: return false; diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 3166b91c46..4de7b587e8 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -250,8 +250,7 @@ S390PCIBusDevice *s390_pci_find_dev_by_target(S390pciSt= ate *s, return NULL; } =20 -static S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s, - PCIDevice *pci_dev) +S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s, PCIDevice *pci= _dev) { S390PCIBusDevice *pbdev; =20 diff --git a/include/hw/s390x/s390-pci-bus.h b/include/hw/s390x/s390-pci-bu= s.h index f643e13057..9228523ce8 100644 --- a/include/hw/s390x/s390-pci-bus.h +++ b/include/hw/s390x/s390-pci-bus.h @@ -402,6 +402,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(S390pciState = *s, uint32_t fh); S390PCIBusDevice *s390_pci_find_dev_by_fid(S390pciState *s, uint32_t fid); S390PCIBusDevice *s390_pci_find_dev_by_target(S390pciState *s, const char *target); +S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s, + PCIDevice *pci_dev); S390PCIBusDevice *s390_pci_find_next_avail_dev(S390pciState *s, S390PCIBusDevice *pbdev); void s390_pci_ism_reset(void); --=20 2.52.0