From patchwork Wed Sep 19 11:05:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 184974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 130D12C007F for ; Wed, 19 Sep 2012 21:05:55 +1000 (EST) Received: from localhost ([::1]:57328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEI6L-0003xr-0S for incoming@patchwork.ozlabs.org; Wed, 19 Sep 2012 07:05:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEI61-0003T9-Hw for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEI5v-00040A-C6 for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:05:33 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:43428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEI5v-0003xh-7I for qemu-devel@nongnu.org; Wed, 19 Sep 2012 07:05:27 -0400 X-IronPort-AV: E=Sophos;i="4.80,447,1344211200"; d="scan'208";a="208531418" Received: from ftlpmailmx01.citrite.net ([10.13.107.65]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 19 Sep 2012 11:05:25 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.65) with Microsoft SMTP Server id 8.3.279.1; Wed, 19 Sep 2012 07:05:25 -0400 Received: from [10.80.3.61] (helo=perard.uk.xensource.com) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1TEI5s-0004Gv-Pk; Wed, 19 Sep 2012 12:05:24 +0100 From: Anthony PERARD To: QEMU-devel Date: Wed, 19 Sep 2012 12:05:05 +0100 Message-ID: <1348052705-16370-1-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.7.12 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Anthony PERARD , "Zhang, Yang Z" , Stefano Stabellini , Xen Devel Subject: [Qemu-devel] [PATCH] xen: Fix, no unplug of pt device by platform device. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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" Signed-off-by: Anthony PERARD --- 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); } }