From patchwork Tue Jun 12 00:21:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ray Jui X-Patchwork-Id: 10458989 X-Patchwork-Delegate: bhelgaas@google.com 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 ADD306020F for ; Tue, 12 Jun 2018 00:22:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C23C285DD for ; Tue, 12 Jun 2018 00:22:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90C96285E8; Tue, 12 Jun 2018 00:22:00 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 662B6285DD for ; Tue, 12 Jun 2018 00:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934680AbeFLAVd (ORCPT ); Mon, 11 Jun 2018 20:21:33 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34907 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934641AbeFLAV3 (ORCPT ); Mon, 11 Jun 2018 20:21:29 -0400 Received: by mail-qt0-f194.google.com with SMTP id s9-v6so22157131qtg.2 for ; Mon, 11 Jun 2018 17:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=47Y2wR93qclqlv5ZINfXplaxowHIThS2SV+BbG68R/U=; b=gSAmfFptwz7Q4ul2I0PQ05VZv86uJgj32dXN3PiWWDF0n6qpG73rnBhUXwdsGsz0D5 XkeXZpIf8I9lPXS7U3AH45xXcwwEUvRqVmN/t6AHUpSlFRqaTUcHRjbzXZeqC/Q8tRhH mXzpH2uSdSIiM0X4M5vYcYjpSCNTMzme7Bjag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=47Y2wR93qclqlv5ZINfXplaxowHIThS2SV+BbG68R/U=; b=LdeW2zR/Se04tCJc2RWUESmz2sBxJ4zQBq6MtwXo6zihEt/UT2SeFdC1qcUP2pQRVT zcnNwddK4t0DVP2h2CgQ0E/HCz8jMRg0wPDkWzK/nQCKUPrbWtssh8wKf2yMy+JY9moc D74eVD3XsesrTB7YBvBkdOXT5sVPG7+JEKwdRL8/UNc05w75R2BfnbEEEKzHtRoJGG8h oUetbXlm0JsI9GAauUfMqSf9h4DVGV7DJhBjY/o6DT1tY9uRrYViLylijud70MsfTUJX tWU+xTHHFHUdDdm+vKKQYUlC79zFzoZys/e+zi1ggbtZxFq05tLj5us+1F4hLE+ebio5 Sfsw== X-Gm-Message-State: APt69E1p5dmlsnzASBGnZCpw44pIAkbNULXXtcuiweKyEsS0MbvVZXfN QcKad1dn73VDQaZk/LZs6LFv7A== X-Google-Smtp-Source: ADUXVKIE84F06LJOEyx5sTDlcR21ovceeXu0z9zjx1E/xHCJqFy/p363hrZ3O73JVmO/TshAAyB+OA== X-Received: by 2002:a0c:cd13:: with SMTP id b19-v6mr1336875qvm.83.1528762888403; Mon, 11 Jun 2018 17:21:28 -0700 (PDT) Received: from lbrmn-lnxub44-1.ric.broadcom.com ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id v26-v6sm31470299qtc.12.2018.06.11.17.21.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jun 2018 17:21:27 -0700 (PDT) From: Ray Jui To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Bjorn Helgaas , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, Ray Jui Subject: [PATCH v2 3/5] PCI: iproc: Disable MSI parsing in certain PAXC blocks Date: Mon, 11 Jun 2018 17:21:05 -0700 Message-Id: <1528762867-16823-4-git-send-email-ray.jui@broadcom.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1528762867-16823-1-git-send-email-ray.jui@broadcom.com> References: <1528762867-16823-1-git-send-email-ray.jui@broadcom.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The internal MSI parsing logic in certain revisions of PAXC root complexes does not work properly and can casue corruptions on the writes. They need to be disabled Signed-off-by: Ray Jui Reviewed-by: Scott Branden Reviewed-by: Oza Pawandeep --- drivers/pci/host/pcie-iproc.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index 680f6b1..0804aa2 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -1197,10 +1197,22 @@ static int iproc_pcie_paxb_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr) return ret; } -static void iproc_pcie_paxc_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr) +static void iproc_pcie_paxc_v2_msi_steer(struct iproc_pcie *pcie, u64 msi_addr, + bool enable) { u32 val; + if (!enable) { + /* + * Disable PAXC MSI steering. All write transfers will be + * treated as non-MSI transfers + */ + val = iproc_pcie_read_reg(pcie, IPROC_PCIE_MSI_EN_CFG); + val &= ~MSI_ENABLE_CFG; + iproc_pcie_write_reg(pcie, IPROC_PCIE_MSI_EN_CFG, val); + return; + } + /* * Program bits [43:13] of address of GITS_TRANSLATER register into * bits [30:0] of the MSI base address register. In fact, in all iProc @@ -1254,7 +1266,7 @@ static int iproc_pcie_msi_steer(struct iproc_pcie *pcie, return ret; break; case IPROC_PCIE_PAXC_V2: - iproc_pcie_paxc_v2_msi_steer(pcie, msi_addr); + iproc_pcie_paxc_v2_msi_steer(pcie, msi_addr, true); break; default: return -EINVAL; @@ -1480,6 +1492,24 @@ int iproc_pcie_remove(struct iproc_pcie *pcie) } EXPORT_SYMBOL(iproc_pcie_remove); +/* + * The MSI parsing logic in certain revisions of Broadcom PAXC based root + * complex does not work and needs to be disabled + */ +static void quirk_paxc_disable_msi_parsing(struct pci_dev *pdev) +{ + struct iproc_pcie *pcie = iproc_data(pdev->bus); + + if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) + iproc_pcie_paxc_v2_msi_steer(pcie, 0, false); +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x16f0, + quirk_paxc_disable_msi_parsing); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd802, + quirk_paxc_disable_msi_parsing); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0xd804, + quirk_paxc_disable_msi_parsing); + MODULE_AUTHOR("Ray Jui "); MODULE_DESCRIPTION("Broadcom iPROC PCIe common driver"); MODULE_LICENSE("GPL v2");