qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Michael Tsirkin <mstirkin@redhat.com>,
	qemu-devel@nongnu.org, Alex Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 0/15][RFC] New PCI interfaces
Date: Wed, 10 Feb 2010 13:29:18 -0600	[thread overview]
Message-ID: <4B73090E.1020408@codemonkey.ws> (raw)
In-Reply-To: <f43fc5581002101034x4b554d1cl1c848292ea8a5a0f@mail.gmail.com>

On 02/10/2010 12:34 PM, Blue Swirl wrote:
> On Wed, Feb 10, 2010 at 12:01 AM, Anthony Liguori<aliguori@us.ibm.com>  wrote:
>    
>> This is a work in progress that I wanted to share giving some of the discussions
>> around rwhandlers.  The idea is to make PCI devices have a common set of
>> functions to interact with the CPU that is driven entirely through the PCI bus.
>>
>> I've tested the network card conversions, but have not yet tested the other
>> bits.
>>      
> By itself, the patches look OK. But given that the conclusion of the
> generic DMA discussion was to aim for mapping approach (in order to
> prepare for zero copy DMA), I wonder how the patches fit to the larger
> picture. Perhaps instead of pci specific functions, a more generic
> memory object with read and write methods could be introduced, which
> would be more useful in the longer term?
>    

This is a good point and it's something that needs to be addressed for 
the virtio conversion.

I was thinking:

void *pci_memory_map(PCIDevice *dev, pcibus_t addr, pcibus_t *plen, int 
is_write);

void pci_memory_unmap(PCIDevice *dev, void *buf, pcibus_t *plen, int 
is_write, pcibus_t access_len);

Not too surprising.

Since virtio devices can live on two busses (sysbus with Syborg or PCI), 
we need to introduce a set of virtio specific functions.

void virtio_memory_read(VirtIODevice *dev, uint64_t addr, void *buf, int len);
void virtio_memory_write(VirtIODevice *dev, uint64_t addr, const void *buf, int len);
void *virtio_memory_map(VirtIODevice *dev, uint64_t addr, uint64_t *plen, int is_write);
void virtio_memory_unmap(VirtIODevice *dev, uint64_t addr, uint64_t *plen, int is_write, uint64_t access_len);

Inside the VirtIODevice, there would be corresponding function pointers, and depending on whether it was a PCI device or a Syborg device, it would call pci_memory_map or cpu_physical_memory_map.

If we introduced a consistent address type, it would be possible to make generic memory access functions that used a state variable to mask this from the user.

I personally prefer the explicit interfaces though.  It makes it easy to look at a PCI device and see that it only uses PCI interfaces.  I also think that some bus concepts will be difficult to abstract in a generic way.

Regards,

Anthony Liguori

  reply	other threads:[~2010-02-10 19:29 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 22:01 [Qemu-devel] [PATCH 0/15][RFC] New PCI interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 01/15] pci: add new bus functions Anthony Liguori
2010-02-10  8:09   ` Isaku Yamahata
2010-02-10  8:57   ` [Qemu-devel] " Michael S. Tsirkin
2010-02-09 22:01 ` [Qemu-devel] [PATCH 02/15] rtl8139: convert to new PCI interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 03/15] lsi53c895a: convert to new pci interfaces Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 04/15] e1000: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 05/15] wdt_i6300esb: fix io type leakage Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 06/15] wdt_i6300esb: convert to new pci inteface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 07/15] ac97: convert to new PCI API Anthony Liguori
2010-02-09 22:45   ` malc
2010-02-09 22:52     ` Anthony Liguori
2010-02-09 23:06       ` malc
2010-02-09 23:10         ` Anthony Liguori
2010-02-09 23:36           ` malc
2010-02-09 23:52             ` Anthony Liguori
2010-02-10  0:24               ` malc
2010-02-11 14:20                 ` Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 08/15] es1370: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 09/15] eepro100: " Anthony Liguori
2010-02-10  6:32   ` Stefan Weil
2010-02-10  9:49     ` [Qemu-devel] " Michael S. Tsirkin
2010-02-10 10:43       ` Markus Armbruster
2010-02-10 10:48         ` Michael S. Tsirkin
2010-02-10 14:13     ` [Qemu-devel] " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 10/15] virtio-pci: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 11/15] pci: add pci_register_msix_region Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 12/15] ne2000: convert to new pci interface Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 13/15] pcnet: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 14/15] usb-uhci: " Anthony Liguori
2010-02-09 22:01 ` [Qemu-devel] [PATCH 15/15] pci: byte swap as PCI interface layer Anthony Liguori
2010-02-10  9:31 ` [Qemu-devel] Re: [PATCH 0/15][RFC] New PCI interfaces Michael S. Tsirkin
2010-02-10 18:34 ` [Qemu-devel] " Blue Swirl
2010-02-10 19:29   ` Anthony Liguori [this message]
2010-02-10 20:41     ` Richard Henderson
2010-02-10 21:13       ` Anthony Liguori
2010-02-12 17:40         ` Blue Swirl
2010-03-01  2:51     ` Paul Brook

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=4B73090E.1020408@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agraf@suse.de \
    --cc=blauwirbel@gmail.com \
    --cc=mstirkin@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).