From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226q9JuZ302YtBOuVtWTF3BSdNFYXledq4OX6gN9VutlYNKGV5l7tmfyHeDh+7pe7ABZd56P ARC-Seal: i=1; a=rsa-sha256; t=1517257049; cv=none; d=google.com; s=arc-20160816; b=nY5kl6mx9HJXca0t/rfoWiHf9voeTzAPE1jxaNwHgytBRBC1AQdXLlgdLxln7/xtuf H21bY041raeocxHQc/sC57c/8/cVP7cpwqweO47mOCjyzBzGmFQrSh46dxNav7we/XJm 5ACBDtyMQ11xKL9dLfYpELXT+B6GWWtEgXEriihsFi0njUeBYQBIsFOAqBXemcsGUdvI WfGs6x0TriVYatXdlP/tJkh0hFfjPPe4MWompyZm60vOWEigzqHpUClrn6IwAtKUs/24 bkKg/+/CLgF1bQzwqPPGZzWH2Dbr0rulm9pP7VPv17elPsj9uzAsS+Vs8SzJlZ+Hp1bR ch2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fnPGh121roE4bwNAeXqVl8pGgNIYUkwcH3SUAyFRizg=; b=IgfuiPuHiMLpu1NoVtGSgoI5A0CE86B7a9IZ94sqz7xg3Pc6RS9ndpSV9A2FHdCq9D Ida7N3BFvwSQBr8kgasf8d2cpCMzrY8d65Vi1pFteOGQVRNV2bXuCFKHIVJsn+hPKeRB /huEB6KWFf7rRMSxgyPg5XiI+PonlmEuPhuAWlaUnbqdrQFPNdZsR2mDM0FzDxwMQFZe 1SIM8YJXmluHLlNtG7se8Ur5QYBAKyW/3FKXRnRsCyODLCmZDN8xAiUh1LjcG/1LM0Wh WpY56QJnJWx+iglA8KvB2l/qtlCOsS/drz2jz9yMi+woGJ5hSWIhcGhJ7U/RRliAlAMa 7Kxg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minghuan Lian , Bjorn Helgaas , Matthias Brugger Subject: [PATCH 4.4 18/74] PCI: layerscape: Fix MSG TLP drop setting Date: Mon, 29 Jan 2018 13:56:23 +0100 Message-Id: <20180129123848.411589520@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590959327592913840?= X-GMAIL-MSGID: =?utf-8?q?1590959327592913840?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Minghuan Lian commit 1195c103f6c98d9ff381cac3a8760d4f8a133627 upstream. Some kinds of Layerscape PCIe controllers will forward the received message TLPs to system application address space, which could corrupt system memory or lead to a system hang. Enable MSG_DROP to fix this issue. Signed-off-by: Minghuan Lian Signed-off-by: Bjorn Helgaas Signed-off-by: Matthias Brugger Signed-off-by: Greg Kroah-Hartman --- drivers/pci/host/pci-layerscape.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_ iowrite16(PCI_CLASS_BRIDGE_PCI, pcie->dbi + PCI_CLASS_DEVICE); } +/* Drop MSG TLP except for Vendor MSG */ +static void ls_pcie_drop_msg_tlp(struct ls_pcie *pcie) +{ + u32 val; + + val = ioread32(pcie->dbi + PCIE_STRFMR1); + val &= 0xDFFFFFFF; + iowrite32(val, pcie->dbi + PCIE_STRFMR1); +} + static int ls1021_pcie_link_up(struct pcie_port *pp) { u32 state; @@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pc static void ls1021_pcie_host_init(struct pcie_port *pp) { struct ls_pcie *pcie = to_ls_pcie(pp); - u32 val, index[2]; + u32 index[2]; pcie->scfg = syscon_regmap_lookup_by_phandle(pp->dev->of_node, "fsl,pcie-scfg"); @@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct dw_pcie_setup_rc(pp); - /* - * LS1021A Workaround for internal TKT228622 - * to fix the INTx hang issue - */ - val = ioread32(pcie->dbi + PCIE_STRFMR1); - val &= 0xffff; - iowrite32(val, pcie->dbi + PCIE_STRFMR1); + ls_pcie_drop_msg_tlp(pcie); } static int ls_pcie_link_up(struct pcie_port *pp) @@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pci iowrite32(1, pcie->dbi + PCIE_DBI_RO_WR_EN); ls_pcie_fix_class(pcie); ls_pcie_clear_multifunction(pcie); + ls_pcie_drop_msg_tlp(pcie); iowrite32(0, pcie->dbi + PCIE_DBI_RO_WR_EN); }