From nobody Tue Apr 16 22:34:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1678415916; cv=none; d=zohomail.com; s=zohoarc; b=TV0Xl1HJXGxEI/AN8AOcbm6Xvl6ATVo1uMmejyTrRYwXUIxRwFCKIZ5oHmGLBlAhIdWSFURHxKxfb53U24w5jmtjKf4qrzy73Vvst/m+C2y06Gau7kfKMKtew+gSUzXijuAo1MSs2w5lGeAJginhl4PCVODp6PoxwyhCkQh89co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678415916; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=IpD7ZeefVBGEaMOxWcAx+IDyVaF8pggb7Aq/w+Qt+T0=; b=coFe3sy2aWiYXXqS5OjlqP88yHZrxaRSnny9AkA64gd8nxGTbk8hbUApsO+CwPMPv/m+b8C/bMHV98w6FOUQiez3KLCTOqH8BEztaqd+5OAALtMjVOfy4yie5QFX2WRoGnIGt3Jua95F3KBN+lD+ILnxwyz4aAXjraQsR9ABaT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678415916352732.3770597227181; Thu, 9 Mar 2023 18:38:36 -0800 (PST) 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-601-Cf_Lw0_qPe-CHyvDEdEU9A-1; Thu, 09 Mar 2023 21:38:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4CF9811E9C; Fri, 10 Mar 2023 02:38:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3DB6408573E; Fri, 10 Mar 2023 02:38:24 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D3F519466DF; Fri, 10 Mar 2023 02:38:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C7F3A1946597 for ; Fri, 10 Mar 2023 02:38:22 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7413414171B6; Fri, 10 Mar 2023 02:38:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C336140EBF4 for ; Fri, 10 Mar 2023 02:38:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C69B29AA387 for ; Fri, 10 Mar 2023 02:38:22 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-GP5FsyXMOIW4v2wyALVhjA-1; Thu, 09 Mar 2023 21:38:20 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32A1bM50004124 for ; Fri, 10 Mar 2023 02:38:18 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p7bs8a8e0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 10 Mar 2023 02:38:18 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 329H6NVB030496 for ; Fri, 10 Mar 2023 02:38:15 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3p6g8635vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 10 Mar 2023 02:38:15 +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 32A2cC1T32440612 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Mar 2023 02:38:12 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4715E2004B; Fri, 10 Mar 2023 02:38:12 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2882220043; Fri, 10 Mar 2023 02:38:12 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTPS; Fri, 10 Mar 2023 02:38:12 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id D28E6E027B; Fri, 10 Mar 2023 03:38:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678415915; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IpD7ZeefVBGEaMOxWcAx+IDyVaF8pggb7Aq/w+Qt+T0=; b=O7W6RLO0wrwwVVuRUiNZRlNnBMFbptAq++s0Rp10uPGk86EEgPiWg1zT+kd2MuonVXSPUX ADGMUFzDKHJyld0pe9bmaXzv4Zun6wqir99EoXJHNBDVLt2I4zkMfgDnCZONv8YJ+C1nED L84eGS2KL8JlWHYArBcXkPuqI2kpmWI= X-MC-Unique: Cf_Lw0_qPe-CHyvDEdEU9A-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: GP5FsyXMOIW4v2wyALVhjA-1 From: Eric Farman To: libvir-list@redhat.com Subject: [PATCH] qemuAppendLoadparmMachineParm: add loadparm from hostdev Date: Fri, 10 Mar 2023 03:38:09 +0100 Message-Id: <20230310023809.328434-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: SwridjEx42Wf-5mQemnyImcKum8FaIow X-Proofpoint-GUID: SwridjEx42Wf-5mQemnyImcKum8FaIow X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-09_14,2023-03-09_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 mlxscore=0 malwarescore=0 impostorscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303100016 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski , Marc Hartmayer Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678415916941100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit 54fa1b44afc ("conf: Add loadparm boot option for a boot device") added the ability to specify a loadparm parameter on a tag, while commit 29ba41c2d40 ("qemu: Add loadparm to qemu command line string") added that value to the QEMU "-machine" command line parameters. Unfortunately, the latter commit only looked at disks and network devices for boot information, even though anything with VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT could potentially have this tag. In practice, a tag pointing to a passthrough (SCSI or DASD) disk device can be used in this way, which means the loadparm is accepted, but not given to QEMU. Correct this, and add some XML/argv tests. Signed-off-by: Eric Farman Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 24 ++++++++++++++ ...machine-loadparm-hostdev.s390x-latest.args | 33 +++++++++++++++++++ .../machine-loadparm-hostdev.xml | 23 +++++++++++++ tests/qemuxml2argvtest.c | 1 + .../machine-loadparm-hostdev.s390x-latest.xml | 33 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 6 files changed, 115 insertions(+) create mode 100644 tests/qemuxml2argvdata/machine-loadparm-hostdev.s390x-l= atest.args create mode 100644 tests/qemuxml2argvdata/machine-loadparm-hostdev.xml create mode 100644 tests/qemuxml2xmloutdata/machine-loadparm-hostdev.s390x= -latest.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0f0f72fbea..929bcc0be1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6595,6 +6595,30 @@ qemuAppendLoadparmMachineParm(virBuffer *buf, return; } } + + for (i =3D 0; i< def->nhostdevs; i++) { + virDomainHostdevDef *hostdev =3D def->hostdevs[i]; + virDomainHostdevSubsys *subsys =3D &hostdev->source.subsys; + virDomainHostdevSubsysMediatedDev *mdevsrc =3D &subsys->u.mdev; + + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) + continue; + + /* Only get the load parameter from a bootable disk */ + if (subsys->type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && + subsys->type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) + continue; + + /* For MDEV hostdevs, only CCW types are bootable */ + if (subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && + mdevsrc->model !=3D VIR_MDEV_MODEL_TYPE_VFIO_CCW) + continue; + + if (hostdev->info->bootIndex =3D=3D 1 && hostdev->info->loadparm) { + virBufferAsprintf(buf, ",loadparm=3D%s", hostdev->info->loadpa= rm); + return; + } + } } =20 =20 diff --git a/tests/qemuxml2argvdata/machine-loadparm-hostdev.s390x-latest.a= rgs b/tests/qemuxml2argvdata/machine-loadparm-hostdev.s390x-latest.args new file mode 100644 index 0000000000..0b59d67ea1 --- /dev/null +++ b/tests/qemuxml2argvdata/machine-loadparm-hostdev.s390x-latest.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,usb=3Doff,dump-guest-core=3Doff,memory-backend=3D= s390.ram,loadparm=3D2 \ +-accel tcg \ +-cpu qemu \ +-m 512 \ +-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 vfio-ccw,id=3Dhostdev0,sysfsdev=3D/sys/bus/mdev/devices/90c6c135-a= d44-41d0-b1b7-bae47de48627,bootindex=3D1,devno=3Dfe.0.0000 \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0001 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/machine-loadparm-hostdev.xml b/tests/qe= muxml2argvdata/machine-loadparm-hostdev.xml new file mode 100644 index 0000000000..70ce9789cb --- /dev/null +++ b/tests/qemuxml2argvdata/machine-loadparm-hostdev.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 524288 + 524288 + 2 + + hvm + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + +
+ + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 60fc69a92c..c879fa90e0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2629,6 +2629,7 @@ mymain(void) =20 DO_TEST_NOCAPS("machine-loadparm-s390"); DO_TEST_NOCAPS("machine-loadparm-net-s390"); + DO_TEST_CAPS_ARCH_LATEST("machine-loadparm-hostdev", "s390x"); DO_TEST_NOCAPS("machine-loadparm-multiple-disks-nets-s390"); DO_TEST_PARSE_ERROR_NOCAPS("machine-loadparm-s390-char-invalid"); DO_TEST_PARSE_ERROR_NOCAPS("machine-loadparm-s390-len-invalid"); diff --git a/tests/qemuxml2xmloutdata/machine-loadparm-hostdev.s390x-latest= .xml b/tests/qemuxml2xmloutdata/machine-loadparm-hostdev.s390x-latest.xml new file mode 100644 index 0000000000..f564d6deb0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/machine-loadparm-hostdev.s390x-latest.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 524288 + 524288 + 2 + + hvm + + + qemu + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + +