From patchwork Thu Sep 1 12:11:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 9308985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E0204607D2 for ; Thu, 1 Sep 2016 12:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF6BE29331 for ; Thu, 1 Sep 2016 12:14:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C43F829334; Thu, 1 Sep 2016 12:14:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9600829335 for ; Thu, 1 Sep 2016 12:14:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfQqM-0004l6-La; Thu, 01 Sep 2016 12:11:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfQqK-0004kB-Ps for xen-devel@lists.xenproject.org; Thu, 01 Sep 2016 12:11:41 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 17/E6-01026-CFA18C75; Thu, 01 Sep 2016 12:11:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRWlGSWpSXmKPExsUSuHLSAt3fUif CDWbdVbD4vmUykwOjx+EPV1gCGKNYM/OS8isSWDMaLr1mL1grWHG17yhTA+Mlni5GLg4WgcXM Ei97+lm6GDk4JARCJZZfsYUwRSSe/E8DKRESOMMkcfHiBKASTg42ASWJvQePM4LYIgIxEvu/b GcHsZkFvjJKHH7gDGILC1hK3L94B6yGRUBVYurEE0wgNq+AscSDza3MILaEgJzEpW1fwGxOAR OJY93XweYIAdX8/riREaJeUOLkzCcsEPPlJZq3zmaewMg/C0lqFpLUAkamVYzqxalFZalFuhZ 6SUWZ6RkluYmZObqGBqZ6uanFxYnpqTmJScV6yfm5mxiBocYABDsYDzY7H2KU5GBSEuVVizse LsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mCN0byRLiQYFFqempFWmYOMOhh0hIcPEoivBdA0rzFB Ym5xZnpEKlTjIpS4rxTQRICIImM0jy4NlikXWKUlRLmZQQ6RIinILUoN7MEVf4VozgHo5Iw7y yQKTyZeSVw018BLWYCWlxy7TjI4pJEhJRUA2Njxul/5e7fXjm2bZXUtU/eKGwtymt+7LRSb9+ qpUe+Lrox78myl3rMjH4tsV3R4h4LIo/ZzL/T5XLoxdzfMumFTUY8017cYSz2O9MpnO0jxq0l aFhZXSf/c1JZWuGk1C/VDMqbXZJTX+Zo2Xo1Lfsk51t4bt0d20lFkWapvmpXvzzxKD9bpsRSn JFoqMVcVJwIABFi/7uvAgAA X-Env-Sender: olaf@aepfle.de X-Msg-Ref: server-2.tower-206.messagelabs.com!1472731899!41327915!1 X-Originating-IP: [81.169.146.160] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: QmFkIElQOiA4MS4xNjkuMTQ2LjE2MCA9PiA1NTc3MTg=\n,sa_preprocessor: QmFkIElQOiA4MS4xNjkuMTQ2LjE2MCA9PiA1NTc3MTg=\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52774 invoked from network); 1 Sep 2016 12:11:39 -0000 Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.160) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2016 12:11:39 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1472731899; l=1970; s=domk; d=aepfle.de; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Date: Subject:Cc:To:From; bh=PENZYLAUF2jH7WJ4SGKlltCR2Py8qBOXLNksrum4CcA=; b=MGR290cpEiC9SGNUm8e7sf1mKULoWtNLac6U5XvTPDwbtzMoH0cLknO8SUmQrgo7EqK 0ekF94gUpA82yTKyKpCRyu+4srbwpLEsgJqapOMC7INZ0g0NWiCpuIfEJtPE+EFzSovwl un0fZjR5np5ewBZbsWeGVIUkO9Kb6hO6WDQ= X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+yackYocTD1iAi8x+OWi5z/J1IL7CYRxLEwpkY2XtLzyRUcY= X-RZG-CLASS-ID: mo00 Received: from aepfle.de (nat.nue.novell.com [IPv6:2620:113:80c0:5::2222]) by smtp.strato.de (RZmta 38.13 AUTH) with ESMTPSA id w093bcs81CBcBj4 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 1 Sep 2016 14:11:38 +0200 (CEST) From: Olaf Hering To: Stefano Stabellini , Anthony Perard Date: Thu, 1 Sep 2016 14:11:30 +0200 Message-Id: <20160901121131.16007-2-olaf@aepfle.de> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160901121131.16007-1-olaf@aepfle.de> References: <20160901121131.16007-1-olaf@aepfle.de> MIME-Version: 1.0 Cc: Olaf Hering , Eduardo Habkost , "Michael S. Tsirkin" , qemu-devel@nongnu.org, xen-devel@lists.xenproject.org, Paolo Bonzini , Richard Henderson Subject: [Xen-devel] [PATCH 1/2] xen_platform: unplug also SCSI disks X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Using 'vdev=sd[a-o]' will create an emulated LSI controller, which can be used by the emulated BIOS to boot from disk. If the HVM domU has also PV driver the disk may appear twice in the guest. To avoid this an unplug of the emulated hardware is needed, similar to what is done for IDE and NIC drivers already. Since the SCSI controller provides only disks the entire controller can be unplugged at once. Impact of the change for classic and pvops based guest kernels: vdev=sda:disk0 before: pvops: disk0=pv xvda + emulated sda classic: disk0=pv sda + emulated sdq after: pvops: disk0=pv xvda classic: disk0=pv sda vdev=hda:disk0, vdev=sda:disk1 before: pvops: disk0=pv xvda disk1=emulated sda classic: disk0=pv hda disk1=pv sda + emulated sdq after: pvops: disk0=pv xvda disk1=not accessible by blkfront, index hda==index sda classic: disk0=pv hda disk1=pv sda vdev=hda:disk0, vdev=sda:disk1, vdev=sdb:disk2 before: pvops: disk0=pv xvda disk1=emulated sda disk2=pv xvdb + emulated sdb classic: disk0=pv hda disk1=pv sda + emulated sdq disk2=pv sdb + emulated sdr after: pvops: disk0=pv xvda disk1=not accessible by blkfront, index hda==index sda disk2=pv xvdb classic: disk0=pv hda disk1=pv sda disk2=pv sda Signed-off-by: Olaf Hering --- hw/i386/xen/xen_platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index aa78393..d94b53c 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -115,6 +115,11 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) && strcmp(d->name, "xen-pci-passthrough") != 0) { pci_piix3_xen_ide_unplug(DEVICE(d)); } + else if (pci_get_word(d->config + PCI_CLASS_DEVICE) == + PCI_CLASS_STORAGE_SCSI + && strcmp(d->name, "xen-pci-passthrough") != 0) { + object_unparent(OBJECT(d)); + } } static void pci_unplug_disks(PCIBus *bus)