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: 9308989 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 79C40607D2 for ; Thu, 1 Sep 2016 12:14:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68E4229330 for ; Thu, 1 Sep 2016 12:14:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DB9C29334; Thu, 1 Sep 2016 12:14:36 +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 1FB1029330 for ; Thu, 1 Sep 2016 12:14:35 +0000 (UTC) Received: from localhost ([::1]:36761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfQt8-00034N-97 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 01 Sep 2016 08:14:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfQqU-0000ig-PF for qemu-devel@nongnu.org; Thu, 01 Sep 2016 08:11:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfQqO-0003OI-CC for qemu-devel@nongnu.org; Thu, 01 Sep 2016 08:11:49 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::8]:23351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfQqO-0003OA-4o for qemu-devel@nongnu.org; Thu, 01 Sep 2016 08:11:44 -0400 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::8 Subject: [Qemu-devel] [PATCH 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 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;