From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1bBE-0001HY-2n for qemu-devel@nongnu.org; Thu, 18 Dec 2014 08:31:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1bB5-0000M9-1g for qemu-devel@nongnu.org; Thu, 18 Dec 2014 08:31:48 -0500 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:46706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1bB4-0000Lw-S8 for qemu-devel@nongnu.org; Thu, 18 Dec 2014 08:31:38 -0500 Received: by mail-wi0-f182.google.com with SMTP id h11so1818138wiw.3 for ; Thu, 18 Dec 2014 05:31:38 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5492D735.4040907@redhat.com> Date: Thu, 18 Dec 2014 14:31:33 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1418850613-26821-1-git-send-email-lersek@redhat.com> <1418850613-26821-2-git-send-email-lersek@redhat.com> <5492B7FD.2010903@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 01/11] fw_cfg: hard separation between the MMIO and I/O port mappings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Andrew Jones , Laszlo Ersek , Alexander Graf "Richard W.M. Jones" , QEMU Developers On 18/12/2014 13:58, Peter Maydell wrote: > On 18 December 2014 at 11:18, Paolo Bonzini wrote: >> >> >> On 17/12/2014 22:10, Laszlo Ersek wrote: >>> +static Property fw_cfg_mem_properties[] = { >>> + DEFINE_PROP_UINT64("ctl_addr", FWCfgMemState, ctl_addr, -1), >>> + DEFINE_PROP_UINT64("data_addr", FWCfgMemState, data_addr, -1), >>> + DEFINE_PROP_END_OF_LIST(), >>> +}; >>> + >>> +static void fw_cfg_mem_realize(DeviceState *dev, Error **errp) >>> +{ >>> + FWCfgMemState *s = FW_CFG_MEM(dev); >>> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); >>> + >>> + memory_region_init_io(&s->ctl_iomem, OBJECT(s), &fw_cfg_ctl_mem_ops, >>> + FW_CFG(s), "fwcfg.ctl", FW_CFG_SIZE); >>> + sysbus_init_mmio(sbd, &s->ctl_iomem); >>> + sysbus_mmio_map(sbd, 0, s->ctl_addr); >>> + >>> + memory_region_init_io(&s->data_iomem, OBJECT(s), &fw_cfg_data_mem_ops, >>> + FW_CFG(s), "fwcfg.data", FW_CFG_DATA_SIZE); >>> + sysbus_init_mmio(sbd, &s->data_iomem); >>> + sysbus_mmio_map(sbd, 1, s->data_addr); >>> +} >> >> Strictly speaking sysbus_mmio_map should be called by the caller, as in >> the old fw_cfg_init---which lets you drop the properties too. > > I'd really rather we got this correct -- mmio_map in a realize > function is wrong and if we merge this I'll have to immediately > write a bug fix patch to move it out again... Laszlo is on vacation, I'll prepare a fixup patch tomorrow. Paolo