Received: from eggs.gnu.org ([2001:4830:134:3::10]:50092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbFkV-0008I0-D7 for qemu-devel@nongnu.org; Tue, 29 Oct 2013 16:18:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbFkO-0003NK-1r for qemu-devel@nongnu.org; Tue, 29 Oct 2013 16:18:47 -0400 Received: from p15195424.pureserver.info ([82.165.34.74]:35683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbFkN-0003N6-Ok for qemu-devel@nongnu.org; Tue, 29 Oct 2013 16:18:39 -0400 Message-ID: <527017C8.8000409@ilande.co.uk> Date: Tue, 29 Oct 2013 20:17:12 +0000 From: Mark Cave-Ayland MIME-Version: 1.0 References: <87d2moh5kt.fsf@blackfin.pond.sub.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] There are two distinct qdevs named TYPE_OPENPROM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Blue Swirl , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , Markus Armbruster , Anthony Liguori , QEMU Developers On 29/10/13 14:32, Peter Maydell wrote: > On 29 October 2013 07:57, Markus Armbruster wrote: >> sun4m.c and sun4u.c both define a qdev named TYPE_OPENPROM. As far as I >> can tell, they differ only in the name of their memory region. >> >> If they ever get linked into the same executable, >> type_register_internal() will reject the second one. But they aren't, >> so this isn't a bug. Is it bad style? > > Yes, in several ways. Board models shouldn't include qdev devices > in their source files -- the devices should have their own source files > in the appropriate section of hw/. We shouldn't have multiple devices > of the same TYPE like that. And the device should probably be built > once rather than per-target. > > I also suspect this device is jumping through hoops to deal with the > fact that our image-loading API doesn't have any "load this image > into this memory region" function (compare discussion recently > on how the sbus graphics card patches handle loading their prom > image). Fixing that might also simplify these devices. From my time spent in the sun4m code recently, there are really just two devices at the moment: one represents the RAM within the 36-bit address space and the other represents the PROM located above the RAM region. As Peter rightly points out, the TYPE_OPENPROM stuff mainly appears to be a hack to allow the ROM to be loaded into a MemoryRegion which is then usable by the sysbus API. So if someone could come up with suitable "load this image into this memory region" routine to replace load_image_targphys() then this particular problem would go away. ATB, Mark.