From nobody Mon Feb 9 19:25:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1586181149; cv=none; d=zohomail.com; s=zohoarc; b=XPg//jaB+J91wsiA77tzG32HRS0eaZmATFS9GrqFQ1oR+9AQ7r/CeC2nY9rObODlbun383U+tgdY8Tg6csSFRRLACPlHXl/zBTyU4PXYbybQkEdL9SM6RSWMqCLin0T0n7YX9QT776McHn/zm/E2GGJaeqp/TANRCErfD1702S8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586181149; h=Content-Type:Content-Transfer-Encoding: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=QNBeLqrrzD22/AwM3ZtGcjC99ko6oGFDJAVuzlpyyhg=; b=YFMb6mA35vPw2g8jkgR937ccxgRbfnOIhbpuQa3tNQxJvpGcn3SGKj82dYSSm2ldL1I0OupNYrUcXUdZpg/YBuTMhuBh2ztVOVtlz9TCMCjZNL6I2+HqygteNFdAAJSqLcDfSghHvnBVDGgNE38inm6KAAiVqv+7aFELuEaUkcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586181149659566.0149324141571; Mon, 6 Apr 2020 06:52:29 -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-65-9LN7xZizOcSVoHICavrNDA-1; Mon, 06 Apr 2020 09:52:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9468618B9FC2; Mon, 6 Apr 2020 13:52:18 +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 6DC465C1B0; Mon, 6 Apr 2020 13:52:18 +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 2878993A73; Mon, 6 Apr 2020 13:52:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036DphYw018368 for ; Mon, 6 Apr 2020 09:51:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C8D25C28F; Mon, 6 Apr 2020 13:51:43 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-243.phx2.redhat.com [10.3.112.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E7AB5C1B0 for ; Mon, 6 Apr 2020 13:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586181148; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=QNBeLqrrzD22/AwM3ZtGcjC99ko6oGFDJAVuzlpyyhg=; b=bUuhBihW1gGmbS+UnHr/buGk1vsgEUi/P1+Xf93/DyW7Pgboa18wNIV6ja1btvbeRoJCn7 ilWWzsNsyAR6NMXyVDgekbpNL2rLu23zMQHg9SE/OENIAkZp6CLJ6lQuMX7PR2VahuZsYi qlYpOYAFl+OY/c/QOLRlSIKUpXpY1tY= X-MC-Unique: 9LN7xZizOcSVoHICavrNDA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] conf: simplify logic when checking for AUTOASSIGN PCI addresses Date: Mon, 6 Apr 2020 09:51:27 -0400 Message-Id: <20200406135130.3080946-8-laine@redhat.com> In-Reply-To: <20200406135130.3080946-1-laine@redhat.com> References: <20200406135130.3080946-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.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.16 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" Old behavior: If the address was manually provided by config, copy device AUTOASSIGN flag into the bus flag, and then later on in the function *always* check for a match of the flags (which will always match if the address came from config, since we just copied it). New behavior: Don't mess with the bus flags - just directly check if the AUTOASSIGN flag matches in bus and dev, but only make the check if the address didn't come from config (i.e. it was auto-assigned by libvirt). Signed-off-by: Laine Stump --- src/conf/domain_addr.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index effc223a12..429550e970 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -358,18 +358,22 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddres= sPtr addr, */ if (busFlags & VIR_PCI_CONNECT_TYPES_ENDPOINT) busFlags |=3D VIR_PCI_CONNECT_TYPES_ENDPOINT; - /* Also allow manual specification of bus to override - * libvirt's assumptions about whether or not hotplug - * capability will be required. - */ - if (devFlags & VIR_PCI_CONNECT_AUTOASSIGN) - busFlags |=3D VIR_PCI_CONNECT_AUTOASSIGN; /* if the device is a pci-bridge, allow manually * assigning to any bus that would also accept a * standard PCI device. */ if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_BRIDGE) devFlags |=3D VIR_PCI_CONNECT_TYPE_PCI_DEVICE; + } else if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) && + !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) { + if (reportError) { + virReportError(errType, + _("The device at PCI address %s was auto-assign= ed " + "this address, but the PCI controller " + "with index=3D'%d' doesn't allow auto-assignm= ent"), + addrStr, addr->bus); + } + return false; } =20 /* If this bus doesn't allow the type of connection (PCI @@ -419,17 +423,6 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddress= Ptr addr, addrStr, addr->bus, connectStr); return false; } - if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) && - !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) { - if (reportError) { - virReportError(errType, - _("The device at PCI address %s requires " - "hotplug capability, but the PCI controller " - "with index=3D'%d' doesn't support hotplug"), - addrStr, addr->bus); - } - return false; - } return true; } =20 --=20 2.25.2