Re: [V9fs-developer] [kvm-devel] [RFC] 9p: add KVM/QEMU pci transport

2007-08-29 Thread Latchesar Ionkov
That's also in our plans. There was no virtio support in KVM when I
started working in the transport.

Thanks,
Lucho

On 8/29/07, Anthony Liguori <[EMAIL PROTECTED]> wrote:
> I think that it would be nicer to implement the p9 transport on top of
> virtio instead of directly on top of PCI.  I think your PCI transport
> would make a pretty nice start of a PCI virtio transport though.
>
> Regards,
>
> Anthony Liguori
>
> On Tue, 2007-08-28 at 13:52 -0500, Eric Van Hensbergen wrote:
> > From: Latchesar Ionkov <[EMAIL PROTECTED]>
> >
> > This adds a shared memory transport for a synthetic 9p device for
> > paravirtualized file system support under KVM/QEMU.
> >
> > Signed-off-by: Latchesar Ionkov <[EMAIL PROTECTED]>
> > Signed-off-by: Eric Van Hensbergen <[EMAIL PROTECTED]>
> > ---
> >  Documentation/filesystems/9p.txt |2 +
> >  net/9p/Kconfig   |   10 ++-
> >  net/9p/Makefile  |4 +
> >  net/9p/trans_pci.c   |  295 
> > ++
> >  4 files changed, 310 insertions(+), 1 deletions(-)
> >  create mode 100644 net/9p/trans_pci.c
> >
> > diff --git a/Documentation/filesystems/9p.txt 
> > b/Documentation/filesystems/9p.txt
> > index 1a5f50d..e1879bd 100644
> > --- a/Documentation/filesystems/9p.txt
> > +++ b/Documentation/filesystems/9p.txt
> > @@ -46,6 +46,8 @@ OPTIONS
> >   tcp  - specifying a normal TCP/IP connection
> >   fd   - used passed file descriptors for connection
> >  (see rfdno and wfdno)
> > + pci  - use a PCI pseudo device for 9p communication
> > + over shared memory between a guest and host
> >
> >uname=name user name to attempt mount as on the remote server.  The
> >   server may override or ignore this value.  Certain user
> > diff --git a/net/9p/Kconfig b/net/9p/Kconfig
> > index 09566ae..8517560 100644
> > --- a/net/9p/Kconfig
> > +++ b/net/9p/Kconfig
> > @@ -16,13 +16,21 @@ menuconfig NET_9P
> >  config NET_9P_FD
> >   depends on NET_9P
> >   default y if NET_9P
> > - tristate "9P File Descriptor Transports (Experimental)"
> > + tristate "9p File Descriptor Transports (Experimental)"
> >   help
> > This builds support for file descriptor transports for 9p
> > which includes support for TCP/IP, named pipes, or passed
> > file descriptors.  TCP/IP is the default transport for 9p,
> > so if you are going to use 9p, you'll likely want this.
> >
> > +config NET_9P_PCI
> > + depends on NET_9P
> > + tristate "9p PCI Shared Memory Transport (Experimental)"
> > + help
> > +   This builds support for a PCI psuedo-device currently available
> > +   under KVM/QEMU which allows for 9p transactions over shared
> > +   memory between the guest and the host.
> > +
> >  config NET_9P_DEBUG
> >   bool "Debug information"
> >   depends on NET_9P
> > diff --git a/net/9p/Makefile b/net/9p/Makefile
> > index 7b2a67a..26ce89d 100644
> > --- a/net/9p/Makefile
> > +++ b/net/9p/Makefile
> > @@ -1,5 +1,6 @@
> >  obj-$(CONFIG_NET_9P) := 9pnet.o
> >  obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
> > +obj-$(CONFIG_NET_9P_PCI) += 9pnet_pci.o
> >
> >  9pnet-objs := \
> >   mod.o \
> > @@ -14,3 +15,6 @@ obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
> >
> >  9pnet_fd-objs := \
> >   trans_fd.o \
> > +
> > +9pnet_pci-objs := \
> > + trans_pci.o \
> > diff --git a/net/9p/trans_pci.c b/net/9p/trans_pci.c
> > new file mode 100644
> > index 000..36ddc5f
> > --- /dev/null
> > +++ b/net/9p/trans_pci.c
> > @@ -0,0 +1,295 @@
> > +/*
> > + * net/9p/trans_pci.c
> > + *
> > + * 9P over PCI transport layer. For use with KVM/QEMU.
> > + *
> > + *  Copyright (C) 2007 by Latchesar Ionkov <[EMAIL PROTECTED]>
> > + *
> > + *  This program is free software; you can redistribute it and/or modify
> > + *  it under the terms of the GNU General Public License version 2
> > + *  as published by the Free Software Foundation.
> > + *
> > + *  This program is distributed in the hope that it will be useful,
> > + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + *  GNU General Public License for more details.
> > + *
> > + *  You should have received a copy of the GNU General Public License
> > + *  along with this program; if not, write to:
> > + *  Free Software Foundation
> > + *  51 Franklin Street, Fifth Floor
> > + *  Boston, MA  02111-1301  USA
> > + *
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define P9PCI_DRIVER_NAME "9P PCI Device"
> > +#define P9PCI_DRIVER_VERSION "1"
> > +
> > +#define PCI_VENDOR_ID_9P 0x5002
> > +#define PCI_DEVICE_ID_9P 0x000D
> > +

Re: [V9fs-developer] [kvm-devel] [RFC] 9p: add KVM/QEMU pci transport

2007-08-29 Thread Latchesar Ionkov
That's also in our plans. There was no virtio support in KVM when I
started working in the transport.

Thanks,
Lucho

On 8/29/07, Anthony Liguori [EMAIL PROTECTED] wrote:
 I think that it would be nicer to implement the p9 transport on top of
 virtio instead of directly on top of PCI.  I think your PCI transport
 would make a pretty nice start of a PCI virtio transport though.

 Regards,

 Anthony Liguori

 On Tue, 2007-08-28 at 13:52 -0500, Eric Van Hensbergen wrote:
  From: Latchesar Ionkov [EMAIL PROTECTED]
 
  This adds a shared memory transport for a synthetic 9p device for
  paravirtualized file system support under KVM/QEMU.
 
  Signed-off-by: Latchesar Ionkov [EMAIL PROTECTED]
  Signed-off-by: Eric Van Hensbergen [EMAIL PROTECTED]
  ---
   Documentation/filesystems/9p.txt |2 +
   net/9p/Kconfig   |   10 ++-
   net/9p/Makefile  |4 +
   net/9p/trans_pci.c   |  295 
  ++
   4 files changed, 310 insertions(+), 1 deletions(-)
   create mode 100644 net/9p/trans_pci.c
 
  diff --git a/Documentation/filesystems/9p.txt 
  b/Documentation/filesystems/9p.txt
  index 1a5f50d..e1879bd 100644
  --- a/Documentation/filesystems/9p.txt
  +++ b/Documentation/filesystems/9p.txt
  @@ -46,6 +46,8 @@ OPTIONS
tcp  - specifying a normal TCP/IP connection
fd   - used passed file descriptors for connection
   (see rfdno and wfdno)
  + pci  - use a PCI pseudo device for 9p communication
  + over shared memory between a guest and host
 
 uname=name user name to attempt mount as on the remote server.  The
server may override or ignore this value.  Certain user
  diff --git a/net/9p/Kconfig b/net/9p/Kconfig
  index 09566ae..8517560 100644
  --- a/net/9p/Kconfig
  +++ b/net/9p/Kconfig
  @@ -16,13 +16,21 @@ menuconfig NET_9P
   config NET_9P_FD
depends on NET_9P
default y if NET_9P
  - tristate 9P File Descriptor Transports (Experimental)
  + tristate 9p File Descriptor Transports (Experimental)
help
  This builds support for file descriptor transports for 9p
  which includes support for TCP/IP, named pipes, or passed
  file descriptors.  TCP/IP is the default transport for 9p,
  so if you are going to use 9p, you'll likely want this.
 
  +config NET_9P_PCI
  + depends on NET_9P
  + tristate 9p PCI Shared Memory Transport (Experimental)
  + help
  +   This builds support for a PCI psuedo-device currently available
  +   under KVM/QEMU which allows for 9p transactions over shared
  +   memory between the guest and the host.
  +
   config NET_9P_DEBUG
bool Debug information
depends on NET_9P
  diff --git a/net/9p/Makefile b/net/9p/Makefile
  index 7b2a67a..26ce89d 100644
  --- a/net/9p/Makefile
  +++ b/net/9p/Makefile
  @@ -1,5 +1,6 @@
   obj-$(CONFIG_NET_9P) := 9pnet.o
   obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
  +obj-$(CONFIG_NET_9P_PCI) += 9pnet_pci.o
 
   9pnet-objs := \
mod.o \
  @@ -14,3 +15,6 @@ obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
 
   9pnet_fd-objs := \
trans_fd.o \
  +
  +9pnet_pci-objs := \
  + trans_pci.o \
  diff --git a/net/9p/trans_pci.c b/net/9p/trans_pci.c
  new file mode 100644
  index 000..36ddc5f
  --- /dev/null
  +++ b/net/9p/trans_pci.c
  @@ -0,0 +1,295 @@
  +/*
  + * net/9p/trans_pci.c
  + *
  + * 9P over PCI transport layer. For use with KVM/QEMU.
  + *
  + *  Copyright (C) 2007 by Latchesar Ionkov [EMAIL PROTECTED]
  + *
  + *  This program is free software; you can redistribute it and/or modify
  + *  it under the terms of the GNU General Public License version 2
  + *  as published by the Free Software Foundation.
  + *
  + *  This program is distributed in the hope that it will be useful,
  + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  + *  GNU General Public License for more details.
  + *
  + *  You should have received a copy of the GNU General Public License
  + *  along with this program; if not, write to:
  + *  Free Software Foundation
  + *  51 Franklin Street, Fifth Floor
  + *  Boston, MA  02111-1301  USA
  + *
  + */
  +
  +#include linux/module.h
  +#include linux/kernel.h
  +#include linux/compiler.h
  +#include linux/pci.h
  +#include linux/init.h
  +#include linux/ioport.h
  +#include linux/completion.h
  +#include linux/interrupt.h
  +#include linux/io.h
  +#include linux/uaccess.h
  +#include linux/irq.h
  +#include linux/poll.h
  +#include net/9p/9p.h
  +#include net/9p/transport.h
  +
  +#define P9PCI_DRIVER_NAME 9P PCI Device
  +#define P9PCI_DRIVER_VERSION 1
  +
  +#define PCI_VENDOR_ID_9P 0x5002
  +#define PCI_DEVICE_ID_9P 0x000D
  +
  +#define MAX_PCI_BUF  (4*1024) /* TODO: Get a number from lucho */
  +
  +struct