From nobody Sun Feb 8 14:53:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1590009165; cv=none; d=zohomail.com; s=zohoarc; b=DpRVV0j6uq4l6nx2ADKD2Cbhearafd/CIgj4xYpOFOBLRCIx6n4BYglvTUvSZdfMsv0g0q9643iaa65HmaxHMl9ZnzhPyKJVRmhDpueJd4Me2XC/oD9ZSUqYsUMpXT8JAtOl1+5Vu3DM0PR7aGi0EN+/mVU18BNeMVfe9Z8Rlu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590009165; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O+CyqplIKBCRpfPd3Mhk9gTigKQmSePH+dBEL3sW+ok=; b=XOL7KWk9B5cFWJtRl5eYd1AQbMn3mwHXI1+9xkWC7GykrRfMJNpm0loVv9LUqodH8egcXXDMR86QMkmzM7COOfeH0ZikTRpeydgXEorjARwuB02DcS3YoViwE0Y4q3zc3eceC1HdwuZ0GnYw8HfCe1NcSQWPNN92xM/Wu0tE13Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1590009165367356.7628230757945; Wed, 20 May 2020 14:12:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-KRTKXTQPMOaqYh11qxExiA-1; Wed, 20 May 2020 17:12:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09DC9835B45; Wed, 20 May 2020 21:12:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB6AA60C87; Wed, 20 May 2020 21:12:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ABDC154D05; Wed, 20 May 2020 21:12:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04KLCQFB002101 for ; Wed, 20 May 2020 17:12:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 890C22156A2E; Wed, 20 May 2020 21:12:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 755F62166BA3 for ; Wed, 20 May 2020 21:12:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F8D78A5E4C for ; Wed, 20 May 2020 21:12:26 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-0HbLGBBLNC6o5C_BrhU_WA-1; Wed, 20 May 2020 17:12:23 -0400 Received: by mail-qt1-f193.google.com with SMTP id l1so3811988qtp.6 for ; Wed, 20 May 2020 14:12:23 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:fbf2:bc5e:c314:af31:7070]) by smtp.gmail.com with ESMTPSA id z14sm2992031qki.83.2020.05.20.14.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2020 14:12:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590009164; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=O+CyqplIKBCRpfPd3Mhk9gTigKQmSePH+dBEL3sW+ok=; b=Puo4h9D7UWcsOyVq8vn4f6MjXzY2oNa0XV2alx9o1O91fJtgeyD3N19rtgsipNIjCYkMdB t1KIP0vMrdKdi69FYnkdQSzGyjFE8Bsd2Ymso3h2zTiZcp38ggXCpxounZLBP+6JgTwUld KM1XQxUVNRCCU/oERpi6vIJx2CLZgVI= X-MC-Unique: KRTKXTQPMOaqYh11qxExiA-1 X-MC-Unique: 0HbLGBBLNC6o5C_BrhU_WA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O+CyqplIKBCRpfPd3Mhk9gTigKQmSePH+dBEL3sW+ok=; b=n98VWAK7Bu29qgK0b9oBxpkCpjm5rdYBRIoIgplUeQyXtO77ohJU867728h4cAV3Is 35j/bVU3NcPKnbJbm4hOcRiq5s4jst4u7PzFvkCf01fNPzhMolI2d4ruxPKG+UhmBO14 gMn3Yu42TqBQQu07G2bInATImBOpDijgmf7VALlqpTazQJKVGX5oImrWl+DxtniLYAui V/NX4wfbyqKVNmqGeu6Ek4UU77qhcAOQY7bFM5iZ+t8fB2b8Z0vBeBaryaugSx4vKDgI f7uSPi9jCjthgFqrNnaTDeZTYBvYrjtf9/VnE8qRdioXMHEeuWCunIenVTLylM8bmnQT Sx9w== X-Gm-Message-State: AOAM532eni9avT7EhKrG1vG+5TwjBclKqCkLJQxrgRW13VAOUmice00P IMphvPFujHZIDeJFl93e1hJg85hf X-Google-Smtp-Source: ABdhPJzKbqvCrHMHnazhGE0YwpzLBiRW1/kbnPccvMVyCLQ4Jq6puyA37KChfi5lzJT0lqPgVya2cg== X-Received: by 2002:ac8:2db0:: with SMTP id p45mr7028200qta.354.1590009143033; Wed, 20 May 2020 14:12:23 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 09/21] qemu: hotplug: move assignment outside qemuDomainAttachHostPCIDevice Date: Wed, 20 May 2020 18:11:31 -0300 Message-Id: <20200520211143.2980117-10-danielhb413@gmail.com> In-Reply-To: <20200520211143.2980117-1-danielhb413@gmail.com> References: <20200520211143.2980117-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , sbhat@linux.ibm.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Shivaprasad G Bhat No functional change. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_hotplug.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d88a0922d4..6991d7988c 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1605,12 +1605,9 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr drive= r, virDomainHostdevDefPtr hostdev) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_HOSTDEV, - { .hostdev =3D hostdev } }; virDomainDeviceInfoPtr info =3D hostdev->info; int ret; g_autofree char *devstr =3D NULL; - bool releaseaddr =3D false; bool teardowncgroup =3D false; bool teardownlabel =3D false; bool teardowndevice =3D false; @@ -1643,14 +1640,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr drive= r, if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0) goto error; =20 - if (qemuDomainIsPSeries(vm->def)) - /* Isolation groups are only relevant for pSeries guests */ - qemuDomainFillDeviceIsolationGroup(vm->def, &dev); - - if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) - goto error; - releaseaddr =3D true; - if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("guest unexpectedly quit during hotplug")); @@ -1692,9 +1681,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, if (teardownmemlock && qemuDomainAdjustMaxMemLock(vm, false) < 0) VIR_WARN("Unable to reset maximum locked memory on hotplug fail"); =20 - if (releaseaddr) - qemuDomainReleaseDeviceAddress(vm, info); - return -1; } =20 @@ -2934,6 +2920,8 @@ qemuDomainAttachHostDevice(virQEMUDriverPtr driver, virDomainHostdevDefPtr hostdev) { qemuDomainObjPrivatePtr priv =3D vm->privateData; + virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_HOSTDEV, + { .hostdev =3D hostdev } }; =20 if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -2948,7 +2936,15 @@ qemuDomainAttachHostDevice(virQEMUDriverPtr driver, hostdev, priv->qemuCaps) = < 0) return -1; =20 + if (qemuDomainIsPSeries(vm->def)) + /* Isolation groups are only relevant for pSeries guests */ + qemuDomainFillDeviceIsolationGroup(vm->def, &dev); + + if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) + return -1; + if (qemuDomainAttachHostPCIDevice(driver, vm, hostdev) < 0) { + qemuDomainReleaseDeviceAddress(vm, hostdev->info); qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev,= 1); return -1; } --=20 2.26.2