From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhjPC-0004m1-4q for qemu-devel@nongnu.org; Thu, 01 Oct 2015 15:20:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhjP7-0008Ah-Vg for qemu-devel@nongnu.org; Thu, 01 Oct 2015 15:20:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhjP7-0008AR-P7 for qemu-devel@nongnu.org; Thu, 01 Oct 2015 15:20:33 -0400 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: Laszlo Ersek Message-ID: <560D877D.7020408@redhat.com> Date: Thu, 1 Oct 2015 21:20:29 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit 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: Peter Maydell Cc: Drew , Stefan Hajnoczi , "Gabriel L. Somlo" , QEMU Developers , Kevin O'Connor , Gerd Hoffmann , =?UTF-8?Q?Marc_Mar=c3=ad?= On 10/01/15 19:18, Peter Maydell wrote: > 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)... I had the same idea looming in the back of my mind, but I wouldn't know how to attack the refactoring (plus I wouldn't want to delay Marc's work with it -- after all the function is not being introduced by this series), so I didn't bring it up. :P Thanks! Laszlo