Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2882328rwb; Mon, 15 Aug 2022 13:14:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR6QaZrwbogRA/Wo0A1XHC0jnvqT5J1xRcsz6UhjSb0ZtCgUALfkvqTsBxISSWPEzOQxwSmg X-Received: by 2002:a05:6402:1492:b0:43d:7b8c:486e with SMTP id e18-20020a056402149200b0043d7b8c486emr16033083edv.367.1660594460270; Mon, 15 Aug 2022 13:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594460; cv=none; d=google.com; s=arc-20160816; b=fngKCfyP9BWpk5m/WP/Yd9utUJoo2XxLtuhQ44AyXCAcwo4AXS82j543lOAMM9Nx5u 0gYLbfxh9fyoG7OAtsVXJN0uMazQE/khusMMseJJQXp8wbWzxA8gIcBadZ2+7nkVrG7f u51n3Ohc5rKPQYbVjvDv4ZZ+6Uai7tvnzRXbOMtJOwU7Z9UCr/L82V6+/tOlN00rsUML UXS94NtEKIUP0zXQb3dtShqd01QJBhO+XUYDjUxuuDZC44uRAc6TOeBgP0RsdD/NH51l kJQqZpNE6AONsDGF9gGRIR7hcsJmnfILrXwSJ7fmhVLBNu9LnjvA4nQWjk0cy2eQBj1D WgDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JQTm28Agv/9qbYpiWF8eeYXCTJ/52Cgsbo8rIq568IM=; b=ufT5H+hFk0VdZuipJ9WXKnmnJ+G1GA/Rs78LD4r2/2cglyszWJA9aKiHtbWQVpdts7 NIooYBIpNyDMs+7Aqa15yjBiBEccJIle1OC4IrO8rqgVH4N69+vW2n/g7l3/m+6IkgBU /j4rNEaAfcEGoW9oOhIh6CdSFiBf74YGnP5j8BZ8rl+lCn5KWow9TUJzi23reu1IGxM8 bTshTsj0XZ9eKKbx9GgxgVUK4rbLwg7ZbRxpjizlzqm+T0fRs/z+YFbZ7fni1g7Qg/vu DKXOpS32YdkP8YcF8AjfWBsp9/oL9yeqZwHP2VZiX3hZLRfETwrt6xzBXZqjLCL9M76w oP8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k7bjfWJy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402270a00b0043cb30af926si9040806edd.58.2022.08.15.13.13.54; Mon, 15 Aug 2022 13:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k7bjfWJy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344632AbiHOTVZ (ORCPT + 99 others); Mon, 15 Aug 2022 15:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344665AbiHOTRO (ORCPT ); Mon, 15 Aug 2022 15:17:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD00E3C8D5; Mon, 15 Aug 2022 11:38:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0620C61024; Mon, 15 Aug 2022 18:38:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E56CBC433D6; Mon, 15 Aug 2022 18:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588713; bh=zQsLFdj2P+OSam3i5qL4NMoAljPhyjGZE2whu/cO+EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7bjfWJyzpoq/dMS2yTUYfOt+NnQhllx1lvhXN2cKV2YD/wcimsfp2Y4PErqlRf4a w92bVE2kuhd8NjZg4nXn284JOLtR6Sy18o+nuUEuLDW6COLeanp+RtpCHa9mO70PU2 fpltHwaS2YW/mXDKxzh37+4FOe3Go6albetBRN68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 461/779] PCI: dwc: Disable outbound windows only for controllers using iATU Date: Mon, 15 Aug 2022 20:01:45 +0200 Message-Id: <20220815180356.999594058@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin [ Upstream commit d60a2e281e9de2b2f67343b2e39417ca0f4fd54e ] Some DWC-based controllers (e.g., pcie-al.c and pci-keystone.c, identified by the fact that they override the default dw_child_pcie_ops) use their own address translation approach instead of the DWC internal ATU (iATU). For those controllers, skip disabling the iATU outbound windows. [bhelgaas: commit log, update multiple window comment] Fixes: 458ad06c4cdd ("PCI: dwc: Ensure all outbound ATU windows are reset") Link: https://lore.kernel.org/r/20220624143428.8334-4-Sergey.Semin@baikalelectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-designware-host.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 3200e906bcda..7cd4593ad12f 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -536,7 +536,6 @@ static struct pci_ops dw_pcie_ops = { void dw_pcie_setup_rc(struct pcie_port *pp) { - int i; u32 val, ctrl, num_ctrls; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -588,19 +587,22 @@ void dw_pcie_setup_rc(struct pcie_port *pp) PCI_COMMAND_MASTER | PCI_COMMAND_SERR; dw_pcie_writel_dbi(pci, PCI_COMMAND, val); - /* Ensure all outbound windows are disabled so there are multiple matches */ - for (i = 0; i < pci->num_ob_windows; i++) - dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); - /* * If the platform provides its own child bus config accesses, it means * the platform uses its own address translation component rather than * ATU, so we should not program the ATU here. */ if (pp->bridge->child_ops == &dw_child_pcie_ops) { - int atu_idx = 0; + int i, atu_idx = 0; struct resource_entry *entry; + /* + * Disable all outbound windows to make sure a transaction + * can't match multiple windows. + */ + for (i = 0; i < pci->num_ob_windows; i++) + dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); + /* Get last memory resource entry */ resource_list_for_each_entry(entry, &pp->bridge->windows) { if (resource_type(entry->res) != IORESOURCE_MEM) -- 2.35.1