From patchwork Fri Sep 9 09:00:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kurz X-Patchwork-Id: 667935 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 3sVrmt1YjNz9rxm for ; Fri, 9 Sep 2016 19:02:04 +1000 (AEST) Received: from localhost ([::1]:56690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biHh9-0006Rd-Cb for incoming@patchwork.ozlabs.org; Fri, 09 Sep 2016 05:01:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biHgS-000664-Ka for qemu-devel@nongnu.org; Fri, 09 Sep 2016 05:01:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biHgM-0004dd-9W for qemu-devel@nongnu.org; Fri, 09 Sep 2016 05:01:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38829 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biHgM-0004dW-5T for qemu-devel@nongnu.org; Fri, 09 Sep 2016 05:01:10 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u898vvcY086442 for ; Fri, 9 Sep 2016 05:01:09 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 25bc2r7cub-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 09 Sep 2016 05:01:08 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 9 Sep 2016 03:01:08 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 9 Sep 2016 03:01:05 -0600 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: groug@kaod.org Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 7930E19D803F; Fri, 9 Sep 2016 03:00:33 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u89913DY12386790; Fri, 9 Sep 2016 02:01:03 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E876C6E03F; Fri, 9 Sep 2016 03:01:02 -0600 (MDT) Received: from [192.168.66.108] (unknown [9.164.184.210]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id 6D1596E045; Fri, 9 Sep 2016 03:01:01 -0600 (MDT) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 09 Sep 2016 11:00:59 +0200 User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090909-0008-0000-0000-00000582B70E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005732; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00755692; UDB=6.00357854; IPR=6.00528634; BA=6.00004704; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012626; XFM=3.00000011; UTC=2016-09-09 09:01:07 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090909-0009-0000-0000-00003B01E0D4 Message-Id: <147341165997.11456.17787680040800198615.stgit@bahia> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-09_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609090137 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v2] virtio-pci: error out when both legacy and modern modes are disabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cornelia Huck , Markus Armbruster , Marcel Apfelbaum , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz Without presuming if we got there because of a user mistake or some more subtle bug in the tooling, it really does not make sense to implement a non-functional device. Signed-off-by: Greg Kurz Reviewed-by: Marcel Apfelbaum Reviewed-by: Cornelia Huck Signed-off-by: Greg Kurz --- v2: - moved the check to virtio_pci_realize() to ensure disable_legacy is either ON or OFF, but not AUTO (this would cause the check to fail before we have a chance to know if the device can actually work). I've kept the R-b tags, please raise a flag if this is inapropriate. I've dropped the other patch about virtio-9p: the issue will be addressed in a separate series. --- hw/virtio/virtio-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 268fd8ebb219..551c4346bf4b 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1770,6 +1770,14 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) proxy->disable_legacy = pcie_port ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; } + if (!(virtio_pci_modern(proxy) || virtio_pci_legacy(proxy))) { + error_setg(errp, "device cannot work as neither modern nor legacy mode" + " is enabled"); + error_append_hint(errp, "Set either disable-modern or disable-legacy" + " to off\n"); + return; + } + if (pcie_port && pci_is_express(pci_dev)) { int pos;