All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] virtio-pci: Allow PCIe virtio devices on root bus
@ 2017-02-08  6:16 David Gibson
  2017-02-08 10:40 ` Laszlo Ersek
  0 siblings, 1 reply; 18+ messages in thread
From: David Gibson @ 2017-02-08  6:16 UTC (permalink / raw)
  To: marcel, abologna
  Cc: qemu-devel, qemu-ppc, mst, thuth, lvivier, benh, David Gibson

Marcel,

Your original patch adding PCIe support to virtio-pci.c has the
limitation noted below that PCIe won't be enabled if the device is on
the root bus (rather than under a root or downstream port).  As
reasoned below, I think removing the check is correct, even for x86
(though it would rarely be useful there).  But I could well have
missed something.  Let me know if so...



Virtio devices can appear as either vanilla PCI or PCI-Express devices
depending on the bus they're connected to.  At the moment it will only
appear as vanilla PCI if connected to the root bus of a PCIe host bridge.

Presumably this is to reflect the fact that PCIe devices usually need to
be connected to a root (or further downstream) port rather than directly
on the root bus.  However, due to the odd requirements of the PAPR spec on the 'pseries'
machine type, it's normal for PCIe devices to appear on the root bus
without root ports.

Further, even on x86, there's no inherent reason we couldn't present a
virtio device as an "integrated device" (typically used for things built
into the PCI chipset), and those devices *do* typically appear on the root
bus.

pcie_endpoint_cap_init() already automatically adjusts to advertise as
an integrated device rather than a "normal" PCIe endpoint when attached to
a root bus.  So we can remove the check for root bus within virtio and
allow (at the user's discretion) a PCIe virtio bus to be attached to a
root bus.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/virtio/virtio-pci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 5ce42af..caea44c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1737,8 +1737,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
 {
     VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev);
     VirtioPCIClass *k = VIRTIO_PCI_GET_CLASS(pci_dev);
-    bool pcie_port = pci_bus_is_express(pci_dev->bus) &&
-                     !pci_bus_is_root(pci_dev->bus);
+    bool pcie_port = pci_bus_is_express(pci_dev->bus);
 
     if (!kvm_has_many_ioeventfds()) {
         proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-02-19 18:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08  6:16 [Qemu-devel] [RFC] virtio-pci: Allow PCIe virtio devices on root bus David Gibson
2017-02-08 10:40 ` Laszlo Ersek
2017-02-09  4:16   ` David Gibson
2017-02-09  9:04     ` Laszlo Ersek
2017-02-10  0:37       ` David Gibson
2017-02-12 19:05         ` Marcel Apfelbaum
2017-02-13  4:33           ` David Gibson
2017-02-13 10:14             ` Marcel Apfelbaum
2017-02-14  4:15               ` David Gibson
2017-02-14 12:53                 ` Marcel Apfelbaum
2017-02-15  1:45                   ` David Gibson
2017-02-15 14:59                     ` Marcel Apfelbaum
2017-02-16  2:48                       ` David Gibson
2017-02-16  3:28                         ` David Gibson
2017-02-16 19:14                           ` Marcel Apfelbaum
2017-02-19 18:19                             ` Andrea Bolognani
2017-02-16 19:07                         ` Marcel Apfelbaum
2017-02-16  7:31                   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.