Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp131423pxb; Tue, 2 Feb 2021 00:50:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcDj3Etx+Aazm7EEdPZqwgySPx9h5F8Q8ZlI+/T92LvAkr5jgq2ogOM4QdORHft15HGSXP X-Received: by 2002:a17:906:87c3:: with SMTP id zb3mr21621437ejb.244.1612255833205; Tue, 02 Feb 2021 00:50:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612255833; cv=none; d=google.com; s=arc-20160816; b=A/CgeaOb8I6qds08e10Wz6eOSu39N8BX4GothgWNX87L30rERrjoWq4RWLg5uz/hEf IQYEwEZohOh1aA//rP+qyxfl+hgG+wr/Op8kKm2y1sDuLQIKBIV/bvcdE8AQjuLykMyp 8z7A/2enh2DdlR+53C/cDYh7r/ycCaqijs/kFS1Zjsb+QK+Z/hc/GiXrpeGSNBiPZ5nB S8+Ev6u4QAubsSmJhyp2xRXDf+gzcqymrST9eY1bmVCQEeaoRVtZidoodcvLYRyptYwh TCwWStAh/fUbohce7q6z3TWEuFln24aCZssKoasaPZOM3uhg4/CUeSSqLe+Pxz7HOZru uqGw== 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=9ywKhdDTtBn3L2XcRNpTuOIXa0fWWZM7h+1A/Zcw8zE=; b=gCizMKOcUYJAgxs9BnBLFlYXtGABD2xh4IqYBDT3PL2e48NMt2fM8o0uDLvSDOcMVa yloUfhwZfN+nz7JxUiGovWSgC0L/xWAO3jjzjgzp70sHcG4UtGSqflldEH6KMqE7sqzG TdaS7v8e36aEYBrHTi60dL+G2eJDpnv8zaNebfJzgYUH3eqoM8OifaaDVru7ohujS+ux WjMECAU84M1oAd3gIhEt3Oo/u6aCF7thMySB3Jk8EnU5w0rdxXm8OQ1ruGleH0XLJtHT pvM6u3Ndv/W2Ir+na/Lq6+Vhs8c7VutcbYbSmmSSZOgd7qtj0wx/x9By7hIFEaxAeobW BDLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=C4Q2oIVg; 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 u7si12336558edx.172.2021.02.02.00.50.08; Tue, 02 Feb 2021 00:50:33 -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=C4Q2oIVg; 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 S232784AbhBBIsl (ORCPT + 99 others); Tue, 2 Feb 2021 03:48:41 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:46384 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbhBBIsg (ORCPT ); Tue, 2 Feb 2021 03:48:36 -0500 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210202084754epoutp04e10b5845f8097b37ed0b5c7a7990c11c~f4f5uZv7j0994509945epoutp04p for ; Tue, 2 Feb 2021 08:47:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210202084754epoutp04e10b5845f8097b37ed0b5c7a7990c11c~f4f5uZv7j0994509945epoutp04p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612255674; bh=9ywKhdDTtBn3L2XcRNpTuOIXa0fWWZM7h+1A/Zcw8zE=; h=From:To:Cc:Subject:Date:References:From; b=C4Q2oIVggb1eggSjWKwme1XJCWX8W2qr2Em5kkQ8oDKbB7P/sLmpWWgf1l3fhMxQ7 bWgLwQMPTJp5jKzlAsrN5KP5ARQ5U08KXnK318Q1H8S8/fnpOsbA3msQHcls6Ur5vb SMes/WJMjgqjg0Imi7ctRgWGTyyRmpePFy+urHEc= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210202084753epcas5p291ba80de4715cea02b809aea310fce1a~f4f4-cLhP2708227082epcas5p2b; Tue, 2 Feb 2021 08:47:53 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id AB.44.33964.9B119106; Tue, 2 Feb 2021 17:47:53 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210202072903epcas5p43dd06fede21ea3a31961b811507fb7f7~f3bDNF9Kd2209222092epcas5p4-; Tue, 2 Feb 2021 07:29:03 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210202072903epsmtrp16119f63f255121615ffa35fab9b34520~f3bDMTcWE2135921359epsmtrp1F; Tue, 2 Feb 2021 07:29:03 +0000 (GMT) X-AuditID: b6c32a4b-eb7ff700000184ac-c2-601911b9735a Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 43.4B.08745.E3FF8106; Tue, 2 Feb 2021 16:29:02 +0900 (KST) Received: from ubuntu.sa.corp.samsungelectronics.net (unknown [107.108.83.125]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210202072857epsmtip1242282d003a92d3e8521ab83acdf2b2d~f3a_fwgRZ0218902189epsmtip18; Tue, 2 Feb 2021 07:28:57 +0000 (GMT) From: Shradha Todi To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: bhelgaas@google.com, robh@kernel.org, lorenzo.pieralisi@arm.com, gustavo.pimentel@synopsys.com, jingoohan1@gmail.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 v3] PCI: dwc: Add upper limit address for outbound iATU Date: Tue, 2 Feb 2021 12:58:38 +0530 Message-Id: <1612250918-19610-1-git-send-email-shradha.t@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsWy7bCmlu5OQckEgwUTNCyWNGVY7LrbwW7x cdpKJosVX2ayW9x5foPR4vKuOWwWZ+cdZ7N48/sFu8WTKY9YLY5uDLZYtPULu8X/PTvYLXoP 11rcWM/uwOexZt4aRo+ds+6yeyzYVOqxaVUnm0ffllWMHlv2f2b0+LxJLoA9issmJTUnsyy1 SN8ugSvj3IJHbAXtQhWdt7ezNzCu5u9i5OSQEDCRWHygnbGLkYtDSGA3o8S0z9uZIZxPjBLP Ju1lA6kSEvjMKNH+RBWmY/q0TywQRbsYJXbuWgrV0cIkcX7uHFaQKjYBLYnGr13MILaIgLXE 4fYtbCBFzAJbmSQWvl/PCJIQFnCXuHsMwmYRUJW4s2QXmM0r4Cox5dpZdoh1chI3z3UyQ9gv 2SXuHYM63EVi051PTBC2sMSr41ug6qUkXva3Qdn5ElMvPAU6lQPIrpBY3lMHEbaXOHBlDliY WUBTYv0ufYiwrMTUU+vAJjIL8En0/n4CNZ1XYsc8GFtZ4svfPSwQtqTEvGOXWSGme0hMOOsC YgoJxEq0vNedwCg7C2H+AkbGVYySqQXFuempxaYFxnmp5XrFibnF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zIR+rZ4YqTLnl+hv//w pcYfmK8R0xjHbbvufbzJd/H/G8+cWxnyvvrL/Vufy473Flv9rDjIaFoeave/43zy7+MCjOue OnVbzt5hHbB69aIND5LzY6wfunQptNWyZWWF3JVnac75pSXp6s/7n0Pb/tPmfzcn+L86Ftu9 YMdpbo3Kw+qBSnq7p8gypG7aWWgqKfFI3e3U00z1Y3ltgUV6stKNFTpa6ukG6yMaMn0re3Wq q5gOyFck1As9/nB28RzWPgXugDirLn3lqxP25W8/ou/14dfNadvtwyXWV/w8p8Zuo/fvoMhb HiXV4ukVM79lNkTzf1mxftOHSb0Tb97KvLfVjLu0vavmha0SS3FGoqEWc1FxIgAgT5hnuQIA AA== X-CMS-MailID: 20210202072903epcas5p43dd06fede21ea3a31961b811507fb7f7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210202072903epcas5p43dd06fede21ea3a31961b811507fb7f7 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 Reviewed-by: Pankaj Dubey Reviewed-by: Rob Herring --- 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. v3: Rebased on pci/dwc branch drivers/pci/controller/dwc/pcie-designware.c | 5 +++++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index bfacdb3..dc23ece 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -332,11 +332,16 @@ 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)); val = type | PCIE_ATU_FUNC_NUM(func_no); + val = ((upper_32_bits(size - 1)) && (pci->version >= 0x460A)) ? + val | PCIE_ATU_INCREASE_REGION_SIZE : val; if (pci->version == 0x490A) val = dw_pcie_enable_ecrc(val); dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index d8d2e0a..7247c8b 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -100,6 +100,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