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: 9310641 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 6553E60756 for ; Fri, 2 Sep 2016 09:46:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 536DE292CD for ; Fri, 2 Sep 2016 09:46:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4839629452; Fri, 2 Sep 2016 09:46:09 +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 64A6B292CD for ; Fri, 2 Sep 2016 09:46:07 +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 1bfl13-00051b-Ry; Fri, 02 Sep 2016 09:44:05 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfl12-000507-Fs for xen-devel@lists.xenproject.org; Fri, 02 Sep 2016 09:44:04 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 2C/9B-03271-4E949C75; Fri, 02 Sep 2016 09:44:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRWlGSWpSXmKPExsUSuHLSHd3Hnif DDbr3G1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBm9HZYFywQqZk57xdrAOI+7i5GLg0VgMbPE ynsz2LoYOTkkBHwlli++xdLFyAFki0g8+Z8GUiMkcJdJ4snLnYwgNWwCShJ7Dx4Hs0UEYiT2f 9nODmIzC3xllDj8wBnEFhbwlji99jXYTBYBVYmHk6aD1fAKGEucu7+LEWKXnMSlbV+YQXZxCp hIfDwIViIEVNKwZxlUuaDEyZlPWCDGy0s0b53NPIGRfxaS1CwkqQWMTKsYNYpTi8pSi3SNjPW SijLTM0pyEzNzdA0NjPVyU4uLE9NTcxKTivWS83M3MQJDrZ6BgXEHY99ev0OMkhxMSqK8r+1P hgvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4HX3AMoJFqWmp1akZeYAgx4mLcHBoyTCOw8kzVtck JhbnJkOkTrFqMuxbd7eK0xCLHn5ealS4rwTQYoEQIoySvPgRsAi8BKjrJQwLyMDA4MQT0FqUW 5mCar8K0ZxDkYlYd5ukCk8mXklcJteAR3BBHREybXjIEeUJCKkpBoYLSdqKU1UrKqao3nnvqt dqt4OS+Yt++w2bnB9El2jlpZttCfrtPvVXT93S5t84J1oN8Hkps2Hg+xH9bb8s7f6X3XhlOnS d8u7GvKePXW/dCvJ96P4wV8xjzW6pHrKzpSnpSfsPevzc/e0CZczVtpExOvtYpSdcfDsX5Wcf 5eVppzt2V2ktOf/EiWW4oxEQy3mouJEAJPUhuW7AgAA X-Env-Sender: olaf@aepfle.de X-Msg-Ref: server-15.tower-31.messagelabs.com!1472809443!54683555!1 X-Originating-IP: [81.169.146.220] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5715 invoked from network); 2 Sep 2016 09:44:03 -0000 Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.220) by server-15.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Sep 2016 09:44:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1472809443; 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=CTKa5vb6V6iqfKRQv0gqp6id/Ve6z3Qm/XwMpreWPZ5nzOKJ5r+8pONAbGgDJWGBzhK B5/rYvQVvS7YfeBOpPz+J3rI8jNHnk1inZWAMU0YIUPx1njgzqtXKWCPATRpTXmg5BsQY uk72OHvJaGQs8zw9EjfJivlqPeDa3ohBt4E= 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 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 v2 2/2] xen_platform: SUSE xenlinux unplug for emulated PCI 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 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;