|
From: | Igor Mitsyanko |
Subject: | Re: [Qemu-devel] [PATCH V4 09/12] hw/sd.c: convert SD state to QOM object |
Date: | Tue, 31 Jul 2012 21:09:10 +0400 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
On 07/31/2012 08:17 PM, Peter Maydell wrote:
On 31 July 2012 16:29, Markus Armbruster <address@hidden> wrote:Igor Mitsyanko <address@hidden> writes:QEMU requires all objects derived from TYPE_DEVICE to be connected to some bus, if no bus was specified in new object class description, QEMU practically assumes this object to be a sysbus device and connects it to main system bus. A while ago it wasn't even possible to create a class directly derived from DEVICE_CLASS without tying this class to some bus, QEMU would have abort() during initialization. Now, after "bus_info" member was removed from DeviceClass structure, it became possible, but still, it most definitely will cause errors because QEMU will assume such an object to be a SysBusDevice. For example, sysbus_dev_print() (called by "info qtree" monitor command) directly casts DeviceState object to SysBusDevice without checking if it is actually possible.I'm afraid the first few device models that don't connect to a qbus are bound to flush out a few bugs. Nevertheless, device models should be subtypes of TYPE_DEVICE, shouldn't they? Anthony?Sounds right to me. Added bonus, we can use nice APIs for declaring and setting properties (qdev_prop_set_*) rather than nasty ones (object_property-set_*) :-) -- PMM
Just to clarify things for myself, system bus is supposed to go away in the future, but nobody knows when exactly since many things in qemu seriously intertwined with it. Bussless devices are presumably supported, but that support uses a "hack" of tying bussless devices to main system bus so they could be visible to the rest of the system. You're proposing to derive TYPE_SD directly from TYPE_DEVICE without specifying a bus for it, incidentally fixing any existing bugs in current bussless devices support.
[Prev in Thread] | Current Thread | [Next in Thread] |