On Tue, Oct 26, 2010 at 8:05 AM, Avi Kivity <avi@xxxxxxxxxx> wrote: > Â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? Yes, but then the object should also contain size information. That should not be needed for mapping at higher level. >> 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 */ > }; One issue with my series was that it would be great if the devices just had some BAR structures (used by PCI layer to map the devices) inside PCI/qdev structures, but I invented that too late. Maybe this can be addressed in your design? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html