From: Asias He Subject: [PATCH 1/6] kvm tools: define marcros for virtio device io space size and pci device number Date: Fri, 8 Apr 2011 22:12:48 +0800 Message-ID: <1302271973-7604-1-git-send-email-asias.hejun@gmail.com> Cc: kvm@vger.kernel.org, Ingo Molnar , Asias He To: Pekka Enberg , Cyrill Gorcunov Return-path: Received: from mail-yx0-f174.google.com ([209.85.213.174]:53954 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751562Ab1DGOOD (ORCPT ); Thu, 7 Apr 2011 10:14:03 -0400 Received: by yxs7 with SMTP id 7so1024931yxs.19 for ; Thu, 07 Apr 2011 07:14:02 -0700 (PDT) Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Asias He --- 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 /* 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; -- 1.7.4.1