From patchwork Thu Apr 23 06:21:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 463891 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 A58211400B7 for ; Thu, 23 Apr 2015 16:26:55 +1000 (AEST) Received: from localhost ([::1]:38286 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlAb7-00089F-HQ for incoming@patchwork.ozlabs.org; Thu, 23 Apr 2015 02:26:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlAX5-0008Qd-Qd for qemu-devel@nongnu.org; Thu, 23 Apr 2015 02:22:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlAX4-0001gq-LH for qemu-devel@nongnu.org; Thu, 23 Apr 2015 02:22:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlAX4-0001gl-D4 for qemu-devel@nongnu.org; Thu, 23 Apr 2015 02:22:42 -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 (8.14.4/8.14.4) with ESMTP id t3N6MfjC004576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 23 Apr 2015 02:22:41 -0400 Received: from jason-ThinkPad-T430s.redhat.com (vpn1-7-179.pek2.redhat.com [10.72.7.179]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3N6M58G032751; Thu, 23 Apr 2015 02:22:40 -0400 From: Jason Wang To: qemu-devel@nongnu.org Date: Thu, 23 Apr 2015 14:21:44 +0800 Message-Id: <1429770109-23873-12-git-send-email-jasowang@redhat.com> In-Reply-To: <1429770109-23873-1-git-send-email-jasowang@redhat.com> References: <1429770109-23873-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: Jason Wang , mst@redhat.com Subject: [Qemu-devel] [PATCH V7 11/16] 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 = {