From nobody Sun Nov 24 02:16:56 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 1730903773426897.0245533285156; Wed, 6 Nov 2024 06:36:13 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 41729154F; Wed, 6 Nov 2024 09:36:12 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 3366F15F2; Wed, 6 Nov 2024 09:32:13 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 5F6A513A9; Wed, 6 Nov 2024 09:32:06 -0500 (EST) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 CC6781399 for ; Wed, 6 Nov 2024 09:32:04 -0500 (EST) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A6EA42W028850; Wed, 6 Nov 2024 14:32:04 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 42r9ytg3a4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2024 14:32:04 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A65UkeI032050; Wed, 6 Nov 2024 14:32:03 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 42nydmpb7x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Nov 2024 14:32:03 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4A6EVwJ564487810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Nov 2024 14:31:58 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 799612004D; Wed, 6 Nov 2024 14:31:58 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 453322005A; Wed, 6 Nov 2024 14:31:58 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.247]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 6 Nov 2024 14:31:58 +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=CK21eAcdK6PKIsvSg 2GrnAYrCLvBTDBwokleUdBTjuk=; b=K9Yb42K9iuKHmN3Nh/UP0Z9IOB8pBO9d3 rFpK81rug493FHyP+0nrfe5Duli7VjefCw8BX7m92k/nKZGwgz6ZM6a0LjkGcjM8 rAShyWQn4DDaWnKtDj3Po/jRaI8ebi1TLKE+sIOTbCHbz8838WtPE2UIUr5GQkBO w5+VGKnSsFtMBz6ZzQRVxyAveNR447QHuDwKdqxw+sgcM1dQUhX3g5pS3WvrjIUF 69umw1NhSZPIMv8JRXH8yMiEUTPnE75XVUHyHh4xK8EFahMiECUY3xRpyXWEvOD+ BpK30i0cQod7eo4QL3kf/KVB23OXtdqzcpcx7iNkNzyZjHEfYS7+Q== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH 3/3] qemu: command: add multi boot device support on s390x Date: Wed, 6 Nov 2024 15:31:57 +0100 Message-ID: <20241106143157.58978-4-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106143157.58978-1-fiuczy@linux.ibm.com> References: <20241106143157.58978-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: yAj48sEzEYzMmBKmiz3nksB55O5V5VaW X-Proofpoint-ORIG-GUID: yAj48sEzEYzMmBKmiz3nksB55O5V5VaW 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 suspectscore=0 mlxscore=0 spamscore=0 impostorscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411060111 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 65I373PYKO4VXNGCC5HNWH7DTHPTRGET X-Message-ID-Hash: 65I373PYKO4VXNGCC5HNWH7DTHPTRGET 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 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: 1730903774869116600 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 | 40 ++++++++++++--- 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, 346 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..cdc0ea18d7 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; + g_autofree 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,14 @@ 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 (disk->info.loadparm && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D g_strdup(disk->info.loadparm); + } + if (disk->wwn) { unsigned long long w =3D 0; =20 @@ -1791,6 +1797,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 +3623,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); + g_autofree char *bootLoadparm =3D NULL; =20 if (virDomainNetIsVirtioModel(net)) { const char *tx =3D NULL; @@ -3701,11 +3709,16 @@ qemuBuildNicDevProps(virDomainDef *def, =20 virMacAddrFormat(&net->mac, macaddr); =20 + if (net->info.loadparm && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D g_strdup(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 +4764,22 @@ qemuBuildSCSIVHostHostdevDevProps(const virDomainDe= f *def, virJSONValue * qemuBuildSCSIHostdevDevProps(const virDomainDef *def, virDomainHostdevDef *dev, - const char *backendAlias) + const char *backendAlias, + virQEMUCaps *qemuCaps) { + g_autofree char *bootLoadparm =3D NULL; g_autoptr(virJSONValue) props =3D NULL; =20 + if (dev->info->loadparm && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D g_strdup(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 +4860,22 @@ 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; + g_autofree 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 (dev->info->loadparm && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW_DEVICE_LOADPARM)) + bootLoadparm =3D g_strdup(dev->info->loadparm); + if (virJSONValueObjectAdd(&props, "s:driver", qemuBuildHostdevMdevModelTypeStr= ing(mdevsrc), "s:id", dev->info->alias, @@ -4857,6 +4883,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 +4982,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 +5081,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 +6906,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 + +