From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52458) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKnsI-0000nX-R1 for qemu-devel@nongnu.org; Sun, 07 Oct 2012 06:14:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKnsH-0006PH-Rw for qemu-devel@nongnu.org; Sun, 07 Oct 2012 06:14:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKnsH-0006P3-CC for qemu-devel@nongnu.org; Sun, 07 Oct 2012 06:14:17 -0400 Message-ID: <507155E1.6090907@redhat.com> Date: Sun, 07 Oct 2012 12:13:53 +0200 From: Avi Kivity MIME-Version: 1.0 References: <20120831141231.GA18777@igalia.com> <5040E1A7.4010401@suse.de> <20121005132036.GA29555@igalia.com> <506EEE79.10608@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Ping [PATCH 0/2] Add TPCI200 and IP-Octal 232 IndustryPack emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Anthony Liguori , Alberto Garcia , qemu-devel@nongnu.org, Paul Brook , Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 10/05/2012 06:24 PM, Blue Swirl wrote: > > I'd suppose addressing devices in the bus could be implemented more > efficiently with better use of memory API, now some of it is > reimplemented. Maybe Avi can propose something? Luckily the low-order bits are used for offsets, and the high-order bits are used for selecting the sub-device. So you could easily have struct IPackDevice { DeviceState qdev; int32_t slot; /* IRQ objects for the IndustryPack INT0# and INT1# */ qemu_irq *irq; MemoryRegion io_space; MemoryRegion id_space; MemoryRegion int_space; MemoryRegion mem8_space; /* for las3 */ MemoryRegion mem16_space; /* for las2 */ }; The PCI device would then just map each space (with memory_region_add_subregion()) into las1/las2/las3 such that the high bits select the device/space. The low bits would automatically become the offset into the space. -- error compiling committee.c: too many arguments to function