From patchwork Mon Nov 12 11:57:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 1727911 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 67437DFF38 for ; Mon, 12 Nov 2012 11:58:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752843Ab2KLL5w (ORCPT ); Mon, 12 Nov 2012 06:57:52 -0500 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]:55181 "EHLO cam-admin0.cambridge.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831Ab2KLL5l (ORCPT ); Mon, 12 Nov 2012 06:57:41 -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 qACBvZE7025863; Mon, 12 Nov 2012 11:57:35 GMT Received: by mudshark.cambridge.arm.com (Postfix, from userid 1000) id 22AFEC25E4; 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 11/16] kvm tools: virtio: add dummy set_size_vq implementations Date: Mon, 12 Nov 2012 11:57:25 +0000 Message-Id: <1352721450-11340-12-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 When a guest kernel initialises a virtio device using an MMIO transport, it attempts to set the size of the virtual queue. For devices that expect a PCI transport, this is not the case and, as such, our console, 9p and rng virtio devices do not set a pointer for this function and subsequently SEGV. This patch adds a dummy implementation of the function to avoid the fatal signal. Signed-off-by: Will Deacon --- tools/kvm/virtio/9p.c | 7 +++++++ tools/kvm/virtio/console.c | 7 +++++++ tools/kvm/virtio/rng.c | 7 +++++++ 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index 835a8c4..a372c22 100644 --- a/tools/kvm/virtio/9p.c +++ b/tools/kvm/virtio/9p.c @@ -1300,6 +1300,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq) return VIRTQUEUE_NUM; } +static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size) +{ + /* FIXME: dynamic */ + return size; +} + struct virtio_ops p9_dev_virtio_ops = (struct virtio_ops) { .get_config = get_config, .get_host_features = get_host_features, @@ -1308,6 +1314,7 @@ struct virtio_ops p9_dev_virtio_ops = (struct virtio_ops) { .notify_vq = notify_vq, .get_pfn_vq = get_pfn_vq, .get_size_vq = get_size_vq, + .set_size_vq = set_size_vq, }; int virtio_9p_rootdir_parser(const struct option *opt, const char *arg, int unset) diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c index 1df6cb0..ea5d974 100644 --- a/tools/kvm/virtio/console.c +++ b/tools/kvm/virtio/console.c @@ -172,6 +172,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq) return VIRTIO_CONSOLE_QUEUE_SIZE; } +static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size) +{ + /* FIXME: dynamic */ + return size; +} + static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) { .get_config = get_config, .get_host_features = get_host_features, @@ -180,6 +186,7 @@ static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) { .notify_vq = notify_vq, .get_pfn_vq = get_pfn_vq, .get_size_vq = get_size_vq, + .set_size_vq = set_size_vq, }; int virtio_console__init(struct kvm *kvm) diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c index b2616d8..e1e4fc0 100644 --- a/tools/kvm/virtio/rng.c +++ b/tools/kvm/virtio/rng.c @@ -132,6 +132,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq) return VIRTIO_RNG_QUEUE_SIZE; } +static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size) +{ + /* FIXME: dynamic */ + return size; +} + static struct virtio_ops rng_dev_virtio_ops = (struct virtio_ops) { .get_config = get_config, .get_host_features = get_host_features, @@ -140,6 +146,7 @@ static struct virtio_ops rng_dev_virtio_ops = (struct virtio_ops) { .notify_vq = notify_vq, .get_pfn_vq = get_pfn_vq, .get_size_vq = get_size_vq, + .set_size_vq = set_size_vq, }; int virtio_rng__init(struct kvm *kvm)