From patchwork Mon Nov 12 11:57:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 1727861 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C160C3FCDE for ; Mon, 12 Nov 2012 11:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752947Ab2KLL5m (ORCPT ); Mon, 12 Nov 2012 06:57:42 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:55158 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752742Ab2KLL5j (ORCPT ); Mon, 12 Nov 2012 06:57:39 -0500 Received: from mudshark.cambridge.arm.com (mudshark.cambridge.arm.com [10.1.79.58]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id qACBvYE9025847; Mon, 12 Nov 2012 11:57:34 GMT Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id 0A2FBC2A95; Mon, 12 Nov 2012 11:57:34 +0000 (GMT) From: Will Deacon To: kvm@vger.kernel.org Cc: penberg@kernel.org, marc.zyngier@arm.com, c.dall@virtualopensystems.com, matt.evans@arm.com, peter.maydell@linaro.org, Will Deacon Subject: [RFC PATCH 10/16] kvm tools: virtio-mmio: use subsys_id instead of pci device ID Date: Mon, 12 Nov 2012 11:57:24 +0000 Message-Id: <1352721450-11340-11-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1352721450-11340-1-git-send-email-will.deacon@arm.com> References: <1352721450-11340-1-git-send-email-will.deacon@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The virtio MMIO code attempts to map PCI device IDs to virtio MMIO device IDs by subtracting 0x1000 and adding 1, however this conversion only works for NET and BLK devices. This patch uses the subsys_id (which is actually the virtio device ID for virtio-mmio devices) instead of the PCI device ID when populating the mmio device header. Signed-off-by: Will Deacon --- tools/kvm/virtio/mmio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c index 2d538b8..18a268b 100644 --- a/tools/kvm/virtio/mmio.c +++ b/tools/kvm/virtio/mmio.c @@ -231,7 +231,7 @@ int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev, vmmio->hdr = (struct virtio_mmio_hdr) { .magic = {'v', 'i', 'r', 't'}, .version = 1, - .device_id = device_id - 0x1000 + 1, + .device_id = subsys_id, .vendor_id = 0x4d564b4c , /* 'LKVM' */ .queue_num_max = 256, };