Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-04-01 Thread Avi Kivity
On 03/31/2010 12:12 PM, Michael S. Tsirkin wrote: $ echo 4 /sys/.../msix/allocate $ # subdirectories 0 1 2 3 magically appear $ # bind fd 13 to msix There's no way to know, when qemu starts, how many vectors will be used by driver. So I think we can just go ahead and

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-04-01 Thread Avi Kivity
On 04/01/2010 01:59 PM, Michael S. Tsirkin wrote: On Thu, Apr 01, 2010 at 11:58:29AM +0300, Avi Kivity wrote: On 03/31/2010 12:12 PM, Michael S. Tsirkin wrote: $ echo 4 /sys/.../msix/allocate $ # subdirectories 0 1 2 3 magically appear $ # bind fd 13 to msix

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-04-01 Thread Avi Kivity
On 03/30/2010 05:52 PM, Cam Macdonell wrote: Ah, the usual ioctls are ugly, go away. It could be done via sysfs: $ cat /sys/.../msix/max-interrupts 256 $ echo 4 /sys/.../msix/allocate $ # subdirectories 0 1 2 3 magically appear $ # bind fd 13 to msix $ echo 13

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-04-01 Thread Michael S. Tsirkin
On Thu, Apr 01, 2010 at 11:58:29AM +0300, Avi Kivity wrote: On 03/31/2010 12:12 PM, Michael S. Tsirkin wrote: $ echo 4 /sys/.../msix/allocate $ # subdirectories 0 1 2 3 magically appear $ # bind fd 13 to msix There's no way to know, when qemu starts, how many vectors will

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-31 Thread Michael S. Tsirkin
On Mon, Mar 29, 2010 at 11:59:24PM +0300, Avi Kivity wrote: On 03/28/2010 10:48 PM, Cam Macdonell wrote: On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivitya...@redhat.com wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-30 Thread Cam Macdonell
On Mon, Mar 29, 2010 at 2:59 PM, Avi Kivity a...@redhat.com wrote: On 03/28/2010 10:48 PM, Cam Macdonell wrote: On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivitya...@redhat.com  wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-29 Thread Avi Kivity
On 03/28/2010 10:48 PM, Cam Macdonell wrote: On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivitya...@redhat.com wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface, an ioctl() on the fd to assign an eventfd to an MSI

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Michael S. Tsirkin
On Sat, Mar 27, 2010 at 08:48:34PM +0300, Avi Kivity wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface, an ioctl() on the fd to assign an eventfd to an MSI vector. Similar to ioeventfd, but instead of mapping a doorbell to an

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Avi Kivity
On 03/28/2010 10:47 AM, Michael S. Tsirkin wrote: Maybe irqcontrol could be extended? What's irqcontrol? uio accepts 32 bit writes to the char device file. We can encode the fd number there, and use the high bit to signal assign/deassign. Ugh. Very unexpandable. --

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Michael S. Tsirkin
On Sun, Mar 28, 2010 at 11:02:11AM +0300, Avi Kivity wrote: On 03/28/2010 10:47 AM, Michael S. Tsirkin wrote: Maybe irqcontrol could be extended? What's irqcontrol? uio accepts 32 bit writes to the char device file. We can encode the fd number there, and use the high bit to

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Avi Kivity
On 03/28/2010 12:40 PM, Michael S. Tsirkin wrote: uio accepts 32 bit writes to the char device file. We can encode the fd number there, and use the high bit to signal assign/deassign. Ugh. Very unexpandable. It currently fails on any non-4 byte write. So if we need more bits in

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Michael S. Tsirkin
On Sun, Mar 28, 2010 at 12:45:02PM +0300, Avi Kivity wrote: On 03/28/2010 12:40 PM, Michael S. Tsirkin wrote: uio accepts 32 bit writes to the char device file. We can encode the fd number there, and use the high bit to signal assign/deassign. Ugh. Very unexpandable. It

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Avi Kivity
On 03/28/2010 01:31 PM, Michael S. Tsirkin wrote: Aren't ioctls a lot simpler? Multiplexing multiple functions on write()s is just ioctls done uglier. I don't have an opinion here. Writes do have an advantage that strace can show the buffer content without being patched. ioctls

