From patchwork Fri Oct 21 20:06:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9390041 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 DBE1560762 for ; Fri, 21 Oct 2016 20:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCFA92A296 for ; Fri, 21 Oct 2016 20:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C15B42A29A; Fri, 21 Oct 2016 20:09:00 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 6EC6B2A296 for ; Fri, 21 Oct 2016 20:09:00 +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 1bxg5s-0002AH-VB; Fri, 21 Oct 2016 20:07:08 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bxg5s-00029G-Cl for xen-devel@lists.xenproject.org; Fri, 21 Oct 2016 20:07:08 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id 31/73-28497-B657A085; Fri, 21 Oct 2016 20:07:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRWlGSWpSXmKPExsVybKJsh25WKVe Ewcxt1hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aDGRNYCg4JVTw69Yy1gfEibxcjF4eQwFRG ib1TjjNDONuZJKZNusHaxcjJwSZgKPH3ySY2EFtEQEai89IiRpAiZoE+Romd3ceYQBLCAhYSf 9rfgDWwCKhKvDwwHWgSBwevgJvEuTYLkLCEgJzEyWOTwUo4BdwlVq3+zQSxrI1RYs+9xywQRR kS83rmsELYXhKLblyCstUkrp7bxDyBkW8BI8MqRo3i1KKy1CJdQwu9pKLM9IyS3MTMHF1DAzO 93NTi4sT01JzEpGK95PzcTYzAUGEAgh2MNzcGHGKU5GBSEuVdNJEzQogvKT+lMiOxOCO+qDQn tfgQowwHh5IEr3sJV4SQYFFqempFWmYOMGhh0hIcPEoivAzAwBXiLS5IzC3OTIdInWJUlBLnT QLpEwBJZJTmwbXBIuUSo6yUMC8j0CFCPAWpRbmZJajyrxjFORiVhHk/FwNN4cnMK4Gb/gpoMR PQ4po0DpDFJYkIKakGxhl6DC1isx6Ex8e+clpzKmlPX7hDx5oWoydu8Sz9vbvrFZcaWXAc/3s 0yv7tyVvrIt7+37DljdhxaSv/fBGDCSuPSPCK7XL4HmJhtLhaf1l0s2SArK72pd/Lfr785TO9 8V6k53Pr7UEzKriWSm1uy/qTbc8tomnyXcNNwV7z40q1d8sXTC31VWIpzkg01GIuKk4EAPvHK i6PAgAA X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-2.tower-27.messagelabs.com!1477080425!14333497!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19909 invoked from network); 21 Oct 2016 20:07:06 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Oct 2016 20:07:06 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 629CF2010B; Fri, 21 Oct 2016 20:07:04 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 137E5201BB; Fri, 21 Oct 2016 20:07:03 +0000 (UTC) From: Stefano Stabellini To: peter.maydell@linaro.org Date: Fri, 21 Oct 2016 13:06:58 -0700 Message-Id: <1477080419-19730-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1477080419-19730-1-git-send-email-sstabellini@kernel.org> References: <1477080419-19730-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, Olaf Hering , sstabellini@kernel.org, qemu-devel@nongnu.org Subject: [Xen-devel] [PULL 2/3] 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Olaf Hering 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 Reviewed-by: Stefano Stabellini Signed-off-by: Stefano Stabellini --- hw/i386/xen/xen_platform.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index f85635c..91d8a7a 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -114,6 +114,10 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) PCI_CLASS_STORAGE_IDE && 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)); } }