Received: from eggs.gnu.org ([2001:4830:134:3::10]:45300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoW6I-0007gC-UJ for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:24:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoW6E-0008PW-2Z for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:24:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40177) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoW6D-0008PS-QH for qemu-devel@nongnu.org; Thu, 05 Dec 2013 05:24:01 -0500 From: Markus Armbruster References: <1386188688-6480-1-git-send-email-agraf@suse.de> Date: Thu, 05 Dec 2013 11:23:57 +0100 In-Reply-To: <1386188688-6480-1-git-send-email-agraf@suse.de> (Alexander Graf's message of "Wed, 4 Dec 2013 21:24:48 +0100") Message-ID: <87r49r4mv6.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] qdev: Keep global allocation counter per bus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Paolo Bonzini , QEMU Developers , Anthony Liguori Alexander Graf writes: > When we have 2 separate qdev devices that both create a qbus of the > same type without specifying a bus name or device name, we end up > with two buses of the same name, such as ide.0 on the Mac machines: > > dev: macio-ide, id "" > bus: ide.0 > type IDE > dev: macio-ide, id "" > bus: ide.0 > type IDE > > If we now spawn a device that connects to a ide.0 the last created > bus gets the device, with the first created bus inaccessible to the > command line. > > After some discussion on IRC we concluded that the best quick fix way > forward for this is to make automated bus-class type based allocation > count a global counter. That's what this patch implements. With this > we instead get > > dev: macio-ide, id "" > bus: ide.1 > type IDE > dev: macio-ide, id "" > bus: ide.0 > type IDE > > on the example mentioned above. What I don't like about the global counter: we define the board's ABI implicitly by device initialization order. Bad taste and fragile, but we do this elsewhere, too, e.g. pci_create_simple(bugs, -1, ...). Wanted: tests to catch accidental ABI changes, covering at least the parts we define implicitly.