From patchwork Tue May 17 12:11:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 791332 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 p4HCBZue028524 for ; Tue, 17 May 2011 12:11:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754405Ab1EQMLc (ORCPT ); Tue, 17 May 2011 08:11:32 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:61636 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754356Ab1EQMLc (ORCPT ); Tue, 17 May 2011 08:11:32 -0400 Received: by fxm17 with SMTP id 17so371612fxm.19 for ; Tue, 17 May 2011 05:11: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=ZzNLoqtZVpPx9+xUmgBko3C4M1bS4ABbqIfygq5iZ34=; b=A9Dl2sociYDJJ2Yrd4kDM2A22neLPdCFFW+GsLBDodZUC+Ph4N4YtTtYpGGTnMusVu yLO7JrIodhplE9AvieORdYvtBdUWdLG1I4Dt9el7NBsFpfXRmHopPpWgVO6UrvPBByFw +FAvJanNwDYfmSnIWzkAAXnWt5wRVwjmNPl/E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=q1I13G3es7HXDP9z1mvTQamXAjohGNL22GHMU2tx91FgxBav/qLtTFGlSr7+Wf3+ff iuT5D/EjXJwi0/tLA3aaU9vlY7Hr0VgpVz2va6399h6aQKboFdnU5GVUuL0MvlZ5/+Xc tDzSvh9o7ih+TfYPx6NL/PIW3sRrVIkhJTbgs= Received: by 10.223.85.196 with SMTP id p4mr692934fal.105.1305634290301; Tue, 17 May 2011 05:11:30 -0700 (PDT) Received: from localhost.localdomain ([188.120.132.169]) by mx.google.com with ESMTPS id b17sm193748fab.23.2011.05.17.05.11.28 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 May 2011 05:11:29 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: mingo@elte.hu, asias.hejun@gmail.com, prasadjoshi124@gmail.com, gorcunov@gmail.com, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH] kvm tools: Use virtio IDs from Date: Tue, 17 May 2011 15:11:04 +0300 Message-Id: <1305634264-29848-1-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc3 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]); Tue, 17 May 2011 12:11:35 +0000 (UTC) Instead of redefining virtio IDs in our headers, use IDs defined in . Signed-off-by: Sasha Levin --- tools/kvm/include/kvm/virtio-pci-dev.h | 7 ++----- tools/kvm/virtio/blk.c | 4 ++-- tools/kvm/virtio/console.c | 4 ++-- tools/kvm/virtio/net.c | 4 ++-- tools/kvm/virtio/rng.c | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tools/kvm/include/kvm/virtio-pci-dev.h b/tools/kvm/include/kvm/virtio-pci-dev.h index 706ad20..fa8328d 100644 --- a/tools/kvm/include/kvm/virtio-pci-dev.h +++ b/tools/kvm/include/kvm/virtio-pci-dev.h @@ -1,6 +1,8 @@ #ifndef VIRTIO_PCI_DEV_H_ #define VIRTIO_PCI_DEV_H_ +#include + /* * Virtio PCI device constants and resources * they do use (such as irqs and pins). @@ -11,11 +13,6 @@ #define PCI_DEVICE_ID_VIRTIO_CONSOLE 0x1003 #define PCI_DEVICE_ID_VIRTIO_RNG 0x1004 -#define PCI_SUBSYSTEM_ID_VIRTIO_NET 0x0001 -#define PCI_SUBSYSTEM_ID_VIRTIO_BLK 0x0002 -#define PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE 0x0003 -#define PCI_SUBSYSTEM_ID_VIRTIO_RNG 0x0004 - #define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 #define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET 0x1af4 diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c index 6c9eb19..c9b8a54 100644 --- a/tools/kvm/virtio/blk.c +++ b/tools/kvm/virtio/blk.c @@ -299,7 +299,7 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk) .revision_id = 0, .class = 0x010000, .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET, - .subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_BLK, + .subsys_id = VIRTIO_ID_BLOCK, .bar[0] = blk_dev_base_addr | PCI_BASE_ADDRESS_SPACE_IO, }, /* @@ -310,7 +310,7 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk) .host_features = (1UL << VIRTIO_BLK_F_SEG_MAX | 1UL << VIRTIO_BLK_F_FLUSH), }; - if (irq__register_device(PCI_DEVICE_ID_VIRTIO_BLK, &dev, &pin, &line) < 0) + if (irq__register_device(VIRTIO_ID_BLOCK, &dev, &pin, &line) < 0) return; bdev->pci_hdr.irq_pin = pin; diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c index 66da288..c0e251c 100644 --- a/tools/kvm/virtio/console.c +++ b/tools/kvm/virtio/console.c @@ -35,7 +35,7 @@ static struct pci_device_header virtio_console_pci_device = { .revision_id = 0, .class = 0x078000, .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET, - .subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE, + .subsys_id = VIRTIO_ID_CONSOLE, .bar[0] = IOPORT_VIRTIO_CONSOLE | PCI_BASE_ADDRESS_SPACE_IO, }; @@ -244,7 +244,7 @@ void virtio_console__init(struct kvm *kvm) { u8 dev, line, pin; - if (irq__register_device(PCI_DEVICE_ID_VIRTIO_CONSOLE, &dev, &pin, &line) < 0) + if (irq__register_device(VIRTIO_ID_CONSOLE, &dev, &pin, &line) < 0) return; virtio_console_pci_device.irq_pin = pin; diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c index 567f921..b47f02a 100644 --- a/tools/kvm/virtio/net.c +++ b/tools/kvm/virtio/net.c @@ -36,7 +36,7 @@ static struct pci_device_header pci_header = { .revision_id = 0, .class = 0x020000, .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET, - .subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_NET, + .subsys_id = VIRTIO_ID_NET, .bar[0] = IOPORT_VIRTIO_NET | PCI_BASE_ADDRESS_SPACE_IO, }; @@ -388,7 +388,7 @@ void virtio_net__init(const struct virtio_net_parameters *params) if (virtio_net__tap_init(params)) { u8 dev, line, pin; - if (irq__register_device(PCI_DEVICE_ID_VIRTIO_NET, &dev, &pin, &line) < 0) + if (irq__register_device(VIRTIO_ID_NET, &dev, &pin, &line) < 0) return; pci_header.irq_pin = pin; diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c index cf258fa..9bd0098 100644 --- a/tools/kvm/virtio/rng.c +++ b/tools/kvm/virtio/rng.c @@ -30,7 +30,7 @@ static struct pci_device_header virtio_rng_pci_device = { .revision_id = 0, .class = 0x010000, .subsys_vendor_id = PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET, - .subsys_id = PCI_SUBSYSTEM_ID_VIRTIO_RNG, + .subsys_id = VIRTIO_ID_RNG, .bar[0] = IOPORT_VIRTIO_RNG | PCI_BASE_ADDRESS_SPACE_IO, }; @@ -172,7 +172,7 @@ void virtio_rng__init(struct kvm *kvm) if (rdev.fd < 0) die("Failed initializing RNG"); - if (irq__register_device(PCI_DEVICE_ID_VIRTIO_RNG, &dev, &pin, &line) < 0) + if (irq__register_device(VIRTIO_ID_RNG, &dev, &pin, &line) < 0) return; virtio_rng_pci_device.irq_pin = pin;