From patchwork Fri Apr 8 02:05:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 691701 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3726mx1023225 for ; Thu, 7 Apr 2011 02:06:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932228Ab1DGCGd (ORCPT ); Wed, 6 Apr 2011 22:06:33 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:55085 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932195Ab1DGCGb (ORCPT ); Wed, 6 Apr 2011 22:06:31 -0400 Received: by pxi2 with SMTP id 2so1118447pxi.10 for ; Wed, 06 Apr 2011 19:06:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=jdYwJqdrShIe9WQBknXXMZGDK77zmsvil38SyttR8B8=; b=aYm7IoukolozyIX3xgKt9Lg3Tzwp8nYCzC3agV9hEUHvxQai6wy3Y4eRaclzyyq4BQ mgn2AmJQHWMnx77xkR4Lw1C7Ajo1/fdOd/syed4M34kS8vcdrVJ8510HGCn1kIGyMM8e 86AD3UKGuT0YcLm+g6Yt+yDSYpPD2LgQw5Pyo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=nQnlH47pKY5qjAVb10ZpQwUj/B5BN/Yybmsrzh2efOVSIwFBk7va+A4MleNDQJXDeQ 6ZMKoS1/qd6fmR3nkLRFl7vHVSGpDXVBaCIDvhSBvAQlFQiirSWl+K9ZN+fy9++ciFU6 F0DOt/8mgeCpGmCKVi1KrU8lcXUOzmvUwfh2I= Received: by 10.142.122.8 with SMTP id u8mr296633wfc.283.1302141990763; Wed, 06 Apr 2011 19:06:30 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id z10sm1549135wfj.15.2011.04.06.19.06.26 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Apr 2011 19:06:29 -0700 (PDT) From: Asias He To: Pekka Enberg , Cyrill Gorcunov Cc: Ingo Molnar , Prasad Joshi , kvm@vger.kernel.org, Asias He Subject: [PATCH 1/3] kvm tools: define marcros for virtio device io space size and pci device number Date: Fri, 8 Apr 2011 10:05:07 +0800 Message-Id: <1302228309-6583-1-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.4.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 07 Apr 2011 02:07:02 +0000 (UTC) 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;