From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b05Tk-0003nq-2k for qemu-devel@nongnu.org; Tue, 10 May 2016 07:05:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b05Tf-0007Cx-Nu for qemu-devel@nongnu.org; Tue, 10 May 2016 07:05:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b05Tf-0007Cs-I1 for qemu-devel@nongnu.org; Tue, 10 May 2016 07:05:23 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (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 E2BE02E51CC for ; Tue, 10 May 2016 11:05:22 +0000 (UTC) References: <1462816056-17463-1-git-send-email-marcel@redhat.com> <8737pqfhac.fsf@dusky.pond.sub.org> From: Marcel Apfelbaum Message-ID: <5731C070.2010709@redhat.com> Date: Tue, 10 May 2016 14:05:20 +0300 MIME-Version: 1.0 In-Reply-To: <8737pqfhac.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 0/3] qdev: order devices by priority before creating them List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, mst@redhat.com On 05/10/2016 11:28 AM, Markus Armbruster wrote: > Marcel Apfelbaum writes: > >> This series aims to allow more devices to be used with '-device' >> by sorting the devices based on a predefined creation order flag >> before creating them. >> >> Devices like IOMMU need to be created before others, so they can leverage >> the DeviceCreationPriority flag introduced by the first patch to DeviceClass. >> >> The second patch sorts the devices by their DeviceCreationPriority >> before creating them. >> >> Finally, the last patch demonstrates how it can be used to ensure >> the creation of host-bridges before the pci-bridges and pci-bridges before >> the others. >> >> I preferred to combine all the priorities into a single enum >> to better manage the creation order. >> >> This is an RFC because I only wanted to know if it seems like the right way to go. >> Comments are appreciated, > Hi Markus, Thanks for looking into this. > Can you explain why requiring the user to specify -device in a sane > order isn't good enough? > Point taken, the truth is I didn't like the 'order' restriction in the first place. If the device creation depends on the id of some other devices (e.g we need the bus id to plug a device into it), for IOMMU devices it gets a little tricky. You can add the IOMMU device before other PCI devices but it will not work (because some internal implementation). This is why we added using -machine pc,iommu=on. I suppose we have other examples as well. This is not user friendly IMO. To solve the specific IOMMU problem we can check that there are no PCI devices created yet, but I am not sure is a better approach and is strictly related to this device. The goal is to be able to add more devices with -device and I thought this kind of creation in steps may help. Thanks, Marcel