From nobody Tue Nov 4 23:51:36 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531424875404447.6504688678858; Thu, 12 Jul 2018 12:47:55 -0700 (PDT) Received: from localhost ([::1]:33760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdhZ9-0000oe-5v for importer@patchew.org; Thu, 12 Jul 2018 15:47:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdhXE-0008H7-H3 for qemu-devel@nongnu.org; Thu, 12 Jul 2018 15:45:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdhXD-0001a3-Ha for qemu-devel@nongnu.org; Thu, 12 Jul 2018 15:45:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44090) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdhXD-0001ZH-BE for qemu-devel@nongnu.org; Thu, 12 Jul 2018 15:45:51 -0400 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 85BA4C03D470; Thu, 12 Jul 2018 19:45:50 +0000 (UTC) Received: from localhost (ovpn-116-12.gru2.redhat.com [10.97.116.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9582360910; Thu, 12 Jul 2018 19:45:44 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 12 Jul 2018 16:45:22 -0300 Message-Id: <20180712194522.31063-4-ehabkost@redhat.com> In-Reply-To: <20180712194522.31063-1-ehabkost@redhat.com> References: <20180712194522.31063-1-ehabkost@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.31]); Thu, 12 Jul 2018 19:45:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 3/3] pci: Document ownership rules of pci_root_bus_new*() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , "Michael S. Tsirkin" , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ownership rules of pci_root_bus_new*() aren't trivial: the caller owns the new object if parent is NULL, otherwise ownership is transferred to the parent. Clarify that on comments. Signed-off-by: Eduardo Habkost Reviewed-by: Marcel Apfelbaum --- include/hw/pci/pci.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 990d6fcbde..5d445c431c 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -396,15 +396,30 @@ typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque= , int pin); =20 bool pci_bus_is_express(PCIBus *bus); bool pci_bus_is_root(PCIBus *bus); + +/** + * pci_root_bus_new_inplace: + * +* If @parent is not NULL the returned object will be owned by @parent, +* otherwise it will be owned by the caller. +*/ void pci_root_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *p= arent, const char *name, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, uint8_t devfn_min, const char *typename); + +/** + * pci_root_bus_new: + * +* If @parent is not NULL the returned object will be owned by @parent, +* otherwise it will be owned by the caller. +*/ PCIBus *pci_root_bus_new(DeviceState *parent, const char *name, MemoryRegion *address_space_mem, MemoryRegion *address_space_io, uint8_t devfn_min, const char *typename); + void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_= irq, void *irq_opaque, int nirq); int pci_bus_get_irq_level(PCIBus *bus, int irq_num); --=20 2.18.0.rc1.1.g3f1ff2140