Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-19 Thread David Gibson
On Wed, Oct 19, 2011 at 11:10:15AM +0200, Avi Kivity wrote: > On 10/18/2011 03:46 AM, David Gibson wrote: > > On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > > > On 10/14/2011 04:14 AM, David Gibson wrote: > > > > > Virtio is a very, very special case. virtio requires coherent RAM >

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-19 Thread Avi Kivity
On 10/18/2011 03:46 AM, David Gibson wrote: > On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > > On 10/14/2011 04:14 AM, David Gibson wrote: > > > > Virtio is a very, very special case. virtio requires coherent RAM > > > > access. > > > > > > Right. Virtio's access to memory is *not

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-18 Thread Rusty Russell
On Tue, 18 Oct 2011 12:46:50 +1100, David Gibson wrote: > On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > > On 10/14/2011 04:14 AM, David Gibson wrote: > > > > Virtio is a very, very special case. virtio requires coherent RAM > > > > access. > > > > > > Right. Virtio's access to m

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-18 Thread Michael S. Tsirkin
On Tue, Oct 18, 2011 at 12:46:50PM +1100, David Gibson wrote: > On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > > On 10/14/2011 04:14 AM, David Gibson wrote: > > > > Virtio is a very, very special case. virtio requires coherent RAM > > > > access. > > > > > > Right. Virtio's access

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-17 Thread David Gibson
On Sun, Oct 16, 2011 at 03:15:53PM +0200, Avi Kivity wrote: > On 10/14/2011 04:14 AM, David Gibson wrote: > > > Virtio is a very, very special case. virtio requires coherent RAM access. > > > > Right. Virtio's access to memory is *not* emulated PCI DMA, it's > > god-like hypervisor access to gues

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-16 Thread Avi Kivity
On 10/14/2011 04:14 AM, David Gibson wrote: > > Virtio is a very, very special case. virtio requires coherent RAM access. > > Right. Virtio's access to memory is *not* emulated PCI DMA, it's > god-like hypervisor access to guest system memory. It should > correctly bypass any IOMMU, and so shoul

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-16 Thread Michael S. Tsirkin
On Fri, Oct 14, 2011 at 01:14:07PM +1100, David Gibson wrote: > On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > > >>>Hmm, not entirely virtio specific, some devi

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-13 Thread David Gibson
On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > >>>Hmm, not entirely virtio specific, some devices use stX macros to do the > >>>conversion. E.g. stw_be_phys and st

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread David Gibson
On Thu, Oct 13, 2011 at 02:43:06AM +1100, David Gibson wrote: > On Wed, Oct 12, 2011 at 09:22:01AM +0200, Michael S. Tsirkin wrote: > > On Wed, Oct 12, 2011 at 02:07:46PM +1100, David Gibson wrote: > > > Um.. why? PCI is defined by the spec to be LE, so I don't see that we > > > need explicit endi

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread David Gibson
On Wed, Oct 12, 2011 at 09:22:01AM +0200, Michael S. Tsirkin wrote: > On Wed, Oct 12, 2011 at 02:07:46PM +1100, David Gibson wrote: > > Um.. why? PCI is defined by the spec to be LE, so I don't see that we > > need explicit endianness versions for PCI helpers. > > LE in the spec only applies to s

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread Michael S. Tsirkin
On Wed, Oct 12, 2011 at 02:09:26PM +1100, David Gibson wrote: > On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > > >>>Hmm, not entirely virtio specific, some devi

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread Gerd Hoffmann
Hi, Yes.. as do the stX_pci_dma() helpers. They assume LE, rather than having two variants, because PCI is an LE spec, and all normal PCI devices work in LE. IMO, not really. PCI devices do DMA any way they like. LE is probably more common because both ARM and x86 processors are LE. Also

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread Michael S. Tsirkin
On Wed, Oct 12, 2011 at 02:11:37PM +1100, David Gibson wrote: > On Sun, Oct 02, 2011 at 12:52:39PM +0200, Michael S. Tsirkin wrote: > > On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > > > On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > > > >On Mon, Sep 05, 2011 at 02:34:56PM +1000

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-12 Thread Michael S. Tsirkin
On Wed, Oct 12, 2011 at 02:07:46PM +1100, David Gibson wrote: > Um.. why? PCI is defined by the spec to be LE, so I don't see that we > need explicit endianness versions for PCI helpers. LE in the spec only applies to structures defined by the spec, that is pci configuration and msix tables in de

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-11 Thread David Gibson
On Sun, Oct 02, 2011 at 02:14:28PM +0200, Michael S. Tsirkin wrote: > On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > > On 10/02/2011 01:17 PM, Michael S. Tsirkin wrote: > > >On Sun, Oct 02, 2011 at 12:58:35PM +0200, Avi Kivity wrote: > > >> On 10/02/2011 12:52 PM, Michael S. Tsirkin

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-11 Thread David Gibson
On Sun, Oct 02, 2011 at 12:52:39PM +0200, Michael S. Tsirkin wrote: > On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > > On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > > >On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: > > >> This patch adds functions to pci.[ch] to

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-11 Thread David Gibson
On Mon, Oct 03, 2011 at 08:17:05AM -0500, Anthony Liguori wrote: > On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > >>>Hmm, not entirely virtio specific, some devices use stX macros to do the > >>>conversion. E.g. stw_be_phys and st

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-03 Thread Anthony Liguori
On 10/02/2011 07:14 AM, Michael S. Tsirkin wrote: On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: Hmm, not entirely virtio specific, some devices use stX macros to do the conversion. E.g. stw_be_phys and stl_le_phys are used in several places. These are fine - explicit endianness.

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-03 Thread Anthony Liguori
On 10/02/2011 05:25 AM, Michael S. Tsirkin wrote: On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: This patch adds functions to pci.[ch] to perform PCI DMA operations. At present, these are just stubs which perform directly cpu physical memory accesses. Using these stubs, however,

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Avi Kivity
On 10/02/2011 02:14 PM, Michael S. Tsirkin wrote: > > These are fine - explicit endianness. Right. So changing these to e.g. stl_dma and assuming LE is default seems like a step backwards. Agree. "l" implies a word with some endianness, not "4 unstructured bytes". -- error compiling commit

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Michael S. Tsirkin
On Sun, Oct 02, 2011 at 02:01:10PM +0200, Avi Kivity wrote: > On 10/02/2011 01:17 PM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 12:58:35PM +0200, Avi Kivity wrote: > >> On 10/02/2011 12:52 PM, Michael S. Tsirkin wrote: > >> >On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: >

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Avi Kivity
On 10/02/2011 01:17 PM, Michael S. Tsirkin wrote: On Sun, Oct 02, 2011 at 12:58:35PM +0200, Avi Kivity wrote: > On 10/02/2011 12:52 PM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > >> On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > >> >On

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Michael S. Tsirkin
On Sun, Oct 02, 2011 at 01:28:37PM +0200, Alexander Graf wrote: > >> Good point. Though this is really a virtio specific issue since > >> other devices have explicit endianness (not guest dependent). > > > > Hmm, not entirely virtio specific, some devices use stX macros to do the > > conversion.

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Alexander Graf
On 02.10.2011, at 13:17, Michael S. Tsirkin wrote: > On Sun, Oct 02, 2011 at 12:58:35PM +0200, Avi Kivity wrote: >> On 10/02/2011 12:52 PM, Michael S. Tsirkin wrote: >>> On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > On Mon

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Michael S. Tsirkin
On Sun, Oct 02, 2011 at 12:58:35PM +0200, Avi Kivity wrote: > On 10/02/2011 12:52 PM, Michael S. Tsirkin wrote: > >On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > >> On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > >> >On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote:

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Avi Kivity
On 10/02/2011 12:52 PM, Michael S. Tsirkin wrote: On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > >On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: > >> This patch adds functions to pci.[ch] to perform PCI DMA ope

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Michael S. Tsirkin
On Sun, Oct 02, 2011 at 12:29:08PM +0200, Avi Kivity wrote: > On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: > >On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: > >> This patch adds functions to pci.[ch] to perform PCI DMA operations. At > >> present, these are just stubs which p

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Avi Kivity
On 10/02/2011 12:25 PM, Michael S. Tsirkin wrote: On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: > This patch adds functions to pci.[ch] to perform PCI DMA operations. At > present, these are just stubs which perform directly cpu physical memory > accesses. > > Using these stu

Re: [Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-10-02 Thread Michael S. Tsirkin
On Mon, Sep 05, 2011 at 02:34:56PM +1000, David Gibson wrote: > This patch adds functions to pci.[ch] to perform PCI DMA operations. At > present, these are just stubs which perform directly cpu physical memory > accesses. > > Using these stubs, however, distinguishes PCI device DMA transactions

[Qemu-devel] [PATCH 1/9] Add stub functions for PCI device models to do PCI DMA

2011-09-04 Thread David Gibson
This patch adds functions to pci.[ch] to perform PCI DMA operations. At present, these are just stubs which perform directly cpu physical memory accesses. Using these stubs, however, distinguishes PCI device DMA transactions from other accesses to physical memory, which will allow PCI IOMMU suppo