qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] xen: Fix, no unplug of pt device by platform device.
@ 2012-09-19 11:05 Anthony PERARD
  2012-09-19 13:06 ` Stefano Stabellini
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony PERARD @ 2012-09-19 11:05 UTC (permalink / raw)
  To: QEMU-devel; +Cc: Anthony PERARD, Zhang, Yang Z, Stefano Stabellini, Xen Devel

The Xen platform device will unplug any NICs if requested by the guest (PVonHVM)
including a NIC that would have been passthrough. This patch makes sure that a
passthrough device will not be unplug.

Reported-by: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

---
 hw/xen_platform.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/xen_platform.c b/hw/xen_platform.c
index 0d6c2ff..956dbfe 100644
--- a/hw/xen_platform.c
+++ b/hw/xen_platform.c
@@ -85,8 +85,10 @@ static void log_writeb(PCIXenPlatformState *s, char val)
 
 static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
 {
+    /* We have to ignore passthrough devices */
     if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
-            PCI_CLASS_NETWORK_ETHERNET) {
+            PCI_CLASS_NETWORK_ETHERNET
+            && strcmp(d->name, "xen-pci-passthrough") != 0) {
         qdev_free(&d->qdev);
     }
 }
@@ -98,8 +100,10 @@ static void pci_unplug_nics(PCIBus *bus)
 
 static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
 {
+    /* We have to ignore passthrough devices */
     if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
-            PCI_CLASS_STORAGE_IDE) {
+            PCI_CLASS_STORAGE_IDE
+            && strcmp(d->name, "xen-pci-passthrough") != 0) {
         qdev_unplug(&(d->qdev), NULL);
     }
 }
-- 
Anthony PERARD

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

* Re: [Qemu-devel] [PATCH] xen: Fix, no unplug of pt device by platform device.
  2012-09-19 11:05 [Qemu-devel] [PATCH] xen: Fix, no unplug of pt device by platform device Anthony PERARD
@ 2012-09-19 13:06 ` Stefano Stabellini
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2012-09-19 13:06 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Zhang, Yang Z, Stefano Stabellini, QEMU-devel, Xen Devel

On Wed, 19 Sep 2012, Anthony PERARD wrote:
> The Xen platform device will unplug any NICs if requested by the guest (PVonHVM)
> including a NIC that would have been passthrough. This patch makes sure that a
> passthrough device will not be unplug.
> 
> Reported-by: "Zhang, Yang Z" <yang.z.zhang@intel.com>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 

Zhang, does it this patch fix the problem for you?


>  hw/xen_platform.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/xen_platform.c b/hw/xen_platform.c
> index 0d6c2ff..956dbfe 100644
> --- a/hw/xen_platform.c
> +++ b/hw/xen_platform.c
> @@ -85,8 +85,10 @@ static void log_writeb(PCIXenPlatformState *s, char val)
>  
>  static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
>  {
> +    /* We have to ignore passthrough devices */
>      if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
> -            PCI_CLASS_NETWORK_ETHERNET) {
> +            PCI_CLASS_NETWORK_ETHERNET
> +            && strcmp(d->name, "xen-pci-passthrough") != 0) {
>          qdev_free(&d->qdev);
>      }
>  }
> @@ -98,8 +100,10 @@ static void pci_unplug_nics(PCIBus *bus)
>  
>  static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
>  {
> +    /* We have to ignore passthrough devices */
>      if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
> -            PCI_CLASS_STORAGE_IDE) {
> +            PCI_CLASS_STORAGE_IDE
> +            && strcmp(d->name, "xen-pci-passthrough") != 0) {
>          qdev_unplug(&(d->qdev), NULL);
>      }
>  }
> -- 
> Anthony PERARD
> 

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

end of thread, other threads:[~2012-09-19 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 11:05 [Qemu-devel] [PATCH] xen: Fix, no unplug of pt device by platform device Anthony PERARD
2012-09-19 13:06 ` Stefano Stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).