[{"id":1776736,"web_url":"http://patchwork.ozlabs.org/comment/1776736/","msgid":"<20170928040809.GA12504@umbus>","list_archive_url":null,"date":"2017-09-28T04:08:09","subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","submitter":{"id":47,"url":"http://patchwork.ozlabs.org/api/people/47/","name":"David Gibson","email":"david@gibson.dropbear.id.au"},"content":"On Wed, Sep 27, 2017 at 04:56:32PM -0300, Eduardo Habkost wrote:\n> The following devices support both PCI Express and Conventional\n> PCI, by including special code to handle the QEMU_PCI_CAP_EXPRESS\n> flag and/or conditional pcie_endpoint_cap_init() calls:\n> \n> * vfio-pci (is_express=1, but legacy PCI handled by\n>   vfio_populate_device())\n\nIn the case of VFIO, won't this depend on the capabilities of the\ndevice on the host?\n\n> * vmxnet3 (is_express=0, but PCIe handled by vmxnet3_realize())\n> * pvscsi (is_express=0, but PCIe handled by pvscsi_realize())\n> * virtio-pci (is_express=0, but PCIe handled by\n>   virtio_pci_dc_realize(), and additional legacy PCI code at\n>   virtio_pci_realize())\n> * base-xhci (is_express=1, but pcie_endpoint_cap_init() call\n>   is conditional on pci_bus_is_express(dev->bus)\n>   * Note that xhci does not clear QEMU_PCI_CAP_EXPRESS like the\n>     other hybrid devices\n> \n> Cc: Dmitry Fleytman <dmitry@daynix.com>\n> Cc: Jason Wang <jasowang@redhat.com>\n> Cc: Paolo Bonzini <pbonzini@redhat.com>\n> Cc: Gerd Hoffmann <kraxel@redhat.com>\n> Cc: Alex Williamson <alex.williamson@redhat.com>\n> Cc: \"Michael S. Tsirkin\" <mst@redhat.com>\n> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>\n\nExcept for the query above,\n\nReviewed-by: David Gibson <david@gibson.dropbear.id.au>\n\n> ---\n> Changes v1 -> v2:\n> * s/legacy/conventional/\n>   * Suggested-by: Alex Williamson <alex.williamson@redhat.com>\n> * Mark base-xhci as hybrid too\n> ---\n>  hw/net/vmxnet3.c       | 5 +++++\n>  hw/scsi/vmw_pvscsi.c   | 2 ++\n>  hw/usb/hcd-xhci.c      | 5 +++++\n>  hw/vfio/pci.c          | 5 +++++\n>  hw/virtio/virtio-pci.c | 5 +++++\n>  5 files changed, 22 insertions(+)\n> \n> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c\n> index a19a7a31dd..f99d9a69ec 100644\n> --- a/hw/net/vmxnet3.c\n> +++ b/hw/net/vmxnet3.c\n> @@ -2651,6 +2651,11 @@ static const TypeInfo vmxnet3_info = {\n>      .instance_size = sizeof(VMXNET3State),\n>      .class_init    = vmxnet3_class_init,\n>      .instance_init = vmxnet3_instance_init,\n> +    .interfaces = (InterfaceInfo[]) {\n> +        { INTERFACE_PCIE_DEVICE },\n> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> +        { }\n> +    },\n>  };\n>  \n>  static void vmxnet3_register_types(void)\n> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c\n> index 6d3f0bf11d..d6b315f8b2 100644\n> --- a/hw/scsi/vmw_pvscsi.c\n> +++ b/hw/scsi/vmw_pvscsi.c\n> @@ -1300,6 +1300,8 @@ static const TypeInfo pvscsi_info = {\n>      .class_init    = pvscsi_class_init,\n>      .interfaces = (InterfaceInfo[]) {\n>          { TYPE_HOTPLUG_HANDLER },\n> +        { INTERFACE_PCIE_DEVICE },\n> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>          { }\n>      }\n>  };\n> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c\n> index d75c085d94..af3a9d88de 100644\n> --- a/hw/usb/hcd-xhci.c\n> +++ b/hw/usb/hcd-xhci.c\n> @@ -3670,6 +3670,11 @@ static const TypeInfo xhci_info = {\n>      .instance_size = sizeof(XHCIState),\n>      .class_init    = xhci_class_init,\n>      .abstract      = true,\n> +    .interfaces = (InterfaceInfo[]) {\n> +        { INTERFACE_PCIE_DEVICE },\n> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> +        { }\n> +    },\n>  };\n>  \n>  static void qemu_xhci_class_init(ObjectClass *klass, void *data)\n> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c\n> index 31e1edf447..913433d6ba 100644\n> --- a/hw/vfio/pci.c\n> +++ b/hw/vfio/pci.c\n> @@ -3023,6 +3023,11 @@ static const TypeInfo vfio_pci_dev_info = {\n>      .class_init = vfio_pci_dev_class_init,\n>      .instance_init = vfio_instance_init,\n>      .instance_finalize = vfio_instance_finalize,\n> +    .interfaces = (InterfaceInfo[]) {\n> +        { INTERFACE_PCIE_DEVICE },\n> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> +        { }\n> +    },\n>  };\n>  \n>  static void register_vfio_pci_dev_type(void)\n> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\n> index 8b0d6b69cd..67c8ab63ad 100644\n> --- a/hw/virtio/virtio-pci.c\n> +++ b/hw/virtio/virtio-pci.c\n> @@ -1958,6 +1958,11 @@ static const TypeInfo virtio_pci_info = {\n>      .class_init    = virtio_pci_class_init,\n>      .class_size    = sizeof(VirtioPCIClass),\n>      .abstract      = true,\n> +    .interfaces = (InterfaceInfo[]) {\n> +        { INTERFACE_PCIE_DEVICE },\n> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> +        { }\n> +    },\n>  };\n>  \n>  /* virtio-blk-pci */","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=gibson.dropbear.id.au\n\theader.i=@gibson.dropbear.id.au header.b=\"HfOvfvEt\"; \n\tdkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2hCT0Rt6z9tXb\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 14:14:11 +1000 (AEST)","from localhost ([::1]:57274 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxQDB-0000eB-30\n\tfor incoming@patchwork.ozlabs.org; Thu, 28 Sep 2017 00:14:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:53953)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dxQCT-0000cQ-06\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 00:13:26 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <dgibson@ozlabs.org>) id 1dxQCR-0003VF-SP\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 00:13:24 -0400","from ozlabs.org ([2401:3900:2:1::2]:53289)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <dgibson@ozlabs.org>) id 1dxQCQ-0003TK-G9\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 00:13:23 -0400","by ozlabs.org (Postfix, from userid 1007)\n\tid 3y2hBN03fkz9tXj; Thu, 28 Sep 2017 14:13:15 +1000 (AEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n\td=gibson.dropbear.id.au; s=201602; t=1506571996;\n\tbh=fmkB9fxakuEsTQ6xiTtTqHdHnXC8VvahYc7OiJTv+8c=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HfOvfvEtY2dvmeRfjY2ygqaxqqsvE0gHMZYu6qfMLJ/S9Ej0K0TMSM/P8mPlWy12L\n\tmQacF5Zfc/s4qa6abyZCuUUmhZizIR5a3bZYKCSqL9/Jtdfr54iNknSXF3/5zeaIjS\n\t0ewwnlf05cfb3vzjEs2sT6faCm+cWN7BNbDzN7ME=","Date":"Thu, 28 Sep 2017 14:08:09 +1000","From":"David Gibson <david@gibson.dropbear.id.au>","To":"Eduardo Habkost <ehabkost@redhat.com>","Message-ID":"<20170928040809.GA12504@umbus>","References":"<20170927195635.16014-1-ehabkost@redhat.com>\n\t<20170927195635.16014-3-ehabkost@redhat.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"y/KK5WT0dXhrzWcJ\"","Content-Disposition":"inline","In-Reply-To":"<20170927195635.16014-3-ehabkost@redhat.com>","User-Agent":"Mutt/1.9.0 (2017-09-02)","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2401:3900:2:1::2","Subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"\"Michael S. Tsirkin\" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, \n\tqemu-devel@nongnu.org, Dmitry Fleytman <dmitry@daynix.com>,\n\tAlex Williamson <alex.williamson@redhat.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,\n\tLaine Stump <laine@redhat.com>, Alistair Francis <alistair23@gmail.com>, \n\tMarcel Apfelbaum <marcel@redhat.com>, David Gibson <dgibson@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1776911,"web_url":"http://patchwork.ozlabs.org/comment/1776911/","msgid":"<f41c462f-7f03-c6d2-bef5-cfd99a6c9adb@redhat.com>","list_archive_url":null,"date":"2017-09-28T09:27:16","subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","submitter":{"id":65362,"url":"http://patchwork.ozlabs.org/api/people/65362/","name":"Marcel Apfelbaum","email":"marcel@redhat.com"},"content":"On 28/09/2017 7:08, David Gibson wrote:\n> On Wed, Sep 27, 2017 at 04:56:32PM -0300, Eduardo Habkost wrote:\n>> The following devices support both PCI Express and Conventional\n>> PCI, by including special code to handle the QEMU_PCI_CAP_EXPRESS\n>> flag and/or conditional pcie_endpoint_cap_init() calls:\n>>\n>> * vfio-pci (is_express=1, but legacy PCI handled by\n>>    vfio_populate_device())\n> \n> In the case of VFIO, won't this depend on the capabilities of the\n> device on the host?\n> \n\nMost (almost all?) assigned devices are PCI Express,\nthey will be exposed as PCI/PCI express depending on the\nslot they are plugged into.\n\nAnyway, the interface only states the device can be PCI or PCI Express,\nso I think is OK.\n\nReviewed-by: Marcel Apfelbaum <marcel@redhat.com>\n\nThanks,\nMarcel\n\n>> * vmxnet3 (is_express=0, but PCIe handled by vmxnet3_realize())\n>> * pvscsi (is_express=0, but PCIe handled by pvscsi_realize())\n>> * virtio-pci (is_express=0, but PCIe handled by\n>>    virtio_pci_dc_realize(), and additional legacy PCI code at\n>>    virtio_pci_realize())\n>> * base-xhci (is_express=1, but pcie_endpoint_cap_init() call\n>>    is conditional on pci_bus_is_express(dev->bus)\n>>    * Note that xhci does not clear QEMU_PCI_CAP_EXPRESS like the\n>>      other hybrid devices\n>>\n>> Cc: Dmitry Fleytman <dmitry@daynix.com>\n>> Cc: Jason Wang <jasowang@redhat.com>\n>> Cc: Paolo Bonzini <pbonzini@redhat.com>\n>> Cc: Gerd Hoffmann <kraxel@redhat.com>\n>> Cc: Alex Williamson <alex.williamson@redhat.com>\n>> Cc: \"Michael S. Tsirkin\" <mst@redhat.com>\n>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>\n> \n> Except for the query above,\n> \n> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>\n> \n>> ---\n>> Changes v1 -> v2:\n>> * s/legacy/conventional/\n>>    * Suggested-by: Alex Williamson <alex.williamson@redhat.com>\n>> * Mark base-xhci as hybrid too\n>> ---\n>>   hw/net/vmxnet3.c       | 5 +++++\n>>   hw/scsi/vmw_pvscsi.c   | 2 ++\n>>   hw/usb/hcd-xhci.c      | 5 +++++\n>>   hw/vfio/pci.c          | 5 +++++\n>>   hw/virtio/virtio-pci.c | 5 +++++\n>>   5 files changed, 22 insertions(+)\n>>\n>> diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c\n>> index a19a7a31dd..f99d9a69ec 100644\n>> --- a/hw/net/vmxnet3.c\n>> +++ b/hw/net/vmxnet3.c\n>> @@ -2651,6 +2651,11 @@ static const TypeInfo vmxnet3_info = {\n>>       .instance_size = sizeof(VMXNET3State),\n>>       .class_init    = vmxnet3_class_init,\n>>       .instance_init = vmxnet3_instance_init,\n>> +    .interfaces = (InterfaceInfo[]) {\n>> +        { INTERFACE_PCIE_DEVICE },\n>> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>> +        { }\n>> +    },\n>>   };\n>>   \n>>   static void vmxnet3_register_types(void)\n>> diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c\n>> index 6d3f0bf11d..d6b315f8b2 100644\n>> --- a/hw/scsi/vmw_pvscsi.c\n>> +++ b/hw/scsi/vmw_pvscsi.c\n>> @@ -1300,6 +1300,8 @@ static const TypeInfo pvscsi_info = {\n>>       .class_init    = pvscsi_class_init,\n>>       .interfaces = (InterfaceInfo[]) {\n>>           { TYPE_HOTPLUG_HANDLER },\n>> +        { INTERFACE_PCIE_DEVICE },\n>> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>>           { }\n>>       }\n>>   };\n>> diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c\n>> index d75c085d94..af3a9d88de 100644\n>> --- a/hw/usb/hcd-xhci.c\n>> +++ b/hw/usb/hcd-xhci.c\n>> @@ -3670,6 +3670,11 @@ static const TypeInfo xhci_info = {\n>>       .instance_size = sizeof(XHCIState),\n>>       .class_init    = xhci_class_init,\n>>       .abstract      = true,\n>> +    .interfaces = (InterfaceInfo[]) {\n>> +        { INTERFACE_PCIE_DEVICE },\n>> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>> +        { }\n>> +    },\n>>   };\n>>   \n>>   static void qemu_xhci_class_init(ObjectClass *klass, void *data)\n>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c\n>> index 31e1edf447..913433d6ba 100644\n>> --- a/hw/vfio/pci.c\n>> +++ b/hw/vfio/pci.c\n>> @@ -3023,6 +3023,11 @@ static const TypeInfo vfio_pci_dev_info = {\n>>       .class_init = vfio_pci_dev_class_init,\n>>       .instance_init = vfio_instance_init,\n>>       .instance_finalize = vfio_instance_finalize,\n>> +    .interfaces = (InterfaceInfo[]) {\n>> +        { INTERFACE_PCIE_DEVICE },\n>> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>> +        { }\n>> +    },\n>>   };\n>>   \n>>   static void register_vfio_pci_dev_type(void)\n>> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\n>> index 8b0d6b69cd..67c8ab63ad 100644\n>> --- a/hw/virtio/virtio-pci.c\n>> +++ b/hw/virtio/virtio-pci.c\n>> @@ -1958,6 +1958,11 @@ static const TypeInfo virtio_pci_info = {\n>>       .class_init    = virtio_pci_class_init,\n>>       .class_size    = sizeof(VirtioPCIClass),\n>>       .abstract      = true,\n>> +    .interfaces = (InterfaceInfo[]) {\n>> +        { INTERFACE_PCIE_DEVICE },\n>> +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n>> +        { }\n>> +    },\n>>   };\n>>   \n>>   /* virtio-blk-pci */\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=marcel@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2q9l2L7Hz9t38\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 19:28:11 +1000 (AEST)","from localhost ([::1]:58135 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxV73-0007hF-B9\n\tfor incoming@patchwork.ozlabs.org; Thu, 28 Sep 2017 05:28:09 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:33497)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcel@redhat.com>) id 1dxV6U-0007eF-0h\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:27:35 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcel@redhat.com>) id 1dxV6P-0006Xc-Ml\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:27:34 -0400","from mx1.redhat.com ([209.132.183.28]:39310)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <marcel@redhat.com>) id 1dxV6P-0006XI-E7\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 05:27:29 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 81EC4C0FAC12;\n\tThu, 28 Sep 2017 09:27:28 +0000 (UTC)","from mapfelba-osx.local (unknown [10.35.206.52])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id C298917253;\n\tThu, 28 Sep 2017 09:27:17 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 81EC4C0FAC12","To":"David Gibson <david@gibson.dropbear.id.au>,\n\tEduardo Habkost <ehabkost@redhat.com>","References":"<20170927195635.16014-1-ehabkost@redhat.com>\n\t<20170927195635.16014-3-ehabkost@redhat.com>\n\t<20170928040809.GA12504@umbus>","From":"Marcel Apfelbaum <marcel@redhat.com>","Message-ID":"<f41c462f-7f03-c6d2-bef5-cfd99a6c9adb@redhat.com>","Date":"Thu, 28 Sep 2017 12:27:16 +0300","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0)\n\tGecko/20100101 Thunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170928040809.GA12504@umbus>","Content-Type":"text/plain; charset=windows-1252; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.31]);\n\tThu, 28 Sep 2017 09:27:28 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"\"Michael S. Tsirkin\" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, \n\tqemu-devel@nongnu.org, Alex Williamson <alex.williamson@redhat.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,\n\tLaine Stump <laine@redhat.com>, Alistair Francis <alistair23@gmail.com>, \n\tDmitry Fleytman <dmitry@daynix.com>, David Gibson <dgibson@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1777019,"web_url":"http://patchwork.ozlabs.org/comment/1777019/","msgid":"<20170928130644.GO4115@localhost.localdomain>","list_archive_url":null,"date":"2017-09-28T13:06:44","subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","submitter":{"id":195,"url":"http://patchwork.ozlabs.org/api/people/195/","name":"Eduardo Habkost","email":"ehabkost@redhat.com"},"content":"On Thu, Sep 28, 2017 at 02:08:09PM +1000, David Gibson wrote:\n> On Wed, Sep 27, 2017 at 04:56:32PM -0300, Eduardo Habkost wrote:\n> > The following devices support both PCI Express and Conventional\n> > PCI, by including special code to handle the QEMU_PCI_CAP_EXPRESS\n> > flag and/or conditional pcie_endpoint_cap_init() calls:\n> > \n> > * vfio-pci (is_express=1, but legacy PCI handled by\n> >   vfio_populate_device())\n> \n> In the case of VFIO, won't this depend on the capabilities of the\n> device on the host?\n\nYes.  But the interface names are static data about the device\ntype, which really supports both cases.\n\nDeciding where exactly a VFIO device can be plugged before\nrunning the VM will require additional data about the host, and\nthat can't be provided by QEMU (because it's not running yet).\n\n> \n> > * vmxnet3 (is_express=0, but PCIe handled by vmxnet3_realize())\n> > * pvscsi (is_express=0, but PCIe handled by pvscsi_realize())\n> > * virtio-pci (is_express=0, but PCIe handled by\n> >   virtio_pci_dc_realize(), and additional legacy PCI code at\n> >   virtio_pci_realize())\n> > * base-xhci (is_express=1, but pcie_endpoint_cap_init() call\n> >   is conditional on pci_bus_is_express(dev->bus)\n> >   * Note that xhci does not clear QEMU_PCI_CAP_EXPRESS like the\n> >     other hybrid devices\n> > \n> > Cc: Dmitry Fleytman <dmitry@daynix.com>\n> > Cc: Jason Wang <jasowang@redhat.com>\n> > Cc: Paolo Bonzini <pbonzini@redhat.com>\n> > Cc: Gerd Hoffmann <kraxel@redhat.com>\n> > Cc: Alex Williamson <alex.williamson@redhat.com>\n> > Cc: \"Michael S. Tsirkin\" <mst@redhat.com>\n> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>\n> \n> Except for the query above,\n> \n> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>\n> \n> > ---\n> > Changes v1 -> v2:\n> > * s/legacy/conventional/\n> >   * Suggested-by: Alex Williamson <alex.williamson@redhat.com>\n> > * Mark base-xhci as hybrid too\n> > ---\n> >  hw/net/vmxnet3.c       | 5 +++++\n> >  hw/scsi/vmw_pvscsi.c   | 2 ++\n> >  hw/usb/hcd-xhci.c      | 5 +++++\n> >  hw/vfio/pci.c          | 5 +++++\n> >  hw/virtio/virtio-pci.c | 5 +++++\n> >  5 files changed, 22 insertions(+)\n> > \n> > diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c\n> > index a19a7a31dd..f99d9a69ec 100644\n> > --- a/hw/net/vmxnet3.c\n> > +++ b/hw/net/vmxnet3.c\n> > @@ -2651,6 +2651,11 @@ static const TypeInfo vmxnet3_info = {\n> >      .instance_size = sizeof(VMXNET3State),\n> >      .class_init    = vmxnet3_class_init,\n> >      .instance_init = vmxnet3_instance_init,\n> > +    .interfaces = (InterfaceInfo[]) {\n> > +        { INTERFACE_PCIE_DEVICE },\n> > +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> > +        { }\n> > +    },\n> >  };\n> >  \n> >  static void vmxnet3_register_types(void)\n> > diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c\n> > index 6d3f0bf11d..d6b315f8b2 100644\n> > --- a/hw/scsi/vmw_pvscsi.c\n> > +++ b/hw/scsi/vmw_pvscsi.c\n> > @@ -1300,6 +1300,8 @@ static const TypeInfo pvscsi_info = {\n> >      .class_init    = pvscsi_class_init,\n> >      .interfaces = (InterfaceInfo[]) {\n> >          { TYPE_HOTPLUG_HANDLER },\n> > +        { INTERFACE_PCIE_DEVICE },\n> > +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> >          { }\n> >      }\n> >  };\n> > diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c\n> > index d75c085d94..af3a9d88de 100644\n> > --- a/hw/usb/hcd-xhci.c\n> > +++ b/hw/usb/hcd-xhci.c\n> > @@ -3670,6 +3670,11 @@ static const TypeInfo xhci_info = {\n> >      .instance_size = sizeof(XHCIState),\n> >      .class_init    = xhci_class_init,\n> >      .abstract      = true,\n> > +    .interfaces = (InterfaceInfo[]) {\n> > +        { INTERFACE_PCIE_DEVICE },\n> > +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> > +        { }\n> > +    },\n> >  };\n> >  \n> >  static void qemu_xhci_class_init(ObjectClass *klass, void *data)\n> > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c\n> > index 31e1edf447..913433d6ba 100644\n> > --- a/hw/vfio/pci.c\n> > +++ b/hw/vfio/pci.c\n> > @@ -3023,6 +3023,11 @@ static const TypeInfo vfio_pci_dev_info = {\n> >      .class_init = vfio_pci_dev_class_init,\n> >      .instance_init = vfio_instance_init,\n> >      .instance_finalize = vfio_instance_finalize,\n> > +    .interfaces = (InterfaceInfo[]) {\n> > +        { INTERFACE_PCIE_DEVICE },\n> > +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> > +        { }\n> > +    },\n> >  };\n> >  \n> >  static void register_vfio_pci_dev_type(void)\n> > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c\n> > index 8b0d6b69cd..67c8ab63ad 100644\n> > --- a/hw/virtio/virtio-pci.c\n> > +++ b/hw/virtio/virtio-pci.c\n> > @@ -1958,6 +1958,11 @@ static const TypeInfo virtio_pci_info = {\n> >      .class_init    = virtio_pci_class_init,\n> >      .class_size    = sizeof(VirtioPCIClass),\n> >      .abstract      = true,\n> > +    .interfaces = (InterfaceInfo[]) {\n> > +        { INTERFACE_PCIE_DEVICE },\n> > +        { INTERFACE_CONVENTIONAL_PCI_DEVICE },\n> > +        { }\n> > +    },\n> >  };\n> >  \n> >  /* virtio-blk-pci */\n> \n> -- \n> David Gibson\t\t\t| I'll have my music baroque, and my code\n> david AT gibson.dropbear.id.au\t| minimalist, thank you.  NOT _the_ _other_\n> \t\t\t\t| _way_ _around_!\n> http://www.ozlabs.org/~dgibson","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=ehabkost@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2w3659qsz9t5Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 23:07:46 +1000 (AEST)","from localhost ([::1]:59202 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxYXY-0004RF-Q7\n\tfor incoming@patchwork.ozlabs.org; Thu, 28 Sep 2017 09:07:44 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59556)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dxYXD-0004Q3-K7\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 09:07:24 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <ehabkost@redhat.com>) id 1dxYX9-0000V1-Gy\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 09:07:23 -0400","from mx1.redhat.com ([209.132.183.28]:47492)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <ehabkost@redhat.com>) id 1dxYX9-0000UN-7S\n\tfor qemu-devel@nongnu.org; Thu, 28 Sep 2017 09:07:19 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id D71C0DA6A0;\n\tThu, 28 Sep 2017 13:07:17 +0000 (UTC)","from localhost (ovpn-116-3.gru2.redhat.com [10.97.116.3])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 9B7B42CFF3;\n\tThu, 28 Sep 2017 13:06:46 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com D71C0DA6A0","Date":"Thu, 28 Sep 2017 10:06:44 -0300","From":"Eduardo Habkost <ehabkost@redhat.com>","To":"David Gibson <david@gibson.dropbear.id.au>","Message-ID":"<20170928130644.GO4115@localhost.localdomain>","References":"<20170927195635.16014-1-ehabkost@redhat.com>\n\t<20170927195635.16014-3-ehabkost@redhat.com>\n\t<20170928040809.GA12504@umbus>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170928040809.GA12504@umbus>","X-Fnord":"you can see the fnord","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.38]);\n\tThu, 28 Sep 2017 13:07:18 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH v2 2/5] pci: Add interface names to hybrid\n\tPCI devices","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"\"Michael S. Tsirkin\" <mst@redhat.com>, Jason Wang <jasowang@redhat.com>, \n\tqemu-devel@nongnu.org, Dmitry Fleytman <dmitry@daynix.com>,\n\tAlex Williamson <alex.williamson@redhat.com>,\n\tPaolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>,\n\tLaine Stump <laine@redhat.com>, Alistair Francis <alistair23@gmail.com>, \n\tMarcel Apfelbaum <marcel@redhat.com>, David Gibson <dgibson@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]