From nobody Fri Oct 3 16:44:21 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D858D2FFDC7 for ; Thu, 28 Aug 2025 07:35:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366519; cv=none; b=mu2kDIwr2z/SLgWHizsNTLTxvo55aqP2Yht/YdgAecrkkfXcVeptoTtYC9LA1Erf0pooAgFW2XZjy2zL1MH/z9SvNQpxHRo/q41XbEeM24ozWIXkXI1jQaRQonoe4pdaggl691pxsZ4tOlT8w3F1S4KZvZ9wx7XD02IDDNFig7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366519; c=relaxed/simple; bh=9CBfmxAvq02vasDOK9GiRt9O37eldSDYJzZR+Ih4/NI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qEeFYA2IzBQM1KeBHEKlmus9oWTrzAucQNjZuoFXmdS3BwAOcVt4LMHU/7W/Jyl8mOw9hI4i2QUcgO+03dmFb0Epul5CNufkjCqBpcUQx5kImWS1tOra0XgecfiRuBPHL7ZgRFL21AKdA8Zg5jMJHjwSgyuy2xqVDIlTZG5JZrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=J70s0CH2; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="J70s0CH2" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57S624KG023129 for ; Thu, 28 Aug 2025 07:35:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Q4BKfFv3tKNplKEqotWZto9ii2lZDoPptOc//ona8r4=; b=J70s0CH2TbZMWrFW ydx+0oxW43XJgqe/W7RSawzCCuzmBsxHuY9ofWx7OUCjOZcLmQruHDqpHIKNERda tkvdDXdPOOm7M3iToQRpGT6Qc9f2rFO6rpbnVGph6j+SOUZFw1HXHkz938x5Kdal MH+4ybo+lI0QVYyRF3AgdYsdUD/S+YsO5ey1suh5JtGg8/KzVDsbacGwltg8GH2c K9zAaeblzmPlhDcuIQ1OyqzRZ4ZoALcYh3OGWaGtfoahyQH7E57mJghJToROoFGA P8ToTB5EZGR14WgW1TSDTHB/Jy7SODE0WxIOrgHICnn1zj7A5aw1sGGpY0QtGD9O UsZCIw== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48q5y5q54h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 28 Aug 2025 07:35:16 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-b47174bdce2so552144a12.2 for ; Thu, 28 Aug 2025 00:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756366515; x=1756971315; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q4BKfFv3tKNplKEqotWZto9ii2lZDoPptOc//ona8r4=; b=ksto8xL/C91kZa5EEVH+xUIiDh4SXlq/N9B0xPHQexdrhGmjro2d6Er0FaYTrV2s/0 q/yl4UcSa30FKuJSfnCiM1xt0AMY2GFOiD8TRu8kNFvBX+jKgVl4sdIIqFRx6htSLxfX 8RPo+z4fVZjAsvtqzJprKgIH6+A40oESxGYIZM/IAJWvERtJpgNKOeX5VKGSLJagxys4 yVhpT/XnRRuUbGmlwc8CSBroLLCGv2DdMwqX/0xcsemDKNERZmgiXmbKELUERIP7pF67 fagzRjfbmmUuf1ra/xiuFKmYqmLma3KYokKXCsHilgT8kThChoRXANt78kUBJUKrj3Ru w6Gg== X-Forwarded-Encrypted: i=1; AJvYcCVzw/66Lg7/3cXuP3aalI4a9xQqmupGayeewwPc1n+0JETd8C0Vv/O6PFM3u4NIC8/Qx7WFw/HyCDdYTqM=@vger.kernel.org X-Gm-Message-State: AOJu0YzN4gjDOceXWFytP5322JGEdNk1r9fADWvUQSgo1TBFhryqmWfd LvLXblkVWh8putBfLcqU2+Bi9hQz6COf2Twvwe2plK8SeGCR18GLsejU/c2cXhs/SMTBnxlA5Ou cLu+itvg5RZ0OrfoYPKEDyMcqwElNYUWcwdNDFC9HXlrBx60Xqd5i+kIfy/Aedx9xeGg= X-Gm-Gg: ASbGncsKUAOBjrYZiThHpjeVtd9nCjKKRV6LubnH+ybrQoITwW2kEcDVWgtlnRUAWuY A75zbWmin/URm329ho7MZP2JoebJOMasbC5r6w349KwpLjU1QswTp/c+ERLzZ6DvYiUa11r1UTj b9VwO/3u0WxSLrf4juj9Wv+0o3iE8ipG2g7TH1I5+h/uHgy42Cxcip9BfTV+BWrs6EqrV/cTqHB PNS/zyURSvDJsrhzpDi6V+QT0JmZdNpNEUNHB7p6INpMDw2IEWzV1gZ4dzg6caI7F9KPTqE7Gf7 OwCkHHcfcGM1Y870KbSqncRn7AQ6HgiIqyFfpyaHSHlagnN8J5nuV1hfXqV6pYvQkSSghtlafWY = X-Received: by 2002:a05:6a20:9148:b0:243:b38b:ebaa with SMTP id adf61e73a8af0-243b38bee66mr703703637.18.1756366515322; Thu, 28 Aug 2025 00:35:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEepxGLjZzmncLdDY7xaRKWaGRZvSK+T4t0mXkK1dDoy3G3QR1FaJMRplw1MYwIE797osj++w== X-Received: by 2002:a05:6a20:9148:b0:243:b38b:ebaa with SMTP id adf61e73a8af0-243b38bee66mr703671637.18.1756366514840; Thu, 28 Aug 2025 00:35:14 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4b77dc7614sm9605810a12.8.2025.08.28.00.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 00:35:14 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 28 Aug 2025 13:04:22 +0530 Subject: [PATCH v8 1/5] arm64: dts: qcom: sc7280: Increase config size to 256MB for ECAM feature Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250828-ecam_v4-v8-1-92a30e0fa02d@oss.qualcomm.com> References: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> In-Reply-To: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , Manivannan Sadhasivam , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jingoo Han Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, quic_vpernami@quicinc.com, mmareddy@quicinc.com, Krishna Chaitanya Chundru , Konrad Dybcio , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756366503; l=2217; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=9CBfmxAvq02vasDOK9GiRt9O37eldSDYJzZR+Ih4/NI=; b=D5t8rDZHiDMSu6zuQdZirT2Ko83CIgI4U8MZmO/xjF/Q87QzUXtZ3tgFS3hrfPpRPi5x+ANxe 03+8XcT5J3YD9UhlC41r05kOwjPOLNJDsX874lcVMthp4GTE4zWFR/o X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIzMDAzMyBTYWx0ZWRfX6wIM2cEqaSzA tJc36JpReZKJE+waivgDZYXH5xp1FTJBu/AATPok83NljPFtVtTJGmGjFG3vkUEsL6NyztWYNTn zMh+XMruz2Hp4XYy13T/6RWr19K0D+uBp+E1Czm26/rAG2J7ksSWeT5qFMlkx0GSEJ3PHQomV5w CYEJmAk0y4mGvIcmj4Fzwwh+OTu1OHBzpkHqb8zu1BnpFxDxeIgvwZ6A9AZgMve1S7wTrhMvlri SXXxAz2/E7+JhW0+wlVM+oSM8jQQn93gnmYLxar7zXSGsTXit0faMKLzfZNGGEkoFqXoaMMoBis IpDeSXtE+4J84usyjfzvl+bTxDRm5ZUFksNk5m1utTMZji/jhoxdyGPi4ys49sZ6IxKmIoGygmy UwetHTA1 X-Authority-Analysis: v=2.4 cv=Lco86ifi c=1 sm=1 tr=0 ts=68b006b4 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=bvY3E1ByFFb03tV5gjAA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: -HhVKFw9RtD9Bt0Kg-di0qMDHRdASkk7 X-Proofpoint-ORIG-GUID: -HhVKFw9RtD9Bt0Kg-di0qMDHRdASkk7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-28_02,2025-08-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 clxscore=1015 malwarescore=0 spamscore=0 suspectscore=0 phishscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508230033 PCIe ECAM(Enhanced Configuration Access Mechanism) feature requires maximum of 256MB configuration space. To enable this feature increase configuration space size to 256MB. If the config space is increased, the BAR space needs to be truncated as it resides in the same location. To avoid the bar space truncation move config space, DBI, ELBI, iATU to upper PCIe region and use lower PCIe iregion entirely for BAR region. This depends on the commit: '10ba0854c5e6 ("PCI: qcom: Disable mirroring of DBI and iATU register space in BAR region")' Reviewed-by: Manivannan Sadhasivam Reviewed-by: Konrad Dybcio Signed-off-by: Krishna Chaitanya Chundru --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 64a2abd3010018e94eb50c534a509d6b4cf2473b..36afeb2e45937f8ad301c55caf2= 96babdb499820 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2202,11 +2202,11 @@ wifi: wifi@17a10040 { =20 pcie1: pcie@1c08000 { compatible =3D "qcom,pcie-sc7280"; - reg =3D <0 0x01c08000 0 0x3000>, - <0 0x40000000 0 0xf1d>, - <0 0x40000f20 0 0xa8>, - <0 0x40001000 0 0x1000>, - <0 0x40100000 0 0x100000>; + reg =3D <0x0 0x01c08000 0 0x3000>, + <0x4 0x10001000 0 0xf1d>, + <0x4 0x10001f20 0 0xa8>, + <0x4 0x10000000 0 0x1000>, + <0x4 0x00000000 0 0x10000000>; =20 reg-names =3D "parf", "dbi", "elbi", "atu", "config"; device_type =3D "pci"; @@ -2217,8 +2217,8 @@ pcie1: pcie@1c08000 { #address-cells =3D <3>; #size-cells =3D <2>; =20 - ranges =3D <0x01000000 0x0 0x00000000 0x0 0x40200000 0x0 0x100000>, - <0x02000000 0x0 0x40300000 0x0 0x40300000 0x0 0x1fd00000>; + ranges =3D <0x01000000 0x0 0x00000000 0x0 0x40000000 0x0 0x100000>, + <0x02000000 0x0 0x40100000 0x0 0x40100000 0x0 0x1ff00000>; =20 interrupts =3D , , --=20 2.34.1 From nobody Fri Oct 3 16:44:21 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 876312FFDFB for ; Thu, 28 Aug 2025 07:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366524; cv=none; b=Da6PzRSvTKkzlaZNLXP4IGuWrkGrQLUvFugqRAwFvdfGe48w4AkywEAmua2NuJ95Ox5xy6OWAHjo3RvHJfdA79qRgYtRfSTaybIAinASRBURAOWAftk6x2UPT0aGtbzN1hnTJjeOIe2hkJEn/nN3VdpdZ7+rKNdaqW6l4iFsJj8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366524; c=relaxed/simple; bh=baBIAb49MxduM5gBqS+AIR83kaKzbO1n1WU9xKYWh0E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CIWls/XVfmq+GgD71bo6kiA/ucY83okl8VtZgRcLx+rC+U+voEeW+2Z2IJyGvmL6co9mpm2y4Bdu9U9H64w/N7RFQwFaSbJEgDFtW7+EnEaOJ9Ec/kDj4BrvDixNQ+4PAPrK2yBSJKv2HEJAIfPqQ1uXDiQH+zJy0X11wL/0Ys0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=JgKGsMVc; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="JgKGsMVc" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57S61hCS009458 for ; Thu, 28 Aug 2025 07:35:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Bcw8SVGU6KozHp+cFpIEECdCat+/J3psNgrGaj/N3wI=; b=JgKGsMVcsoSjqt6w eGpxCkbhBYgUxsiCAIlCDC9RdFYiiIKd2k8it/QJlcvCpPKx9GD67wpJEK85JFUh jeHYL0msL+Y+Yq4kf4YX4W5NhC/QEIO2tO+AnyVSLb6iEU5FnSBiYxm7qFrKXWo4 hg6ksQKifCl8qzAkcjYINNX7mJ+V7PrwmnyYqIULegGZT2jed5EuLQS1kJSiZl1q M9fvfNovHXxO8tbHJxgAWf6pPeuhe39ZLSs2wl/+jMYj8+vlyyf2Rl87Vu8PWmSy IBP+HIr0u79k72s32KQgEUjiJ2S8Kfmvm2VeW/iKgKFoiTmIEzK4adxmphtHHAAz SV7oZA== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48sh8anm2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 28 Aug 2025 07:35:21 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-771e4a8b533so667123b3a.3 for ; Thu, 28 Aug 2025 00:35:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756366521; x=1756971321; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bcw8SVGU6KozHp+cFpIEECdCat+/J3psNgrGaj/N3wI=; b=GPnOgUvB+AtmV+YVs2XdkPbjqmnmYlLEYB8dG1BY14NzO+KvKX3xHNUqY14SlDWpuE DkS0PX/elxVr2t5oDl16kwZ/uHv8hROY471tOcmo8JjyEAqWTbCQ79afGSx/Z73Lp39g edQzKj10q4bs8yVgk9TllU3Xcjv4pxlVdVnRmwq8O5IjXemylmGU839dpq7l87Wsms/h wb5LRmJS2OOrRZ/wqsiTxDkVqls3VTSB20McqX0fj2B436f3yo4ikPKma66sWukZQbpv e0YcLlRBSzo9da4rDt5NYH/4cgQvqnS1VPftFd11xGNNlBden1swWZaA8+/sYRWoI082 qtHw== X-Forwarded-Encrypted: i=1; AJvYcCX9Si7EX9HFB+edEUrCtFUEORstP6ciqbmsVzQ9ZKMvQ3T73jXkUpMVPnYpbr0bkWoUJXzwBg/+ow1NxPo=@vger.kernel.org X-Gm-Message-State: AOJu0YxMrhFChp2UxhKWCJ/QTo/1+kEE0NswhxTENIFovsxoXp8zvBvD 0/4A7TIhFksjEAvjswSR0bb1t8C+HbfQWB9mUp1QoQwkiVApkygEwnMxImKWk2GELJF6SfogtCc DHgfzZVjLns7PHa/7FdYo/pHTUS22cxER4OKJlFeUb1+yWJAJAo9Lxuj0vehJZ7/AAys= X-Gm-Gg: ASbGncuvBoNZAxrNwO6jG1CQsMNyY/yenN3gxeF1mqCmHVTVVAJgS0sX27VYqhZoq+b 3un1WLmFeq4Vcqvd3zCltVSLrHiTQL3KBA8xfivh6wB1QCBs6H0XYeOqqdVX+wYC2yz5oaEk3AF cNTFfSc36BPBdrwYBkaxWRx3+6iunGs6MCcb7IKVhP0vUENkOpuwpwTlHuOU7xZu+VPyXeDvYSR c+NcZNj1nhZWQ7l8PfU6YvIcamCYw5HM3FB6jcuECU1P2XS9gx8tXiaswoHGlP5U/gaqt0i13gl ioTWAIaYRJVaU2kh2LvWNTT4jvhhaAZtMDMax0kCTbVPPSnfL2WRV8S/cC+dCogHQtIVHpCH2P0 = X-Received: by 2002:a05:6a20:734f:b0:231:acae:1977 with SMTP id adf61e73a8af0-24340c0faebmr33056230637.15.1756366520740; Thu, 28 Aug 2025 00:35:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGqKf6x0p+HRSdaIY6VwavENLliL5CVF/xXooan6+Zly5ChHdt0Lk95GVnS8O6Q9shJv13Mg== X-Received: by 2002:a05:6a20:734f:b0:231:acae:1977 with SMTP id adf61e73a8af0-24340c0faebmr33056182637.15.1756366520161; Thu, 28 Aug 2025 00:35:20 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4b77dc7614sm9605810a12.8.2025.08.28.00.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 00:35:19 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 28 Aug 2025 13:04:23 +0530 Subject: [PATCH v8 2/5] PCI: dwc: Add support for ELBI resource mapping Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250828-ecam_v4-v8-2-92a30e0fa02d@oss.qualcomm.com> References: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> In-Reply-To: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , Manivannan Sadhasivam , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jingoo Han Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, quic_vpernami@quicinc.com, mmareddy@quicinc.com, Krishna Chaitanya Chundru , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756366503; l=2000; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=baBIAb49MxduM5gBqS+AIR83kaKzbO1n1WU9xKYWh0E=; b=TKihAuNriez516iIXhX4LKVsLszp633LecGCi3r7p+3DZsS8S3yGRL0vmif4gG0HB2Cbd/Ayp Mv9FClckxhoCMfa+fjCqGFHUneHYfQz7l1ad80gl8dbYFoM/k97AAr4 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=cLDgskeN c=1 sm=1 tr=0 ts=68b006b9 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=De8H20xVS9kR4mXr8yMA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODI2MDE1MyBTYWx0ZWRfX/1jnh9Q9U3Ze pAYxj7cSL4mv3gj4Y+zVwj7jbbUWyt2RYHfhZpJapUUEiOuyTGvFK0xrcdnGAr0YdfDLNgFawiw RgZ7KR7TrQVD8Bl43phm+JRepVSMBO99BdlDuolt3+PC2qtyfbW39qLtIVFcQHri/aRCZwpOCdJ B5WsXBpoY6I/M5+KWUbnorGdBs+N4rdwXvhHmP2Aq2chu39RSJOa8p1DmYA5iizA6lfSsGkXLMe QWzq4jXBJ2R5bgORp3/j9H88AxZ7hanHHQFFwoR9Mps+kW07+zPJqA/ykkOR1PKSk93lIOTGNi/ lzy8IiMIZhwYW4jqem6d5jz8hT+4GuTZKmf5W32ZRi+oIz0655s6eqiiGOqixS52vv27PdvqE1+ kLoguSqJ X-Proofpoint-GUID: VmvXAm3hxaQQmPoXLnTLOP4Zk2PvVXad X-Proofpoint-ORIG-GUID: VmvXAm3hxaQQmPoXLnTLOP4Zk2PvVXad X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-28_02,2025-08-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 malwarescore=0 spamscore=0 adultscore=0 impostorscore=0 suspectscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508260153 External Local Bus Interface(ELBI) registers are optional registers in DWC IPs having vendor specific registers. Since ELBI register space is applicable for all DWC based controllers, move the resource get code to DWC core and make it optional. Suggested-by: Manivannan Sadhasivam Reviewed-by: Manivannan Sadhasivam Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware.c | 9 +++++++++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 89aad5a08928cc29870ab258d33bee9ff8f83143..4684c671a81bee468f686a83cc9= 92433b38af59d 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -167,6 +167,15 @@ int dw_pcie_get_resources(struct dw_pcie *pci) } } =20 + if (!pci->elbi_base) { + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "elbi"); + if (res) { + pci->elbi_base =3D devm_ioremap_resource(pci->dev, res); + if (IS_ERR(pci->elbi_base)) + return PTR_ERR(pci->elbi_base); + } + } + /* LLDD is supposed to manually switch the clocks and resets state */ if (dw_pcie_cap_is(pci, REQ_RES)) { ret =3D dw_pcie_get_clocks(pci); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 00f52d472dcdd794013a865ad6c4c7cc251edb48..ceb022506c3191cd8fe58041152= 6e20cc3758fed 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -492,6 +492,7 @@ struct dw_pcie { resource_size_t dbi_phys_addr; void __iomem *dbi_base2; void __iomem *atu_base; + void __iomem *elbi_base; resource_size_t atu_phys_addr; size_t atu_size; resource_size_t parent_bus_offset; --=20 2.34.1 From nobody Fri Oct 3 16:44:21 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC4323009F0 for ; Thu, 28 Aug 2025 07:35:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366530; cv=none; b=CmDLr3Bq388FPwJoTactaV3Qa1Lfb3Ab55SktI/On9Rg4I55vaU/KW5OxSy7mcPydk0xgepNzlsuDecBLvXnNXcSh02sOFFglIhaFTTNicjHFsoxvVwvR2LrJIAxfBjqMQDJC7If6Ax2a10fn2Y6KN2KxnX1lCejx6q2iWtf6+M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366530; c=relaxed/simple; bh=KBp6nSRvIcRzTpSQhn0xmjkXEw3wCkCaBQEeNdgizT0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oyRUGcMeIhhLdrcORPivBmlUUevbsSTkFnAazW/YoMtXfqJD7qo1ELierwFXd3H+6mLsWssgFRENsFknQdP0BsEhpr+BWduKVk12xOX4xHphJgZja+Go2GpE8pOpi+ow2THTr0n1KSh7BnwDJsIDi3RiDrk8bBT/6Gojt7uinhw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=gdFsJQGq; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="gdFsJQGq" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57S6547a015828 for ; Thu, 28 Aug 2025 07:35:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= WJK4jm7RiyIMS3SdVA3437OyfLU1Kx1wG7QYMtyssFY=; b=gdFsJQGqYz55xKds CDh/O1YqTzzh99grZt3qs0FAgX+aiYMIEraOuCHZQjnO17+x7jTZy/NrywqSsJKf Me+JTyt44f55pAeqKbSAPMp2tbxpN4zGEfr93+ssRlBbVMI1KocloPE79HUnbjr+ lGc9BXFiEo74tqRjj/5Y7hccztxSyg9wAPfS+bdEzqObvUTa3H6mZkHhEsC9Tyg8 uj6agE1JbCskozaCOWBxtt67tsYv4SACJgjJ8X5LMCZc2TQRabJ3vHAkAJicfXIF /V9yAWuBF5lgKKOflKOxtl6djEk5C9FwGZYXjEXbseZ1oHZoS/s7ylEZHKKr8DSH ah+rtw== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48rtpf1npv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 28 Aug 2025 07:35:27 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b49d8b818d2so916370a12.3 for ; Thu, 28 Aug 2025 00:35:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756366526; x=1756971326; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WJK4jm7RiyIMS3SdVA3437OyfLU1Kx1wG7QYMtyssFY=; b=PAKnDVdVFV6P1k2OsfDo95IAikbM8TEOT7zu0/lO96Bh89LEF9cp23L5znzzxtHbsg 23YJvoKaBRtuXw2lnIiSr/0nboI3fzB1YFGA1lv37C4qFdNwBzqZMVUYZkM/oHA7Vq3Q ZQKTkw6jVAqV+B6InEhNSsY741hFUAHb2ufhwrCuR+xcijl1a3d8b9txeOD0D7JaaoKu fifPUaR/eO6YEvbpw0QvCZgRBM6r98tz56U482jxMl19C//rM/3rAmJAtrTN9UIA1xiR HWjitBIj6sNwq4aK/c4nO6WK6ORKglFffvV2a+Vt47cNYlCw1POjo6n7m9tqXcAHsSQu +Wtg== X-Forwarded-Encrypted: i=1; AJvYcCUI4tbnRLsSGVDWSSS8eaG4hJge0KbIVz9lUUll6udF2R1wLkli+Insa+YMeKp1iE8ZMHrjSKgXgiutJjU=@vger.kernel.org X-Gm-Message-State: AOJu0YxRd9GAhzvM/0QLQ9d7oLJdVrxYEmKlKR5a/vPfA+R67U4OBloc 0IUzm7yDTPnci3Vh578sNfyJk7HoKL96ojMfVGfQGfPS3gCIdWlr7fTtsnunkpumTJ9omQlpGVx lmgpTIqRA8rASQnqsiktgRju+UzzdiD59FSyPk2HXXa8JJ40C1loKLnoUaRe3ZhA4/2k= X-Gm-Gg: ASbGncs9q92T/8cJKzQKW1wU/mboxlOh1Ou0EjMvgdTAfzBk0/EJvPwYewdfOQiatay NJFSl8XUCHufvhRDajimPO3kPTiSvSe9kKqv7TSJuxQCQG0xkLszLc9qwnUG7dQFbYGF2k/wNB5 tT74sYF7AWcyUAa/ZKVqu7LuY79fLC9XGfWGLN1+C8GrPIpMl+bKGA1P5/g9sgir0F8rGrZgiGc FRlRugeeHde3NxP8NBb1Ob0CAWnKULzumOGyBsSSx3NoCtto+GQnLlVvQulwVtgBPsJ9XMokhNB JDBNPBkDg1Fou8DpGeUgDHU71ULq1rmeF4kjEjF0eTWz0GsYgN7fo9xkySqjQ8vnea6a18++Fug = X-Received: by 2002:a05:6a21:99a5:b0:243:a05d:7aae with SMTP id adf61e73a8af0-243a05d865emr7069722637.43.1756366526202; Thu, 28 Aug 2025 00:35:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEoFuJglFABJuxVf4orjreJLtLa4Oys5F+mE17UzaMHIHMwekOoVe1507tRqq6Fvj9qvtHSw== X-Received: by 2002:a05:6a21:99a5:b0:243:a05d:7aae with SMTP id adf61e73a8af0-243a05d865emr7069681637.43.1756366525677; Thu, 28 Aug 2025 00:35:25 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4b77dc7614sm9605810a12.8.2025.08.28.00.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 00:35:25 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 28 Aug 2025 13:04:24 +0530 Subject: [PATCH v8 3/5] PCI: dwc: qcom: Switch to dwc ELBI resource mapping Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250828-ecam_v4-v8-3-92a30e0fa02d@oss.qualcomm.com> References: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> In-Reply-To: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , Manivannan Sadhasivam , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jingoo Han Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, quic_vpernami@quicinc.com, mmareddy@quicinc.com, Krishna Chaitanya Chundru , Konrad Dybcio , Manivannan Sadhasivam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756366503; l=1995; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=KBp6nSRvIcRzTpSQhn0xmjkXEw3wCkCaBQEeNdgizT0=; b=oNV0PxO/r7YhMLERiBsCRDsXhtCB4hqyzujBvtZI4waA9lAZMe/RlJVDQFVqejVxU9MxfVrdZ t1pV5VoAoE7BTWts4EGqxE7hXlWO+5yOsh+8ziCrYnGV4mE6wHMf07x X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: cROVcVlA4jcsZyIWa_0-ihlLNw2f_r6U X-Proofpoint-ORIG-GUID: cROVcVlA4jcsZyIWa_0-ihlLNw2f_r6U X-Authority-Analysis: v=2.4 cv=Hd8UTjE8 c=1 sm=1 tr=0 ts=68b006bf cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=KKAkSRfTAAAA:8 a=EUspDBNiAAAA:8 a=Py5lcOcq67Lbq8UMOfUA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODI1MDE0MiBTYWx0ZWRfX6EUKML7Ep3WW mmHTFVrF2jEtiH7JmfMutUiZfQ8C6PWiu2Nntu+o/KY8oeYaS29EcQCIRdl7PDjz6innYtfFP2d 6/fN1IcAKcHq2UVL2XJVLNr8KwDd55fAWMFVdk0Ysq14HZZkjXdbMcrDCfIh3S8FKXVykAMWTH2 Psumy39427gRrIxsW554Wv2rEEMZcxnsk/PO3Tze4Ydo70qpGyPXxnjLg6pptS+8TFqqOFKmZNY ZOAFZjNaZWu4lfTbSK0BX4jkvJ/MGwC2vU9baCst4e4iu70zLlwE1oxDI1KxJFG+G1ykn8q/+k+ MZ3hThqIOlp/TCQwjBMrFCtKLkQSv1DZK6/Lg8I6b7I1g/FqkpBlV3pIOA0ljK6dko+C5ywf/aD MCZQF3tL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-28_02,2025-08-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508250142 Instead of using qcom ELBI resources mapping let the DWC core map it ELBI is DWC specific. Reviewed-by: Manivannan Sadhasivam Reviewed-by: Konrad Dybcio Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 294babe1816e4d0c2b2343fe22d89af72afcd6cd..5092752de23866ef95036bb3f8f= ae9bb06e8ea1e 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -276,7 +276,6 @@ struct qcom_pcie_port { struct qcom_pcie { struct dw_pcie *pci; void __iomem *parf; /* DT parf */ - void __iomem *elbi; /* DT elbi */ void __iomem *mhi; union qcom_pcie_resources res; struct phy *phy; @@ -414,12 +413,17 @@ static void qcom_pcie_configure_dbi_atu_base(struct q= com_pcie *pcie) =20 static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie) { + struct dw_pcie *pci =3D pcie->pci; u32 val; =20 + if (!pci->elbi_base) { + dev_err(pci->dev, "ELBI is not present\n"); + return; + } /* enable link training */ - val =3D readl(pcie->elbi + ELBI_SYS_CTRL); + val =3D readl(pci->elbi_base + ELBI_SYS_CTRL); val |=3D ELBI_SYS_CTRL_LT_ENABLE; - writel(val, pcie->elbi + ELBI_SYS_CTRL); + writel(val, pci->elbi_base + ELBI_SYS_CTRL); } =20 static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) @@ -1861,12 +1865,6 @@ static int qcom_pcie_probe(struct platform_device *p= dev) goto err_pm_runtime_put; } =20 - pcie->elbi =3D devm_platform_ioremap_resource_byname(pdev, "elbi"); - if (IS_ERR(pcie->elbi)) { - ret =3D PTR_ERR(pcie->elbi); - goto err_pm_runtime_put; - } - /* MHI region is optional */ res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "mhi"); if (res) { --=20 2.34.1 From nobody Fri Oct 3 16:44:21 2025 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DEDB302CC3 for ; Thu, 28 Aug 2025 07:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366535; cv=none; b=B8hhF7/hOex2VET1nFLQbRoQk8v8ztdaReLxoQk3zjpmLu5lEs9InETR79WPi3johse/ba8VpTZekYCQr5dU5/HMHI+wIEpTsCe7S07qD84S89Y1G0BQ41YbPTwr2VKuPh/LuEAj6J7jAHjKx71vzdGGpiO6Nb8W22EHgEZgHiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366535; c=relaxed/simple; bh=RhlPWZq6Ql42bTovAKhXMpPmIjKZlHY5zh7e1V0AKB4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gvYBql6xNmPX2STlgl2Gn1rPdDmpK9/3u/mdDzqnNik2yQS1AORMPJ1XiYdhQ6bCTMV+FV0Fbbmqk1iQlf/5GmN7fysFaiNHhLrfbpfKfcgL8x9FsZodAOhLlaKW03pidQmvxPD6UDfs0xKUuWTq4jAd9Oj7CE+AnbTeHLeDBMg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=E5krZRSO; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="E5krZRSO" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57S5o3PV031830 for ; Thu, 28 Aug 2025 07:35:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= i2hv8zySTFskMihifTLDMmKmlG/86gfnPpzETLZ1VDU=; b=E5krZRSOCemZO2SL bD4m7JuCKj+g4P++BbzSIk7avgl1EPyfJzCD02K653Sk1EMePTsdMauZEN0KawT7 LvEkxdj63WgD9cTRUpL8jvwCo+bEjiwKpBJKxM8nAjUw+KqG3th3JJfqEE82XN85 +4kY8e6ZJOJfce6A7CcE83oh60D/9AOk7O8e9pGsd3JUZQLuBdcPhJxVD8+zOCcl rU6EAdfHnbvBDdbhh3jLhhou6x83CpO/iOQSEiVydkc6gEF/BZtEmZEZm+mN3s1t m8UR2CN7fUyoodikSJNILVPJkG9tDspj9yMLvePIrTHbfrpx8J9DMgLvpVt94n8H 9fghAw== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48q5xpyhy2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 28 Aug 2025 07:35:32 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-77220823fefso61172b3a.0 for ; Thu, 28 Aug 2025 00:35:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756366532; x=1756971332; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i2hv8zySTFskMihifTLDMmKmlG/86gfnPpzETLZ1VDU=; b=vDjX7DQ/Zx6nyWEKgxesInUEqzS7PSD8n4vwyPf2Nhl+Ugof0kucS2Z9Y28KVV73UU 5O4QWuzXwfOpuWT56TB3VxECbKSQIodeSaQoGJOMBRnikeo2YnSq3WB2tJyHJSpHdiwF Oj3A5PHc8F34BsHAkwEJedhvUi0nOS3Vx5KGonsCPt4jZRYL9a495XezMMLSTGRQSuGZ 1hFOCjvwyqwIQZKjGD5ReCXbRqVaUWXtVYmrO5C2WA05z11QYlBMeYAHeF3ipP6BDkJV F4Nl/c1TUx2q9muhNI/pIV2qCibDS+V2ZFvbvxaVsqXpOLkburdo732mJDpiQ+kHz+Fq L1cQ== X-Forwarded-Encrypted: i=1; AJvYcCVS3YX7B1FZvW4yfI7xgR4ayi0QWLrc8SyN1TyfzYU90f9TMAUMTt6iNGnBzfTYit9ROjuvJei1r0c/Bn8=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9mXMb2CKbaYEGTuNfZgbVE2tk8mNQ08W3OW/BCzKNMpBS6yd8 Yomc4vc0WSj88Xg2wcljptIe85TB46RIba4JuRdNbgZd5jyZFiGwyuq6nzkNclP+0tMtKdXKPuS 75Wfc34kzF+yYreiaM/pC8xSVyJlDoSr+iJOsRpqMcRGulT/2ynIepanhyunpJ4ugvAo= X-Gm-Gg: ASbGncv4RgV4tQPQgJwA+sp2WEfV83hxaE2nNslERLJPDiKuerabI5fEdulWk6uLUUA IcPaxKS3mDp2ZMz8fwdtFpCaRRlWw+MvDaedTIbUo0umL/W+dLLqHaA9RFHQQp/eqQ3z0JMO8EB ALT3hnFbhHX/5lAih70K0u6VijOg6EQMOzcKapu90ArqNQyw0BA6NUhNBC0IgtSbe8MltavyVe0 fs/oXzZ17r0LTLHbYkDhbt9q2VdJaPFzipRiUG9xGOLXVrfO2cuIZPokCTc4iHAVxfif8PYp0Lo WNbXvlSWICVMqDbFJ3Le0o0qW7XIANemagu9U7u8srT5fm4TKF34fCPV5XQOWbs9rr822/qV/MM = X-Received: by 2002:a05:6a20:9148:b0:243:af83:6c75 with SMTP id adf61e73a8af0-243af8371abmr1702359637.28.1756366531586; Thu, 28 Aug 2025 00:35:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETTLCkOG5SjGj9E9sbiq93kMShGujzEjgOgexU71zwzEtZKGXgxOlHgQ/zYh9bM+s+JD7PIQ== X-Received: by 2002:a05:6a20:9148:b0:243:af83:6c75 with SMTP id adf61e73a8af0-243af8371abmr1702301637.28.1756366530988; Thu, 28 Aug 2025 00:35:30 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4b77dc7614sm9605810a12.8.2025.08.28.00.35.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 00:35:30 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 28 Aug 2025 13:04:25 +0530 Subject: [PATCH v8 4/5] PCI: dwc: Add ECAM support with iATU configuration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250828-ecam_v4-v8-4-92a30e0fa02d@oss.qualcomm.com> References: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> In-Reply-To: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , Manivannan Sadhasivam , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jingoo Han Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, quic_vpernami@quicinc.com, mmareddy@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756366503; l=10695; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=RhlPWZq6Ql42bTovAKhXMpPmIjKZlHY5zh7e1V0AKB4=; b=dI7n/6t0fzkt/58hBSLjEl7uElcepU6I8uZEY4d9z+6iLh7bsWVsdQnyJEwiSNJhR+f3bL6Yr x3YxMlm2FQlCzGltbKH1poDEzd5sKXsyOgbEVgcB/geOPtQE8H4NnfU X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Authority-Analysis: v=2.4 cv=KOlaDEFo c=1 sm=1 tr=0 ts=68b006c4 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=EUspDBNiAAAA:8 a=hD80L64hAAAA:8 a=XZV-MPuiRh-Ah259ym0A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-GUID: GEkwdU49C3H0YGKXBGFeyrdG464x_uuq X-Proofpoint-ORIG-GUID: GEkwdU49C3H0YGKXBGFeyrdG464x_uuq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIzMDAzMyBTYWx0ZWRfX1vJgc3vCZk9+ WIpNq9BMIWhgyYODHRhPAoRm2hy4YMxEiC9trdra8Wvs72LQzqdUDixaBiFt2/VV0qTiQjiyKsk +eiFwtsDb0NoJ7E3RS4dnatQypMmyXOHhFgILVrbqkoF9QRjw7FQs3GKSkqPQtQFR3CT0Gf3ezq DirXQUKUHB0PZZ+wfyxoR8A5kr/EnggOzxynDPiS1XKpdoBnGV5DY/C2Ci8omQG5kRu2xrEw/at lo8EPnszL58NxukwuCm1MHIJ1311EIyAgLmWdPqoMF75tiWWC4nRDr17b3Aawew5hMuxFIsXUOh a9/T3H67WTYI198/ClDyvEDgX25g7kPh9DHfX0M2A9YtZVoGm63h0y3tUdX4bBhYeGl412scIfW 9VXIqQdo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-28_02,2025-08-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 bulkscore=0 adultscore=0 phishscore=0 impostorscore=0 spamscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508230033 The current implementation requires iATU for every configuration space access which increases latency & cpu utilization. Designware databook 5.20a, section 3.10.10.3 says about CFG Shift Feature, which shifts/maps the BDF (bits [31:16] of the third header DWORD, which would be matched against the Base and Limit addresses) of the incoming CfgRd0/CfgWr0 down to bits[27:12]of the translated address. Configuring iATU in config shift feature enables ECAM feature to access the config space, which avoids iATU configuration for every config access. Add "ctrl2" into struct dw_pcie_ob_atu_cfg to enable config shift feature. As DBI comes under config space, this avoids remapping of DBI space separately. Instead, it uses the mapped config space address returned from ECAM initialization. Change the order of dw_pcie_get_resources() execution to achieve this. Enable the ECAM feature if the config space size is equal to size required to represent number of buses in the bus range property. As per PCIe spec 6, sec 7.2.2 the memory should be aligned to 256MB for ECAM. The synopsys iATU also uses bits [27:12] to form BDF, so the base address must be 256MB aligned. Add a check to ensure the configuration space base address is 256MB aligned before enabling ECAM. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/Kconfig | 1 + drivers/pci/controller/dwc/pcie-designware-host.c | 145 ++++++++++++++++++= +--- drivers/pci/controller/dwc/pcie-designware.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 5 + 4 files changed, 138 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dw= c/Kconfig index ff6b6d9e18ecfa44273e87931551f9e63fbe3cba..a0e7ad3fb5afec63b0f919732a5= 0147229623186 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -20,6 +20,7 @@ config PCIE_DW_HOST bool select PCIE_DW select IRQ_MSI_LIB + select PCI_HOST_COMMON =20 config PCIE_DW_EP bool diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 952f8594b501254d2b2de5d5e056e16d2aa8d4b7..eda7affcdcb2075d07ba6eeab70= e41b6548a4b18 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -8,6 +8,7 @@ * Author: Jingoo Han */ =20 +#include #include #include #include @@ -32,6 +33,8 @@ static struct pci_ops dw_child_pcie_ops; MSI_FLAG_PCI_MSIX | \ MSI_GENERIC_FLAGS_MASK) =20 +#define IS_256MB_ALIGNED(x) IS_ALIGNED(x, SZ_256M) + static const struct msi_parent_ops dw_pcie_msi_parent_ops =3D { .required_flags =3D DW_PCIE_MSI_FLAGS_REQUIRED, .supported_flags =3D DW_PCIE_MSI_FLAGS_SUPPORTED, @@ -413,6 +416,92 @@ static void dw_pcie_host_request_msg_tlp_res(struct dw= _pcie_rp *pp) } } =20 +static int dw_pcie_config_ecam_iatu(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct dw_pcie_ob_atu_cfg atu =3D {0}; + resource_size_t bus_range_max; + struct resource_entry *bus; + int ret; + + bus =3D resource_list_first_type(&pp->bridge->windows, IORESOURCE_BUS); + + /* + * Root bus under the host bridge doesn't require any iATU configuration + * as DBI region will be used to access root bus config space. + * Immediate bus under Root Bus, needs type 0 iATU configuration and + * remaining buses need type 1 iATU configuration. + */ + atu.index =3D 0; + atu.type =3D PCIE_ATU_TYPE_CFG0; + atu.parent_bus_addr =3D pp->cfg0_base + SZ_1M; + /* 1MiB is to cover 1 (bus) * 32 (devices) * 8 (functions) */ + atu.size =3D SZ_1M; + atu.ctrl2 =3D PCIE_ATU_CFG_SHIFT_MODE_ENABLE; + ret =3D dw_pcie_prog_outbound_atu(pci, &atu); + if (ret) + return ret; + + bus_range_max =3D resource_size(bus->res); + + if (bus_range_max < 2) + return 0; + + /* Configure remaining buses in type 1 iATU configuration */ + atu.index =3D 1; + atu.type =3D PCIE_ATU_TYPE_CFG1; + atu.parent_bus_addr =3D pp->cfg0_base + SZ_2M; + atu.size =3D (SZ_1M * bus_range_max) - SZ_2M; + atu.ctrl2 =3D PCIE_ATU_CFG_SHIFT_MODE_ENABLE; + + return dw_pcie_prog_outbound_atu(pci, &atu); +} + +static int dw_pcie_create_ecam_window(struct dw_pcie_rp *pp, struct resour= ce *res) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct device *dev =3D pci->dev; + struct resource_entry *bus; + + bus =3D resource_list_first_type(&pp->bridge->windows, IORESOURCE_BUS); + if (!bus) + return -ENODEV; + + pp->cfg =3D pci_ecam_create(dev, res, bus->res, &pci_generic_ecam_ops); + if (IS_ERR(pp->cfg)) + return PTR_ERR(pp->cfg); + + pci->dbi_base =3D pp->cfg->win; + pci->dbi_phys_addr =3D res->start; + + return 0; +} + +static bool dw_pcie_ecam_enabled(struct dw_pcie_rp *pp, struct resource *c= onfig_res) +{ + struct resource *bus_range; + u64 nr_buses; + + /* + * 256MB alignment is required for Enhanced Configuration Address Mapping= (ECAM), + * as per PCIe Spec 6, Sec 7.2.2. It ensures proper mapping of memory add= resses + * to Bus-Device-Function (BDF) fields in config TLPs. + * + * The synopsys iATU also uses bits [27:12] to form BDF, so the base addr= ess must + * be 256MB aligned. + */ + if (!IS_256MB_ALIGNED(config_res->start)) + return false; + + bus_range =3D resource_list_first_type(&pp->bridge->windows, IORESOURCE_B= US)->res; + if (!bus_range) + return false; + + nr_buses =3D resource_size(config_res) >> PCIE_ECAM_BUS_SHIFT; + + return !!(nr_buses >=3D resource_size(bus_range)); +} + static int dw_pcie_host_get_resources(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); @@ -422,10 +511,6 @@ static int dw_pcie_host_get_resources(struct dw_pcie_r= p *pp) struct resource *res; int ret; =20 - ret =3D dw_pcie_get_resources(pci); - if (ret) - return ret; - res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); if (!res) { dev_err(dev, "Missing \"config\" reg space\n"); @@ -435,9 +520,32 @@ static int dw_pcie_host_get_resources(struct dw_pcie_r= p *pp) pp->cfg0_size =3D resource_size(res); pp->cfg0_base =3D res->start; =20 - pp->va_cfg0_base =3D devm_pci_remap_cfg_resource(dev, res); - if (IS_ERR(pp->va_cfg0_base)) - return PTR_ERR(pp->va_cfg0_base); + pp->ecam_enabled =3D dw_pcie_ecam_enabled(pp, res); + if (pp->ecam_enabled) { + ret =3D dw_pcie_create_ecam_window(pp, res); + if (ret) + return ret; + + pp->bridge->ops =3D (struct pci_ops *)&pci_generic_ecam_ops.pci_ops; + pp->bridge->sysdata =3D pp->cfg; + pp->cfg->priv =3D pp; + } else { + pp->va_cfg0_base =3D devm_pci_remap_cfg_resource(dev, res); + if (IS_ERR(pp->va_cfg0_base)) + return PTR_ERR(pp->va_cfg0_base); + + /* Set default bus ops */ + pp->bridge->ops =3D &dw_pcie_ops; + pp->bridge->child_ops =3D &dw_child_pcie_ops; + pp->bridge->sysdata =3D pp; + } + + ret =3D dw_pcie_get_resources(pci); + if (ret) { + if (pp->cfg) + pci_ecam_free(pp->cfg); + return ret; + } =20 /* Get the I/O range from DT */ win =3D resource_list_first_type(&pp->bridge->windows, IORESOURCE_IO); @@ -476,14 +584,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) if (ret) return ret; =20 - /* Set default bus ops */ - bridge->ops =3D &dw_pcie_ops; - bridge->child_ops =3D &dw_child_pcie_ops; - if (pp->ops->init) { ret =3D pp->ops->init(pp); if (ret) - return ret; + goto err_free_ecam; } =20 if (pci_msi_enabled()) { @@ -525,6 +629,14 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) if (ret) goto err_free_msi; =20 + if (pp->ecam_enabled) { + ret =3D dw_pcie_config_ecam_iatu(pp); + if (ret) { + dev_err(dev, "Failed to configure iATU in ECAM mode\n"); + goto err_free_msi; + } + } + /* * Allocate the resource for MSG TLP before programming the iATU * outbound window in dw_pcie_setup_rc(). Since the allocation depends @@ -560,8 +672,6 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) /* Ignore errors, the link may come up later */ dw_pcie_wait_for_link(pci); =20 - bridge->sysdata =3D pp; - ret =3D pci_host_probe(bridge); if (ret) goto err_stop_link; @@ -587,6 +697,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) if (pp->ops->deinit) pp->ops->deinit(pp); =20 +err_free_ecam: + if (pp->cfg) + pci_ecam_free(pp->cfg); + return ret; } EXPORT_SYMBOL_GPL(dw_pcie_host_init); @@ -609,6 +723,9 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp) =20 if (pp->ops->deinit) pp->ops->deinit(pp); + + if (pp->cfg) + pci_ecam_free(pp->cfg); } EXPORT_SYMBOL_GPL(dw_pcie_host_deinit); =20 diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 4684c671a81bee468f686a83cc992433b38af59d..6826ddb9478d41227fa011018cf= fa8d2242336a9 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -576,7 +576,7 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, val =3D dw_pcie_enable_ecrc(val); dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL1, val); =20 - val =3D PCIE_ATU_ENABLE; + val =3D PCIE_ATU_ENABLE | atu->ctrl2; if (atu->type =3D=3D PCIE_ATU_TYPE_MSG) { /* The data-less messages only for now */ val |=3D PCIE_ATU_INHIBIT_PAYLOAD | atu->code; diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index ceb022506c3191cd8fe580411526e20cc3758fed..f770e160ce7c538e0835e7cf80b= ae9ed099f906c 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -20,6 +20,7 @@ #include #include #include +#include #include =20 #include @@ -169,6 +170,7 @@ #define PCIE_ATU_REGION_CTRL2 0x004 #define PCIE_ATU_ENABLE BIT(31) #define PCIE_ATU_BAR_MODE_ENABLE BIT(30) +#define PCIE_ATU_CFG_SHIFT_MODE_ENABLE BIT(28) #define PCIE_ATU_INHIBIT_PAYLOAD BIT(22) #define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19) #define PCIE_ATU_LOWER_BASE 0x008 @@ -387,6 +389,7 @@ struct dw_pcie_ob_atu_cfg { u8 func_no; u8 code; u8 routing; + u32 ctrl2; u64 parent_bus_addr; u64 pci_addr; u64 size; @@ -425,6 +428,8 @@ struct dw_pcie_rp { struct resource *msg_res; bool use_linkup_irq; struct pci_eq_presets presets; + bool ecam_enabled; + struct pci_config_window *cfg; }; =20 struct dw_pcie_ep_ops { --=20 2.34.1 From nobody Fri Oct 3 16:44:21 2025 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 479EC2E54A0 for ; Thu, 28 Aug 2025 07:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366541; cv=none; b=puCdgOOL7ZQug8MUNeFhWCAeQKqVciP9600kSUGiOUObpN6MiOHGl3mEjBCWc9oMHC2GRoo61+DXMm3xKkzxpeTJ+3MLByM3O93myfNvkV7CurJG4cvYWHkZ5lV1YaYKcGKPUpI+beWhCXmcRCHc1n0ApvrbkvVp3Q72Opln54Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756366541; c=relaxed/simple; bh=SOT5cGlpb58tUYLt/M6MzsCLIazUCm6K/kilP0NCvb8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h8TPNPwY3FVHzO5rmp1HWHFilrGvJtVNB1tsdVlEBc/jKgKtfJKsK+YYqgbLHyTkET81F+Ej8fPXSwwR8JsibI0Z3dB9ds2++jlLaE2LUeo8VvaWL/Kw5W8cZhzZPTjY2z/OENaK6RTLKP60er7uNztvtsJ4nRhBJzg9STq8Yn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ug2zcyFE; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Ug2zcyFE" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 57S5rOr5014879 for ; Thu, 28 Aug 2025 07:35:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= mdI99dLf1C1ECl5BQMbQ2XzHbC/9lRRaEhwE6+uDPVk=; b=Ug2zcyFEn0nb6vUc zEN8ehc6zn8mgzT6A4bq189Wj2S1Gzvk27eB1WqZ34vU8RRJMvy2vwneVcug1tOR 5Qq8SbgXI92AeMGe9sezEquKJXpVuHSiZnqk/+1jU8+IGHsUFOgAo2KW6Q2gQMZT egZRSp90tlk26ObkdRmwJh1N+wK2RCcCxRF823sYygDC2xb51qqhYiir1yvbnmhk c62fbQLEh/1IqtZsBA/A2o1Wl+Exu6KUpuN9JATxAgYZHRHjtxCm2D2kdi7CFZC5 prydrxJS7Sk3BnZx2UJJjuPqCl4UZSvi56+spZTNs+uHCYp0wHOoXHtvR9nqoi6F N+8WYA== Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 48q5we72y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 28 Aug 2025 07:35:38 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-b4c2c09a760so539753a12.2 for ; Thu, 28 Aug 2025 00:35:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756366537; x=1756971337; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mdI99dLf1C1ECl5BQMbQ2XzHbC/9lRRaEhwE6+uDPVk=; b=Y0DOtoMDmCP+HVu45owPKO9hlB2kCT64eESmfD9HM5oBV9ZjZGZC4bPIA0OIef9JJ+ BfrChk8gDHQGEYf0r9L0qKr2+fEw8ZQi7KDOjw8q8EHiOF8QfEHCM7RzDmY2NyOiq80i G3J7dpBuHx9zspAEviCy0rSHZZn1Pq4+c4D3AHwIZGYtJlT5ddl2C6178+6cr9b9tBFu dvSeKj30yZ6lWbWC0o66jCuOiY+FUI3R1cZev890MV9ibY9F0btnvKBXTZ9Fd8zSRYE3 yfuisQnoiOZR8ZIpPpmNDRDybdJdZYhWh+kKXkH3V4DKvbYBV0ZrAYYavTxJvghnMHfD sZtQ== X-Forwarded-Encrypted: i=1; AJvYcCVNaemTVnr5s2I62YWLyTVxRGqIbJirCg+sZO+wVlK9nvNlT5i03BkHXGKGNmROFJW6Ft9pnrJoQNe6a0Q=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1mDxJMFTfC8PiGBqbyHUSOYLjQw8KGJmG3bC+EnmGMH479hSV grJeBgA6lpC4P9/xp0cJAMLQe1yiMtnQr4y5kIrrzFeJdjeEMuYyxg+H/G751DaGHAC7nhS8AVJ 6f2zLX3S0of/iEookzsfFnUqnaMBnZhm9Iy99WX8x5Pk2mYNoJ8ziBmWK2dd8AIuZ0u8= X-Gm-Gg: ASbGnctNqXg01XK/vlW7v6u6yKyuNaQJvD1/QxcDB01H3fNLZja8sZ+2fX3tHm7SW5A OARCB/Uxd6ayYmaUglqsgiLEmCAbTuCs3Elv+Zi0rLTLx2ZxKDrQWKlycwRgDW3jyI7RTKOOjJ4 F3yDa9g0P/ungS6WC2HztFSQXW2HQH6t71WVLOtKVyYg7R6ubSEoZS0mKgsSq502D/p1qWxWFGh k7ovcVVZVVipBuRF7cARKjMB6sIK1E9erdMWgvKoqZcfvH00m2XERH5SctWEyW2CDSGTsiD6Zxu BNnxvFOtfWI0KLtfuaKu4Ckrb2mo2iyYJMVLPkk/dGETt9SCiTNjObir4PxJkLQIQE/IMR9SaIE = X-Received: by 2002:a05:6a20:4303:b0:23f:f99d:4661 with SMTP id adf61e73a8af0-24340d1223emr34775097637.38.1756366536972; Thu, 28 Aug 2025 00:35:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEPKJkzrPSYvs6SE5D7ZnDcbQs3kZDqycFu9LsGoSOfVI+xGTIg/YwbRJj7uy+bE4H3E/2NVA== X-Received: by 2002:a05:6a20:4303:b0:23f:f99d:4661 with SMTP id adf61e73a8af0-24340d1223emr34775058637.38.1756366536454; Thu, 28 Aug 2025 00:35:36 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b4b77dc7614sm9605810a12.8.2025.08.28.00.35.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Aug 2025 00:35:35 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 28 Aug 2025 13:04:26 +0530 Subject: [PATCH v8 5/5] PCI: qcom: Add support for ECAM feature Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250828-ecam_v4-v8-5-92a30e0fa02d@oss.qualcomm.com> References: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> In-Reply-To: <20250828-ecam_v4-v8-0-92a30e0fa02d@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , Manivannan Sadhasivam , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Jingoo Han Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, quic_vbadigan@quicinc.com, quic_mrana@quicinc.com, quic_vpernami@quicinc.com, mmareddy@quicinc.com, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1756366503; l=5936; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=SOT5cGlpb58tUYLt/M6MzsCLIazUCm6K/kilP0NCvb8=; b=5T7mKEC+kVDYoC8offDWdkOBIkRE3N+aVHczCvfVmcR1obmYogBI6TeVqii3vsCdDruF6AYZO XXeluSKeFsTBDToJ4BVJaGv8mqiz5X/fhRY57CZ03NY1LGVbYYxKyG9 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: TqKtUr1ha7MrhATNVfNx4eNwhfLkiDC2 X-Proofpoint-ORIG-GUID: TqKtUr1ha7MrhATNVfNx4eNwhfLkiDC2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwODIzMDAzMyBTYWx0ZWRfXwVd2PmxQp3WY RK/v57h/JHzhi6OcwYL1rs0B0U/+B/9Db7Yo9la2TgpJfewjxaYR4s3kHRuscYLk1MiDTo9rJ3R K774W8Qcc426h+eA60julBtv5QsAnkyTO9nF8iv1sOQmn74degdlySHC5h1FeFZROUtCZerEh0s b0+eHMpmuC97n0+zSmXF+pU1cZCU7pHfY033tR9vCyJhEniTwmCK12/pbXmYc/GNod0D5rilXab BfQbtNkVBd1nwvM37JyVlVNIq52g6BVeNpwK0aby1Er5vTG2g6GJqsgvdrLHdmaY8jgNrQUpjYS BFcj2kEOqZUMy+O8Si2Cc552FiG61Wijg+mg7m+UlO+qlNtDGz2705Esh72R2M+c0Or5Wb100C1 ZfCF7Gi8 X-Authority-Analysis: v=2.4 cv=BJazrEQG c=1 sm=1 tr=0 ts=68b006ca cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=2OwXVqhp2XgA:10 a=EUspDBNiAAAA:8 a=oQbQ34n3Jerzy_GFPTkA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-08-28_02,2025-08-26_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 priorityscore=1501 clxscore=1015 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2507300000 definitions=main-2508230033 The ELBI registers falls after the DBI space, PARF_SLV_DBI_ELBI register gives us the offset from which ELBI starts. So override ELBI with the offset from PARF_SLV_DBI_ELBI and cfg win to map these regions. On root bus, we have only the root port. Any access other than that should not go out of the link and should return all F's. Since the iATU is configured for the buses which starts after root bus, block the transactions starting from function 1 of the root bus to the end of the root bus (i.e from dbi_base + 4kb to dbi_base + 1MB) from going outside the link through ECAM blocker through PARF registers. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 70 ++++++++++++++++++++++++++++++= ++++ 1 file changed, 70 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 5092752de23866ef95036bb3f8fae9bb06e8ea1e..8f3c86c77e2604fd7826083f63b= 66b4cb62a341d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -55,6 +55,7 @@ #define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8 #define PARF_Q2A_FLUSH 0x1ac #define PARF_LTSSM 0x1b0 +#define PARF_SLV_DBI_ELBI 0x1b4 #define PARF_INT_ALL_STATUS 0x224 #define PARF_INT_ALL_CLEAR 0x228 #define PARF_INT_ALL_MASK 0x22c @@ -64,6 +65,16 @@ #define PARF_DBI_BASE_ADDR_V2_HI 0x354 #define PARF_SLV_ADDR_SPACE_SIZE_V2 0x358 #define PARF_SLV_ADDR_SPACE_SIZE_V2_HI 0x35c +#define PARF_BLOCK_SLV_AXI_WR_BASE 0x360 +#define PARF_BLOCK_SLV_AXI_WR_BASE_HI 0x364 +#define PARF_BLOCK_SLV_AXI_WR_LIMIT 0x368 +#define PARF_BLOCK_SLV_AXI_WR_LIMIT_HI 0x36c +#define PARF_BLOCK_SLV_AXI_RD_BASE 0x370 +#define PARF_BLOCK_SLV_AXI_RD_BASE_HI 0x374 +#define PARF_BLOCK_SLV_AXI_RD_LIMIT 0x378 +#define PARF_BLOCK_SLV_AXI_RD_LIMIT_HI 0x37c +#define PARF_ECAM_BASE 0x380 +#define PARF_ECAM_BASE_HI 0x384 #define PARF_NO_SNOOP_OVERRIDE 0x3d4 #define PARF_ATU_BASE_ADDR 0x634 #define PARF_ATU_BASE_ADDR_HI 0x638 @@ -87,6 +98,7 @@ =20 /* PARF_SYS_CTRL register fields */ #define MAC_PHY_POWERDOWN_IN_P2_D_MUX_EN BIT(29) +#define PCIE_ECAM_BLOCKER_EN BIT(26) #define MST_WAKEUP_EN BIT(13) #define SLV_WAKEUP_EN BIT(12) #define MSTR_ACLK_CGC_DIS BIT(10) @@ -134,6 +146,9 @@ /* PARF_LTSSM register fields */ #define LTSSM_EN BIT(8) =20 +/* PARF_SLV_DBI_ELBI */ +#define SLV_DBI_ELBI_ADDR_BASE GENMASK(11, 0) + /* PARF_INT_ALL_{STATUS/CLEAR/MASK} register fields */ #define PARF_INT_ALL_LINK_UP BIT(13) #define PARF_INT_MSI_DEV_0_7 GENMASK(30, 23) @@ -317,6 +332,48 @@ static void qcom_ep_reset_deassert(struct qcom_pcie *p= cie) qcom_perst_assert(pcie, false); } =20 +static void qcom_pci_config_ecam(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct qcom_pcie *pcie =3D to_qcom_pcie(pci); + u64 addr, addr_end; + u32 val; + + /* Set the ECAM base */ + writel_relaxed(lower_32_bits(pci->dbi_phys_addr), pcie->parf + PARF_ECAM_= BASE); + writel_relaxed(upper_32_bits(pci->dbi_phys_addr), pcie->parf + PARF_ECAM_= BASE_HI); + + /* + * The only device on root bus is the Root Port. Any access to the PCIe + * region will go outside the PCIe link. As part of enumeration the PCI + * sw can try to read to vendor ID & device ID with different device + * number and function number under root bus. As any access other than + * root bus, device 0, function 0, should not go out of the link and + * should return all F's. Since the iATU is configured for the buses + * which starts after root bus, block the transactions starting from + * function 1 of the root bus to the end of the root bus (i.e from + * dbi_base + 4kb to dbi_base + 1MB) from going outside the link. + */ + addr =3D pci->dbi_phys_addr + SZ_4K; + writel_relaxed(lower_32_bits(addr), pcie->parf + PARF_BLOCK_SLV_AXI_WR_BA= SE); + writel_relaxed(upper_32_bits(addr), pcie->parf + PARF_BLOCK_SLV_AXI_WR_BA= SE_HI); + + writel_relaxed(lower_32_bits(addr), pcie->parf + PARF_BLOCK_SLV_AXI_RD_BA= SE); + writel_relaxed(upper_32_bits(addr), pcie->parf + PARF_BLOCK_SLV_AXI_RD_BA= SE_HI); + + addr_end =3D pci->dbi_phys_addr + SZ_1M - 1; + + writel_relaxed(lower_32_bits(addr_end), pcie->parf + PARF_BLOCK_SLV_AXI_W= R_LIMIT); + writel_relaxed(upper_32_bits(addr_end), pcie->parf + PARF_BLOCK_SLV_AXI_W= R_LIMIT_HI); + + writel_relaxed(lower_32_bits(addr_end), pcie->parf + PARF_BLOCK_SLV_AXI_R= D_LIMIT); + writel_relaxed(upper_32_bits(addr_end), pcie->parf + PARF_BLOCK_SLV_AXI_R= D_LIMIT_HI); + + val =3D readl_relaxed(pcie->parf + PARF_SYS_CTRL); + val |=3D PCIE_ECAM_BLOCKER_EN; + writel_relaxed(val, pcie->parf + PARF_SYS_CTRL); +} + static int qcom_pcie_start_link(struct dw_pcie *pci) { struct qcom_pcie *pcie =3D to_qcom_pcie(pci); @@ -326,6 +383,9 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) qcom_pcie_common_set_16gt_lane_margining(pci); } =20 + if (pci->pp.ecam_enabled) + qcom_pci_config_ecam(&pci->pp); + /* Enable Link Training state machine */ if (pcie->cfg->ops->ltssm_enable) pcie->cfg->ops->ltssm_enable(pcie); @@ -1314,6 +1374,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); struct qcom_pcie *pcie =3D to_qcom_pcie(pci); + u16 offset; int ret; =20 qcom_ep_reset_assert(pcie); @@ -1322,6 +1383,15 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) if (ret) return ret; =20 + if (pp->ecam_enabled) { + /* + * Override ELBI when ECAM is enabled, as when ECAM + * is enabled ELBI moves along with the dbi config space. + */ + offset =3D FIELD_GET(SLV_DBI_ELBI_ADDR_BASE, readl(pcie->parf + PARF_SLV= _DBI_ELBI)); + pci->elbi_base =3D pci->dbi_base + offset; + } + ret =3D qcom_pcie_phy_power_on(pcie); if (ret) goto err_deinit; --=20 2.34.1