Re: [Qemu-devel] Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Jamie Lokier
Avi Kivity wrote: ioctls encode the buffer size into the ioctl number, so in theory strace doesn't need to be taught about an ioctl to show its buffer. Unfortunately ioctl numbers don't always follow that rule :-( But maybe that's just awful proprietary drivers that I've seen. Anyway, strace

Re: [Qemu-devel] Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread malc
On Sun, 28 Mar 2010, Jamie Lokier wrote: Avi Kivity wrote: ioctls encode the buffer size into the ioctl number, so in theory strace doesn't need to be taught about an ioctl to show its buffer. Unfortunately ioctl numbers don't always follow that rule :-( It's not a rule to begin with,

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Cam Macdonell
On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivity a...@redhat.com wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface, an ioctl() on the fd to assign an eventfd to an MSI vector.  Similar to ioeventfd, but instead of mapping a

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-27 Thread Avi Kivity
On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface, an ioctl() on the fd to assign an eventfd to an MSI vector. Similar to ioeventfd, but instead of mapping a doorbell to an eventfd, it maps a real MSI to an eventfd. uio will

[PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
This patch adds a driver for my shared memory PCI device using the uio_pci interface. The driver has three memory regions. The first memory region is for device registers for sending interrupts. The second BAR is for receiving MSI-X interrupts and the third memory region maps the shared memory.

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface. The driver has three memory regions. The first memory region is for device registers for sending interrupts. The second BAR is for receiving

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface. The driver has three memory regions. The first memory region is for device registers for sending interrupts. The second BAR is for receiving

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 11:15 AM, Michael S. Tsirkin wrote: - Why are you using 32 bit long memory accesses for interrupts? 16 bit IO eould be enough and it's faster. This what virtio-pci does. Why is 16 bit io faster? -- error compiling committee.c: too many arguments to function -- To

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 08:09 AM, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface. The driver has three memory regions. The first memory region is for device registers for sending interrupts. The second BAR is for receiving MSI-X interrupts and

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 11:40:09AM +0200, Avi Kivity wrote: On 03/25/2010 11:15 AM, Michael S. Tsirkin wrote: - Why are you using 32 bit long memory accesses for interrupts? 16 bit IO eould be enough and it's faster. This what virtio-pci does. Why is 16 bit io faster? Something to

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 11:58:30AM +0200, Avi Kivity wrote: On 03/25/2010 11:44 AM, Michael S. Tsirkin wrote: On Thu, Mar 25, 2010 at 11:40:09AM +0200, Avi Kivity wrote: On 03/25/2010 11:15 AM, Michael S. Tsirkin wrote: - Why are you using 32 bit long memory accesses for

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:15 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region is for

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Anthony Liguori
On 03/25/2010 11:18 AM, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:15 AM, Michael S. Tsirkinm...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface. The driver has

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:46 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 08:09 AM, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region is for device registers for

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:05 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region is for

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 06:23 PM, Anthony Liguori wrote: There has been previous discussion of virtio, however while virtio is good for exporting guest memory, it's not ideal for importing memory into a guest. virtio is a DMA-based API which means that it doesn't assume cache coherent shared memory.

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 11:05 AM, Michael S. Tsirkin wrote: +static struct pci_device_id ivshmem_pci_ids[] __devinitdata = { +{ +.vendor =0x1af4, +.device =0x1110, vendor ids must be registered with PCI SIG. this one does not seem to be registered. That's the

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 11:23:05AM -0500, Anthony Liguori wrote: On 03/25/2010 11:18 AM, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:15 AM, Michael S. Tsirkinm...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 10:30:42AM -0600, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:05 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 06:36:02PM +0200, Avi Kivity wrote: On 03/25/2010 11:05 AM, Michael S. Tsirkin wrote: +static struct pci_device_id ivshmem_pci_ids[] __devinitdata = { +{ +.vendor =0x1af4, +.device =0x1110, vendor ids must be registered with PCI

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 06:32:15PM +0200, Avi Kivity wrote: On 03/25/2010 06:23 PM, Anthony Liguori wrote: There has been previous discussion of virtio, however while virtio is good for exporting guest memory, it's not ideal for importing memory into a guest. virtio is a DMA-based API which

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Michael S. Tsirkin
On Thu, Mar 25, 2010 at 10:24:20AM -0600, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:46 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 08:09 AM, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 06:40 PM, Michael S. Tsirkin wrote: On Thu, Mar 25, 2010 at 06:32:15PM +0200, Avi Kivity wrote: On 03/25/2010 06:23 PM, Anthony Liguori wrote: There has been previous discussion of virtio, however while virtio is good for exporting guest memory, it's not ideal for

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Avi Kivity
On 03/25/2010 06:37 PM, Michael S. Tsirkin wrote: On Thu, Mar 25, 2010 at 06:36:02PM +0200, Avi Kivity wrote: On 03/25/2010 11:05 AM, Michael S. Tsirkin wrote: +static struct pci_device_id ivshmem_pci_ids[] __devinitdata = { +{ +.vendor =0x1af4, +

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 10:34 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 10:30:42AM -0600, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:05 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds