Received: by 10.192.165.148 with SMTP id m20csp2479329imm; Sun, 22 Apr 2018 07:55:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/y7c3UMUlK6fCHQZMTfWSfik47SrwCoCFl4wvaOiABKb4hZ34182DCCIZ+xhAjfGmtP5ce X-Received: by 10.98.86.204 with SMTP id h73mr15821535pfj.47.1524408907675; Sun, 22 Apr 2018 07:55:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408907; cv=none; d=google.com; s=arc-20160816; b=S+e8b5LgLzUn/h5TUq4LXmXbFvD/boE/+cs8QDI70JrtbeBNWuXRTGUr/9+UuFbgsk XyCP49dsNaAqsyU8u+C0h2ESeJpTIzRBdPw4EOaIM0MNYbL5M8pTE+J8sHaXpO5ND0gk +lev/K0Oi/r1VIx4OSbYP+j3RJPQgX18s9nSgd1qHxoPGxbFO9vq2piasOhiiXAA6y2j wOvx5yL2PHsNhPxq6cdJ8S/wVT4USpuJEd7WCiDxQNw26/PUITsB1ohWogJwNr1agrBp lM8F1lzS462J489kBrRlURjghDXfQ/hAPYtKPVUJKEyhptfECAnreAeEHKoW/Jzj8FW2 L+iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+ktORAUJD4TwgaA8UxKq4T+d/Os065gv5Q8cISQwI64=; b=M4B/zgmy/FYMeC0SUbyXfQgZRTL/io2kpQxI3xv5aax3hoWpxpesu9Kql5fOOTOSOc 09b1kPZeG9aYTj5nGwuDzAKInfdLbb9+RmH9t2mswqqcON8TcUsFIKpfKmTG9f6+eA2m ApWrh4DMiay85e4uyvGDZKs5izYVHChc3kwhi+P+dJ9vB4JgZ16gEPz0pvt91X0lGmyU heUGIziqkrbWnMOftmCyPCyWGzjSF9VNFy3otbegOQ0j4/Qa7QcOswwRCUSZ+IChJ6EF 6Znf1fpnEpa/sJ+o3k6F2GsqEP95Nl2SQYXi4BuSKM/YB6JNSmfaVUFoUO6K4mujxXG1 6MOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h186si8491594pge.324.2018.04.22.07.54.53; Sun, 22 Apr 2018 07:55:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757031AbeDVOOg (ORCPT + 99 others); Sun, 22 Apr 2018 10:14:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56448 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756977AbeDVOOa (ORCPT ); Sun, 22 Apr 2018 10:14:30 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 08E2B12; Sun, 22 Apr 2018 14:14:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pridhiviraj Paidipeddi , Michael Neuling , Russell Currey , Michael Ellerman Subject: [PATCH 4.9 83/95] powerpc/eeh: Fix enabling bridge MMIO windows Date: Sun, 22 Apr 2018 15:53:52 +0200 Message-Id: <20180422135213.820559868@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Neuling commit 13a83eac373c49c0a081cbcd137e79210fe78acd upstream. On boot we save the configuration space of PCIe bridges. We do this so when we get an EEH event and everything gets reset that we can restore them. Unfortunately we save this state before we've enabled the MMIO space on the bridges. Hence if we have to reset the bridge when we come back MMIO is not enabled and we end up taking an PE freeze when the driver starts accessing again. This patch forces the memory/MMIO and bus mastering on when restoring bridges on EEH. Ideally we'd do this correctly by saving the configuration space writes later, but that will have to come later in a larger EEH rewrite. For now we have this simple fix. The original bug can be triggered on a boston machine by doing: echo 0x8000000000000000 > /sys/kernel/debug/powerpc/PCI0001/err_injct_outbound On boston, this PHB has a PCIe switch on it. Without this patch, you'll see two EEH events, 1 expected and 1 the failure we are fixing here. The second EEH event causes the anything under the PHB to disappear (i.e. the i40e eth). With this patch, only 1 EEH event occurs and devices properly recover. Fixes: 652defed4875 ("powerpc/eeh: Check PCIe link after reset") Cc: stable@vger.kernel.org # v3.11+ Reported-by: Pridhiviraj Paidipeddi Signed-off-by: Michael Neuling Acked-by: Russell Currey Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/eeh_pe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/powerpc/kernel/eeh_pe.c +++ b/arch/powerpc/kernel/eeh_pe.c @@ -795,7 +795,8 @@ static void eeh_restore_bridge_bars(stru eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]); /* PCI Command: 0x4 */ - eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1]); + eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1] | + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); /* Check the PCIe link is ready */ eeh_bridge_check_link(edev);