Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp731880pxu; Wed, 6 Jan 2021 02:56:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFie5XBrDu7kvUWyQkDF8xH70MwUOGMDRS3TtNm2trLroRmIJhWDV2ZIdfSgtRxSumO8q1 X-Received: by 2002:a17:906:fb0e:: with SMTP id lz14mr2574446ejb.232.1609930562182; Wed, 06 Jan 2021 02:56:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609930562; cv=none; d=google.com; s=arc-20160816; b=ySUUeEwrT/qlXH4jekErFd4yws4lIlQNrQlF8V4ts579dP4xEV8ZRazRLMWM8SDEoj oU/HKLCXsFUvsTqLPeDzkX0TOq5aNyQ98ml2UST0nluoUVaTmG3c/tJR1hTCAd+cSqcw B3LGQvTCfh7vBikt3Pd93qklem4Q1+LyaFCj/Vt43iMKckkEZerr2mTAeRhqO5RlsJkj 4Zme2uwAC3GgYw9k1DMbvwr4Ic6pT9PLb0dNx0jxWL0Ry0kqP46p0csHgLNzA/vTYeaP ENjYrwiEfKr42ZjtGLckIbJf9lRRCizDcGz0EBBZGasHJb3JAyjVn37kLclwjaJkLWb/ k9xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=cIQaJtOHcRr1hOe5xiVBlUoUJ8Ww27E+DGEh1wg5s0w=; b=nY7BNFjpKOH/p9/1x7LBNNaunv8pncIBi7qHOFstxz1MuArfFzWAmWktaRAHMud+H7 5/TYeLRbJZQQY9/5tZTTgXPqCO3CYU7y+swxNzZtIVXyLVIW3JJt+XJ5LwaQA4UD+yF8 jPX9esM7vx8hM2pTvUucufAVEZktpbOU2hW1sQkn1JLsiy5lKokzNpM7ybNKh9AWOpQb 6tGyTlp2qsj4wvfgdMHtxfiOyFDbK3KkLHK9UtmUsYKtqVEysBuV6su3G9S0wWGqrw+7 iGvEZxz7hjAGScNkx8kUorsuX7bdxCNj7cRnSgL45cjOyPMwULCOah/Hnmq1VJnYuja2 1w9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=vO2Qhi55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d13si843578edv.602.2021.01.06.02.55.37; Wed, 06 Jan 2021 02:56:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=vO2Qhi55; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727157AbhAFKxG (ORCPT + 99 others); Wed, 6 Jan 2021 05:53:06 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:40463 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727132AbhAFKxF (ORCPT ); Wed, 6 Jan 2021 05:53:05 -0500 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20210106105222epoutp03cf1b681dcb7498f12f142c0e741b074b~Xnx3ElWZb0130401304epoutp03Z for ; Wed, 6 Jan 2021 10:52:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20210106105222epoutp03cf1b681dcb7498f12f142c0e741b074b~Xnx3ElWZb0130401304epoutp03Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1609930342; bh=cIQaJtOHcRr1hOe5xiVBlUoUJ8Ww27E+DGEh1wg5s0w=; h=From:To:Cc:Subject:Date:References:From; b=vO2Qhi556UH+atPlMVmdPlnj7FaIU94HGt7jj9QmJo/nToyUscV70MlDVLp68phFl qbV9N0O2TCs5tZKJ/RUbyZsKvrLJQe50amWcyDARemb2dwv3CmtgqjDeGFQ6FYM0fE 31Eu0f///ywRj8OuEMG+rTpUzZzAcRtY9AqwpK6c= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20210106105221epcas5p48a32f6f1dc6ee99192e215d63f93c0aa~Xnx2hcvx60440204402epcas5p4g; Wed, 6 Jan 2021 10:52:21 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 65.BA.50652.56695FF5; Wed, 6 Jan 2021 19:52:21 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20210106105019epcas5p377bdbff5cd9e14e5107ccbf2b87b5754~XnwFRXjgH1840318403epcas5p3f; Wed, 6 Jan 2021 10:50:19 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210106105019epsmtrp1e13e77c8d196083fe8a6e040c0b4add7~XnwFQgSvS0573305733epsmtrp1T; Wed, 6 Jan 2021 10:50:19 +0000 (GMT) X-AuditID: b6c32a4a-6b3ff7000000c5dc-f3-5ff596653c29 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 35.27.08745.BE595FF5; Wed, 6 Jan 2021 19:50:19 +0900 (KST) Received: from ubuntu.sa.corp.samsungelectronics.net (unknown [107.108.83.125]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210106105017epsmtip1fc9990cda5e1491abc9900f9c68816ed~XnwDHoFCs3243232432epsmtip1q; Wed, 6 Jan 2021 10:50:17 +0000 (GMT) From: Shradha Todi To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, robh@kernel.org, lorenzo.pieralisi@arm.com, bhelgaas@google.com, pankaj.dubey@samsung.com, sriram.dash@samsung.com, niyas.ahmed@samsung.com, p.rajanbabu@samsung.com, l.mehra@samsung.com, hari.tv@samsung.com, Shradha Todi Subject: [PATCH v2] PCI: dwc: Add upper limit address for outbound iATU Date: Wed, 6 Jan 2021 16:20:10 +0530 Message-Id: <1609930210-19227-1-git-send-email-shradha.t@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42LZdlhTXTd12td4g8OXhC2WNGVY7LrbwW7x cdpKJosVX2ayW9x5foPR4vKuOWwWZ+cdZ7N48/sFu8WTKY9YLY5uDLZYtPULu8X/PTvYLXoP 11rcWM/uwOexZt4aRo+ds+6yeyzYVOqxaVUnm0ffllWMHlv2f2b0+LxJLoA9issmJTUnsyy1 SN8ugStjwr4W9oI3ghVdb16xNjBO5+9i5OSQEDCRmLlwHlsXIxeHkMBuRok5T39BOZ8YJT5N /ckM4XxmlJi0exUzTMuKmZdZIBK7GCV2tm2BclqYJD5eucoIUsUmoCXR+LULrENEwFricPsW sLnMAluZJM4uXsgGkhAWcJfY9uo0WAOLgKrEn/ZJ7CA2r4CrxNoJs5gg1slJ3DzXCXaHhMBb don757dC3eEi8fHNS1YIW1ji1fEt7BC2lMTL/jYoO19i6oWnQOdxANkVEst76iDC9hIHrswB CzMLaEqs36UPEZaVmHpqHdhaZgE+id7fT6BO4JXYMQ/GVpb48ncPC4QtKTHv2GWoCzwkFn89 ABYXEoiVmLL+L+sERtlZCBsWMDKuYpRMLSjOTU8tNi0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xi4JRqYDLul/r7Qyg5eWWqIGd17z61 Rt8Vn8J/vVcq3rPyF8PXZ6cfTFycwLX/+Q2++S//ak3eJ3WpdtX+7zercp34W7gK42pcdsxl /M10ka29sHjV2R38pn+/SGkWqAcnv2cMMtm1NrF+f/IHwXOvdRfPL3t4s8RsUeSxw0oRiRpu 6d3Busp/NR483N/Nuf3tqsauV9UPwkW+r/dZu1zozELVzDytPoXdVk8Wn4/lE15x0OvGUpkb phcmpNwt0fxix+R43+78vtJP+QuqDTuLI058SPe8O9sp9fOr6KMiYU+42p9wJLzri3l4M0FO 7w7L+3N3f8ZLbMhnkc2y3+9wXzfGpEB/jWLS+788gsdT/SNrniixFGckGmoxFxUnAgD2cGq3 uwIAAA== X-CMS-MailID: 20210106105019epcas5p377bdbff5cd9e14e5107ccbf2b87b5754 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210106105019epcas5p377bdbff5cd9e14e5107ccbf2b87b5754 References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The size parameter is unsigned long type which can accept size > 4GB. In that case, the upper limit address must be programmed. Add support to program the upper limit address and set INCREASE_REGION_SIZE in case size > 4GB. Signed-off-by: Shradha Todi --- v1: https://lkml.org/lkml/2020/12/20/187 v2: Addressed Rob's review comment and added PCI version check condition to avoid writing to reserved registers. drivers/pci/controller/dwc/pcie-designware.c | 9 +++++++-- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 74590c7..1d62ca9 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -290,12 +290,17 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, upper_32_bits(cpu_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT, lower_32_bits(cpu_addr + size - 1)); + if (pci->version >= 0x460A) + dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_LIMIT, + upper_32_bits(cpu_addr + size - 1)); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET, lower_32_bits(pci_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_TARGET, upper_32_bits(pci_addr)); - dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, type | - PCIE_ATU_FUNC_NUM(func_no)); + val = type | PCIE_ATU_FUNC_NUM(func_no); + val = ((upper_32_bits(size - 1)) && (pci->version >= 0x460A)) ? + val | PCIE_ATU_INCREASE_REGION_SIZE : val; + dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val); dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, PCIE_ATU_ENABLE); /* diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 8b905a2..7da79eb 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -102,6 +102,7 @@ #define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) #define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) #define PCIE_ATU_UPPER_TARGET 0x91C +#define PCIE_ATU_UPPER_LIMIT 0x924 #define PCIE_MISC_CONTROL_1_OFF 0x8BC #define PCIE_DBI_RO_WR_EN BIT(0) -- 2.7.4