From patchwork Fri Jan 22 07:20:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8087971 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9CE20BEEE5 for ; Fri, 22 Jan 2016 07:20:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 123DD20456 for ; Fri, 22 Jan 2016 07:20:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1846F20445 for ; Fri, 22 Jan 2016 07:20:29 +0000 (UTC) Received: from localhost ([::1]:51106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMW1E-0000Dr-8J for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 Jan 2016 02:20:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMW17-00008O-Gt for qemu-devel@nongnu.org; Fri, 22 Jan 2016 02:20:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMW13-00019I-91 for qemu-devel@nongnu.org; Fri, 22 Jan 2016 02:20:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55508) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMW13-00018x-46 for qemu-devel@nongnu.org; Fri, 22 Jan 2016 02:20:17 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id F2370F5DCA for ; Fri, 22 Jan 2016 07:20:15 +0000 (UTC) Received: from fam-t430.nay.redhat.com. (dhcp-15-42.nay.redhat.com [10.66.15.42]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0M7KBhX019624; Fri, 22 Jan 2016 02:20:13 -0500 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 22 Jan 2016 15:20:10 +0800 Message-Id: <1453447210-13259-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH] virtio-pci: Fix vq enabled flag on reset for virtio 1.0 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Virtio 1.0 requires queue_enable status in virtio_pci_common_cfg to be cleared upon device reset (virtio-v1.0.pdf, section 4.1.4.3.1), but we don't do it. This causes trouble on Linux's virtio-blk-pci probe since seabios 1.9.0 update (commit ad30c0b0d), if modern enabled. Kernel spits: ... [ 5.624492] virtio_blk: probe of virtio0 failed with error -2 ... To fix it, call the virtio-pci's reset handler instead of the device attached on the bus. Signed-off-by: Fam Zheng --- hw/virtio/virtio-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 94667e6..f0ab812 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1310,6 +1310,8 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr, return val; } +static void virtio_pci_reset(DeviceState *qdev); + static void virtio_pci_common_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { @@ -1351,7 +1353,7 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr, } if (vdev->status == 0) { - virtio_reset(vdev); + virtio_pci_reset(DEVICE(proxy)); msix_unuse_all_vectors(&proxy->pci_dev); }