From nobody Thu Nov 28 16:32:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521099205316557.2910585163921; Thu, 15 Mar 2018 00:33:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B4167F7A7; Thu, 15 Mar 2018 07:33:24 +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 BFA6C608F4; Thu, 15 Mar 2018 07:33:23 +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 7CB644CAA3; Thu, 15 Mar 2018 07:33:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2EHJmrD024676 for ; Wed, 14 Mar 2018 13:20:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0989F5D70B; Wed, 14 Mar 2018 17:19:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 015255D753 for ; Wed, 14 Mar 2018 17:19:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8655E7E9C2 for ; Wed, 14 Mar 2018 17:19:43 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2EHImGj105816 for ; Wed, 14 Mar 2018 13:19:43 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gq6nev108-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 14 Mar 2018 13:19:42 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Mar 2018 17:19:40 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 14 Mar 2018 17:19:38 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2EHJcoK50528356 for ; Wed, 14 Mar 2018 17:19:38 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EEE3A4051 for ; Wed, 14 Mar 2018 17:12:27 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E544A404D for ; Wed, 14 Mar 2018 17:12:26 +0000 (GMT) Received: from localhost.localdomain (unknown [9.79.182.166]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Wed, 14 Mar 2018 17:12:26 +0000 (GMT) From: Shivaprasad G Bhat To: libvir-list@redhat.com Date: Wed, 14 Mar 2018 22:49:35 +0530 In-Reply-To: <152104711186.10112.1077788328340024644.stgit@localhost.localdomain> References: <152104711186.10112.1077788328340024644.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18031417-0040-0000-0000-0000042079D5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18031417-0041-0000-0000-000026237F3E Message-Id: <152104795960.10112.16299515500617305394.stgit@localhost.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-14_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803140192 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Mar 2018 17:19:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Mar 2018 17:19:43 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'sbhat@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.701 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 11/28] qemu: address: Separate the slots into multiple aggregates 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 15 Mar 2018 07:33:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Today's aggregate flag with the slot being true for pcie-root-ports is not enough as there will more number of aggregates depending on the number of Multifuntion PCI cards assigned to the domain. The aggregate is changed to unsigned int and Zero means Not Applicable, 1 is reserved for the pcie-root-ports and >=3D 2 for the the PCI multifunction cards(coming..). Signed-off-by: Shivaprasad G Bhat --- src/conf/device_conf.h | 1=20 src/conf/domain_addr.c | 43 ++++++++++++++------- src/conf/domain_addr.h | 36 ++++++++--------- src/qemu/qemu_domain_address.c | 83 +++++++++++++++++++++++++++++++++---= ---- src/qemu/qemu_domain_address.h | 8 ++++ 5 files changed, 123 insertions(+), 48 deletions(-) diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index f87d6f1fc6..cdb2040fb8 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -163,6 +163,7 @@ struct _virDomainDeviceInfo { * assignment, never saved and never reported. */ int pciConnectFlags; /* enum virDomainPCIConnectFlags */ + unsigned int aggregateSlotIdx; /* Used when the aggregate flag is set = */ char *loadparm; =20 /* PCI devices will only be automatically placed on a PCI bus diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 0c914fe25c..c4a0b99628 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -63,7 +63,7 @@ virDomainPCIControllerModelToConnectType(virDomainControl= lerModelPCI model) return VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: - return VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT | VIR_PCI_CONNECT_AGGRE= GATE_SLOT; + return VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT; =20 case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: return VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT; @@ -565,6 +565,7 @@ virDomainPCIAddressReserveAddrInternal(virDomainPCIAddr= essSetPtr addrs, virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, unsigned int isolationGroup, + unsigned int aggregateSlotIdx, bool fromConfig) { int ret =3D -1; @@ -598,8 +599,13 @@ virDomainPCIAddressReserveAddrInternal(virDomainPCIAdd= ressSetPtr addrs, * slot, set the slot's aggregate flag. */ if (!bus->slot[addr->slot].functions && - flags & VIR_PCI_CONNECT_AGGREGATE_SLOT) { - bus->slot[addr->slot].aggregate =3D true; + aggregateSlotIdx > 0) { + bus->slot[addr->slot].aggregateSlotIdx =3D aggregateSlotIdx; + } else if (bus->slot[addr->slot].aggregateSlotIdx !=3D aggregateSlotId= x && fromConfig) { + bus->slot[addr->slot].aggregateSlotIdx =3D 0; + VIR_DEBUG("PCI functions of %.4x:%.2x is aggregated to slot %u" + "because of user assigned address %s", + addr->domain, addr->bus, aggregateSlotIdx, addrStr); } =20 if (virDomainPCIAddressBusIsEmpty(bus) && !bus->isolationGroupLocked) { @@ -624,8 +630,8 @@ virDomainPCIAddressReserveAddrInternal(virDomainPCIAddr= essSetPtr addrs, =20 /* mark the requested function as reserved */ bus->slot[addr->slot].functions |=3D (1 << addr->function); - VIR_DEBUG("Reserving PCI address %s (aggregate=3D'%s')", addrStr, - bus->slot[addr->slot].aggregate ? "true" : "false"); + VIR_DEBUG("Reserving PCI address %s (aggregateSlotIdx=3D'%d')", addrSt= r, + bus->slot[addr->slot].aggregateSlotIdx); =20 ret =3D 0; cleanup: @@ -638,10 +644,11 @@ int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, - unsigned int isolationGroup) + unsigned int isolationGroup, + unsigned int aggregateSlotIdx) { return virDomainPCIAddressReserveAddrInternal(addrs, addr, flags, - isolationGroup, true); + isolationGroup, aggregat= eSlotIdx, true); } =20 int @@ -678,6 +685,7 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr= addrs, =20 ret =3D virDomainPCIAddressReserveAddrInternal(addrs, &dev->addr.p= ci, flags, dev->isolation= Group, + dev->aggregateSlotIdx, true); } else { ret =3D virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1); @@ -730,6 +738,7 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr ad= drs) static int virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCIAddressBusPtr bus, virPCIDeviceAddressPtr searchAd= dr, + unsigned int aggregateSlotIdx, int function, virDomainPCIConnectFlags flags, bool *found) @@ -753,8 +762,8 @@ virDomainPCIAddressFindUnusedFunctionOnBus(virDomainPCI= AddressBusPtr bus, break; } =20 - if (flags & VIR_PCI_CONNECT_AGGREGATE_SLOT && - bus->slot[searchAddr->slot].aggregate) { + if (bus->slot[searchAddr->slot].aggregateSlotIdx > 0 && + bus->slot[searchAddr->slot].aggregateSlotIdx =3D=3D aggreg= ateSlotIdx) { /* slot and device are okay with aggregating devices */ if ((bus->slot[searchAddr->slot].functions & (1 << searchAddr->function)) =3D=3D 0) { @@ -799,6 +808,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPt= r addrs, virPCIDeviceAddressPtr next_addr, virDomainPCIConnectFlags flags, unsigned int isolationGroup, + unsigned int aggregateSlotIdx, int function) { virPCIDeviceAddress a =3D { 0 }; @@ -827,7 +837,9 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPt= r addrs, =20 a.slot =3D bus->minSlot; =20 - if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, function, + if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, + aggregateSlotIdx, + function, flags, &found) < 0)= { goto error; } @@ -851,7 +863,9 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPt= r addrs, =20 a.slot =3D bus->minSlot; =20 - if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, function, + if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, + aggregateSlotIdx, + function, flags, &found) < 0)= { goto error; } @@ -910,12 +924,13 @@ virDomainPCIAddressReserveNextAddr(virDomainPCIAddres= sSetPtr addrs, { virPCIDeviceAddress addr; =20 - if (virDomainPCIAddressGetNextAddr(addrs, &addr, flags, - dev->isolationGroup, function) < 0) + if (virDomainPCIAddressGetNextAddr(addrs, &addr, flags, dev->isolation= Group, + dev->aggregateSlotIdx, function) < = 0) return -1; =20 if (virDomainPCIAddressReserveAddrInternal(addrs, &addr, flags, - dev->isolationGroup, false)= < 0) + dev->isolationGroup, + dev->aggregateSlotIdx, fals= e) < 0) return -1; =20 if (!addrs->dryRun) { diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index d3541bab09..fa98b67e5c 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -32,23 +32,18 @@ typedef enum { VIR_PCI_CONNECT_HOTPLUGGABLE =3D 1 << 0, /* is hotplug needed/supported= */ =20 - /* set for devices that can share a single slot in auto-assignment - * (by assigning one device to each of the 8 functions on the slot) - */ - VIR_PCI_CONNECT_AGGREGATE_SLOT =3D 1 << 1, - /* kinds of devices as a bitmap so they can be combined (some PCI * controllers permit connecting multiple types of devices) */ - VIR_PCI_CONNECT_TYPE_PCI_DEVICE =3D 1 << 2, - VIR_PCI_CONNECT_TYPE_PCIE_DEVICE =3D 1 << 3, - VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT =3D 1 << 4, - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT =3D 1 << 5, - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT =3D 1 << 6, - VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE =3D 1 << 7, - VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS =3D 1 << 8, - VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS =3D 1 << 9, - VIR_PCI_CONNECT_TYPE_PCI_BRIDGE =3D 1 << 10, + VIR_PCI_CONNECT_TYPE_PCI_DEVICE =3D 1 << 1, + VIR_PCI_CONNECT_TYPE_PCIE_DEVICE =3D 1 << 2, + VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT =3D 1 << 3, + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT =3D 1 << 4, + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT =3D 1 << 5, + VIR_PCI_CONNECT_TYPE_DMI_TO_PCI_BRIDGE =3D 1 << 6, + VIR_PCI_CONNECT_TYPE_PCI_EXPANDER_BUS =3D 1 << 7, + VIR_PCI_CONNECT_TYPE_PCIE_EXPANDER_BUS =3D 1 << 8, + VIR_PCI_CONNECT_TYPE_PCI_BRIDGE =3D 1 << 9, } virDomainPCIConnectFlags; =20 /* a combination of all bits that describe the type of connections @@ -81,12 +76,12 @@ typedef struct { */ uint8_t functions; =20 - /* aggregate is true if this slot has only devices with - * VIR_PCI_CONNECT_AGGREGATE assigned to its functions (meaning - * that other devices with the same flags could also be - * auto-assigned to the other functions) + /* aggregate is greater than zero if this slot has only devices with + * VIR_PCI_CONNECT_AGGREGATE assigned to its functions and + * that other devices with the same aggregateSlotIdx could also be + * auto-assigned to the other functions on this slot) */ - bool aggregate; + unsigned int aggregateSlotIdx; } virDomainPCIAddressSlot; =20 typedef struct { @@ -152,7 +147,8 @@ bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSe= tPtr addrs, int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, - unsigned int isolationGroup) + unsigned int isolationGroup, + unsigned int aggregateSlotIdx) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 int virDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs, diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 5f4e8edd2c..424b56dac9 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -26,6 +26,7 @@ #include "qemu_domain_address.h" #include "qemu_domain.h" #include "viralloc.h" +#include "virhostdev.h" #include "virerror.h" #include "virlog.h" =20 @@ -1185,6 +1186,53 @@ qemuDomainSetupIsolationGroups(virDomainDefPtr def) } =20 =20 +void +qemuDomainSetDeviceSlotAggregateIdx(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainDeviceDefPtr dev) +{ + virDomainDeviceInfoPtr info =3D virDomainDeviceGetInfo(dev); + + if (!info) + return; + + info->aggregateSlotIdx =3D 0; + + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT)= { + info->aggregateSlotIdx =3D 1; + } + } + + return; +} + + +static int +qemuDomainFillDeviceSlotAggregationIter(virDomainDefPtr def, + virDomainDeviceDefPtr dev, + virDomainDeviceInfoPtr info ATTRIB= UTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) +{ + qemuDomainSetDeviceSlotAggregateIdx(def, dev); + + return 0; +} + + +static int +qemuDomainSetupSlotAggregation(virDomainDefPtr def) +{ + if (virDomainDeviceInfoIterate(def, qemuDomainFillDeviceSlotAggregatio= nIter, + NULL) < 0) { + return -1; + } + + return 0; +} + + /** * qemuDomainFillDevicePCIConnectFlags: * @@ -1319,7 +1367,8 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRI= BUTE_UNUSED, =20 if (virDomainPCIAddressReserveAddr(addrs, addr, info->pciConnectFlags, - info->isolationGroup) < 0) { + info->isolationGroup, + info->aggregateSlotIdx) < 0) { goto cleanup; } =20 @@ -1480,7 +1529,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr= def, continue; } if (addrs->nbuses && - virDomainPCIAddressReserveAddr(addrs, &cont->info.addr.pci, fl= ags, 0) < 0) + virDomainPCIAddressReserveAddr(addrs, &cont->info.addr.pci, fl= ags, 0, 0) < 0) goto cleanup; } =20 @@ -1489,11 +1538,11 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefP= tr def, memset(&tmp_addr, 0, sizeof(tmp_addr)); tmp_addr.slot =3D 1; /* ISA Bridge at 00:01.0 */ - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0, 0) = < 0) goto cleanup; /* Bridge at 00:01.3 */ tmp_addr.function =3D 3; - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0, 0) = < 0) goto cleanup; } =20 @@ -1528,7 +1577,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr= def, goto cleanup; } } else { - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags= , 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags= , 0, 0) < 0) goto cleanup; primaryVideo->info.addr.pci =3D tmp_addr; primaryVideo->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE= _PCI; @@ -1553,7 +1602,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr= def, VIR_DEBUG("PCI address 0:0:2.0 in use, future addition of a vi= deo" " device will not be possible without manual" " intervention"); - } else if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,= 0) < 0) { + } else if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,= 0, 0) < 0) { goto cleanup; } } @@ -1629,7 +1678,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr d= ef, assign =3D true; } if (assign) { - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, f= lags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, f= lags, 0, 0) < 0) goto cleanup; =20 cont->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -1652,7 +1701,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr d= ef, memset(&tmp_addr, 0, sizeof(tmp_addr)); tmp_addr.slot =3D 0x1E; if (!virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) { - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, f= lags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, f= lags, 0, 0) < 0) goto cleanup; =20 cont->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -1676,12 +1725,12 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr= def, tmp_addr.slot =3D 0x1F; tmp_addr.function =3D 0; tmp_addr.multi =3D VIR_TRISTATE_SWITCH_ON; - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0, 0) = < 0) goto cleanup; =20 tmp_addr.function =3D 3; tmp_addr.multi =3D VIR_TRISTATE_SWITCH_ABSENT; - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0, 0) = < 0) goto cleanup; } =20 @@ -1715,7 +1764,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr d= ef, goto cleanup; } } else { - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags= , 0) < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags= , 0, 0) < 0) goto cleanup; primaryVideo->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE= _PCI; primaryVideo->info.addr.pci =3D tmp_addr; @@ -1741,7 +1790,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr d= ef, " device will not be possible without manual" " intervention"); virResetLastError(); - } else if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,= 0) < 0) { + } else if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags,= 0, 0) < 0) { goto cleanup; } } @@ -1762,7 +1811,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr d= ef, !virDeviceInfoPCIAddressWanted(&sound->info)) { continue; } - if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0)= < 0) + if (virDomainPCIAddressReserveAddr(addrs, &tmp_addr, flags, 0,= 0) < 0) goto cleanup; =20 sound->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; @@ -1967,7 +2016,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, /* Reserve this function on the slot we found */ if (virDomainPCIAddressReserveAddr(addrs, &addr, cont->info.pciConnectFl= ags, - cont->info.isolationGro= up) < 0) { + cont->info.isolationGro= up, + cont->info.aggregateSlo= tIdx) < 0) { goto error; } =20 @@ -2348,6 +2398,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, if (qemuDomainSetupIsolationGroups(def) < 0) goto cleanup; =20 + if (qemuDomainSetupSlotAggregation(def) < 0) + goto cleanup; + if (nbuses > 0) { /* 1st pass to figure out how many PCI bridges we need */ if (!(addrs =3D qemuDomainPCIAddressSetCreate(def, nbuses, true))) @@ -2463,6 +2516,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, dev.data.controller =3D def->controllers[contIndex]; /* set connect flags so it will be properly addressed */ qemuDomainFillDevicePCIConnectFlags(def, &dev, qemuCaps, drive= r); + qemuDomainSetDeviceSlotAggregateIdx(def, &dev); =20 /* Reserve an address for the controller. pci-root and pcie-ro= ot * controllers don't plug into any other PCI controller, hence @@ -2932,6 +2986,7 @@ qemuDomainEnsurePCIAddress(virDomainObjPtr obj, return 0; =20 qemuDomainFillDevicePCIConnectFlags(obj->def, dev, priv->qemuCaps, dri= ver); + qemuDomainSetDeviceSlotAggregateIdx(obj->def, dev); =20 return virDomainPCIAddressEnsureAddr(priv->pciaddrs, info, info->pciConnectFlags); diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h index 83f8e81cad..650f977cf7 100644 --- a/src/qemu/qemu_domain_address.h +++ b/src/qemu/qemu_domain_address.h @@ -55,6 +55,14 @@ int qemuDomainFillDeviceIsolationGroup(virDomainDefPtr d= ef, virDomainDeviceDefPtr dev) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 +void +qemuDomainSetDeviceSlotAggregateIdx(virDomainDefPtr def, + virDomainDeviceDefPtr dev); +int +qemuDomainDefDeviceFindSlotAggregateIdx(virDomainDefPtr def, + virDomainDeviceDefPtr dev); + + void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm, virDomainDeviceInfoPtr info, const char *devstr); -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list