From patchwork Fri Sep 2 09:43:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 9310643 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 3D99D60756 for ; Fri, 2 Sep 2016 09:47:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E11029452 for ; Fri, 2 Sep 2016 09:47:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2174B2945B; Fri, 2 Sep 2016 09:47:49 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A054029452 for ; Fri, 2 Sep 2016 09:47:48 +0000 (UTC) Received: from localhost ([::1]:41222 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfl4d-0006Sb-S8 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Sep 2016 05:47:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfl4G-0006R5-1y for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:47:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfl4B-0002UM-UC for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:47:24 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::5]:65230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfl4B-0002UA-N5 for qemu-devel@nongnu.org; Fri, 02 Sep 2016 05:47:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1472809638; l=1757; s=domk; d=aepfle.de; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Date: Subject:Cc:To:From; bh=5JuGSlnNINkp2uZ1+vKXAGkNLBsFzeRGflwLZEDDAq4=; b=tVBTCNheHOrs4VJvp8K4FXaG6KPDx/sT86Whw5swWY7UHQTQ9TzPlDOT6eqKaFCKwUn HeOsCnVloIqcnEijh6QqfsGZYS3zjvzRvZQNg23Gucnm7tUHrCz9T4GWYaTEVvkdSPMWv PMIyLOHljDIVLXnWKmjKh9nwDfvKpKki4Vo= X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+yackYocTD1iAi8x+OWtqWFmrC5F/k8z92bXikQ== X-RZG-CLASS-ID: mo00 Received: from aepfle.de (aftr-185-17-206-179.dynamic.mnet-online.de [185.17.206.179]) by smtp.strato.de (RZmta 38.13 DYNA|AUTH) with ESMTPSA id v01914s829i3PTt (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); Fri, 2 Sep 2016 11:44:03 +0200 (CEST) From: Olaf Hering To: Stefano Stabellini , Anthony Perard Date: Fri, 2 Sep 2016 11:43:54 +0200 Message-Id: <20160902094354.25935-3-olaf@aepfle.de> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160902094354.25935-1-olaf@aepfle.de> References: <20160902094354.25935-1-olaf@aepfle.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:238:20a:202:5300::5 Subject: [Qemu-devel] [PATCH v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Olaf Hering , Eduardo Habkost , "Michael S. Tsirkin" , qemu-devel@nongnu.org, xen-devel@lists.xenproject.org, Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implement SUSE specific unplug protocol for emulated PCI devices in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'. This protocol was implemented and used since Xen 3.0.4. It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and openSUSE 12.3. Signed-off-by: Olaf Hering --- hw/i386/xen/xen_platform.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c index 53be3c7..6faee4c 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -313,13 +313,42 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr, uint64_t val, unsigned int size) { PCIXenPlatformState *s = opaque; + PCIDevice *pci_dev = PCI_DEVICE(s); switch (addr) { case 0: /* Platform flags */ platform_fixed_ioport_writeb(opaque, 0, (uint32_t)val); break; + case 4: + if (val == 1) { + /* + * SUSE unplug for Xenlinux + * xen-kmp used this since xen-3.0.4, instead the official protocol + * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));" + * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured. + * If VMDP was to control both disk and LAN it would use 4. + * If it controlled just disk or just LAN, it would use 8 below. + */ + blk_drain_all(); + blk_flush_all(); + pci_unplug_disks(pci_dev->bus); + pci_unplug_nics(pci_dev->bus); + } + break; case 8: - log_writeb(s, (uint32_t)val); + switch (val) { + case 1: + blk_drain_all(); + blk_flush_all(); + pci_unplug_disks(pci_dev->bus); + break; + case 2: + pci_unplug_nics(pci_dev->bus); + break; + default: + log_writeb(s, (uint32_t)val); + break; + } break; default: break;