diff mbox

[1/3] kvm tools: define marcros for virtio device io space size and pci device number

Message ID 1302228309-6583-1-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He April 8, 2011, 2:05 a.m. UTC
Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/blk-virtio.c         |    6 ++++--
 tools/kvm/include/kvm/ioport.h |    7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

Comments

David Ahern April 7, 2011, 3:56 a.m. UTC | #1
Interesting overload of the kvm mailing list. Intended for changes to
the 'native kvm' (ie., tools/kvm)?

David


On 04/07/11 20:05, Asias He wrote:
> Signed-off-by: Asias He <asias.hejun@gmail.com>
> ---
>  tools/kvm/blk-virtio.c         |    6 ++++--
>  tools/kvm/include/kvm/ioport.h |    7 +++++--
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/kvm/blk-virtio.c b/tools/kvm/blk-virtio.c
> index 48211b5..9a723cc 100644
> --- a/tools/kvm/blk-virtio.c
> +++ b/tools/kvm/blk-virtio.c
> @@ -278,6 +278,8 @@ static struct pci_device_header blk_virtio_pci_device = {
>  	.irq_line		= VIRTIO_BLK_IRQ,
>  };
>  
> +#define PCI_VIRTIO_BLK_DEVNUM 1
> +
>  void blk_virtio__init(struct kvm *self)
>  {
>  	if (!self->disk_image)
> @@ -285,7 +287,7 @@ void blk_virtio__init(struct kvm *self)
>  
>  	device.blk_config.capacity = self->disk_image->size / SECTOR_SIZE;
>  
> -	pci__register(&blk_virtio_pci_device, 1);
> +	pci__register(&blk_virtio_pci_device, PCI_VIRTIO_BLK_DEVNUM);
>  
> -	ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, 256);
> +	ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, IOPORT_VIRTIO_BLK_SIZE);
>  }
> diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h
> index 7b6af53..b77f565 100644
> --- a/tools/kvm/include/kvm/ioport.h
> +++ b/tools/kvm/include/kvm/ioport.h
> @@ -5,8 +5,11 @@
>  #include <stdint.h>
>  
>  /* some ports we reserve for own use */
> -#define IOPORT_DBG		0xe0
> -#define IOPORT_VIRTIO_BLK	0xc200	/* Virtio block device */
> +#define IOPORT_DBG			0xe0
> +#define IOPORT_VIRTIO_BLK		0xc200	/* Virtio block device */
> +#define IOPORT_VIRTIO_BLK_SIZE		256
> +#define IOPORT_VIRTIO_CONSOLE		0xd200	/* Virtio console device */
> +#define IOPORT_VIRTIO_CONSOLE_SIZE	256
>  
>  struct kvm;
>  
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pekka Enberg April 7, 2011, 4:40 a.m. UTC | #2
On Thu, Apr 7, 2011 at 6:56 AM, David Ahern <dsahern@gmail.com> wrote:
> Interesting overload of the kvm mailing list. Intended for changes to
> the 'native kvm' (ie., tools/kvm)?

Yup, we're starting to use kvm@ for our patches and discussion as
suggested by Avi.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity April 7, 2011, 7:38 a.m. UTC | #3
On 04/07/2011 07:40 AM, Pekka Enberg wrote:
> On Thu, Apr 7, 2011 at 6:56 AM, David Ahern<dsahern@gmail.com>  wrote:
> >  Interesting overload of the kvm mailing list. Intended for changes to
> >  the 'native kvm' (ie., tools/kvm)?
>
> Yup, we're starting to use kvm@ for our patches and discussion as
> suggested by Avi.

Right, if the load becomes too high we can split it off to a separate list.
diff mbox

Patch

diff --git a/tools/kvm/blk-virtio.c b/tools/kvm/blk-virtio.c
index 48211b5..9a723cc 100644
--- a/tools/kvm/blk-virtio.c
+++ b/tools/kvm/blk-virtio.c
@@ -278,6 +278,8 @@  static struct pci_device_header blk_virtio_pci_device = {
 	.irq_line		= VIRTIO_BLK_IRQ,
 };
 
+#define PCI_VIRTIO_BLK_DEVNUM 1
+
 void blk_virtio__init(struct kvm *self)
 {
 	if (!self->disk_image)
@@ -285,7 +287,7 @@  void blk_virtio__init(struct kvm *self)
 
 	device.blk_config.capacity = self->disk_image->size / SECTOR_SIZE;
 
-	pci__register(&blk_virtio_pci_device, 1);
+	pci__register(&blk_virtio_pci_device, PCI_VIRTIO_BLK_DEVNUM);
 
-	ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, 256);
+	ioport__register(IOPORT_VIRTIO_BLK, &blk_virtio_io_ops, IOPORT_VIRTIO_BLK_SIZE);
 }
diff --git a/tools/kvm/include/kvm/ioport.h b/tools/kvm/include/kvm/ioport.h
index 7b6af53..b77f565 100644
--- a/tools/kvm/include/kvm/ioport.h
+++ b/tools/kvm/include/kvm/ioport.h
@@ -5,8 +5,11 @@ 
 #include <stdint.h>
 
 /* some ports we reserve for own use */
-#define IOPORT_DBG		0xe0
-#define IOPORT_VIRTIO_BLK	0xc200	/* Virtio block device */
+#define IOPORT_DBG			0xe0
+#define IOPORT_VIRTIO_BLK		0xc200	/* Virtio block device */
+#define IOPORT_VIRTIO_BLK_SIZE		256
+#define IOPORT_VIRTIO_CONSOLE		0xd200	/* Virtio console device */
+#define IOPORT_VIRTIO_CONSOLE_SIZE	256
 
 struct kvm;