From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1biQ2r-0007aR-4d for qemu-devel@nongnu.org; Fri, 09 Sep 2016 13:57:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1biQ2m-0002sG-8n for qemu-devel@nongnu.org; Fri, 09 Sep 2016 13:56:56 -0400 References: <1473426607-10516-1-git-send-email-maxime.coquelin@redhat.com> <1473426607-10516-3-git-send-email-maxime.coquelin@redhat.com> <20160909204823-mutt-send-email-mst@kernel.org> From: Maxime Coquelin Message-ID: <8e992b2a-26a4-d21d-a77f-c7c2e7257da3@redhat.com> Date: Fri, 9 Sep 2016 19:56:46 +0200 MIME-Version: 1.0 In-Reply-To: <20160909204823-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/2] virtio-pci: Disable modern interface if backend without VIRTIO_F_VERSION_1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , groug@kaod.org Cc: qemu-devel@nongnu.org, cornelia.huck@de.ibm.com, marcel@redhat.com, vkaplans@redhat.com, qemu-stable@nongnu.org On 09/09/2016 07:48 PM, Michael S. Tsirkin wrote: > On Fri, Sep 09, 2016 at 03:10:07PM +0200, Maxime Coquelin wrote: >> This patch makes pci devices plugging more robust, by not confusing >> guest with modern interface when the backend doesn't support >> VIRTIO_F_VERSION_1. >> >> Cc: Cornelia Huck >> Cc: Marcel Apfelbaum >> Cc: Michael S. Tsirkin >> Cc: qemu-stable@nongnu.org >> Signed-off-by: Maxime Coquelin >> --- >> hw/virtio/virtio-pci.c | 15 +++++++++++++++ >> hw/virtio/virtio-pci.h | 5 +++++ >> 2 files changed, 20 insertions(+) >> >> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c >> index 755f921..9e88d7b 100644 >> --- a/hw/virtio/virtio-pci.c >> +++ b/hw/virtio/virtio-pci.c >> @@ -1581,6 +1581,21 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) >> uint32_t size; >> VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); >> >> + /* >> + * Virtio capabilities present without >> + * VIRTIO_F_VERSION_1 confuses guests >> + */ >> + if (!virtio_test_backend_virtio_1(vdev, errp)) { >> + virtio_pci_disable_modern(proxy); >> + } >> + >> + legacy = virtio_pci_legacy(proxy); >> + modern = virtio_pci_modern(proxy); >> + if (!legacy && !modern) { >> + error_setg(errp, "PCI device is neither legacy nor modern."); >> + return; >> + } >> + > > How does this interact with > virtio-pci: error out when both legacy and modern modes are disabled > ? > If it's the same, I'd rather pick that one and apply your > change on top. Not exactly, since with my patch modern can be disabled after realize callback has been called. But I will base my next revision on top of Greg's patch, and use the same pattern as he did use. Thanks, Maxime