Received: from eggs.gnu.org ([2001:4830:134:3::10]:35095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYzjj-0001B6-0H for qemu-devel@nongnu.org; Mon, 07 Sep 2015 12:57:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYzjf-0001Ko-PI for qemu-devel@nongnu.org; Mon, 07 Sep 2015 12:57:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYzjf-0001Kh-KY for qemu-devel@nongnu.org; Mon, 07 Sep 2015 12:57:39 -0400 From: Markus Armbruster References: <1439302524-19142-1-git-send-email-peter.maydell@linaro.org> <1439302524-19142-2-git-send-email-peter.maydell@linaro.org> <87bnde2nf2.fsf@blackfin.pond.sub.org> Date: Mon, 07 Sep 2015 18:57:37 +0200 In-Reply-To: (Peter Maydell's message of "Mon, 7 Sep 2015 17:42:13 +0100") Message-ID: <8737yq181q.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 1/3] hw/sd/pxa2xx_mmci: convert to SysBusDevice object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Patch Tracking Peter Maydell writes: > On 7 September 2015 at 17:40, Markus Armbruster wrote: >> Peter Maydell writes: >> >>> Convert the pxa2xx_mmci device to be a sysbus device. > >>> +static Property pxa2xx_mmci_properties[] = { >>> + /* Note: pointer property 'drive' may remain NULL, thus no need >>> + * for dc->cannot_instantiate_with_device_add_yet = true; >>> + * Unfortunately this can't be a DEFINE_PROP_DRIVE, because >>> + * setting a 'drive' property results in a call to blk_attach_dev() >>> + * attaching the BlockBackend to this device; that then means that >>> + * the call in sd_init() to blk_attach_dev_nofail() which tries to >>> + * attach the BlockBackend to the SD card object aborts. >>> + */ >>> + DEFINE_PROP_PTR("drive", PXA2xxMMCIState, blk), >>> + DEFINE_PROP_END_OF_LIST(), >>> +}; >> >> As far as I can tell, this problem is an artifact of our interface to >> the common sd-card code, namely sd_init(). sd_init() was made for the >> pre-qdev world: it creates and completely initializes the common >> SDState. >> >> In qdev, we do this in three separate steps: create, set properties, >> realize. Split up sd_init(), and the problem should go away. > > Yes, but I don't really want to gate QOMification of mmc > controller devices on the more complicated problem of > QOMifying sd.c itself, especially since we already have several > QOMified mmc controllers... Is serial.c QOMified? I don't think so, it's merely structured in a QOM-friendly way: typedef SerialState, realize helper serial_realize_core(), unrealize helper serial_exit_core(). If SerialState had more properties, we'd also need a macro to define them. I believe sd.c could be made like that, with not much effort.