From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJmsN-0006sI-Jc for qemu-devel@nongnu.org; Thu, 04 Oct 2012 10:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJmsI-0002zT-Pb for qemu-devel@nongnu.org; Thu, 04 Oct 2012 10:58:11 -0400 Message-ID: <506DA3FA.2080404@redhat.com> Date: Thu, 04 Oct 2012 16:58:02 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1349265000-23834-1-git-send-email-Bharat.Bhushan@freescale.com> <1349265000-23834-3-git-send-email-Bharat.Bhushan@freescale.com> <506D81B3.2040401@redhat.com> <6A3DF150A5B70D4F9B66A25E3F7C888D064B2BBD@039-SN2MPN1-022.039d.mgd.msft.net> In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D064B2BBD@039-SN2MPN1-022.039d.mgd.msft.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] Adding BAR0 for e500 PCI controller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bhushan Bharat-R65777 Cc: "qemu-ppc@nongnu.org" , "qemu-devel@nongnu.org" , "agraf@suse.de" On 10/04/2012 03:46 PM, Bhushan Bharat-R65777 wrote: > > >> -----Original Message----- >> From: Avi Kivity [mailto:avi@redhat.com] >> Sent: Thursday, October 04, 2012 6:02 PM >> To: Bhushan Bharat-R65777 >> Cc: qemu-devel@nongnu.org; qemu-ppc@nongnu.org; agraf@suse.de; Bhushan Bharat- >> R65777 >> Subject: Re: [Qemu-devel] [PATCH 2/2] Adding BAR0 for e500 PCI controller >> >> On 10/03/2012 01:50 PM, Bharat Bhushan wrote: >> > sysbus_connect_irq(s, 0, mpic[pci_irq_nrs[0]]); diff --git >> > a/hw/ppce500_pci.c b/hw/ppce500_pci.c index 92b1dc0..16e4af2 100644 >> > --- a/hw/ppce500_pci.c >> > +++ b/hw/ppce500_pci.c >> > @@ -87,6 +87,7 @@ struct PPCE500PCIState { >> > /* mmio maps */ >> > MemoryRegion container; >> > MemoryRegion iomem; >> > + void *bar0; >> > }; >> >> void *? Why? > > Passing parameter via qdev is either possible by value or by void *. That's why I used void *. Then you shouldn't be using qdev for this. But if you make the changes below, it will likely not be necessary. >> >> However this is best done from the pci device's initialization function, not >> here (the MemoryRegion should be a member of the pci device as well). > > We want to set BAR0 of PCI controller so we did this here. But yes, we also want that all devices under the PCI controller have this mapping, so when they access the MPIC register to send MSI then they can do that. Please elaborate. One way to describe what you want is to issue an 'info mtree' and show what changes you want. > > Which device's initialization function you are talking about? static const TypeInfo e500_host_bridge_info = { .name = "e500-host-bridge", .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(PCIDevice), .class_init = e500_host_bridge_class_init, }; This needs to describe a derived class of PCIDevice, hold the BAR as a data member, and register the BAR in the init function (which doesn't exist yet because you haven't subclassed it). This way the BAR lives in the device which exposes it, like BARs everywhere. -- error compiling committee.c: too many arguments to function