All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] PCI-e device multi-function hot-add support
@ 2015-10-13  8:41 Cao jin
  2015-10-13  8:41 ` [Qemu-devel] [PATCH v3 1/2] enable multi-function hot-add Cao jin
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Cao jin @ 2015-10-13  8:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, alex.williamson, izumi.taku, mst

Support PCI-e device hot-add multi-function via device_add, just ensure
add the function 0 is added last. While allow user to roll back in the
middle via device_del, in case user regret.

changelog:
1. Flag device as unexposed when func 0 doesn`t exist, via return 0xFF
   in case of gratuitous pci bus scan.
2. Since device is unexposed to guest, can remove function individually,
   without interaction with the guest.

Cao jin (2):
  enable multi-function hot-add
  remove function during multi-function hot-add

 hw/pci/pci.c      | 10 ++++++++++
 hw/pci/pci_host.c |  6 +++++-
 hw/pci/pcie.c     | 38 +++++++++++++++++++++++++-------------
 3 files changed, 40 insertions(+), 14 deletions(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [Qemu-devel] [PATCH RFC] hw/virtio: Add PCIe capability to virtio devices
@ 2015-10-12 15:17 Marcel Apfelbaum
  2015-10-12 15:42 ` Michael S. Tsirkin
  0 siblings, 1 reply; 23+ messages in thread
From: Marcel Apfelbaum @ 2015-10-12 15:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel, mst

The virtio devices are converted to PCI-Express
if they are plugged into a PCI-Express bus and
the 'modern' protocol is enabled.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---

This is an RFC because all it does it adds the PCIe capability and nothing more.
I post it early so I can get feedbacks on what is the best way to continue it.

Any comments would be appreciated,
Thanks,
Marcel

 hw/virtio/virtio-pci.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 6703806..f7c93d9 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1591,6 +1591,17 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
 
     address_space_init(&proxy->modern_as, &proxy->modern_cfg, "virtio-pci-cfg-as");
 
+    if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_MODERN)
+        && pci_bus_is_express(pci_dev->bus)) {
+        int pos = pci_add_capability(pci_dev, PCI_CAP_ID_EXP, 0,
+                                     PCI_EXP_VER2_SIZEOF);
+
+        if (pos > 0) {
+            pci_dev->exp.exp_cap = pos;
+            pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
+        }
+    }
+
     virtio_pci_bus_new(&proxy->bus, sizeof(proxy->bus), proxy);
     if (k->realize) {
         k->realize(proxy, errp);
-- 
2.1.0

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

end of thread, other threads:[~2015-10-21  9:11 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13  8:41 [Qemu-devel] [PATCH v3 0/2] PCI-e device multi-function hot-add support Cao jin
2015-10-13  8:41 ` [Qemu-devel] [PATCH v3 1/2] enable multi-function hot-add Cao jin
2015-10-13  8:41 ` [Qemu-devel] [PATCH v3 2/2] remove function during " Cao jin
2015-10-13  8:48   ` [Qemu-devel] [PATCH RFC] hw/virtio: Add PCIe capability to virtio devices Michael S. Tsirkin
2015-10-13 12:19     ` Cao jin
2015-10-13  8:51   ` [Qemu-devel] [PATCH v3 2/2] remove function during multi-function hot-add Michael S. Tsirkin
2015-10-13  9:54     ` Cao jin
2015-10-13 10:21       ` Michael S. Tsirkin
2015-10-13 15:27   ` Alex Williamson
2015-10-14  5:46     ` Cao jin
2015-10-13  8:49 ` [Qemu-devel] [PATCH v3 0/2] PCI-e device multi-function hot-add support Michael S. Tsirkin
2015-10-13 11:54   ` Cao jin
2015-10-13 13:10     ` Michael S. Tsirkin
2015-10-14  5:48       ` Cao jin
2015-10-21  8:32       ` Cao jin
2015-10-21  9:11         ` Michael S. Tsirkin
2015-10-13  8:50 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2015-10-12 15:17 [Qemu-devel] [PATCH RFC] hw/virtio: Add PCIe capability to virtio devices Marcel Apfelbaum
2015-10-12 15:42 ` Michael S. Tsirkin
2015-10-13  8:13   ` Gerd Hoffmann
2015-10-13  8:44     ` Michael S. Tsirkin
2015-10-13 14:31   ` Marcel Apfelbaum
2015-10-13 14:47     ` Michael S. Tsirkin

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.