From nobody Sun Feb 8 21:32:19 2026 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 B75EF2417E2 for ; Thu, 6 Feb 2025 23:29:14 +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=1738884557; cv=none; b=KyUgWDpmvvfeoPlltt65X45xI6oWdJwki4d2D+hBUxDnAMEekNsH0NFA9PbbMKH+6V+xuOAdl1BVbTSuBDIlaeLDwRfHYNUiRlbHExkbntCGvRP972Z+LpSYMIfw9mTeYHdXIz8mFXydSJzCnhOOwRTLeSbM4BO2YcD5f/aHFhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738884557; c=relaxed/simple; bh=s3bIi9NJPl7GvWtItHLAYMBhKKwwbJNGn6/L6WX4Qbc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bWgsw1jAF0VW6swg+GNNQfHA2xB260Kvxp+VO6QC3bKl3QZGI69XCanefN3Rs75Bm07eQoOjLmMUXKBt+hE9PiN2lRkGLEnL6gKxBKLGZEtjke3MNyaQvimV/7klScfa8NJBn+kqmpyjJW2AvBm8s1afNFx5pPAJMU735t2ZSRE= 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=d0eVWQD3; 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="d0eVWQD3" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 516Bkiud003545 for ; Thu, 6 Feb 2025 23:29:13 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= XzVhPReZf2sVqu2mJY4+qLpMOX5OmiFM5s04YydtgQI=; b=d0eVWQD3ua6HtQp8 9IDZYbBqVXmbreERzwSspr2JPcgwfVaJQNXenZ2/XOYn9h9IAqPB6Mf1OxnOFYDY W7P4iYaQZFyUcBZToaqWhZthTvUbMG8wrZy5xqijINdsZeC8WeygGdmkVulgtEMQ a9TXxcGFqQ+/kNGe5/puZgcoT2B6RdEZZch2MQ4Rlaq1Fl1UGqcrg9jwapco5R0n XcvCd7HiYC4UWquB5UB29P2m71OusRXitKCS9g4cQGx70iQF3LFmAzFEV7DVHauj ivAP7vjZ9/EP6WNnzVqiuOO6DZvSfuZmH07plhoAXPFj6C8G3egjoR5UqRGqKFKI E56KJQ== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44mtsa1w1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 06 Feb 2025 23:29:13 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-2f83e54432dso4649305a91.2 for ; Thu, 06 Feb 2025 15:29:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738884552; x=1739489352; 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=XzVhPReZf2sVqu2mJY4+qLpMOX5OmiFM5s04YydtgQI=; b=mZE/Z5cDBIReHJwpH5onu6A2eouU1eQvOOzak2KKS9d6WyjlLo09gSiBevnfbvGgdi NKjAuWKgExu6Cqgj145I2XNcGabJd+F3PpwNoYZB3ADd7n6NgfPFm4GsDrFVbBY/3jnJ Ba+QN8hqQtp66ZlBqHf6OHWpvd1UxCh+rjM5yl1CUkqNqWSJOAu5XXZZZ5oskmzylyaK VTOnaeibIAmIBnUGBuCy1ljUhpexRjidBZ/WIk71zSKLC018amTcz6i1rmZY3qI3BOj0 F9E+mEjVlFWyM/+6pWJwz7PSdNTRDRkcCj4A/USvofSWkkPxIT4m/vc7gb1OCCfzslrx Az/Q== X-Forwarded-Encrypted: i=1; AJvYcCVVUCGVMld1M2g4XLqvDHo9f4x5boPk+TNfBQ06FBKjEahjTPgjzRSWkVtvhbV3vfBQeoep7KvvCoZQXYs=@vger.kernel.org X-Gm-Message-State: AOJu0YxfVWAdloBZSX0gLaUMUMYBMVnlvsBvMwzXI0PC04MMMVcTxYhZ mNmasxXCr9jdn/i28Mx4I7q+eHfBhoIbfM5NisDtjNml7JUv5WoJ/3bf/wCb/Y/uDBYRXVFaebi L1GMhLntZ+yTM0eoefNorzVDBNAjKgzzcsqWAv7mL1wLPblWfij4Uj5UkmcodKLc= X-Gm-Gg: ASbGncu4ENppzmdmh2iHHSYsaZSd0c8/PJgy8b33vfIvjc/hw2tQL3NuqEIidSawi/z +QdtNiTcLUngVZkuakSuEjBzke9jCO91y+3IQ8gRXelGFDot753GlK6v/rzKj5txJM61Ttvp1MH t8pjp8fG333tp2ITIyNDN6cdjZPf808RXdYN4zO2eeLhAfAi1s16Ca3Wgankiy7ojYfN5Wtc3yv WITC7CyZJxY2qZSFt/TDKU3joPD3T/pXi5LNCv0pOPi//WAgpl2tqVYTWbLkbCL39JLq3QvVBqY dkMi9ktzNiEbO24KDy50dadCXOADpg4qQWEVXxCk X-Received: by 2002:aa7:88cb:0:b0:725:eacf:cfda with SMTP id d2e1a72fcca58-7305d51bfafmr1883454b3a.17.1738884552127; Thu, 06 Feb 2025 15:29:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKUgf9YEV08t4p+ocW2IVUib9sdQwfg4g7HFAwuaqDpN3Hq9K+Kipy5UkLkFmKusvAFsXZzQ== X-Received: by 2002:aa7:88cb:0:b0:725:eacf:cfda with SMTP id d2e1a72fcca58-7305d51bfafmr1883423b3a.17.1738884551746; Thu, 06 Feb 2025 15:29:11 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73048ae7f6esm1845905b3a.74.2025.02.06.15.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 15:29:11 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 07 Feb 2025 04:58:56 +0530 Subject: [PATCH v4 1/4] 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: <20250207-ecam_v4-v4-1-94b5d5ec5017@oss.qualcomm.com> References: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> In-Reply-To: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , 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.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738884540; l=2049; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=s3bIi9NJPl7GvWtItHLAYMBhKKwwbJNGn6/L6WX4Qbc=; b=A6+UFleePIXXF4FhpC6Jr2fEHw1pX8UFKKV22d5aVWXk4TucvDFU0J2PaXvViYDf6Upqnguoo xebRSc2gt1FBu+mKnspdruViK0xkR46WpMKzqX8d6pK0kjbkCuchmmG X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: 3uuIXB9daa4gROLb14CGKMq6iCnW7sZI X-Proofpoint-ORIG-GUID: 3uuIXB9daa4gROLb14CGKMq6iCnW7sZI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-06_07,2025-02-05_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 adultscore=0 bulkscore=0 mlxlogscore=713 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502060182 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")' Signed-off-by: Krishna Chaitanya Chundru Reviewed-by: Manivannan Sadhasivam --- arch/arm64/boot/dts/qcom/sc7280.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qco= m/sc7280.dtsi index 0f2caf36910b..64c46221d8bf 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -2201,10 +2201,10 @@ wifi: wifi@17a10040 { 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>; + <4 0x00000000 0 0xf1d>, + <4 0x00000f20 0 0xa8>, + <4 0x10000000 0 0x1000>, + <4 0x00000000 0 0x10000000>; =20 reg-names =3D "parf", "dbi", "elbi", "atu", "config"; device_type =3D "pci"; @@ -2215,8 +2215,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 Sun Feb 8 21:32:19 2026 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 758A223AE73 for ; Thu, 6 Feb 2025 23:29:20 +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=1738884562; cv=none; b=XomKSPlrZJZQhbJAoxlelq+8C6nR7492Wd4HYV5wdhf4u8BER3DkkyxCGlHZ4JPsWwZHvpJsmRmhc4sCLbJwhJS0NFBxSeaoR5w+0XOj0idzEzaq9i3RbUf7CdqMk7FLpMkOpPRBv6Rx02HkOtMISS0qHxdEg9Vq4nXGrPwkGjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738884562; c=relaxed/simple; bh=uY93T0yUB36H70prew0kSW+OhiMEx+NY8OCEPWlQkBg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UXTT1prUIaYxD/ZzyJDlsXtg4lv52CVEmJJai2jkU36f1Xzd6QhhW8NhqPqjeIC1KQXO6yY9fJJzyk6Wwp2hgD6M+x/eKSq5SD6Nt2iLLRs0zoKVajFdUAJpggOgaZKfN0Ur1XDMQDHsYPF3j/JwVdgtSTwJ7QpgXCCimGoVEfI= 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=TAIHOo7T; 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="TAIHOo7T" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 516HrbqA018076 for ; Thu, 6 Feb 2025 23:29:19 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= 6pWXiIdrgRFwUyrRZilnZJMRSt5DtiWHnfUqWM5BgNo=; b=TAIHOo7TGZfFO2cC HwPsTdUzwmGm3WsBOMp5fEelQzItkoKd/+nwC9HrrEKPn07BWhvp7WA21jTSa1yP gfxzOu8Afbd8yuV7FxEXYC2iXKzWrRAwWx+8QCxJcKb/lfP9jphwVEEz8/Vs4mDm Z/+cluCuueQ+a5OQEfEgu4TlT9q1kwhPuM4TKw49+WDrSjkS4cDOd8SUqfVxUCt6 zFSUEz6e0iVOaHAoZdbaUfp6HTVOdcolLV0Yfi/asN9cKqzI1bYlYzqXjjQ+5aT7 L53I7A/s/85AKbNS8BTjJC0dmf9qpWjmwBZinwcViJETZtbuuKRFZZtPuCrjlyZ6 bJQPDw== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44n1vngpx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 06 Feb 2025 23:29:19 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2fa05b7f858so2435622a91.0 for ; Thu, 06 Feb 2025 15:29:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738884558; x=1739489358; 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=6pWXiIdrgRFwUyrRZilnZJMRSt5DtiWHnfUqWM5BgNo=; b=LjjqTryqDEePFqhFPV/bLdQuizquEjhBlOscx1xLsrbGGIMxwqzTVjRApuLk3c6sXn VuNqZDF/hp9VxlsztStHxVGqFKqp4MAiLDt3yu/H5XcKrL8+EQPyyMpZFbB5pZ5NUUFz Zn8/8uNB1dyKS3G8vyWDmyNKsOVeM6saxPMC5GmVZMgdsZla9l6cjNA/OX2YpxD2OpGw Kso8aOViLMFlXIfh3J2RDwIBMbggjeF0GYfENPJ7U2NwwphL/z8bL+6pww0iZsQ2Kk9L EJZskxCgMDlXY904P97/tV6juVTLME0IK79TgI0lj0m3fppMMUbjrU/pBJunWu0toWc+ xNOQ== X-Forwarded-Encrypted: i=1; AJvYcCUV8g1Xh9bgSiSwaR30Xf0wNakt5Qg9a0kBWHSCkUkLsDtTOse10+L0AxHpzw9bUe7OXwsbzPPhyRiIMI8=@vger.kernel.org X-Gm-Message-State: AOJu0YwQvbBgqCG2Ztmbn0jdx8UyLD2gaFpCCnvbBmx+TgTGD7yD3GIj p+HLilIN0ceSp5hbYCO8cjH0F3+rXjGKxBnPBAcPgumKR2/ixfnIt/W1MJ87WzFzZqEfY+t2/NC sWOMWw6jAAdNKAms6gb+wzJUWR4iZf6LWNXAanM1YNA7PdAPvtaldSdVm3MBIFpY= X-Gm-Gg: ASbGncuseuELKHKQZe+aJvU6D0iA22CJz6HL2rfoSq4ngN9777LRN/6T7+jb+f4vQ0Q nYYGyQeChXYMBolJtDBiMv/9EwoNQJvrgziPqa78H+rfiN3GQdHQwjrteRqhckQKeZLDe8dcZzM /VlAPk7gwNNaIz8ry9gtotz3c/bCvzyJ5AqgHpPMniNU0l2DA/uosokEU3eS5r+MCrEuyTgyXvg yu0OhMviqrSC44XVHsvCEgOXYsh8NOrv751Mt/+FIjtBJu0JQNqnvM2GUVcfNbajbPIuAu0V1+W S9YdsDV7AloOH0YodG79RFuxkJDk0wdm4Dy9OHCT X-Received: by 2002:a05:6a00:909c:b0:725:4915:c0f with SMTP id d2e1a72fcca58-7305e504eaemr1346612b3a.11.1738884557750; Thu, 06 Feb 2025 15:29:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMlmubEM1tEV5w3QDKomU/ar27dKIKjLKn2kUcyPtPqM/HtBAHBYpz6Ib8q/iljUxg+UQO9g== X-Received: by 2002:a05:6a00:909c:b0:725:4915:c0f with SMTP id d2e1a72fcca58-7305e504eaemr1346564b3a.11.1738884557236; Thu, 06 Feb 2025 15:29:17 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73048ae7f6esm1845905b3a.74.2025.02.06.15.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 15:29:16 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 07 Feb 2025 04:58:57 +0530 Subject: [PATCH v4 2/4] 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: <20250207-ecam_v4-v4-2-94b5d5ec5017@oss.qualcomm.com> References: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> In-Reply-To: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , 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.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738884540; l=10051; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=uY93T0yUB36H70prew0kSW+OhiMEx+NY8OCEPWlQkBg=; b=x8v0r/PRJSutajaFkl4I4fDV+YJ/r+2X/QfChZezxn1QueqE+L59BVSRoHVGCckak7ikUT6EB RK6pnuh4nuRCiLvQ48+sKJjpFyEXCjyvJyCgMMHGrJjKv/2o/ijEvY0 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: CcPaofrR2-4GSPCzAIYGzfKTY933dcFB X-Proofpoint-GUID: CcPaofrR2-4GSPCzAIYGzfKTY933dcFB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-06_07,2025-02-05_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 impostorscore=0 mlxscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502060182 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, add a function which checks this. The DWC glue drivers uses this function and decide to enable ECAM mode or not. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/Kconfig | 1 + drivers/pci/controller/dwc/pcie-designware-host.c | 133 ++++++++++++++++++= +--- drivers/pci/controller/dwc/pcie-designware.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 11 ++ 4 files changed, 132 insertions(+), 15 deletions(-) diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dw= c/Kconfig index b6d6778b0698..73c3aed6b60a 100644 --- a/drivers/pci/controller/dwc/Kconfig +++ b/drivers/pci/controller/dwc/Kconfig @@ -9,6 +9,7 @@ config PCIE_DW config PCIE_DW_HOST bool select PCIE_DW + 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 ffaded8f2df7..826ff9338646 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -418,6 +418,66 @@ 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 space will represent Root bus configuration 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.cpu_addr =3D pp->cfg0_base + SZ_1M; + 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.cpu_addr =3D pp->cfg0_base + SZ_2M; + atu.size =3D (SZ_1M * (bus_range_max - 2)); + 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; +} + int dw_pcie_host_init(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); @@ -431,10 +491,6 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) =20 raw_spin_lock_init(&pp->lock); =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"); @@ -444,9 +500,28 @@ int dw_pcie_host_init(struct dw_pcie_rp *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); + if (pp->ecam_mode) { + ret =3D dw_pcie_create_ecam_window(pp, res); + if (ret) + return ret; + + 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 */ + bridge->ops =3D &dw_pcie_ops; + bridge->child_ops =3D &dw_child_pcie_ops; + bridge->sysdata =3D pp; + } + + ret =3D dw_pcie_get_resources(pci); + if (ret) + return ret; =20 bridge =3D devm_pci_alloc_host_bridge(dev, 0); if (!bridge) @@ -462,14 +537,10 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) pp->io_base =3D pci_pio_to_address(win->res->start); } =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()) { @@ -504,6 +575,14 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) =20 dw_pcie_iatu_detect(pci); =20 + if (pp->ecam_mode) { + ret =3D dw_pcie_config_ecam_iatu(pp); + if (ret) { + dev_err(dev, "Failed to confuure iATU\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 @@ -539,8 +618,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; @@ -564,6 +641,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); @@ -584,6 +665,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 @@ -999,3 +1083,24 @@ int dw_pcie_resume_noirq(struct dw_pcie *pci) return ret; } EXPORT_SYMBOL_GPL(dw_pcie_resume_noirq); + +bool dw_pcie_ecam_supported(struct dw_pcie_rp *pp) +{ + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + struct platform_device *pdev =3D to_platform_device(pci->dev); + struct resource *config_res, *bus_range; + u64 bus_config_space_count; + + bus_range =3D resource_list_first_type(&pp->bridge->windows, IORESOURCE_B= US)->res; + if (!bus_range) + return false; + + config_res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "config= "); + if (!config_res) + return false; + + bus_config_space_count =3D resource_size(config_res) >> PCIE_ECAM_BUS_SHI= FT; + + return !!(bus_config_space_count >=3D resource_size(bus_range)); +} +EXPORT_SYMBOL_GPL(dw_pcie_ecam_supported); diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 145e7f579072..523ca7f267fb 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -509,7 +509,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 501d9ddfea16..d0ba8855ba2a 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 @@ -171,6 +172,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 @@ -343,6 +345,7 @@ struct dw_pcie_ob_atu_cfg { u8 func_no; u8 code; u8 routing; + u32 ctrl2; u64 cpu_addr; u64 pci_addr; u64 size; @@ -381,6 +384,8 @@ struct dw_pcie_rp { int msg_atu_index; struct resource *msg_res; bool use_linkup_irq; + bool ecam_mode; + struct pci_config_window *cfg; }; =20 struct dw_pcie_ep_ops { @@ -686,6 +691,7 @@ void dw_pcie_host_deinit(struct dw_pcie_rp *pp); int dw_pcie_allocate_domains(struct dw_pcie_rp *pp); void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int d= evfn, int where); +bool dw_pcie_ecam_supported(struct dw_pcie_rp *pp); #else static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci) { @@ -726,6 +732,11 @@ static inline void __iomem *dw_pcie_own_conf_map_bus(s= truct pci_bus *bus, { return NULL; } + +static inline bool dw_pcie_ecam_supported(struct dw_pcie_rp *pp) +{ + return 0; +} #endif =20 #ifdef CONFIG_PCIE_DW_EP --=20 2.34.1 From nobody Sun Feb 8 21:32:19 2026 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 F04DC237712 for ; Thu, 6 Feb 2025 23:29:25 +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=1738884567; cv=none; b=d30WX19xsyYyn4N1E76cmbFzBtZ4izYg+FdafBmosmiuHKilOKeW/6YWLsdl50P6OjAQTZANJOgEz915KdrGEeFUMDIz4pjaBhMzdPKMxkMm17fdcb45hNUc6tY/PgEMtpIYYk6yhRRTDbDx/RxbkqwHhWRiw6BpX44ELvkZHPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738884567; c=relaxed/simple; bh=SWWzA0HUJcFMbO1HqY5NCoLambaGtXZLJb30DVpO5fc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T5XbB1ddfTro41ugHjHktoU/Fs+SJxtFOO3DqZoKf7M4pnq/LqhVSdOZeGx1gFtrOYTvQBWooqSsYZqljiCVS2bVDOoUQ/x74fw7rYPW8+dzlGBbXCo9XOKSD5midIE28azqLxZrUyRd89sVfwmu9bV5mBLIQrZusn8x8g3T6mo= 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=SNEWzWhx; 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="SNEWzWhx" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 516LACOu022583 for ; Thu, 6 Feb 2025 23:29:25 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= Z9b6+uWWlNVG1bR8nFXu1gMB9eppc8z9TSDppb/TGM4=; b=SNEWzWhxO+rHsHyP Duo7tdcMQ/jk1YS6ihmrXhXDoqm8VHhX4qQt4OtegyOSEwmI1+pM2Ut8JkCKlTTb 557+iRiiDU0ZTW3izl1fUM+0z6NypsCpjo+ikQJWbNtLG0THcqv1N5XIdxnXyxCZ +2pDUu+o9u/j5m4cbFiiiIFCqyo+N2+CXBDThkdDCC4CARolROtAPiqfqPE5y9SC K3GreRs0rsdyEkFb/owO0+lHtm4JvzMXI7odsGI/GkmJ6eaJugVfnKV8fmbQkAQ0 6TpikZaeQCqOoJI3jEZR8nhcAl7hMfY+nbIuLwnZ8iqalLMznyccHTHxswtNYZgc yDAPhQ== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44n4rh0897-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 06 Feb 2025 23:29:25 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2163dc0f689so47240395ad.1 for ; Thu, 06 Feb 2025 15:29:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738884564; x=1739489364; 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=Z9b6+uWWlNVG1bR8nFXu1gMB9eppc8z9TSDppb/TGM4=; b=kin5J585WIaCSwd1m5s07l/jazqHUmfEA803uxXRtKpduSLiMkCPOnCMKOt3M/iMMu CpWhNOF8wuIRtjjtuE75oqh43h2/kAlu253P6mH5E+cexZfKGepn6bdvl1gPi8pxyhUi ESQ+WFU5KJMeRK5VFu7Q/iV6gIcjtZahMBSO+vmtRSKKCUnwqHNRUqEJQVFLOcZpKh23 JY2FHnh2+lc2BgTzNb9isFM7igwKGHBrzcNhVmJdgG/QwYtONWRLygXVnXwLkUAv5RNx utnW/G9hapclQeI+8P6LO/IzqilZPEKPclN0DO0cg1v6oPeR+m+oauFPcLCeHL9R9U0A UqYw== X-Forwarded-Encrypted: i=1; AJvYcCXY6nNG+qBgxP8J1SeVYD99EG5ULfttgApuC9P801j3afPjBYze2y0pFzBxf70O18dUb3PUPNkfz5imq8s=@vger.kernel.org X-Gm-Message-State: AOJu0YwRIu+YioJzNV6nwJ/GJ1O0V+/2y65OJK5ZjV4FlOQyEiqfB1o0 V9dGolI55kkqps6abv/kUKu5pVNlmR06vZR8+PIzNGzW5v6QI5eYECqYtbPVg48Ewd9bcyCmtpF ipsPlvYJm+CtPa2vglPs6h1HLd4Oav0CUBQKkp/VlB0r3xsgBxEhgUdiVv9LStc0= X-Gm-Gg: ASbGncsa9R2Cw+YEZDuFbaglQpMZA9X6qW9V1ZLjh6hVuc71VdHyN5WPP4w1BG5y7oR xORxu4cSfkSUC/RpUltLIVlyL0XLdDdMOPjSLV4uDJRYwb7IrDEdcm1AfCpgcN8H+q2DNAmgAgG 9M2CLcuunMV+qJW4P3Pl10PPN7s0+bQQnzSTTKnS0XO+GvppYH03DOq2xYrcZw1yMx4Slc8k/N5 JNc8nCQCXiv0VfxDVgBjbKs6rZTOPVdcZAD3HxCuRoUPbunyHWfrlTn0LVXzfB49GNAu9mTtRoQ PoRMM6lTuhSpfClkPOzTSuJl79XtBepZ+4K3uf7C X-Received: by 2002:a05:6a21:7101:b0:1ed:e2bc:5c9 with SMTP id adf61e73a8af0-1ee03b71f2emr2037047637.38.1738884564532; Thu, 06 Feb 2025 15:29:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVvvYMobydfHRdWhzMPIv8JZmHyxD+Mh3A0E5Fwkz+JeyDtuYL5YSOAi+LGBdODS/8LGwWcw== X-Received: by 2002:a05:6a21:7101:b0:1ed:e2bc:5c9 with SMTP id adf61e73a8af0-1ee03b71f2emr2036920637.38.1738884562752; Thu, 06 Feb 2025 15:29:22 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73048ae7f6esm1845905b3a.74.2025.02.06.15.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 15:29:22 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 07 Feb 2025 04:58:58 +0530 Subject: [PATCH v4 3/4] PCI: dwc: Reduce DT reads by allocating host bridge via DWC glue driver 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: <20250207-ecam_v4-v4-3-94b5d5ec5017@oss.qualcomm.com> References: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> In-Reply-To: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , 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.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738884540; l=1728; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=SWWzA0HUJcFMbO1HqY5NCoLambaGtXZLJb30DVpO5fc=; b=fZyiGh+iMPqdX/K4h9jdTW+5zikUfOPuZjl5KcMx85+JOe7+rbVN381UpyvurlnEV16UJ7VQd jDdcMRo+q70DPlgYt791jj0Frlgw0Nhyo/Av/N0hwH9New5yG8qcNw9 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-GUID: nBOPrh0KNnNRatBx8yhEVPWKHpN73ZYB X-Proofpoint-ORIG-GUID: nBOPrh0KNnNRatBx8yhEVPWKHpN73ZYB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-06_07,2025-02-05_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=930 priorityscore=1501 bulkscore=0 clxscore=1015 spamscore=0 phishscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502060182 dw_pcie_ecam_supported() needs to read bus-range to find the maximum bus range value. The devm_pci_alloc_host_bridge() is already reading bus range and storing it in host bridge.If devm_pci_alloc_host_bridge() moved to start of the controller probe, the dt reading can be avoided and use values stored in the host bridge. Allow DWC glue drivers to allocate the host bridge, avoiding redundant device tree reads primarily in dw_pcie_ecam_supported(). Suggested-by: Bjorn Helgaas Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-designware-host.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 826ff9338646..a18cb1e411e4 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -484,8 +484,8 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) struct device *dev =3D pci->dev; struct device_node *np =3D dev->of_node; struct platform_device *pdev =3D to_platform_device(dev); + struct pci_host_bridge *bridge =3D pp->bridge; struct resource_entry *win; - struct pci_host_bridge *bridge; struct resource *res; int ret; =20 @@ -527,7 +527,12 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp) if (!bridge) return -ENOMEM; =20 - pp->bridge =3D bridge; + if (!pp->bridge) { + bridge =3D devm_pci_alloc_host_bridge(dev, 0); + if (!bridge) + return -ENOMEM; + pp->bridge =3D bridge; + } =20 /* Get the I/O range from DT */ win =3D resource_list_first_type(&bridge->windows, IORESOURCE_IO); --=20 2.34.1 From nobody Sun Feb 8 21:32:19 2026 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 24DC123BF8E for ; Thu, 6 Feb 2025 23:29:30 +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=1738884571; cv=none; b=nGP6a/UnNn8S7G/+xv7HaqV55LBBU9rDXeUu6DiMiPsKGHfe+DPEppTjLfDniWlJnyOwhTOceBYW2gCexQ128agzp9BRsJZr7EzVyCToz2z1OJpC7cXsm4ax+w7g46Xvg4wYsmBjQcIbgtqmvH9u5DV5zuO+xmBeeKiJ3ch6IZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738884571; c=relaxed/simple; bh=BgNsZ2EhBxd/BSWpqXyZykgbwBhLSUsbRTbb1BSQdUc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=twbgIzBAT5MOJMn9cf3Rlei/F8cbHCtkqU0+J51QuvV5XtAhylAfm6gFNB6bdidx7zDuCYZl6Mn3eLsLxKGNNNGnxUSHrcqBdrEO8WzKE13DjYrfA7i2wudUNFqsmFrKbroLDBEYsEJHkDXEE+VOYkWwByZjFtBroIQDPAZkSws= 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=NfNNVWdA; 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="NfNNVWdA" 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 516Iret6019029 for ; Thu, 6 Feb 2025 23:29:29 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= U+bqz9EHeHzQ2Pjn9rG9487ONwiuzpgqIzdaaOh917I=; b=NfNNVWdAWoboHRnz +N4Zg7BpQUG/peh4iVo+XwQBbLfrD09C+v0ZykMi8vDnNRVjss7p2gl+XKRcMKQ7 CuVuRYIXCYcxZcvhsJOTqDceuWVfI4GuXFWg+ddPnZtiCQxR7LQ4mrT5sRV306gO kbrBrvXpiHP6T3LBuec+ikVUmIiH2fHQTKPvHkYlJ7PDZJUNVTw+mM/eW+bXLobQ r6JYDxbCVPXhzeU8Xq5j8BM07UOt04ljxdtcPgml3WGQXHqoXStRaFGEkzl2OARQ Xy4u7aNv6E92mTlv+3HniBmlLNxbb02SjIXznACPURSLjRaXujwqeP+R9bKFdWmk Gr0yLQ== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44n2rt8hu9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 06 Feb 2025 23:29:29 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2f9e1bf0a3bso4749096a91.2 for ; Thu, 06 Feb 2025 15:29:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738884568; x=1739489368; 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=U+bqz9EHeHzQ2Pjn9rG9487ONwiuzpgqIzdaaOh917I=; b=HpoPZXQ/V5DPQoZKSbKHhSJ7Ei4O7TmMdpPGn7zJfRPLAPUpcIlnqvM9OPPRWkCg43 GUgcizoQYifKKMCdO1CLddsGJd3U7iTUGI1yFs+rfBA6RQ2maOIcszOrbJApJ5UtMQXX xX9miAYni2KSPeBfFxldASlc13z2YODphBpaD+AaI260v3yzZh94NZm1dyuPaLt3Mplq nJWWExjlyvqDDYA3qyKrJZLxAIRTy9jLSDySvm9DRsMKfUZnhzT1OaK3CziQMPWBSl2U 7f7xhO2Ra9pl18PB1Gfcj2lz7aabinRChjHpXCkvvKvcC5HHRQZEzg+0g2wqrr6F5ErE mHBQ== X-Forwarded-Encrypted: i=1; AJvYcCVf8huqbjq86r2aqNCg+efJYg8kA+2TJL0pj11YnTIOe0iatmz/Vp/xbjPGqx4mWPdiCo1iK6jF+x+OIOE=@vger.kernel.org X-Gm-Message-State: AOJu0YyGFaeKJe+fEAhLpp2KOSTxIlXrWK0OTDIUNrdbLvN+abke6NEk 71W+aN1fMK5iKEA2g3zLucx97+mwwGbaPd8FXk+1kbNgYvL1YIwsf98cb3u5yUklQ5QxDNzwLNc ERxk/Rt5TweaXmkVwAkBziY9/XHFMIT//rR7xJLankXRHwYMhcolx/wxlo4Ms0TM= X-Gm-Gg: ASbGnct5i2t/bDq0REeIJW1fLkTiPuLxpY/1X0L0LUq/cc5FPMS1lbtVfBJsfyd26xE JB+wZ7z668LxftNVPeaAws2zfViwB0Wqzdu1WgwgTwqMLg3LiKTdZnFpQIqL/e6bY+593V7lZaA EAC7Pp/NWc0bQAzcbBGIDlpbfXahEPxs29AncLYSZT2m2wVFGVff8PuMpEToeD49V8T9t3mZNNJ LDQJfE9yNmZNvmJHaTQhgiIL6SBUSqylieARgsbq0psXUuVPYV710rFKDGYZQ+Jxo6DLS2Md7ko ADeSX2HsU2U4p+SpK1v8gWB2UbAJydRgcRl4BDNl X-Received: by 2002:a05:6a00:4303:b0:72a:83ec:b16e with SMTP id d2e1a72fcca58-7305d53a58fmr1438928b3a.21.1738884568597; Thu, 06 Feb 2025 15:29:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1nJAHgxkAN6yu/cuiRuyEu57hBwAYKzGaS3dQQShr42srddHjkm9PXWcqaHXZhbVEMDlPig== X-Received: by 2002:a05:6a00:4303:b0:72a:83ec:b16e with SMTP id d2e1a72fcca58-7305d53a58fmr1438906b3a.21.1738884568240; Thu, 06 Feb 2025 15:29:28 -0800 (PST) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73048ae7f6esm1845905b3a.74.2025.02.06.15.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 15:29:27 -0800 (PST) From: Krishna Chaitanya Chundru Date: Fri, 07 Feb 2025 04:58:59 +0530 Subject: [PATCH v4 4/4] PCI: qcom: Enable 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: <20250207-ecam_v4-v4-4-94b5d5ec5017@oss.qualcomm.com> References: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> In-Reply-To: <20250207-ecam_v4-v4-0-94b5d5ec5017@oss.qualcomm.com> To: cros-qcom-dts-watchers@chromium.org, Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , 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.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1738884540; l=6070; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=BgNsZ2EhBxd/BSWpqXyZykgbwBhLSUsbRTbb1BSQdUc=; b=LUuYaHAwc2zakqylAGfB988VMwU6n8H9p/Go6NO2jnuQGQwnPr1ZV2j/g3cwoTXFzmrXapBWG 5rIWwjQ4XseBpCb7AXnc0WZ9i67sgP/RrbMPxDYSABKTH+VjaJLT5im X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: 3YKa4kSf9gsg_L9Pqcoy36jhbcHCelF1 X-Proofpoint-GUID: 3YKa4kSf9gsg_L9Pqcoy36jhbcHCelF1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-06_07,2025-02-05_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502060182 The ELBI registers falls after the DBI space, PARF_SLV_DBI_ELBI register gives us the offset from which ELBI starts. so use this offset and cfg win to map these regions instead of doing the ioremap again. 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 | 77 ++++++++++++++++++++++++++++++= ++-- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index e4d3366ead1f..84297b308e7e 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -52,6 +52,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 @@ -61,6 +62,17 @@ #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_OVERIDE 0x3d4 #define PARF_ATU_BASE_ADDR 0x634 #define PARF_ATU_BASE_ADDR_HI 0x638 @@ -84,6 +96,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) @@ -294,6 +307,44 @@ static void qcom_ep_reset_deassert(struct qcom_pcie *p= cie) usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); } =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 other than th= at + * 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 tra= nsactions + * 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); @@ -303,6 +354,9 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) qcom_pcie_common_set_16gt_lane_margining(pci); } =20 + if (pci->pp.ecam_mode) + qcom_pci_config_ecam(&pci->pp); + /* Enable Link Training state machine */ if (pcie->cfg->ops->ltssm_enable) pcie->cfg->ops->ltssm_enable(pcie); @@ -1233,6 +1287,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); @@ -1241,6 +1296,11 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) if (ret) return ret; =20 + if (pp->ecam_mode) { + offset =3D readl(pcie->parf + PARF_SLV_DBI_ELBI); + pcie->elbi =3D pci->dbi_base + offset; + } + ret =3D phy_set_mode_ext(pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); if (ret) goto err_deinit; @@ -1615,6 +1675,13 @@ static int qcom_pcie_probe(struct platform_device *p= dev) pci->ops =3D &dw_pcie_ops; pp =3D &pci->pp; =20 + pp->bridge =3D devm_pci_alloc_host_bridge(dev, 0); + if (!pp->bridge) { + ret =3D -ENOMEM; + goto err_pm_runtime_put; + } + + pci->pp.ecam_mode =3D dw_pcie_ecam_supported(pp); pcie->pci =3D pci; =20 pcie->cfg =3D pcie_cfg; @@ -1631,10 +1698,12 @@ static int qcom_pcie_probe(struct platform_device *= pdev) 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; + if (!pp->ecam_mode) { + 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; + } } =20 /* MHI region is optional */ --=20 2.34.1