From nobody Sun Feb 8 18:56:31 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 306E5332EC8 for ; Fri, 17 Oct 2025 11:41:07 +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=1760701269; cv=none; b=TctLGWH/uBhluzQUxcxvZp7bgqMgRLXdddWyDSMhBCBwtIjb4Y/gnTqP+Sh0DWlXxTQxe0SfkPoKbLXxRy0afHbPf8GeaGCnwoqN8hDlfFER0JhVayl81JeKtc8xCIVf7eclvjbTdP2eD42skLkhnsUXSiFUs++x9cC5MaZtVpk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760701269; c=relaxed/simple; bh=SYQnOLzoc/XQlIR6zJugeR+7h1RDTEhIgsyWh1ZHDpU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UX3SsLkoNEWmBFqGhv8lveaRb69UbSKOImufDYTf+rrzKVjDnza5BNBM6arcg+s82HTq9rgbnKU20shqT0de3/qB+hsSCm4A/uNpzEMyP8QLU8b6+wbcXXsQv+2zWxmNNw5IP7kv+LxBFfvwYaa2x9MvASmce7P3fl76CHavmv0= 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=Lsmam6MI; 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="Lsmam6MI" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H87blk006284 for ; Fri, 17 Oct 2025 11:41:06 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= BVVLiDkYNXzDn9k+peiV6qbonML0XVUZrJ/W3exuaFs=; b=Lsmam6MISayC59Bq 7wvRDLxV43rQKidoPOJqd1YVuI4IvUIZfSaSxqODoJQIf3P1eK6miFVmfBhuOdMS Yi05h9S4ctd+gADvjdEidF0mGfP6ncJCQsJEtxBfBept764LeUFwh0eM8KGrJK9o 2TPCfV/ybMYLzu2IdELA8Oos/wcYJEHfjjACREdXu41vwx7CGY4Kiai3DhCKABYk Vr4PemiZj2VZfRjRhh4yBogo+NiSzqRU5N/APL/k2P4+6vGaavy85tECtzNCkFjI cC5XA56N1JXS7JQWGdhUclZuK4ktRlqInF8LJwlrlVQArz3XPP8Inxf3r+Wi98lk VOVijg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49s6mwxcw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 11:41:06 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-269880a7bd9so23499285ad.3 for ; Fri, 17 Oct 2025 04:41:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760701265; x=1761306065; 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=BVVLiDkYNXzDn9k+peiV6qbonML0XVUZrJ/W3exuaFs=; b=Fg1AHqFi4mKWVfkRDR+aZN8ZiFzZSCyRb/ZL0qV5i0+/sygOclYCBfw8OjtjsYOEed ds22ZSd33Pt28h3oxo/+v3chgPy/NvNfyCENqVlTeSm8V3f3jrXxaz+G7QHC5GUeK5qz frpZa+1zGpHjl+INrjrPhwbnYwMhOO/PISfAGtd6KG6vRg5pq2UfV0El+0JpQxqzx1Vj hewU6OL38hQsk+qJzHRz7XRR0RmdQzTqBwwB74s4OeeUq7Cgp0jU0FzAIBbPSMhRqbdw fExiVlpFlFa1SCFk1EQlJAI6WJy1G31ACDjbrjbTEHRp67x0jMvzmUSBRrkPcphj5unV Hi9g== X-Forwarded-Encrypted: i=1; AJvYcCVt8UikTEO52eX9/84ix+1OEkdnbxMmXCEm56KLiAzLUrMSMSB2LrA80bjSjv2fJ81ZQF3KRgr+AB3vqhE=@vger.kernel.org X-Gm-Message-State: AOJu0YwiivbVKhXYr8f0FzKC3Jf56GpguyUjJ6fzYlDW4FnmhHuG1wTb StSmyjf7SFahqPpCGz4r/wBwJIsDK9VtnpSSdpZswYnp9Q+7pXAfQkoG7vjqDPJkk27zwfNvc/j A9zS9/UQYkkCe4s6p5nQtuB6W1i8FcaUpRQupdmf4KoiAcAuRn8a9PKRsfAWxNxhjMww= X-Gm-Gg: ASbGnctuNsyuHSnLKpus2dnKJitvTXR8q9LbMqjTl7GDxAQ5oqqy3brbX7O0+iTgE6D qdrmuRJGNua0uqXGfrNYwiNYBMGJRpWeC5KDHOhTMNeNl8a0kRdPpot0jhwg3qFeN267l90UQv2 M+DO0Zenkny/WC2AK7cR7hNZi1VhQfN9ZLjumnxkWmJIiMDRiQxgZzcGMAAbb1yDscSFwrXCD9G 6JJgA9NQWjl94Qqt6nW4r1172nrOduw5jtlyxdQTNFo6fU4iMSTv7zBu6wcQjkbOj5WM143TfHt Ak+G0ceMg4jsZvZMIdnlz8QwtBtWOOKtfMqJyhHQCvYTHUx+JMdYas/R548+lELWaFqVgGJsb7N RiT7jPFQh4Vhen65YHjiE4aVD7emnkxcyiQ== X-Received: by 2002:a17:902:d60d:b0:28e:acf2:a782 with SMTP id d9443c01a7336-290cba4edf7mr41580335ad.37.1760701265109; Fri, 17 Oct 2025 04:41:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF1ijODrnEfO8x6cQ5RXjEcoMcy8dr8bkmS1kfEONZv1VUVtXJCoUGK0vbnLyqd6PrGLg4p3g== X-Received: by 2002:a17:902:d60d:b0:28e:acf2:a782 with SMTP id d9443c01a7336-290cba4edf7mr41579885ad.37.1760701264569; Fri, 17 Oct 2025 04:41:04 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29099a7de45sm61489675ad.54.2025.10.17.04.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 04:41:04 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Fri, 17 Oct 2025 17:10:53 +0530 Subject: [PATCH 1/2] PCI: dwc: Fix ECAM enablement when used with vendor drivers 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: <20251017-ecam_fix-v1-1-f6faa3d0edf3@oss.qualcomm.com> References: <20251017-ecam_fix-v1-0-f6faa3d0edf3@oss.qualcomm.com> In-Reply-To: <20251017-ecam_fix-v1-0-f6faa3d0edf3@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Krishna Chaitanya Chundru , Ron Economos X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760701257; l=3169; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=SYQnOLzoc/XQlIR6zJugeR+7h1RDTEhIgsyWh1ZHDpU=; b=StbwIRrfzZ1eRAU+lCV0Pa3Kriw8R0MnjcDC+5okRn9gN8BsHhx8yTQp0XQb5/VnZnpHKbDba meSn/O+a7EOBaI7jmwK0jsR2dDvyblaGiYdR/N50BRaxGnIqTyRvO3p X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDA4MyBTYWx0ZWRfX6vmbnfOedJBN 4+RI9dkK9eNR882hoiK8NhyQf9Jiz5WnXIFnhB2PRAxOvSZd/lnf4UhG9LKDCxonBgZNwwACTp0 F0UbEABFgsHgTvXK6uSCVXGbjwhr0UNn1oGSCXiuyRqDs1mnl7dOs8T2sCUsrW8eC0LfjIudise JdyajJGXL+qaxQMauaxolFMeZeARS6hiR+odlZ7+cp0IdsW84L3nDpfdprRwtMFSH8NiLvB5g0+ 9clP7BuO1KzifY2Rz6rBqiItZI4m3NPYKxTRQIWyHyXmuR4PALeNalLLLgzAipTXVj4oQ/ruDHb IkCLMwamrO+89hhr82PzwGbSssDCkIZ9aFO3eIsqVrjgBx/UJ7UwGL+oqLgdpANQ8wT8P8QnYFG GKZCKKGuVhKMG0m6G731ZXtH5PbdeA== X-Authority-Analysis: v=2.4 cv=Fr4IPmrq c=1 sm=1 tr=0 ts=68f22b52 cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=HaFmDPmJAAAA:8 a=EUspDBNiAAAA:8 a=h4B-02p0z56_JbXvspoA:9 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=nmWuMzfKamIsx3l42hEX:22 X-Proofpoint-GUID: r_djwYCMWA03PNgEGC3AzckPuoO3AVt0 X-Proofpoint-ORIG-GUID: r_djwYCMWA03PNgEGC3AzckPuoO3AVt0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_04,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130083 When the vendor configuration space is 256MB aligned, the DesignWare PCIe host driver enables ECAM access and sets the DBI base to the start of the config space. This causes vendor drivers to incorrectly program iATU regions, as they rely on the DBI address for internal accesses. To fix this, avoid overwriting the DBI base when ECAM is enabled. Instead, introduce a custom ECAM PCI ops implementation that accesses the DBI region directly for bus 0 and uses ECAM for other buses. Fixes: f6fd357f7afb ("PCI: dwc: Prepare the driver for enabling ECAM mechan= ism using iATU 'CFG Shift Feature'") Reported-by: Ron Economos Closes: https://lore.kernel.org/all/eac81c57-1164-4d74-a1b4-6f353c577731@w6= rz.net/ Suggested-by: Manivannan Sadhasivam Signed-off-by: Krishna Chaitanya Chundru Tested-by: Ron Economos --- drivers/pci/controller/dwc/pcie-designware-host.c | 28 +++++++++++++++++++= ---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 20c9333bcb1c4812e2fd96047a49944574df1e6f..e92513c5bda51bde3a7157033dd= bd73afa370d78 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -23,6 +23,7 @@ #include "pcie-designware.h" =20 static struct pci_ops dw_pcie_ops; +static struct pci_ops dw_pcie_ecam_ops; static struct pci_ops dw_child_pcie_ops; =20 #define DW_PCIE_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \ @@ -471,9 +472,6 @@ static int dw_pcie_create_ecam_window(struct dw_pcie_rp= *pp, struct resource *re if (IS_ERR(pp->cfg)) return PTR_ERR(pp->cfg); =20 - pci->dbi_base =3D pp->cfg->win; - pci->dbi_phys_addr =3D res->start; - return 0; } =20 @@ -529,7 +527,7 @@ static int dw_pcie_host_get_resources(struct dw_pcie_rp= *pp) if (ret) return ret; =20 - pp->bridge->ops =3D (struct pci_ops *)&pci_generic_ecam_ops.pci_ops; + pp->bridge->ops =3D &dw_pcie_ecam_ops; pp->bridge->sysdata =3D pp->cfg; pp->cfg->priv =3D pp; } else { @@ -842,12 +840,34 @@ void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus= *bus, unsigned int devfn, } EXPORT_SYMBOL_GPL(dw_pcie_own_conf_map_bus); =20 +static void __iomem *dw_pcie_ecam_conf_map_bus(struct pci_bus *bus, unsign= ed int devfn, int where) +{ + struct pci_config_window *cfg =3D bus->sysdata; + struct dw_pcie_rp *pp =3D cfg->priv; + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + unsigned int busn =3D bus->number; + + if (busn > 0) + return pci_ecam_map_bus(bus, devfn, where); + + if (PCI_SLOT(devfn) > 0) + return NULL; + + return pci->dbi_base + where; +} + static struct pci_ops dw_pcie_ops =3D { .map_bus =3D dw_pcie_own_conf_map_bus, .read =3D pci_generic_config_read, .write =3D pci_generic_config_write, }; =20 +static struct pci_ops dw_pcie_ecam_ops =3D { + .map_bus =3D dw_pcie_ecam_conf_map_bus, + .read =3D pci_generic_config_read, + .write =3D pci_generic_config_write, +}; + static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) { struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); --=20 2.34.1 From nobody Sun Feb 8 18:56:31 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 88541332EBE for ; Fri, 17 Oct 2025 11:41:10 +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=1760701272; cv=none; b=qFufj6ooYAATl9YI5Ounb5QBUVqxWM9cP79QUD/xbjP5xv3fvcn7bS15Bw7bRXShzcRYX4eh46CunRkgzrKzn1AZ/Sdb8GjoYpXDYvTFmepDjHHTeRomDXl/i3hQfYEnWVLsgaRpdNNLeBCuDV+z9nyQh5j+5FBCIYxg7ZFMdRk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760701272; c=relaxed/simple; bh=m8A7Z+/Uzej0uFR6h+286Hezui6tZ0S/gW9IbjKQFa0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kjmIIkyz6U6pgNMtCUrKEHCUK+iB/YWfwXSz3J81KdGVvD+rOvcs/O1cr/mpu52uiYAtON3WdBGOxs0KbQZrZuwN3bCUCY3r+shsS/G9Y1UwH18sq0yHisrdfQtHlbht72Bli3BmhEbMIXMm/u3m71p+TvqwVly/BRZU5XEKYaM= 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=WKynOOb+; 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="WKynOOb+" 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 59H8PF8G001722 for ; Fri, 17 Oct 2025 11:41:09 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= 5n1dR5aX+zAriBU+NGLJBsi8Hal8RuHW2RBllIFUj10=; b=WKynOOb+fb/pSCyt OIjuFO3J6G21QmJ6ZmWPwwH+JQV++S33w7++gDM5XhkpUiDqrf+x0EyVzrVRgDM2 A7/u+NeX73Iw09+66nFG50f4kmR3nwty0UlxARTVCzl3MjLbqo2VWhd6HuHViFRq ZWTlkqgy2woi+hDW3SmHC86ikCnRP2hEYU37LcWHbSjDhyUBWHzQj5oD4ecFY58Q Xyeo3oqYmm1XNS94ZTj4w2chR1WV8MS8nO8GBqPOaAGfk5G7c2nqid9T0MY6jZjE geWeGCOFroLm0EatkRBWlVLO3PjMr+Kyh3aDLLg1CooqfyGWf7vpt2mIaA+OHg51 0C8gEw== 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 49qfd9c4a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 11:41:09 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-290b13e3ac0so16273505ad.0 for ; Fri, 17 Oct 2025 04:41:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760701268; x=1761306068; 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=5n1dR5aX+zAriBU+NGLJBsi8Hal8RuHW2RBllIFUj10=; b=lS5zPXDhPieG4pa0AaKfQjZ3N2T1CDj0SJJ/J79dki1gqGRrxTbiqLDd4FfQKHoijv qBSY97xe0qZYYTc9FLtIM3Fro1h+2uz4SZEjD8nBOKMgBUvq0GrbjJAL4tnre9Dkl5ia 2Sx6qSnmltFRgTQOqF+7u6xuKY+bsHKq684UIEYsqwb4GGGXzgeha8QJaAdv8ncV7KNb bdjjrQrovgtmCji4C+Ep2ufZfc6EKVFm6a79OxWDUe7FSerEhH1PkZ8sJjvplX4OTy+8 iwRRf5tyw6t/7pwWzja9ZKeBeL13PtkztJp0Zd0q150teayUGztMghnGwM7k7HQ9/j5V O1gQ== X-Forwarded-Encrypted: i=1; AJvYcCUtCfxtJA8YjrhxLSSzu7MzVzFfbbrfI9Ho9vcYRakfAwi9A0CmuaMCWf1SFpAfJkVD8NOyDfRXVYWR2kw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1dkYQaJAQrM4nrMCTH09a9AFuZCv2F45+zPcrE8IkAnW/MmZu MW26LO9B67h9j5uxo3OLlCxsIP4eFeTdSlaWjzrOXZO8/Emt7teT5z1OfYcFnGKRicYUZ0aDM9X Na/jZ/8KtCkx7IYPN2jQXY27+ofCXbrrY7N93rsRaLgG+iYpYmu5iEBPkGWQCLyecHu8= X-Gm-Gg: ASbGncuDBz76te/gqq2X1h20RreqqKyyH6RwyBQgPuTPt40+k6rjDK7AMojnlonpq1Q Uh/7b5VShrlq8MjF+cm2jXm4DdTpMR3nN99F32Hr29+OcHDpnJDc750MknXQmsuqL++lAutkVvk TSImJMIKna3Q0CJnUXXEYs21V6mPswjPps/di17Isx+isuk8S8E+4JYM6C6mQA6/ZD+GSo8lnVr mrT/cnYM8q+6fgU3m+aWYH3Vm+2yVMs6iiWLESulEYHaBoEQFTKwDgNmYhRLKsncnlw3VAg+NLj jrcGspxcYgTUhkTkcfz4qljSBKQgC7SP+UbP2E/soISJTuhTunmBAF8wvp+L+sbknR/eFTXDGIA XNCvfYavvognfI8slgaEdISzzxrPoYmT/1Q== X-Received: by 2002:a17:902:d4c4:b0:275:27ab:f6c8 with SMTP id d9443c01a7336-290c9cae467mr41612685ad.20.1760701268384; Fri, 17 Oct 2025 04:41:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjocfv2Bwqp1t3hLZTsL2tXXiGCuqJgYvVcqzCxvcCoJluwhDdXDTl9H3Va3U0brH8h+pMYg== X-Received: by 2002:a17:902:d4c4:b0:275:27ab:f6c8 with SMTP id d9443c01a7336-290c9cae467mr41612325ad.20.1760701267877; Fri, 17 Oct 2025 04:41:07 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29099a7de45sm61489675ad.54.2025.10.17.04.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 04:41:07 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Fri, 17 Oct 2025 17:10:54 +0530 Subject: [PATCH 2/2] PCI: dwc: qcom: Revert "PCI: qcom: Prepare for the DWC ECAM enablement" 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: <20251017-ecam_fix-v1-2-f6faa3d0edf3@oss.qualcomm.com> References: <20251017-ecam_fix-v1-0-f6faa3d0edf3@oss.qualcomm.com> In-Reply-To: <20251017-ecam_fix-v1-0-f6faa3d0edf3@oss.qualcomm.com> To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760701257; l=5541; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=m8A7Z+/Uzej0uFR6h+286Hezui6tZ0S/gW9IbjKQFa0=; b=cntfPsyXyoirVDrMCNoRoHZw0o6UlinA5S64MEYfYQ9uWQ6+z2m78Vufta8QLAA1FtD4hQxIt tIZpfQRmkdsBUII32Na0gIJiMEFma6lce6GHdsIVmNBz6p7TNs96b1Z X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: 7RC1KMKqbkb6N0kQ5ifilp4KT7D1WbZd X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfX6oXwciyLqHmO PPGbSVK0qf9qB3gpsbs5Lj35j6gJ3f504ijX+MP4MzTJtUzvCoUMB01jssKsVU9kXcLfPJtDqRp xU4wyfEmHickUaTB3ady55qTekm/HANCvyUGTapXs3MlP6ZkleA0r34h79uFD1pQhIFpio9OEXD WIxnZwCZSlNpM+DoVE+bJNKwG3FLBEUEsyRzz2b1i2HUC9clU0UtSOUcokrC+pa+hAh/fmTeC86 2vhcf0enHizRjahngFVqBpDYKWHiLNr0QhlCn3V1EWCWw/tZGUo/HJYHkLELo8xWLYiAokAjNyy zCWJa822X2lCtpSiJBgXd4URDregQv7bc1YuItUg6H3xfJQRq4QQOYf90+jgGJiQ4QG5L46MASD 22kKOKdZbNeP4Mqk8WOT47n6aP/TKw== X-Proofpoint-GUID: 7RC1KMKqbkb6N0kQ5ifilp4KT7D1WbZd X-Authority-Analysis: v=2.4 cv=PdTyRyhd c=1 sm=1 tr=0 ts=68f22b55 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=oQbQ34n3Jerzy_GFPTkA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_04,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 bulkscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 Commit f6fd357f7afb ("PCI: dwc: Prepare the driver for enabling ECAM mechanism using iATU 'CFG Shift Feature'") enabled ECAM access by using the config space start as DBI address. However, this approach breaks vendor drivers that rely on the DBI address for internal accesses, especially when the vendor config space is 256MB aligned. To resolve this, a new design avoids using the DBI as the start of config space and instead introduces a custom ECAM PCI ops implementation. As a result, the qcom specific ECAM preparation logic is no longer necessary and is being reverted. Signed-off-by: Krishna Chaitanya Chundru --- drivers/pci/controller/dwc/pcie-qcom.c | 68 ------------------------------= ---- 1 file changed, 68 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 805edbbfe7eba496bc99ca82051dee43d240f359..6948824642dcdcb1f59730479b5= a3d196ebf66ee 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -55,7 +55,6 @@ #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 @@ -65,16 +64,6 @@ #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 @@ -98,7 +87,6 @@ =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) @@ -146,9 +134,6 @@ /* 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) @@ -326,47 +311,6 @@ 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; - - 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 the root bus is a single Root Port. If we try to - * access any devices other than Device/Function 00.0 on Bus 0, the TLP - * will go outside of the controller to the PCI bus. But with CFG Shift - * Feature (ECAM) enabled in iATU, there is no guarantee that the - * response is going to be all F's. Hence, to make sure that the - * requester gets all F's response for accesses other than the Root - * Port, configure iATU to 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). - */ - 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); @@ -1320,7 +1264,6 @@ 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); @@ -1329,17 +1272,6 @@ 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 under the '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; - - qcom_pci_config_ecam(pp); - } - ret =3D qcom_pcie_phy_power_on(pcie); if (ret) goto err_deinit; --=20 2.34.1