From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=55939 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PAeXk-0005VS-Gw for qemu-devel@nongnu.org; Tue, 26 Oct 2010 04:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PAeXg-00065v-I5 for qemu-devel@nongnu.org; Tue, 26 Oct 2010 04:06:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PAeXg-00065i-Af for qemu-devel@nongnu.org; Tue, 26 Oct 2010 04:06:00 -0400 Message-ID: <4CC68BE1.5010207@redhat.com> Date: Tue, 26 Oct 2010 10:05:53 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/2] Type-safe ioport callbacks References: <1287934469-16624-1-git-send-email-avi@redhat.com> <1287934469-16624-2-git-send-email-avi@redhat.com> <4CC55554.4060103@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 10/25/2010 08:38 PM, Blue Swirl wrote: > > > > I don't really see why we need registration; cpu_register_io() takes > > function pointers, a size, and an opaque, and gives an integer handle in > > return. With the IOPort object approach, you set up the IOPort with > > function pointers, size is implied, and the opaque is derived using > > container_of(); the handle is simply the address of the object. > > With the handle, we can separate setting up the structures at device > level, and mapping the object using only the handle at bus or other > higher level. Can this be done with the object approach? I believe so. The handle is simply an indirect pointer, no? > The purpose of that patch series was to perform the separation for PCI > BARs. I wasn't so happy with the series, so I never pushed. In fact I think an IOPort is even more suitable; if we need additional attributes we can use a derived object: struct PCIIOPort { IOPort ioport; /* additional fields */ }; -- error compiling committee.c: too many arguments to function