From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH] kvm tools: adds a PCI device that exports a host shared segment as a PCI BAR in the guest Date: Fri, 26 Aug 2011 09:11:43 +0300 Message-ID: <1314339103.3647.15.camel@lappy> References: <20110824222510.GC14835@dancer.ca.sandia.gov> <4E56C021.4040909@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: David Evensky , penberg@kernel.org, kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:63566 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692Ab1HZGLt (ORCPT ); Fri, 26 Aug 2011 02:11:49 -0400 Received: by wyg24 with SMTP id 24so2196830wyg.19 for ; Thu, 25 Aug 2011 23:11:48 -0700 (PDT) In-Reply-To: <4E56C021.4040909@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, 2011-08-25 at 16:35 -0500, Anthony Liguori wrote: > On 08/24/2011 05:25 PM, David Evensky wrote: > > > > > > This patch adds a PCI device that provides PCI device memory to the > > guest. This memory in the guest exists as a shared memory segment in > > the host. This is similar memory sharing capability of Nahanni > > (ivshmem) available in QEMU. In this case, the shared memory segment > > is exposed as a PCI BAR only. > > > > A new command line argument is added as: > > --shmem pci:0xc8000000:16MB:handle=/newmem:create > > > > diff -uprN -X linux-kvm/Documentation/dontdiff linux-kvm/tools/kvm/include/kvm/pci-shmem.h linux-kvm_pci_shmem/tools/kvm/include/kvm/pci-shmem.h > > --- linux-kvm/tools/kvm/include/kvm/pci-shmem.h 1969-12-31 16:00:00.000000000 -0800 > > +++ linux-kvm_pci_shmem/tools/kvm/include/kvm/pci-shmem.h 2011-08-13 15:43:01.067953711 -0700 > > @@ -0,0 +1,13 @@ > > +#ifndef KVM__PCI_SHMEM_H > > +#define KVM__PCI_SHMEM_H > > + > > +#include > > +#include > > + > > +struct kvm; > > +struct shmem_info; > > + > > +int pci_shmem__init(struct kvm *self); > > +int pci_shmem__register_mem(struct shmem_info *si); > > + > > +#endif > > diff -uprN -X linux-kvm/Documentation/dontdiff linux-kvm/tools/kvm/include/kvm/virtio-pci-dev.h linux-kvm_pci_shmem/tools/kvm/include/kvm/virtio-pci-dev.h > > --- linux-kvm/tools/kvm/include/kvm/virtio-pci-dev.h 2011-08-09 15:38:48.760120973 -0700 > > +++ linux-kvm_pci_shmem/tools/kvm/include/kvm/virtio-pci-dev.h 2011-08-18 10:06:12.171539230 -0700 > > @@ -15,10 +15,13 @@ > > #define PCI_DEVICE_ID_VIRTIO_BLN 0x1005 > > #define PCI_DEVICE_ID_VIRTIO_P9 0x1009 > > #define PCI_DEVICE_ID_VESA 0x2000 > > +#define PCI_DEVICE_ID_PCI_SHMEM 0x0001 > > > > #define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 > > +#define PCI_VENDOR_ID_PCI_SHMEM 0x0001 > > #define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET 0x1af4 > > FYI, that's not a valid vendor and device ID. > > Perhaps the RH folks would be willing to reserve a portion of the device > ID space in their vendor ID for ya'll to play around with. I'm working on a patch on top of David's patch to turn it into a ivshmem device. Once it's ready we would use same vendor/device IDs. -- Sasha.