From nobody Thu Nov 21 16:22:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731068386341262.1929998549847; Fri, 8 Nov 2024 04:19:46 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 34170162C; Fri, 8 Nov 2024 07:19:45 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 02F8315E8; Fri, 8 Nov 2024 07:16:54 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id E9DF1E6B; Fri, 8 Nov 2024 07:16:45 -0500 (EST) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 25A52121A for ; Fri, 8 Nov 2024 07:16:44 -0500 (EST) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A8CACIR003608; Fri, 8 Nov 2024 12:16:43 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 42sjdhr0r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Nov 2024 12:16:42 +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 4A83Xgd0023412; Fri, 8 Nov 2024 12:16:42 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 42p14123ud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Nov 2024 12:16:41 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A8CGc0565864072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Nov 2024 12:16:38 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44E2020040; Fri, 8 Nov 2024 12:16:38 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C4AB2004B; Fri, 8 Nov 2024 12:16:38 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.171.131.23]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 8 Nov 2024 12:16:37 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 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=iuHy/PENqW07bhOrT 0F+JztGtjaDqWfUaJZpGFuV8wQ=; b=g4njIyZNBIFoe7VV77EZ/elUs3Wh+SYkg HAOiUhM6+1F9eQuwE/bq2Jb+1p/Bqw0omVIvtikbm6spi5L117JC4E5F5NxUSt3R w5Ynnr+TRLkrDZ/PcF6VS5zYO8AGX9DDCloKaWy7BJGE9p7lAX0LRJvBAw5URkWb LIDihv0jjpY4B2atwqo+tm8chNO5Xyc7nRyifNm8jou1zkCPINXMCKpY+1kI3b0P A8lko4/5IUxkU8LWU4ArbFaw24kLBPRkEorUymYMaY22cQ454WbSD0Dlh7tBiJzn UW8O/ePKtciBVOyHKgfE8AO6yjS2zk9A20KA6+3YRLbrvYT7D2xkQ== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH v2 3/4] qemu: command: add multi boot device support on s390x Date: Fri, 8 Nov 2024 13:16:36 +0100 Message-ID: <20241108121637.74628-4-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108121637.74628-1-fiuczy@linux.ibm.com> References: <20241108121637.74628-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: oDVHVO3po0kwAgWCrFns-u6zZ0lww_fh X-Proofpoint-ORIG-GUID: oDVHVO3po0kwAgWCrFns-u6zZ0lww_fh 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-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411080100 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 25AVFVWR62RTGNVFOQZBHPVAXRMV5FZD X-Message-ID-Hash: 25AVFVWR62RTGNVFOQZBHPVAXRMV5FZD X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: thuth@redhat.com, jrossi@linux.ibm.com, shalini@linux.ibm.com, mhartmay@linux.ibm.com, pkrempa@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731068386835116600 Content-Type: text/plain; charset="utf-8" If QEMU supports multi boot device make use of it instead of using the single boot device machine parameter. Signed-off-by: Boris Fiuczynski Reviewed-by: Peter Krempa --- src/qemu/qemu_command.c | 36 ++++++++++--- src/qemu/qemu_command.h | 6 ++- src/qemu/qemu_hotplug.c | 6 ++- .../machine-loadparm-hostdev.s390x-9.1.0.args | 33 ++++++++++++ .../machine-loadparm-hostdev.s390x-9.1.0.xml | 33 ++++++++++++ ...machine-loadparm-hostdev.s390x-latest.args | 4 +- ...-multiple-disks-nets-s390.s390x-9.1.0.args | 40 +++++++++++++++ ...m-multiple-disks-nets-s390.s390x-9.1.0.xml | 51 +++++++++++++++++++ ...multiple-disks-nets-s390.s390x-latest.args | 8 +-- ...machine-loadparm-net-s390.s390x-9.1.0.args | 34 +++++++++++++ .../machine-loadparm-net-s390.s390x-9.1.0.xml | 32 ++++++++++++ ...achine-loadparm-net-s390.s390x-latest.args | 4 +- .../machine-loadparm-s390.s390x-9.1.0.args | 34 +++++++++++++ .../machine-loadparm-s390.s390x-9.1.0.xml | 33 ++++++++++++ .../machine-loadparm-s390.s390x-latest.args | 4 +- tests/qemuxmlconftest.c | 4 ++ 16 files changed, 342 insertions(+), 20 deletions(-) create mode 100644 tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.= 1.0.args create mode 100644 tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.= 1.0.xml create mode 100644 tests/qemuxmlconfdata/machine-loadparm-multiple-disks-n= ets-s390.s390x-9.1.0.args create mode 100644 tests/qemuxmlconfdata/machine-loadparm-multiple-disks-n= ets-s390.s390x-9.1.0.xml create mode 100644 tests/qemuxmlconfdata/machine-loadparm-net-s390.s390x-9= .1.0.args create mode 100644 tests/qemuxmlconfdata/machine-loadparm-net-s390.s390x-9= .1.0.xml create mode 100644 tests/qemuxmlconfdata/machine-loadparm-s390.s390x-9.1.0= .args create mode 100644 tests/qemuxmlconfdata/machine-loadparm-s390.s390x-9.1.0= .xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a5ff7695c3..f67176fbfd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1608,6 +1608,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, g_autofree char *chardev =3D NULL; g_autofree char *drive =3D NULL; unsigned int bootindex =3D 0; + const char *bootLoadparm =3D NULL; unsigned int logical_block_size =3D disk->blockio.logical_block_size; unsigned int physical_block_size =3D disk->blockio.physical_block_size; unsigned int discard_granularity =3D disk->blockio.discard_granularity; @@ -1746,9 +1747,13 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, } =20 /* bootindex for floppies is configured via the fdc controller */ - if (disk->device !=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) + if (disk->device !=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) { bootindex =3D disk->info.effectiveBootIndex; =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D disk->info.loadparm; + } + if (disk->wwn) { unsigned long long w =3D 0; =20 @@ -1791,6 +1796,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, "S:chardev", chardev, "s:id", disk->info.alias, "p:bootindex", bootindex, + "S:loadparm", bootLoadparm, "p:logical_block_size", logical_block_size, "p:physical_block_size", physical_block_size, "p:discard_granularity", discard_granularity, @@ -3616,6 +3622,7 @@ qemuBuildNicDevProps(virDomainDef *def, g_autoptr(virJSONValue) props =3D NULL; char macaddr[VIR_MAC_STRING_BUFLEN]; g_autofree char *netdev =3D g_strdup_printf("host%s", net->info.alias); + const char *bootLoadparm =3D NULL; =20 if (virDomainNetIsVirtioModel(net)) { const char *tx =3D NULL; @@ -3701,11 +3708,15 @@ qemuBuildNicDevProps(virDomainDef *def, =20 virMacAddrFormat(&net->mac, macaddr); =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D net->info.loadparm; + if (virJSONValueObjectAdd(&props, "s:netdev", netdev, "s:id", net->info.alias, "s:mac", macaddr, "p:bootindex", net->info.effectiveBootIndex, + "S:loadparm", bootLoadparm, NULL) < 0) return NULL; =20 @@ -4751,15 +4762,21 @@ qemuBuildSCSIVHostHostdevDevProps(const virDomainDe= f *def, virJSONValue * qemuBuildSCSIHostdevDevProps(const virDomainDef *def, virDomainHostdevDef *dev, - const char *backendAlias) + const char *backendAlias, + virQEMUCaps *qemuCaps) { + const char *bootLoadparm =3D NULL; g_autoptr(virJSONValue) props =3D NULL; =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D dev->info->loadparm; + if (virJSONValueObjectAdd(&props, "s:driver", "scsi-generic", "s:drive", backendAlias, "s:id", dev->info->alias, "p:bootindex", dev->info->bootIndex, + "S:loadparm", bootLoadparm, NULL) < 0) return NULL; =20 @@ -4840,16 +4857,21 @@ qemuBuildHostdevMdevModelTypeString(virDomainHostde= vSubsysMediatedDev *mdev) =20 virJSONValue * qemuBuildHostdevMediatedDevProps(const virDomainDef *def, - virDomainHostdevDef *dev) + virDomainHostdevDef *dev, + virQEMUCaps *qemuCaps) { g_autoptr(virJSONValue) props =3D NULL; virDomainHostdevSubsysMediatedDev *mdevsrc =3D &dev->source.subsys.u.m= dev; g_autofree char *mdevPath =3D NULL; + const char *bootLoadparm =3D NULL; /* 'ramfb' property must be omitted unless it's to be enabled */ bool ramfb =3D mdevsrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON; =20 mdevPath =3D virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr); =20 + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D dev->info->loadparm; + if (virJSONValueObjectAdd(&props, "s:driver", qemuBuildHostdevMdevModelTypeStr= ing(mdevsrc), "s:id", dev->info->alias, @@ -4857,6 +4879,7 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *= def, "S:display", qemuOnOffAuto(mdevsrc->display), "B:ramfb", ramfb, "p:bootindex", dev->info->bootIndex, + "S:loadparm", bootLoadparm, NULL) < 0) return NULL; =20 @@ -4955,7 +4978,7 @@ qemuBuildHostdevSCSICommandLine(virCommand *cmd, if (qemuBuildBlockStorageSourceAttachDataCommandline(cmd, data, qemuCa= ps) < 0) return -1; =20 - if (!(devprops =3D qemuBuildSCSIHostdevDevProps(def, hostdev, backendA= lias))) + if (!(devprops =3D qemuBuildSCSIHostdevDevProps(def, hostdev, backendA= lias, qemuCaps))) return -1; =20 if (qemuBuildDeviceCommandlineFromJSON(cmd, devprops, def, qemuCaps) <= 0) @@ -5054,7 +5077,7 @@ qemuBuildHostdevCommandLine(virCommand *cmd, return -1; } =20 - if (!(devprops =3D qemuBuildHostdevMediatedDevProps(def, hostd= ev))) + if (!(devprops =3D qemuBuildHostdevMediatedDevProps(def, hostd= ev, qemuCaps))) return -1; =20 if (qemuBuildDeviceCommandlineFromJSON(cmd, devprops, def, qem= uCaps) < 0) @@ -6879,7 +6902,8 @@ qemuBuildMachineCommandLine(virCommand *cmd, virBufferAsprintf(&buf, ",max-cpu-compat=3D%s", cpu->model); } =20 - qemuAppendLoadparmMachineParm(&buf, def); + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + qemuAppendLoadparmMachineParm(&buf, def); =20 if (def->sec) { switch (def->sec->sectype) { diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 309e566f6c..befc3f4ef9 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -179,7 +179,8 @@ qemuBuildUSBHostdevDevProps(const virDomainDef *def, virJSONValue * qemuBuildSCSIHostdevDevProps(const virDomainDef *def, virDomainHostdevDef *dev, - const char *backendAlias); + const char *backendAlias, + virQEMUCaps *qemuCaps); =20 qemuBlockStorageSourceAttachData * qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDef *hostdev, @@ -197,7 +198,8 @@ qemuBuildSCSIVHostHostdevDevProps(const virDomainDef *d= ef, =20 virJSONValue * qemuBuildHostdevMediatedDevProps(const virDomainDef *def, - virDomainHostdevDef *dev); + virDomainHostdevDef *dev, + virQEMUCaps *qemuCaps); =20 virJSONValue * qemuBuildRedirdevDevProps(const virDomainDef *def, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1a7b69e5bb..5db72ef634 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2541,7 +2541,8 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriver *driver, priv->qemuCaps))) goto cleanup; =20 - if (!(devprops =3D qemuBuildSCSIHostdevDevProps(vm->def, hostdev, back= endalias))) + if (!(devprops =3D qemuBuildSCSIHostdevDevProps(vm->def, hostdev, back= endalias, + priv->qemuCaps))) goto cleanup; =20 VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1); @@ -2761,7 +2762,8 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver, =20 qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1); =20 - if (!(devprops =3D qemuBuildHostdevMediatedDevProps(vm->def, hostdev))) + if (!(devprops =3D qemuBuildHostdevMediatedDevProps(vm->def, hostdev, + priv->qemuCaps))) goto cleanup; =20 VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1); diff --git a/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.arg= s b/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.args new file mode 100644 index 0000000000..0a025e6335 --- /dev/null +++ b/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.args @@ -0,0 +1,33 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine s390-ccw-virtio-9.1,usb=3Doff,dump-guest-core=3Doff,memory-backen= d=3Ds390.ram,loadparm=3D2 \ +-accel tcg \ +-cpu qemu \ +-m size=3D524288k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":536870912= }' \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"vfio-ccw","id":"hostdev0","sysfsdev":"/sys/bus/mdev/de= vices/90c6c135-ad44-41d0-b1b7-bae47de48627","bootindex":1,"devno":"fe.0.000= 0"}' \ +-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0001= "}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.xml= b/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.xml new file mode 100644 index 0000000000..119ae6b0fa --- /dev/null +++ b/tests/qemuxmlconfdata/machine-loadparm-hostdev.s390x-9.1.0.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 524288 + 524288 + 2 + + hvm + + + qemu + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + +