From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [virtio-dev] Re: [RFC PATCH 1/3] qemu: virtio-bypass should explicitly bind to a passthrough device Date: Thu, 5 Apr 2018 17:31:03 +0200 Message-ID: References: <1522573990-5242-1-git-send-email-si-wei.liu@oracle.com> <1522573990-5242-2-git-send-email-si-wei.liu@oracle.com> <20180403152308-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Si-Wei Liu , Jiri Pirko , Stephen Hemminger , Alexander Duyck , David Miller , "Brandeburg, Jesse" , Jakub Kicinski , Jason Wang , "Samudrala, Sridhar" , Netdev , virtualization@lists.linux-foundation.org, virtio-dev@lists.oasis-open.org To: Siwei Liu , "Michael S. Tsirkin" Return-path: Received: from mail-wr0-f172.google.com ([209.85.128.172]:34108 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbeDEPbI (ORCPT ); Thu, 5 Apr 2018 11:31:08 -0400 Received: by mail-wr0-f172.google.com with SMTP id d17so13731595wre.1 for ; Thu, 05 Apr 2018 08:31:07 -0700 (PDT) In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 04/04/2018 10:02, Siwei Liu wrote: >> pci_bus_num is almost always a bug if not done within >> a context of a PCI host, bridge, etc. >> >> In particular this will not DTRT if run before guest assigns bus >> numbers. >> > I was seeking means to reserve a specific pci bus slot from drivers, > and update the driver when guest assigns the bus number but it seems > there's no low-hanging fruits. Because of that reason the bus_num is > only obtained until it's really needed (during get_config) and I > assume at that point the pci bus assignment is already done. I know > the current one is not perfect, but we need that information (PCI > bus:slot.func number) to name the guest device correctly. Can you use the -device "id", and look it up as devices = container_get(qdev_get_machine(), "/peripheral"); return object_resolve_path_component(devices, id); ? Thanks, Paolo