From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDgE1-00067m-CZ for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:53:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDgDw-0005yp-0o for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:53:24 -0400 Received: from [199.232.76.173] (port=51422 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDgDv-0005y6-Lz for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:53:19 -0400 Received: from mx20.gnu.org ([199.232.41.8]:57993) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MDgDu-00026q-W6 for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:53:19 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MDgDt-0004Bs-UG for qemu-devel@nongnu.org; Mon, 08 Jun 2009 10:53:18 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] qdev: hook up i440fx pcihost to system bus. Date: Mon, 8 Jun 2009 15:53:14 +0100 References: <1244464428-3795-1-git-send-email-kraxel@redhat.com> <200906081404.28277.paul@codesourcery.com> <4A2D1A51.309@redhat.com> In-Reply-To: <4A2D1A51.309@redhat.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906081553.14883.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann On Monday 08 June 2009, Gerd Hoffmann wrote: > On 06/08/09 15:04, Paul Brook wrote: > >> typedef struct { > >> + DeviceState qdev; > >> ... > >> +static struct DeviceInfo i440fx_pcihost_devinfo = { > >> + .init = i440fx_initfn, > >> + .bus_type = BUS_TYPE_SYSTEM, > >> +}; > > > > This is clearly a lie. > > --verbose please. If you're adding something to a system bus, it needs to be a system bus device (i.e. SysBusDevice and use sysbus_register_*). The FROM_SYSBUS and similar macros help to protect agains mixing the wrong things, hence my later comment. You should never be setting bus_type directly. It will be done by the appropriate bus wrappers. The comment at the top of qdev.c hints towards this: Devices will generally inherit from a particular bus (e.g. PCI or I2C) rather than this API directly. Paul