From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTZfg-0004Kf-N2 for qemu-devel@nongnu.org; Thu, 24 Nov 2011 08:49:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTZff-00089c-Mb for qemu-devel@nongnu.org; Thu, 24 Nov 2011 08:49:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTZff-00089N-Ar for qemu-devel@nongnu.org; Thu, 24 Nov 2011 08:48:59 -0500 Message-ID: <4ECE4B46.3020600@redhat.com> Date: Thu, 24 Nov 2011 15:48:54 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1322141482-12173-1-git-send-email-benoit.canet@gmail.com> <1322141482-12173-8-git-send-email-benoit.canet@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v4 07/11] bonito: convert north bridge register mapping to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org On 11/24/2011 03:43 PM, Peter Maydell wrote: > 2011/11/24 Beno=C3=AEt Canet : > > @@ -690,17 +688,16 @@ static int bonito_pcihost_initfn(SysBusDevice *= dev) > > static int bonito_initfn(PCIDevice *dev) > > { > > PCIBonitoState *s =3D DO_UPCAST(PCIBonitoState, dev, dev); > > + SysBusDevice *sysbus =3D &s->pcihost->busdev; > > > > /* Bonito North Bridge, built on FPGA, VENDOR_ID/DEVICE_ID are "u= ndefined" */ > > pci_config_set_prog_interface(dev->config, 0x00); > > > > /* set the north bridge register mapping */ > > - s->bonito_reg_handle =3D cpu_register_io_memory(bonito_read, bon= ito_write, s, > > - DEVICE_NATIVE_ENDI= AN); > > - s->bonito_reg_start =3D BONITO_INTERNAL_REG_BASE; > > - s->bonito_reg_length =3D BONITO_INTERNAL_REG_SIZE; > > - cpu_register_physical_memory(s->bonito_reg_start, s->bonito_reg_= length, > > - s->bonito_reg_handle); > > + memory_region_init_io(&s->iomem, &bonito_ops, s, > > + "north-bridge-register", BONITO_INTERNAL_R= EG_SIZE); > > + sysbus_init_mmio_region(sysbus, &s->iomem); > > + sysbus_mmio_map(sysbus, 0, BONITO_INTERNAL_REG_BASE); > > > > /* set the north bridge pci configure mapping */ > > s->bonito_pciconf_handle =3D cpu_register_io_memory(bonito_pcicon= f_read, > > I guess this is the minimal-change conversion patch, but I'm still not > sure it makes any sense to be have one device's initfn be adding sysbus > mmio regions to a totally different device and then mapping them into > address space itself... Oh, this isn't the clean thing to do, certainly. bonito_initfn() should only initialize the PCI interface to the PCI controller, not the PCI controller itself (which should be initialized by bonito_init() or bonito_pcihost_initfn()). But memory/master isn't the right place to do such cleanups; such patches should be directed at the right maintainer, if anyone feels the need to do them. --=20 error compiling committee.c: too many arguments to function