From nobody Sun Feb 8 01:31:07 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 725012FD66D for ; Wed, 22 Oct 2025 07:52: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=1761119539; cv=none; b=swmi0Shyrj5OIkezTl4Mq6dMEQVPj3HRV8VbxmtCs0COoPx3+g6tVhWEuLNjQXBC+sU8SWPLSK4laV9ed+p838lyI3T53L/wgfoxXJLHzODw/Zff4FFoYKLsGzsQzVifU6dGfagcS1cRyGhGvBE0QQTiNoti3MLFir1oklrboqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761119539; c=relaxed/simple; bh=FPPlpLkszDfLj/huk9G6D1NresYhSMQaWaal3M8cqFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lUGtBDL61FWsgmTTWsbKjFliY6fnF2iUJHgRx25vFyndxNUBtITRXcH7+zSeVlXjUCGUK4Tv12dKq4hxjwxI7e0qv2B4AY9zG63uDt0TKg9gBu4j7hjIhuyxrldljcTs6PeR99QFFrkXgp6GuZb9J8Vj5w5J5rWzwBeHVyiFZSw= 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=WVg9qXjo; 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="WVg9qXjo" 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 59M2rWKT024537 for ; Wed, 22 Oct 2025 07:52: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= 1XhTQViaV/X39Anyp8PIXrWuoocdYUl600DmjKTyrwo=; b=WVg9qXjovDTGU7zR N/3nbr54qtCPkA0QVCqhggOOIU1SlVHrVhcVFQUrD7J1VQbqT0HwJJCXSpwit5i/ FSr5E+nGEAGyfpzQ1kUE/Y9vk2NJZBWytzXlL9Rn0My4E+SVsLn0D/zV04fcVKqn iCo3XUWf17t4Jm68knN6ZHrcRIKwH36o9U1Wcale4v2KJVwET/lDRDlkTYVp/e5J DoOVXWMbSN6nBki2vYOQhJX77Ayff5K9V+hzNzDinAxMYiXN3wwz+XtKvzAhTckk RvH0LoO0F+TW+DI2uqnK5fotvboLOOIsl/mPyNZqr11SCR7Cm3OSxa8eltw2tngC tVt9fw== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49wsws65n7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 22 Oct 2025 07:52:15 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-277f0ea6ee6so69150785ad.0 for ; Wed, 22 Oct 2025 00:52:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761119535; x=1761724335; 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=1XhTQViaV/X39Anyp8PIXrWuoocdYUl600DmjKTyrwo=; b=JAX3hc4fcVzIfnj6U5toxd66tLz2gzWnp/o9Q7+S9db6dO7j0os17fY06xQ8ArBf1A /4rsrV5skkVn0LFJ7eCqEAUH5qew8SE1q1j8YP2I1yFuUpX/pAYwuJAIanbHeQ+HOV/j lqxUEpgspOGh7Nxk/9fo/bGqzS4nciPnKmFgi4lji3dzXvi6cs3Imx9TrJTNz8tdeTeV FB9vQco8o+gcVRAMHDAyZRtq4SnyzgCA1xkg/d/6Frh4ICQIx+JXveNdVq+Stdmf9sjq ZtrOx4SgpxJ3L/E9HQePe2QRoVMpPzF8QeDdIjag25C0g8C5oh+yYmi7AFiQs8egA0wG lfQw== X-Forwarded-Encrypted: i=1; AJvYcCVU7qP6N/mzZESoifBTLie0iLqt43H0NiHKjLk6LPPgWpxYx4TXBk0U+9ac2sFIZ92SQSHDPHBq5nhj5QY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6dTym0GYwdYXWkDssHdktz18rD04Ih4HV16SXurl6BZjPg8uJ rkQp20ETxgZsec2D8cYySr+Gw5knZok1FkQSwaV5wDLV6V8M/QZ+vnCWk169SRQMOuk1levQR/8 cnKDx+Y4R+juXIWU1CK+8wTp/VrM/uEDOzWHO71lIjPNgmG6X7svnbosJ1o9gfUDz7Ss= X-Gm-Gg: ASbGnctDEOQvEcs8HeQ/sjAgnX7/mGbuE4MTWPMJ1m0Rm2vqybRnbqaFtDneV61IU62 xWBeycp4ShnXsjN3a3X3qvMwHmtCZGQ28M7MHqe3lxsj1JV4moF61cbrF2WMg0RVjjtWyhuQ7oX GBZtYi0ewddEYJjmqCCKPAoVcO4Dnvei+6f+654tLYcKm8CO2ig53LL+zVDymyc4tlu2LTNPr6P nMpi5C9MqOnlqeekSCH6VK53IQKbsm2BLNRvYkselLlRGDKYUExQ9INJ02VbTHQawan8FXo2R2a /CIc1Gz7q/pWYtfzcGpzGRWa1JBMv6ajUOmgEz15fY6OVtYZp8TWaYYNZsBrOD+IBacEXMH1GPU tAzpMDlGJllHPRV/BT84SsTQ2R+MD0pMUuw== X-Received: by 2002:a17:902:c942:b0:290:c5c8:9419 with SMTP id d9443c01a7336-290cb65b8e4mr250331655ad.48.1761119534687; Wed, 22 Oct 2025 00:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFGqlXT6fObHhgr1D2s85s+Pv0yavAO6a7DXv5jdQ3toDjpK+j4sVXiG3YIRDD8cQ3vqXRO0Q== X-Received: by 2002:a17:902:c942:b0:290:c5c8:9419 with SMTP id d9443c01a7336-290cb65b8e4mr250331255ad.48.1761119534226; Wed, 22 Oct 2025 00:52:14 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fe2c2sm130962275ad.79.2025.10.22.00.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 00:52:13 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Wed, 22 Oct 2025 13:22:00 +0530 Subject: [PATCH v2 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: <20251022-ecam_fix-v2-1-e293b9d07262@oss.qualcomm.com> References: <20251022-ecam_fix-v2-0-e293b9d07262@oss.qualcomm.com> In-Reply-To: <20251022-ecam_fix-v2-0-e293b9d07262@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=1761119527; l=3184; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=FPPlpLkszDfLj/huk9G6D1NresYhSMQaWaal3M8cqFs=; b=uN/3l2SCGQPO7zxgVFtEl7qZ1QV32AyKSorVhSrZUlAabqbmVIrMdvtG1a4tyU6XQywyr8J0s eeOrhLz6yziBsLjSRO5ndXRi+0t507j5jlJg4dYjjJs+YoPjNj4I8I7 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDIwMDE0OCBTYWx0ZWRfXxAOeiaeWcsoz M4swDwxgt9HYxAKSICHoYLRJtO9Uy00kLVE29E6MkxyZnlSMW/MyyV3CAokOdgq5EvosgrL4N1n Ht/zd0STvQGKcx6fk6lAYDpah64SeViNYJ2ae5cWUwb0Lt/3Yy0GE16iSY3GeGgk6FXD72r6ILT YC1QhYClomv1EYDHmAjaMtta2A7DhlSOIt85RwJc1bKy2YxzdpOjJHC4yMIliuHtP8UCy/UXkyk 3/DBWfBN487icH8vgSvlwWjqSryzylN3Y7SqvAvukcWTd5RfGCjDkMXzGCoTTRPAQcvOPPAT5wQ 2AAoDtbEz73drKd6aip0cpfydLaJ8xzG8SxHSsnKokvxRWZA9yLZ0atoErfyyUmnq/M76hT+7bl 7YACBgQBegRrrQmXwpEdPNJHfUYjVA== X-Proofpoint-GUID: UZZrcs7lpnVoKiqoL21E6LmxHcuHO96V X-Proofpoint-ORIG-GUID: UZZrcs7lpnVoKiqoL21E6LmxHcuHO96V X-Authority-Analysis: v=2.4 cv=a+E9NESF c=1 sm=1 tr=0 ts=68f88d2f cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==: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=324X-CrmTo6CU4MGRt3R:22 a=nmWuMzfKamIsx3l42hEX: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-22_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 clxscore=1015 priorityscore=1501 phishscore=0 bulkscore=0 suspectscore=0 malwarescore=0 impostorscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510200148 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 root bus 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 Tested-by: Ron Economos Signed-off-by: Krishna Chaitanya Chundru --- 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..7d95d8ec9f8190dbde80283db78= ca74925532d2e 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); + + if (bus =3D=3D pp->bridge->bus) { + if (PCI_SLOT(devfn) > 0) + return NULL; + + return pci->dbi_base + where; + } + + 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 01:31:07 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 412382FD7CD for ; Wed, 22 Oct 2025 07:52: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=1761119544; cv=none; b=dPIVVQLXOdQxJw1FFM5ul4AwnLzeQGLWasgYs+HKj3ahvgYvTwaA3WWkK4itcDw9QrFsOUJU5fF6Gd5H9lmDNiX0zetgo5h3cNeAqXBpx4JpgsT1Qi/q1yWHQGRlRrED5ecBdcnWoexNxMUfqY1acAtz4mFI+c47AHCloBx3tDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761119544; 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=Rlpe311vk80Cbrf//XUHtkEhGzV0f7mgs7ReFcrgDbg8A4EXP712jjlwY5xdE4Gzo6H/zgQ4of/x8p1t2BdV9tyDD42TNUYb6U41LWQwHVvltKbslOM/1Ef2FfVcVwBE9p2NTo7MQGQOzCx5p1UkJR0WfUi9m0Iv+ssmsQl4ROw= 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=bQPLxohE; 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="bQPLxohE" 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 59M40IRA027963 for ; Wed, 22 Oct 2025 07:52: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= 5n1dR5aX+zAriBU+NGLJBsi8Hal8RuHW2RBllIFUj10=; b=bQPLxohEMDFWGsQH Fz8WKZ3W3aPBF+9ytOw1UybxNJWJucWrC33OGj0VmeqNHsNBZTG5P3pYPZiWKWd2 kRlX1W0l9w67FmengmSaAYkYwoqLL4soCFi0OxZ9leNdm9fCKrxEdzBmgHVEj7J8 D1mSnYjwO2zUtIiNS5LPV619yZoO73aJSRJByXuTsw74mervdvt0xQE+uZY89aKc nQ/deq5YOokqRYeHri85I8tQ/y5Y1FAlIo8Hrum36MJdKyJYdQjy0rwaqIw+Yg0T zzlP/ppTxSE33UJs1SU5VO25HaR8N1vHuiUy3DxL+I5ugqvPBuOsqpyIuBr+Gcif HAeKPw== Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49v27j3rhm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 22 Oct 2025 07:52:19 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-290d860acbcso115656735ad.1 for ; Wed, 22 Oct 2025 00:52:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761119538; x=1761724338; 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=Qw+t2h0qmyxiGdkqi6NWrrd2XLYAGUHkTuGL4a1PmPqt5mo5zaLKEETsLwRlVPSBMQ sevtfOKN5aAYs7O01ApsSSAOEbUEIbIlG8qF0cS4spVxcwb6lT1kFavFWn1XzjwakEe8 dcafYVHiJRlhPl17vu/vi0gcjfCoFdTeiOifdVwLWXdmI3TU5evCWcXqXFkR/8r6GY6S aCcQ4tmeSt5zBUNIEiG8HAJUOkLht3jXUP91hj3vq31ZLMjh7O8vRSdJGUnBahu4BV5g G1iPddJhzlNP+E9rw6cRJx83d3oG4xxajlCffgG4l+As7gUY2whYDhZOmHBtzSQjEVZM jIxA== X-Forwarded-Encrypted: i=1; AJvYcCXIainHHkTadqQeEjHQH6Zy7xPB2QT1bamLoUEntId4z6039tNH9PdZy7/tyJcRa8zbAH+AAVzrSbdl5Cs=@vger.kernel.org X-Gm-Message-State: AOJu0YzwxInr43YFuNl2kygo9vCts5Z3DCRiZ3SOyjEmB8/QDw0N5gWi dXRXafY69neu4aGbVt4ptKFmVFvoDFsPCjwfQ1GJHsfY8TPKHg4oIQIzfejc9MlXwuz17wwoqXF +np45+smrNqzmq71meGHglPLzxCEHynkvfVNcNQtCrbbd9om4K9l3Hg+OiSYsQxFedps= X-Gm-Gg: ASbGncvODqJfRKSImmBS+SD5sSEDQ1FNFB9HS8bD6qjI525gKQit+mGtU4RDqVdz1/o SWgqPsuXK4CXk/VZYkfuY5d7sTWnVH4HdJ3XbdUxeCfJJVqPapTo5W7kwX93Q7+vxo/ozc/Ag7Q S7dGEHfMZe3GnMltQJgtOgeVp1Ff2A9tq2I2CS0D+6fLwlM6ON54zqybnCTCQ3EAJxAcdpzljJ4 Wn1ZSh0fjGuXgUFUepGU6hhuLokQFavRXf/Bm7IGytdto8iU8t2MMlEkbTxqh4F2z9Cntv3zY5E fSfun13rXKYFB3eH5wWkzKngD8Xe0FrKBAGfI7StC817MafmyBr3QkfCHxMVONIPde6kYcoI7es Mf6L3n2aVnp8TOBZnOYzDrWrIbx7R72GT1g== X-Received: by 2002:a17:902:ea01:b0:267:d2f9:2327 with SMTP id d9443c01a7336-290c9cf2d88mr292037245ad.27.1761119537975; Wed, 22 Oct 2025 00:52:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYK0e81sFkQ1GS8jd2/K+lvCaeoR7f2RXyJh4m31HaVclGbSgGzk/dlUQFYsltNq+HqA+vWg== X-Received: by 2002:a17:902:ea01:b0:267:d2f9:2327 with SMTP id d9443c01a7336-290c9cf2d88mr292036735ad.27.1761119537526; Wed, 22 Oct 2025 00:52:17 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fe2c2sm130962275ad.79.2025.10.22.00.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Oct 2025 00:52:17 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Wed, 22 Oct 2025 13:22:01 +0530 Subject: [PATCH v2 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: <20251022-ecam_fix-v2-2-e293b9d07262@oss.qualcomm.com> References: <20251022-ecam_fix-v2-0-e293b9d07262@oss.qualcomm.com> In-Reply-To: <20251022-ecam_fix-v2-0-e293b9d07262@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=1761119527; l=5541; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=m8A7Z+/Uzej0uFR6h+286Hezui6tZ0S/gW9IbjKQFa0=; b=34vohxe/AB9YoqTIM7uXejhqFiItgP7v8j14SzhWcI4Jcnu7AgBmd1twlTqLM5Lway7ovQ2fV T5uuqcePZ0RAa1wELx0iFoIZ3lEFHexKnuS1ri9mdGZ4oRIVS3tAQoe X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE4MDAxOCBTYWx0ZWRfX0kOvcLdEUqJP zzzMged3NF0CdED87wfBqQSkm6DAervfvBzMuKNd0m/4YhxTFcJxv7+8l08ndL77Jor6qMkP+0X PCYnJJv3jYhhvq885Q8g/EBpY3BF/ENNa1tepFlryia75c4KbEYLxLRtQ3QiYWqH+zU4C1ujPrl cY62775JcU/SeLizAVXcC3wNDt7YWWU33cHkpxK3S+1SPglEXWS+tFDtcsyri7Ne+L5qoathKdz rdpE9zy4ptdWKu+FYFjzmfNoJoRdZEP/uNyB6drtDT2Eh9LFX4FthTd9khh/1VUNg56LvBnoQ3L 0O9a4Ab32gV+2I0aPk+jTpxJGVtWM3eXeja0Sj/UsKBvkJIgmXG3uzdEHqA54p9k5TGIRneH2FU 8q/K8Faajzx4VXXLW4lX7FwY/Gb1Kw== X-Authority-Analysis: v=2.4 cv=G4UR0tk5 c=1 sm=1 tr=0 ts=68f88d33 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==: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=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-GUID: tJBl9Ub9cuaQ3fUULhbA5Au5aNdFs57j X-Proofpoint-ORIG-GUID: tJBl9Ub9cuaQ3fUULhbA5Au5aNdFs57j 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-22_02,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 spamscore=0 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510180018 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