Received: by 10.192.165.148 with SMTP id m20csp2522899imm; Sun, 22 Apr 2018 08:48:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+mGWe43tXS8h0PDkByvMGQF5oAfVko7DUeKH+GQH96MOy1jAx3n72oLBdO9ON0/V6MBumM X-Received: by 2002:a17:902:380c:: with SMTP id l12-v6mr15762278plc.19.1524412088720; Sun, 22 Apr 2018 08:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524412088; cv=none; d=google.com; s=arc-20160816; b=uYYAjnXiCm+K8yYCvDrUMYT4w4kgAZb7U84XHncOA1lIZ/8EVZqX0AJqGGBSMZiwFu cCsUWeJvlUOfLLhLXowM3pZGRFGa2KahHyQQqzgd/RiB0uByqHaA2JqOAFQAyei7C4i2 jYbC9zFeUORt3XuVUT30b3UyzLUoTRpuABOt69esZZkwexIWHwKNCHH3UQmoa9Ymw5BR 2dWDuI6DxydDN0lKHzbeckVl42dTvWex/TTLtd8Rzy/XHrdqwX8VfPwhOinWdh2t2/rC YfC6q8eISRYmWEXfEaYUL9/etmfDL7diGblrjgG3CIxXTpdYH0wRyIpmL29zmdWdcjlP OiMw== 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=w68G2XRwo5esC3qudRVEQwHmHCCJUxqsMx7ZUtTbtMs=; b=SzuopnZ+L1lZnMv+dfQDlocLFR3p21cq+RaQ93NlPGFsyf8nCfDsw9svekJoWvVGBI MElvrY1JKayGFqn/hOPtM8tfuIeRL4KLPxTPGZtvumqp9JEnuJ1vFghVImRf/sl9Vb0H YzFcBwh0zNGlWxgyFFMhZUlJ7K5/P7BK4Nzc4C5UyTXnCFf3ETvgZqhONukNHbVqpZ5w sRVzm55eEUydimTrzkIdBBssjfEaDg7+s/IufIMHUNS9hhtwRSFCLZ+cLq+ADxA4wFXg 1YppaKsrWpfneF4H3t5ns2ejre+Pm7LDgl9yO+0kudOCViCZUtT5qCxtwiCunarZBnIQ sZRQ== 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 e66-v6si8707720plb.499.2018.04.22.08.47.54; Sun, 22 Apr 2018 08:48:08 -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 S1755049AbeDVPqM (ORCPT + 99 others); Sun, 22 Apr 2018 11:46:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48484 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753960AbeDVOCU (ORCPT ); Sun, 22 Apr 2018 10:02:20 -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 962CC941; Sun, 22 Apr 2018 14:02:19 +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.16 177/196] powerpc/eeh: Fix enabling bridge MMIO windows Date: Sun, 22 Apr 2018 15:53:17 +0200 Message-Id: <20180422135113.414107835@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@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.16-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 @@ -807,7 +807,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);