Re: [Qemu-devel] [PATCH 1/2] Type-safe ioport callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 25, 2010 at 10:00 AM, Avi Kivity <avi@xxxxxxxxxx> wrote:
> ÂOn 10/24/2010 08:14 PM, Blue Swirl wrote:
>>
>> On Sun, Oct 24, 2010 at 3:34 PM, Avi Kivity<avi@xxxxxxxxxx> Âwrote:
>> > ÂThe current ioport callbacks are not type-safe, in that they accept an
>> > "opaque"
>> > Âpointer as an argument whose type must match the argument to the
>> > registration
>> > Âfunction; this is not checked by the compiler.
>> >
>> > ÂThis patch adds an alternative that is type-safe. ÂInstead of an opaque
>> > Âargument, both registation and the callback use a new IOPort type. ÂThe
>> > Âcallback then uses container_of() to access its main structures.
>> >
>> > ÂCurrently the old and new methods exist side by side; once the old way
>> > is gone,
>> > Âwe can also save a bunch of memory since the new method requires one
>> > pointer
>> > Âper ioport instead of 6.
>> >
>> > ÂSigned-off-by: Avi Kivity<avi@xxxxxxxxxx>
>>
>> If we are going to change the interface, let's do it so that it's
>> useful for other uses too:
>> http://article.gmane.org/gmane.comp.emulators.qemu/76984
>
> 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?

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.
--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux