From patchwork Wed Sep 2 03:25:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 513280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6C9FD1401F0 for ; Wed, 2 Sep 2015 13:30:15 +1000 (AEST) Received: from localhost ([::1]:32987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWykX-00062n-DX for incoming@patchwork.ozlabs.org; Tue, 01 Sep 2015 23:30:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWygH-0007VN-1m for qemu-devel@nongnu.org; Tue, 01 Sep 2015 23:25:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWygG-0006oa-Ad for qemu-devel@nongnu.org; Tue, 01 Sep 2015 23:25:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWygG-0006oR-6L for qemu-devel@nongnu.org; Tue, 01 Sep 2015 23:25:48 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E0F7A31CED8; Wed, 2 Sep 2015 03:25:47 +0000 (UTC) Received: from jason-ThinkPad-T430s.nay.redhat.com (dhcp-14-122.nay.redhat.com [10.66.14.122]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t823PQfo024102; Tue, 1 Sep 2015 23:25:45 -0400 From: Jason Wang To: qemu-devel@nongnu.org Date: Wed, 2 Sep 2015 11:25:25 +0800 Message-Id: <1441164325-14417-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1441164325-14417-1-git-send-email-jasowang@redhat.com> References: <1441164325-14417-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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 V2 8/8] virtio-pci: unbreak queue_enable read 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 Guest always get zero when reading queue_enable. This violates spec. Fixing this by setting the queue_enable to true during any guest writing and setting it to zero during reset. Cc: Michael S. Tsirkin Signed-off-by: Jason Wang --- hw/virtio/virtio-pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index bf61acf..7aab6d1 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1372,6 +1372,7 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr, proxy->vqs[vdev->queue_sel].avail[0], ((uint64_t)proxy->vqs[vdev->queue_sel].used[1]) << 32 | proxy->vqs[vdev->queue_sel].used[0]); + proxy->vqs[vdev->queue_sel].enabled = 1; break; case VIRTIO_PCI_COMMON_Q_DESCLO: proxy->vqs[vdev->queue_sel].desc[0] = val; @@ -1816,9 +1817,15 @@ static void virtio_pci_reset(DeviceState *qdev) { VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev); VirtioBusState *bus = VIRTIO_BUS(&proxy->bus); + int i; + virtio_pci_stop_ioeventfd(proxy); virtio_bus_reset(bus); msix_unuse_all_vectors(&proxy->pci_dev); + + for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { + proxy->vqs[i].enabled = 0; + } } static Property virtio_pci_properties[] = {