From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhhVL-0002K3-W4 for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhhVI-0004bl-QL for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:18:51 -0400 Received: from mail-vk0-f41.google.com ([209.85.213.41]:36094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhhVI-0004bh-Kp for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:18:48 -0400 Received: by vkfp126 with SMTP id p126so44622614vkf.3 for ; Thu, 01 Oct 2015 10:18:48 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <560D44D7.3090305@redhat.com> References: <1443701677-13629-1-git-send-email-markmb@redhat.com> <1443701819-13855-1-git-send-email-markmb@redhat.com> <1443701819-13855-4-git-send-email-markmb@redhat.com> <560D44D7.3090305@redhat.com> From: Peter Maydell Date: Thu, 1 Oct 2015 18:18:28 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v4 3/7] Implement fw_cfg DMA interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Drew , Stefan Hajnoczi , "Gabriel L. Somlo" , QEMU Developers , Kevin O'Connor , Gerd Hoffmann , =?UTF-8?Q?Marc_Mar=C3=AD?= On 1 October 2015 at 15:36, Laszlo Ersek wrote: > I think I finally understand this difference now. It is all rooted in > the difference between the internal APIs sysbus_add_io() and > sysbus_init_mmio(). Both of these are called from the device realize > functions, but the first (sysbus_add_io()) wants the IO port address at > once, whereas the second (sysbus_init_mmio()) doesn't want the address > -- the actual mapping (sysbus_mmio_map()) is delayed to board code; the > device code doesn't want to be aware of it. Yes. The sysbus_add_io() API is firmly wedded to the x86 I/O port concept and to the idea that devices are at fixed I/O port addresses which don't depend on what board they're in (because the few non-x86 systems that set up some kind of "IO port" abstraction are generally doing it to look more x86-like). That said, sysbus_add_io() is one of those odd functions which we use half a dozen times in the whole codebase and which leaves me wondering if it ought to be refactored to work differently (eg split into "declare IO ports" and "map IO ports into IO space" like the mmio functions)... thanks -- PMM