From patchwork Thu Sep 1 12:11:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 9308983 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 1683E60865 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 010B929331 for ; Thu, 1 Sep 2016 12:14:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA0C529336; Thu, 1 Sep 2016 12:14:16 +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 885D029334 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 1bfQqQ-0004li-3g; Thu, 01 Sep 2016 12:11:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfQqO-0004lc-Ud for xen-devel@lists.xenproject.org; Thu, 01 Sep 2016 12:11:45 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 16/AF-09160-00B18C75; Thu, 01 Sep 2016 12:11:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsUSuHLSYt3/Uif CDU43S1h83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl9e94yFawVqJjbNI+5gXExdxcjFweLwGJm iQX7F7B1MXJwSAiESiy/Ygthikg8+Z8GUiIkcIZJ4ubDI6xdjJwcbAJKEnsPHmcEsUUEYiT2f 9nODmIzC3xllDj8wBnEFhbwkDgxcQ0LyBwWAVWJmfsiQMK8AsYS8x6eZwGxJQTkJC5t+8IMYn MKmEgc674ONkYIqOb3x42MEPWCEidnPmGBGC8v0bx1NvMERv5ZSFKzkKQWMDKtYlQvTi0qSy3 SNdNLKspMzyjJTczM0TU0MNbLTS0uTkxPzUlMKtZLzs/dxAgMtHoGBsYdjFfanA8xSnIwKYny qsUdDxfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwXtb8kS4kGBRanpqRVpmDjDkYdISHDxKIrwXQ NK8xQWJucWZ6RCpU4yKUuK8U0ESAiCJjNI8uDZYnF1ilJUS5mVkYGAQ4ilILcrNLEGVf8Uozs GoJMx7FWQKT2ZeCdz0V0CLmYAWl1w7DrK4JBEhJdXAyK3FEPiSa73IBQ+Pj41WLndL4/cZRfx byTTv/3rNh2VNsk+Tek9fkrdSqfcUTpnJf4VBqXTCIf5/d7jCOnI2RBidPFmqPufUpXXmF/un vTXc82Gu1OespFtPcxN64i5fvejXsZojW+pnU+2960WPohRvPDXwmRTldKFJ7tT+N7qbrR75L yrbq8RSnJFoqMVcVJwIAJCN7BCuAgAA X-Env-Sender: olaf@aepfle.de X-Msg-Ref: server-13.tower-31.messagelabs.com!1472731903!57850628!1 X-Originating-IP: [81.169.146.163] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1144 invoked from network); 1 Sep 2016 12:11:43 -0000 Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.163) by server-13.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 1 Sep 2016 12:11:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1472731903; l=1764; s=domk; d=aepfle.de; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Date: Subject:Cc:To:From; bh=1lAQIjCA6Pw0vjqd405eO3rFFKcC36EWJ+SktzisGTI=; b=YL5PMntyh5oILkZonUr2IZs1yTEn0KgJFusnvPO7b6S2+UQAsWAI9BqrJ6c+7AK1h4c RUOtjAqTMugF4HW5Xwjkr//qnbAkJ+h/7vWfTtu94p+U8brOOmVjgRKOWYpXbhpcjC8yI Z5m/gEJ1+lxMFJPzGg0lHISFpAM5tTV7L2U= 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 w093bcs81CBgBj5 (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:42 +0200 (CEST) From: Olaf Hering To: Stefano Stabellini , Anthony Perard Date: Thu, 1 Sep 2016 14:11:31 +0200 Message-Id: <20160901121131.16007-3-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 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 d94b53c..8802482 100644 --- a/hw/i386/xen/xen_platform.c +++ b/hw/i386/xen/xen_platform.c @@ -314,13 +314,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 made use of 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;