From patchwork Wed Apr 1 08:15:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 457130 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1993D1400A0 for ; Wed, 1 Apr 2015 19:18:59 +1100 (AEDT) Received: from localhost ([::1]:42085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDrU-0001g4-Qo for incoming@patchwork.ozlabs.org; Wed, 01 Apr 2015 04:18:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDox-0005I2-8W for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:16:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdDow-0002it-Fy for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:16:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34970) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdDow-0002ih-A8 for qemu-devel@nongnu.org; Wed, 01 Apr 2015 04:16:18 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0C35229331F; Wed, 1 Apr 2015 08:16:18 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (vpn1-6-136.pek2.redhat.com [10.72.6.136]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t318FExm006923; Wed, 1 Apr 2015 04:16:15 -0400 From: Jason Wang To: qemu-devel@nongnu.org Date: Wed, 1 Apr 2015 16:15:05 +0800 Message-Id: <1427876112-12615-12-git-send-email-jasowang@redhat.com> In-Reply-To: <1427876112-12615-1-git-send-email-jasowang@redhat.com> References: <1427876112-12615-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: cornelia.huck@de.ibm.com, Jason Wang , mst@redhat.com Subject: [Qemu-devel] [PATCH V5 11/18] virtio-mmio: switch to bus specific queue limit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Cc: Michael S. Tsirkin Signed-off-by: Jason Wang --- hw/virtio/virtio-mmio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 2ae6942..dbd44b6 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -34,6 +34,8 @@ do { printf("virtio_mmio: " fmt , ## __VA_ARGS__); } while (0) #define DPRINTF(fmt, ...) do {} while (0) #endif +#define VIRTIO_MMIO_QUEUE_MAX 64 + /* QOM macros */ /* virtio-mmio-bus */ #define TYPE_VIRTIO_MMIO_BUS "virtio-mmio-bus" @@ -237,7 +239,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, proxy->guest_page_shift); break; case VIRTIO_MMIO_QUEUESEL: - if (value < VIRTIO_PCI_QUEUE_MAX) { + if (value < virtio_get_queue_max(vdev)) { vdev->queue_sel = value; } break; @@ -257,7 +259,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, } break; case VIRTIO_MMIO_QUEUENOTIFY: - if (value < VIRTIO_PCI_QUEUE_MAX) { + if (value < virtio_get_queue_max(vdev)) { virtio_queue_notify(vdev, value); } break; @@ -403,7 +405,7 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data) k->device_plugged = virtio_mmio_device_plugged; k->has_variable_vring_alignment = true; bus_class->max_dev = 1; - k->queue_max = VIRTIO_PCI_QUEUE_MAX; + k->queue_max = VIRTIO_MMIO_QUEUE_MAX; } static const TypeInfo virtio_mmio_bus_info = {