From patchwork Tue Oct 29 16:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13855299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E11DD3A67C for ; Tue, 29 Oct 2024 18:46:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3cE+RUByeBM+zxwx0nFzkXWP0WlZvWmSl98mTrUt0WM=; b=eaX6V6z4FXUbk8diYwUz5r/32i l9BwFER3PqC0yIMuMT9V1ezbJHs6Vitxm0QXVQZ4OkHBFgUc6iEPo2IU0ei6WoZ/KoJJG0/i4UUvL 4yFso01w7efEbRF982wY4u3xj8cX7ZN7LMahjrTtN+pyL5+1Njn+bXHBbla3MAOQiHRE0S6HoDybf dOaioRLcwWXGPMNpeBwL1cWL8PhNAc6hoebDG6bndUZ6OsFsr+FdLe+uED1QOQ+c4fx6YqZgipwwh 3Qrrfcx8uYF8DvBNds8U6k4arREsxVTsBQa4FP2sa/mJIE4qPZi5oOs/MS2d4LrmB5HfnhM2lRGwa w2h4zOrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5rEr-0000000FXh6-1XJp; Tue, 29 Oct 2024 18:46:45 +0000 Received: from mail-am0eur02on20627.outbound.protection.outlook.com ([2a01:111:f403:2606::627] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5pDN-0000000F8JM-23Aa for linux-arm-kernel@lists.infradead.org; Tue, 29 Oct 2024 16:37:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AuO9ePFZdXOcBZUWHRZW8UF/5alueua+z9cSymhZcJD5gZZMS4k7TkgUh8MOMBMqsW0JWcQRai26MGt6iuFyeQcBzEj3eB7KR1imXlk15jOTj8bBIAqQ15uVyaDbzEgYQ2YnMFqT6D4OQzOKeQ4hkOS3kpXbtERYPpY60Zwf3N7aRQYXfRCKNsbtJwiH3CJ60j20EfTsmT0syShncc3ZwfgHnL0BPRfscCDrLR5wLOkP0ftvhcxT2ZMd51OW5NVVOvEFIYl818lWgwWLim8aFyky2xV+O/Qyl6OoCeqim9Ro0CkfGaZHUThrPFEKccsapkdT8ZlNpKmqLKZJIjgAqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3cE+RUByeBM+zxwx0nFzkXWP0WlZvWmSl98mTrUt0WM=; b=x90kMYg9a5eLLvo4xsxgD86xoEaGwOY2eEkkBFCKai51G9ytCi/lVcwnLJzT5WPey0rZ0tuDB/zj5gHJ9FhPCMsGAI4J7LAfDIwLNYvHZmCx7wsnmQWxYs4QxWMyldsB5/iViFc6H/S4v6/MfMVjO5kEOmXB29qjZMeWubCehjUIdx0sZtARTh24SdRb5YsyIP2p0XV4Exc1uf9NpdVZ+hYnVBuIEUdCGBrkqGN9PLZ/fPTS5eAzLn7CcwanUjJGHNJPTQZCZstQCtVWmSIm+6DM6ydBUr+h+GEmrIaTW2YXnfJB7EqCoEH1V8w8j8IMfC3Zd2nqmhLVpm4uG8Da4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3cE+RUByeBM+zxwx0nFzkXWP0WlZvWmSl98mTrUt0WM=; b=izJQ6Xrvjfz2ZMujKMRe8bpAWHStD4V7yYH0VrVUa9dygYifTEFQF1ILT9cU5DCAeRK0NYtrwS1QSNtzmaEGeuLsWoK/STjxQEAfxH+rDIKZxW1dFFgQAgzOCTeAT0S2FgjtTAQcizCPrcFz+Iq8f2qoe0qeUlZ69dg3ewo1BRAJkigMkvUYvQSsKfgipm+n8dPSRNwWKEApkURdWOfea/pMJQf3/7QPkWCfJERL10NKnB49CjjvvXm8UQrOEzok3uQRMpcc99Kw8q8QnxFgXhnGJOZx1YVgGjFIJ+PeesabAyzVr53EAJPb3M1vmVs8soDYbhpvaM3JQ9EezUWcNw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DBBPR04MB7577.eurprd04.prod.outlook.com (2603:10a6:10:206::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:37:02 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.8093.027; Tue, 29 Oct 2024 16:37:02 +0000 From: Frank Li Date: Tue, 29 Oct 2024 12:36:36 -0400 Subject: [PATCH v7 3/7] PCI: dwc: ep: Add bus_addr_base for outbound window Message-Id: <20241029-pci_fixup_addr-v7-3-8310dc24fb7c@nxp.com> References: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> In-Reply-To: <20241029-pci_fixup_addr-v7-0-8310dc24fb7c@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1730219803; l=5662; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=IMipsZtRh42ozcH33850bFCfms+HZHuAJ8oMSR3hzdU=; b=FKTkpRxObUzPe+YEiqYW8Y9/yElh1Af5kmudHZK9r0Fshr9nflpupBLircq1RQSrr4tcidQ2u r2NuBCH7+QpBgYu3eaURUZKm7goAuMUfwdU0J3DonLt4ygIWmAcGoqz X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR13CA0035.namprd13.prod.outlook.com (2603:10b6:a03:180::48) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7577:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ca8fada-dbc2-4b4c-6b67-08dcf837ea8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|7416014|52116014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?CmCoQ9Ht/8ycG8b1YpXidbhjS2KmVPJ?= =?utf-8?q?zHLZrwS3yw21dKbc2aSjG4yiCEvQwA7A0q9zl9P+RrXfKdquglJj238/w2ZevomhP?= =?utf-8?q?Eg6i2UfZiaw6WopsZqGttxlF5b9GxkoOCpqN+NjtLi24Gyo+6eXiYn059akytW7As?= =?utf-8?q?F4VNdMwresEHiuxwHU8AQ7Fz07Ki3+7sZ7Gc6aOZVnGaeeeI4EI5RZ42B29B6Yqgm?= =?utf-8?q?BALO0V4PGuG22deywj+amuCVBJd9SoU9vHDBBm8cjSA24/0t7cuxxIpKXHThdqUSg?= =?utf-8?q?kcm5D8u1VmdbveVPZDKjLX61HpkhqL6jq8hh/I17CeG1VA+OxShEYiVX0D+Hrrb0E?= =?utf-8?q?7PjuZg2BUgZ0QiYgQ4Gtzc2inqsKEXy8PfgmKicEqqgh4jOEnRc2H0/YthxieH/0h?= =?utf-8?q?NBxzf3JslQxL07voO0iYTV7wjL34KGiEZu3aT6Vky+gsi3SGoYeinKkQimykPwGQa?= =?utf-8?q?PTQSaiYVheny8jwwvZs88IKX9gp8U8bQGGepnnqexHVgWKw7Ffag8nLoso+fEmb9Z?= =?utf-8?q?kxzADQ4xCqH+9dmDKV4A3tRyq0fj1mpJwdgSuSnKKtdAeMcTXqaOs5PtGxkv0+G2C?= =?utf-8?q?aPs5cuPKAm/a51k/lps2EBtYSb/H3ImIf0sRCxnWkTZvVJrUGTPtn3c3OATpGYKeh?= =?utf-8?q?vQmsBCy5+Hpbpt79IQMKJwTQ/JYaJEWONW3XLb8Zm23Uq5vNgHAFzuUblxW4VMZCB?= =?utf-8?q?+pNX0Y1FtZiMttZ6YxL/p9d8IuUpJ/dWoekDrmBzCg1gqr975jEWRJR+TaYpxQp30?= =?utf-8?q?DMeFJN4fiLPo42lgqM8wxRzlZtRmTJMeXWrTo7ATuZg48vWpATjmE/x3GN/8ZTxej?= =?utf-8?q?Nq6G9IpzN4KLICW9yt1Rfjjj+JM1K8e1t0afNaz2h4dWykIU6s7iuj3TFynQYGrOC?= =?utf-8?q?h+rqhFw5P7kx2N1yMlWacxSVzjPpWJ+hOn5RchcVZsBeo2dXR4Gyvp/sxbfwrINRJ?= =?utf-8?q?jNMQX0PpTREqO9RfhjQrce+0bOWNJ5Zm06Uy+4JNi/Jk/SLEVUpvYVPDUjdjlyUrY?= =?utf-8?q?z9aJzuR8OooVsOhOEU8bv20PHc4J02u1OeFSYWnAIqCUGIgNceyfKuQEdimdMPk56?= =?utf-8?q?Q6stOJE3/iLKkYbcR9mSoev6KhQWy42MWbcOQgSB5dc3BLTZx78nqfD0eiScVC3O5?= =?utf-8?q?LWFD5cTF9D9y/QTlQiOSCpWd/bf6IDreC0mRAl4skpDqbci/a8OWXh5pYAxPqvAtF?= =?utf-8?q?zhJSRCgt9IOaQxNyNdZ3JApcOCGD/rS8TFRRaPSWx8uY2Bep1rhzRJd/eAcMwpDQZ?= =?utf-8?q?twGdIYAQ16aBupNvf2WEM9Z1VmI6QvAZvXVnO9Sy/Pf+yo3VtEDLrHHOIHJd3Tbuv?= =?utf-8?q?CFL0lJeSOM2uoYTRKnE/Hbo7wQ2yXf/DOQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(7416014)(52116014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yU5ydLLz80jfLA5ZCMvhgD+D17kz?= =?utf-8?q?5tcLQReEYL61NvaQFrWPqw4s2l6/yrNSnfPt/WXBysLEh5a0PEpfr3QeVpjkV0Nu4?= =?utf-8?q?6P6h1hvEpbCoW+KKhOh84ed4iAFh150+QX1MDU/mB1VlUcYwTs3A0Obc8cHR1rhhP?= =?utf-8?q?mvHrB/qlBdJ0MVEUM2RppIGw6aZfLb/Km02R0F9jOYdKMjUnxWDtnnwxs5N9IPN4v?= =?utf-8?q?FhQEbTAziMS+FW6it4m3MioBRR2z02lBr6YP77iglqNPvqgwq4Ud8nM1J7Gc7zdTZ?= =?utf-8?q?Ih19iKoMxWOoaGOpItzKqenyzqKp7oy7LV16UhjOoW6+yj1RugH+i9GXPW2fJYL/y?= =?utf-8?q?gVUnOdfTdQiNawhA4UufDJ6dEDlrnnf+PRFfG4jUIpK5e+9LFNxUv2tbazyEkd5xN?= =?utf-8?q?YyY3VfEzd9CpM6ZHQM24CD6g7bBlPq5g+0zW2+SlF43MC9lZdQ+dt2AZQrxE16O7G?= =?utf-8?q?KmppeOESIvskjBYcKIzJDasK9ePiHKX2aT0NPNy7fUXzbs8aBdYm+7VvbbnJE0fn9?= =?utf-8?q?YertFv55fwXZQvaVirS58KQyq/dbg7LOUwx9GckpBhikFCswCmovK12gMlv3v8vXV?= =?utf-8?q?oTrpP/AN5PKxyAa2trKskoiBjiC0nUUcm+XYe+wHDbIADwkgT8z6UbCA/gcsPf21X?= =?utf-8?q?CA1EQm5Cqdv/3mPfnQIFuCqRyXNNqNecMCt8yNlGbOeE7HJU8Fd+pXcAXMLoqEfiw?= =?utf-8?q?KlAGI787h1NwNxXZIadShzq2YVNCZXPlQ8rJDUxlMrxBcTjIuZCC0XKJGL/r8uaa4?= =?utf-8?q?uVu+ZsKGXcz2kabOukCWbMUoPJ6Rb+ors+q0vxsnWYjX73b/wR8QDocYUCLek3LDt?= =?utf-8?q?vcrIJIMn4IQqUQ0K+IS9wH3duvh/kI8nmruHWBOeAAnH1VQv9LCn//exsoCNX54wR?= =?utf-8?q?IUT/ObolJq9lVWjQ0eDwhZyDjSol8ffJ2cJ27EPaUt6v+2BefIUH9XKGiAZYdLhgy?= =?utf-8?q?igiiFTV3vspdY1bt8ubHlvz6JrptBIlJ727lUWL0Cc+3QtDOK1uyLGb3pCcFVW2MU?= =?utf-8?q?OX4VYavPq6wfCzHWiy2yz609LFeaJHUnzhIQ5QJJuWPY5E6lzPxgi70q0zzkTm9uE?= =?utf-8?q?zaGkdNtRt1xSQpTbB0B+kgu/YHYbUL21P9KpVK8hAGWj0x/41EydQOKKZ/D3HufYN?= =?utf-8?q?4UNqXn65wceo8HKqhn1MNF0KF45FZtPgp0c0CtsfdV9BA1n7FYam2+BKLC6OtKYBk?= =?utf-8?q?PsG/fsSoytkqXoucNq7WQfFYLEUttZCqYDCB4LDNoGxroxt6y2uoGR/Lesahn+HZA?= =?utf-8?q?c+NCe/dNb6QZDnu6gSiZaZ9MrOX3DBU9ZZXd/3x+emkeNzcb0dFMt6EKG2fBn8klY?= =?utf-8?q?1ckg52KeJpk53XQOrRDXwl/jFQva1gOwjSe010wViYB+am+vw7W/K4KGRaLWpLDjX?= =?utf-8?q?BwTD9p17iXEdzpg6KuZGu9KZYQjB1WHpWDoMIMgFroyZa9BOjZ6VOL0aEV/z8IYZP?= =?utf-8?q?OLTAs3XPF/pRC6JHoB2WgNhXb6H8B9lr2rNAGcvnRgh3zaEVkSy0dYgogIHN/LHCc?= =?utf-8?q?EbDznKWACUyU?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ca8fada-dbc2-4b4c-6b67-08dcf837ea8f X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:37:02.5378 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9CCCn7cz3AH38vpgZaeSpChUNkWhNGyT7ELq9B4XKzuJBhXLJoO05Ga0OCNF3TxInF/onuRYwINr/lWqnyA9Fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7577 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241029_093705_707658_A4515DDC X-CRM114-Status: GOOD ( 19.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Endpoint ┌───────────────────────────────────────────────┐ │ pcie-ep@5f010000 │ │ ┌────────────────┐│ │ │ Endpoint ││ │ │ PCIe ││ │ │ Controller ││ │ bus@5f000000 │ ││ │ ┌──────────┐ │ ││ │ │ │ Outbound Transfer ││ │┌─────┐ │ Bus ┼─────►│ ATU ──────────┬┬─────► ││ │ │ Fabric │Bus │ ││PCI Addr ││ CPU ├───►│ │Addr │ ││0xA000_0000 ││ │CPU │ │0x8000_0000 ││ │└─────┘Addr└──────────┘ │ ││ │ 0x7000_0000 └────────────────┘│ └───────────────────────────────────────────────┘ Add 'bus_addr_base' to configure the outbound window address for CPU write. The bus fabric generally passes the same address to the PCIe EP controller, but some bus fabrics convert the address before sending it to the PCIe EP controller. Above diagram, CPU write data to outbound windows address 0x7000_0000, Bus fabric convert it to 0x8000_0000. ATU should use bus address 0x8000_0000 as input address and convert to PCI address 0xA000_0000. Previously, 'cpu_addr_fixup()' was used to handle address conversion. Now, the device tree provides this information, preferring a common method. bus@5f000000 { compatible = "simple-bus"; ranges = <0x80000000 0x0 0x70000000 0x10000000>; pcie-ep@5f010000 { reg = <0x80000000 0x10000000>; reg-names ="addr_space"; ... }; ... }; 'ranges' in bus@5f000000 descript how address convert from CPU address to bus address. Use `of_property_read_reg()` to obtain the bus address and set it to the ATU correctly, eliminating the need for vendor-specific cpu_addr_fixup(). Add 'using_dtbus_info' to indicate device tree reflect correctly bus address translation in case break compatibility. Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam --- Change from v6 to v7 - none Change from v5 to v6 - update diagram - Add comments for of_property_read_reg() - Remove unrelated 0x5f00_0000 in commit message Change from v3 to v4 - change bus_addr_base to u64 to fix 32bit build error | Reported-by: kernel test robot | Closes: https://lore.kernel.org/oe-kbuild-all/202410230328.BTHareG1-lkp@intel.com/ Change from v2 to v3 - Add using_dtbus_info to control if use device tree bus ranges information. --- drivers/pci/controller/dwc/pcie-designware-ep.c | 21 ++++++++++++++++++++- drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 43ba5c6738df1..a5b40c32aadf5 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "pcie-designware.h" @@ -294,7 +295,7 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no, atu.func_no = func_no; atu.type = PCIE_ATU_TYPE_MEM; - atu.cpu_addr = addr; + atu.cpu_addr = addr - ep->phys_base + ep->bus_addr_base; atu.pci_addr = pci_addr; atu.size = size; ret = dw_pcie_ep_outbound_atu(ep, &atu); @@ -861,6 +862,7 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) struct device *dev = pci->dev; struct platform_device *pdev = to_platform_device(dev); struct device_node *np = dev->of_node; + int index; INIT_LIST_HEAD(&ep->func_list); @@ -873,6 +875,23 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) return -EINVAL; ep->phys_base = res->start; + ep->bus_addr_base = ep->phys_base; + + if (pci->using_dtbus_info) { + index = of_property_match_string(np, "reg-names", "addr_space"); + if (index < 0) + return -EINVAL; + + /* + * Retrieve the local bus address information, which is sent to + * the PCIe Endpoint (EP) controller. If the parent bus + * 'ranges' in the device tree provide the correct address + * conversion information, set 'using_dtbus_info' to true. This + * allows 'cpu_addr_fixup()' to be eliminated. + */ + of_property_read_reg(np, index, &ep->bus_addr_base, NULL); + } + ep->addr_size = resource_size(res); if (ep->ops->pre_init) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f8067393ad35a..f10b533b04f77 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -410,6 +410,7 @@ struct dw_pcie_ep { struct list_head func_list; const struct dw_pcie_ep_ops *ops; phys_addr_t phys_base; + u64 bus_addr_base; size_t addr_size; size_t page_size; u8 bar_to_atu[PCI_STD_NUM_BARS];