All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH 1/2] Type-safe ioport callbacks
Date: Tue, 26 Oct 2010 12:27:01 -0500	[thread overview]
Message-ID: <4CC70F65.7050506@codemonkey.ws> (raw)
In-Reply-To: <4CC70D5D.4020109@redhat.com>

On 10/26/2010 12:18 PM, Avi Kivity wrote:
>  On 10/26/2010 05:09 PM, Blue Swirl wrote:
>> On Tue, Oct 26, 2010 at 8:05 AM, Avi Kivity<avi@redhat.com>  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.
>
> Sorry, I don't follow your meaning.
>
> When I said "size is implied" I meant that the IOPort object has a 
> separate function pointer for sizes 1, 2, and 4, so it 
> ioport_register() doesn't need a size parameter.  But I don't see how 
> that relates to your comment.

Yeah, I don't think it makes sense to combine "this is how to dispatch 
I/O" with "this is a region of I/O address space".

I think an IORegion should contain an IOPort structure though.  I think 
the name needs rethinking.

Maybe:

struct PortIOHandler;
struct MemoryIOHandler;

And it would be good to add a memory callback to this series too.

Regards,

Anthony Liguori

>> >>  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?
>
> It looks to be orthogonal.  It would be great to have a BAR object; 
> that object can then use your API, my API, or the existing API.
>


  reply	other threads:[~2010-10-26 17:27 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 15:34 [PATCH 0/2] Type-safe ioport callbacks Avi Kivity
2010-10-24 15:34 ` [Qemu-devel] " Avi Kivity
2010-10-24 15:34 ` [PATCH 1/2] " Avi Kivity
2010-10-24 15:34   ` [Qemu-devel] " Avi Kivity
2010-10-24 16:41   ` Avi Kivity
2010-10-24 16:41     ` [Qemu-devel] " Avi Kivity
2010-10-24 18:14   ` [Qemu-devel] " Blue Swirl
2010-10-24 18:14     ` Blue Swirl
2010-10-25 10:00     ` Avi Kivity
2010-10-25 10:00       ` Avi Kivity
2010-10-25 18:38       ` Blue Swirl
2010-10-25 18:38         ` Blue Swirl
2010-10-26  8:05         ` Avi Kivity
2010-10-26  8:05           ` Avi Kivity
2010-10-26 15:09           ` Blue Swirl
2010-10-26 15:09             ` Blue Swirl
2010-10-26 17:18             ` Avi Kivity
2010-10-26 17:18               ` Avi Kivity
2010-10-26 17:27               ` Anthony Liguori [this message]
2010-10-26 17:35                 ` Avi Kivity
2010-10-26 18:33                   ` Blue Swirl
2010-10-26 18:33                     ` Blue Swirl
2010-10-27  9:26                     ` Avi Kivity
2010-10-27  9:26                       ` Avi Kivity
2010-10-27 20:23                       ` Blue Swirl
2010-10-27 20:23                         ` Blue Swirl
2010-10-25 12:54   ` Juan Quintela
2010-10-25 12:54     ` [Qemu-devel] " Juan Quintela
2010-10-25 12:56     ` Avi Kivity
2010-10-25 12:56       ` [Qemu-devel] " Avi Kivity
2010-10-24 15:34 ` [PATCH 2/2] piix4 acpi: convert io BAR to type-safe " Avi Kivity
2010-10-24 15:34   ` [Qemu-devel] " Avi Kivity
2010-10-24 17:35 ` [PATCH 0/2] Type-safe " Paolo Bonzini
2010-10-24 17:35   ` [Qemu-devel] " Paolo Bonzini
2010-10-24 17:38   ` Avi Kivity
2010-10-24 17:38     ` [Qemu-devel] " Avi Kivity
2010-10-25 13:46     ` Anthony Liguori
2010-10-25 13:52       ` Paolo Bonzini
2010-10-25 13:52         ` Paolo Bonzini
2010-10-25 14:04         ` Anthony Liguori
2010-10-25 14:04           ` Anthony Liguori
2010-10-25 13:45 ` [Qemu-devel] " Anthony Liguori
2010-10-25 13:45   ` Anthony Liguori
2010-10-25 15:40 ` Markus Armbruster
2010-10-25 15:40   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CC70F65.7050506@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.