From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a48NI-0005iW-JB for qemu-devel@nongnu.org; Wed, 02 Dec 2015 09:27:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a48ND-0000p5-GN for qemu-devel@nongnu.org; Wed, 02 Dec 2015 09:27:16 -0500 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:33548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a48ND-0000oz-8V for qemu-devel@nongnu.org; Wed, 02 Dec 2015 09:27:11 -0500 Received: by wmec201 with SMTP id c201so255836384wme.0 for ; Wed, 02 Dec 2015 06:27:10 -0800 (PST) Date: Wed, 2 Dec 2015 16:27:08 +0200 From: Shmulik Ladkani Message-ID: <20151202162708.17d43a22@pixies> In-Reply-To: <565EF989.9030300@redhat.com> References: <1448987005-28335-1-git-send-email-shmulik.ladkani@ravellosystems.com> <565DCC97.5020504@redhat.com> <20151201213007.2b41e810@halley> <565E0729.9060603@redhat.com> <20151202100109.72be507a@pixies> <565EBF32.80803@redhat.com> <20151202153012.08b80fd9@pixies> <565EF989.9030300@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-pci: Set the QEMU_PCI_CAP_EXPRESS capability early in its DeviceClass realize method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" Hi, On Wed, 2 Dec 2015 16:00:41 +0200, marcel@redhat.com wrote: > > As I can't decide what's better, I'm following your initial suggestion > > and submit for maintainers to review. > > Sure, and thanks for the patience to get to the bottom of it. Sorry, your initial suggestion testing 'pci_bus_is_express() && !pci_bus_is_root()' within 'virtio_pci_dc_realize' will not do the job as in that place pci_dev->bus is still NULL... It's only assigned at pci_qdev_realize. I think this is the main reason for separation. The classes themselves describe the type of the device, which is either pci or pcie, using k->is_express. The class code can't tell whether the actual device instance gets attached to a pci or pcie bus. So yes, 'pci_is_express' really states whether device instance *can* be an pcie device. Thus, I'm going with my initial suggestion, plus minor naming changes. Many thanks!