Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4909776imm; Fri, 18 May 2018 12:49:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZol1AeSPwDj2N9TF754ZN+DfR5RhzL1zIKnpSbdCPONT9uaSkrkettQwvRlJtlREFOPhRiF X-Received: by 2002:a63:6d4e:: with SMTP id i75-v6mr2295419pgc.154.1526672951060; Fri, 18 May 2018 12:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526672951; cv=none; d=google.com; s=arc-20160816; b=KmK+op29wliEPoqsXIyPDge0jqBNVXFH0itpueGXpxzJdmTiKn/uRIo1ukzyiYeey4 BobrpSyBicvTl7A2CsbZbATTbDwErvL52Y+vmE3bMyPv8vQk1Fp9eVXwXNqmJGT0jxZj TDx5Qp2vzeGfqLsjGXIvjQKj9Smi5+xnLTsVQNd4MhppGGdz9YE48xUOo4F5XeYAmm7L XtI7dkvrTu8vTPAqZDpA8CxlbvmU6xGWxy0LBA7Duw/TmtMtVjL0i/+pVGkhVE5H7R75 Dy4yV802Lj8zKGA/CBqWqxsmjPunPjmnwGV+s6WbpKB2bOElVr4ILN2mmgMeL4bIAR+5 qslA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=BjAtz9lOqnz5k3q04cnCYu2Ju+Y4fnH1Y7aZl2jI3OM=; b=rGNPY6jmrHzRpcano9fEeCBwNLwUf1uyu7E4uQkQkQIVkWHN+jLbBooSbPUfM/C1FE TdkX3xmB7SMGhEGamsd5PejuFPuc9IyAns+mJRfZDXBVzbLZh27R9ttTBkMe0PGN7L18 yNpz/oQZ0BWxB62f9mLInfkKvkCHb7HzkwNT1rMsV2LayRAkStuZegOGwNQ/njFlepH2 4hqFKD++3hOgA1YjkTomF+BiCRy2sWjt38+ZNU4qdv5zIPRRuCJcakvFanEXfiP65aTV CfRo7VDonfUC3OTSqTYTz/Gi88OBMTkaV5LborjBMjPU4KRsmC1KeP9y/QX35mss7cPo lW9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=bdvlYJaM; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5-v6si6386739pgv.191.2018.05.18.12.48.55; Fri, 18 May 2018 12:49:11 -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; dkim=pass header.i=@broadcom.com header.s=google header.b=bdvlYJaM; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbeERTsg (ORCPT + 99 others); Fri, 18 May 2018 15:48:36 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:38695 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751744AbeERTsd (ORCPT ); Fri, 18 May 2018 15:48:33 -0400 Received: by mail-qt0-f195.google.com with SMTP id m9-v6so11800016qtb.5 for ; Fri, 18 May 2018 12:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=BjAtz9lOqnz5k3q04cnCYu2Ju+Y4fnH1Y7aZl2jI3OM=; b=bdvlYJaMPgW4E3PwA3BijvyRQVw+AFk7Jny2jp02+aDMe5/YI5ZQdB2W3bViL5ok1x Lv7hv4TzQBR6BO1jJn/N4nmkppfW776Ad81HxTUAeq/sKKCOeLx7qc+b8pDisJB2vWKE DE2bzsXEp1zLfqYW4EE795B2pNP2zMtjyiT74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BjAtz9lOqnz5k3q04cnCYu2Ju+Y4fnH1Y7aZl2jI3OM=; b=tlLl+zNuEKK3/DTmZ22KaPgJD+2R8cIBwOEKEQdZMbscMwDH0ub+zkEPnHcdVLQL1C /93yxPc/JWqkHtd1A+cSW2Mloeen84JybbsYbc+ObiQjUeweSCBOUKXuG/JnneiZ+Xqo SOgg45I7d4iCGT1JoJ51taEVa9OEjY7iodBnuuCBRTZD+/7RrTZccRFvaqAkzyi51fmT IFibLsmzqFxA+X54xSdJlQDj34sF7jT2Buz2U/ElXgxneo/o6xwPgtJvhsAH3xrc8e/7 6QL6IS/PZ+zQAwhjdq1qfwfURxwNks68CBen3qu+zyo3+Q8hIFsE+sgvmdSzu/Fmg3DE UXWg== X-Gm-Message-State: ALKqPweZqEUOfvBCTS6kB73B2CHIWy8TV6BcLyFwPlU/+qgV+sGG7RnC 33kaYiyDQ+hFI/KzMzVSzsRN7wC+r4M= X-Received: by 2002:a0c:f604:: with SMTP id r4-v6mr10075251qvm.138.1526672912467; Fri, 18 May 2018 12:48:32 -0700 (PDT) Received: from [10.136.8.248] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id q23-v6sm6278919qta.20.2018.05.18.12.48.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 12:48:31 -0700 (PDT) Subject: Re: [PATCH INTERNAL 3/3] PCI: iproc: Disable MSI parsing in certain PAXC blocks To: Lorenzo Pieralisi , poza@codeaurora.org Cc: Bjorn Helgaas , Bjorn Helgaas , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, linux-pci-owner@vger.kernel.org References: <1526577692-21104-1-git-send-email-ray.jui@broadcom.com> <1526577692-21104-4-git-send-email-ray.jui@broadcom.com> <20180518135614.GA18605@e107981-ln.cambridge.arm.com> From: Ray Jui Message-ID: Date: Fri, 18 May 2018 12:48:28 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180518135614.GA18605@e107981-ln.cambridge.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lorenzo, On 5/18/2018 6:56 AM, Lorenzo Pieralisi wrote: > On Fri, May 18, 2018 at 02:53:41PM +0530, poza@codeaurora.org wrote: >> On 2018-05-17 22:51, Ray Jui wrote: >>> 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 >>> --- >>> 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 3c76c5f..b906d80 100644 >>> --- a/drivers/pci/host/pcie-iproc.c >>> +++ b/drivers/pci/host/pcie-iproc.c >>> @@ -1144,10 +1144,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 >>> @@ -1201,7 +1213,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); >> >> Are you calling iproc_pcie_paxc_v2_msi_steer() anywhere else with 'false' ? >> I see its getting called only from one place in current code >> iproc_pcie_msi_steer(). > > It is called below with the false field to disable MSIs. That's probably > one reason more to create a function to enable/disable MSIs instead of > adding a parameter to iproc_pcie_paxc_v2_msi_steer(). Correct. Thanks for helping to explain. > > Which brings me to the question: what happens to those MSIs writes > when MSIs are disabled according to this patch ? Are they terminated > at the root complex ? Note the PAXC block parses MSI writes from our internally connected endpoints (i.e., an embedded network processor). The PAXC block examines these MSI writes and modifies the memory attributes (to DEVICE) of these data and then send them out to the AXI bus. These MSI writes will then be forwarded to the GIC (e.g., GICv2m, GICv3-ITS from ARM) for further processing. This is saying, PAXC itself does not process these MSI writes. They are processed by the GIC and associated interrupt will be generated form the GIC. PAXC's job is to parse and tag them properly so these MSI writes can reach the GIC, and at the same, reach the GIC at the right order. On some of these problematic PAXCs, we are being forced to disable this PAXC internal parsing logic. In this case, we set up static mapping with the IOMMU to modify the memory attributes of these MSI writes. These MSI writes are always designated towards a specific memory address (e.g., on the GICv3 based system, it's the address of the translator register), and that's why static mapping table can be set up to work around this. > > Lorenzo > >>> break; >>> default: >>> return -EINVAL; >>> @@ -1427,6 +1439,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");