From mboxrd@z Thu Jan 1 00:00:00 1970 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 0B487CCFA03 for ; Thu, 6 Nov 2025 07:01:25 +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: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Date:CC:To:From :Subject:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=N7Lq+LFeAMurs2Tl7eDUkZp7Sk42LHrVgEvI6mIOlmQ=; b=uZz+Imdog2NYaqy4RzZ/mFd5hK UD5oarSMoLiTtZ6uRpTghWXWupcV2sMthJFCY1mICA8yZf/AHofxus9YgjEzRQeD7bh63Ld0iFasm 1hl9RqNVOYtJ2d1q1R/v6S7WszTBawc6Gn1P5cXnrq/bAAIOGHCNbh4WIvQVDCb8Wxji6qQFLTUXT Kc5m/oEbwfNJygXemRl8rjMULGIDq1K/Bwsf6sIloxQa0cxOcq2j4+BoL282mS8T9SMNTwiCe/uFr 7P5NFVVWFjNCASiSeXARBRG9LZidj0USNKEcedtJhhdacRsZ4MDhdjndzNlrM8oeCi/Bw8HkuEeOZ x5+/4jNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGtzi-0000000EyUN-1hue; Thu, 06 Nov 2025 07:01:18 +0000 Received: from mail-eastus2azhn15010017.outbound.protection.outlook.com ([52.102.138.17] helo=BN1PR04CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vGtzd-0000000EyTx-3Lzz for linux-arm-kernel@lists.infradead.org; Thu, 06 Nov 2025 07:01:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZTQCxEb6H8CMasMFIO7eCp5wfYEqffZqR+ZTYrTBK48SWCi/78xbk++behU71YUKbQ4KThphuoozkICjZRXhiL2sBuJi4YbkdzvdNy9te+6pNCk+64JFT+OJ+BbMndgyD21V2d+ehk4aDR7kArMCEfI6AxXRF54pT+GG6f8uEazB9eL+RmK3Zrydx9zG5OpKD8BWHf1HFXTsP6nf4A4zdfrFNcL7aGurObhwd36tAqPqGdyhNM58Y8mdO/6Cbrz4OOMJqLpH48Hxz3vNT/t0owP02Zs4spgT95qf60TN4gh5n230RggRtvHs7TbHl/Sx3FE/5LlqVTGpGYy0MX+BJQ== 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=N7Lq+LFeAMurs2Tl7eDUkZp7Sk42LHrVgEvI6mIOlmQ=; b=ecW10f+gG/3ItRUzMfJNcP0GtT1++30OYcc7QNLgKi76Zq487tQVNGM0qFqylgfW73VkvYvAtqo/OTyrcf2AowM3XHcq031PCDa4fHET9MA0Y7EsjKQ7v+kYDWB13tsQ68EqWdWFfDwisyxLrRsDmyoYAWeEy1DwK74A5WldsqUYzmYWC/cjEo9JzuMZ7CnMbA6u1Ip+1403Lz8jk5JYisN82zqOHDaOdEOjo4TWLiPeDSAAyikWMWP35NjLRjFuYavwC3dVrxjzVFK4rJ2SyoeKopHj5ZK0oxq+JDwxMmzBC6+rfJMnF0BZH3Q/qV6d7TqQ2Y0uurzLFPEd/PEH0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.21.195) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N7Lq+LFeAMurs2Tl7eDUkZp7Sk42LHrVgEvI6mIOlmQ=; b=CXJiICBS9X/QJkqSUtB6vFHcr2XHvS3RQOeDMXzr5JVhgC6ghsIZf1oCOXowH4V9HQD2+52RLQxhR7mowvvHq/iry66eizVf9xsD30lYaBBA0Stt/vMPVjzEWsBD2Tgk2ws1ahelkwz2tVu62A+0Ku04IsW8HDV4c9VZQO42rlU= Received: from SJ0PR03CA0350.namprd03.prod.outlook.com (2603:10b6:a03:39c::25) by SJ5PPFE654FA166.namprd10.prod.outlook.com (2603:10b6:a0f:fc02::7da) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.12; Thu, 6 Nov 2025 07:01:09 +0000 Received: from BY1PEPF0001AE19.namprd04.prod.outlook.com (2603:10b6:a03:39c:cafe::d7) by SJ0PR03CA0350.outlook.office365.com (2603:10b6:a03:39c::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9298.12 via Frontend Transport; Thu, 6 Nov 2025 07:00:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.21.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.21.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.21.195; helo=flwvzet201.ext.ti.com; pr=C Received: from flwvzet201.ext.ti.com (198.47.21.195) by BY1PEPF0001AE19.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.6 via Frontend Transport; Thu, 6 Nov 2025 07:01:07 +0000 Received: from DFLE204.ent.ti.com (10.64.6.62) by flwvzet201.ext.ti.com (10.248.192.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 6 Nov 2025 01:01:00 -0600 Received: from DFLE212.ent.ti.com (10.64.6.70) by DFLE204.ent.ti.com (10.64.6.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 6 Nov 2025 01:01:00 -0600 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DFLE212.ent.ti.com (10.64.6.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Thu, 6 Nov 2025 01:01:00 -0600 Received: from [10.24.73.74] (uda0492258.dhcp.ti.com [10.24.73.74]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 5A670scI842574; Thu, 6 Nov 2025 01:00:54 -0600 Message-ID: Subject: Re: [PATCH v5 4/4] PCI: keystone: Add support to build as a loadable module From: Siddharth Vadapalli To: Manivannan Sadhasivam CC: , , , , , , , , , , , , , , <18255117159@163.com>, , , , , , , Date: Thu, 6 Nov 2025 12:31:08 +0530 In-Reply-To: References: <20251029080547.1253757-1-s-vadapalli@ti.com> <20251029080547.1253757-5-s-vadapalli@ti.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.1-1 MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PEPF0001AE19:EE_|SJ5PPFE654FA166:EE_ X-MS-Office365-Filtering-Correlation-Id: 385f01e1-6533-49bc-6863-08de1d0242b0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|34020700016|36860700013|82310400026|1800799024|7416014|376014|12100799066; X-Microsoft-Antispam-Message-Info: =?utf-8?B?dGdvMDJzLzVaODZUV1VVRmphOWlsOU15MmFJVTlVUVZFdFBhcW1iaHNab0lI?= =?utf-8?B?anlWUzNzcjRpbk96TDFKa2pFYTV0ZjV5dmU3cSs1am5iMEpMdXc4RitQeWVu?= =?utf-8?B?K3NET2psZ1EyZENFdmh4VUFmSUp6c2dxSDZQd2xBWWtKY2xVV25sdXdPTG9F?= =?utf-8?B?MVZod3ArWFA1OXV0RHQwTmtrNHZPYWRpd0NpOFJmUGhFT3lUTklBYXYvVE1O?= =?utf-8?B?Nm9Nc05WQW9aUU5pUHRHa0d0SUZFQitOaTNQQVBJU3p5QXdQV25qVXF6V1BU?= =?utf-8?B?UkhiWUdYNXYyNWd0SWNTb3BKdXhxLy9XLzJTWExDMUxLM0crZDV0RWx0K3ht?= =?utf-8?B?TU9Rb2I3SU1pWWtLVXdHbU53VUpBOFFObUd0cUVHb3dyZzVoZ05lUGRkUGtZ?= =?utf-8?B?QllxbTNtTUZ5M3lzZ2l6MlZveWEyZ0pnblI2S2U1NlAwcjFrRnJXZktESVdr?= =?utf-8?B?emV0U2xrSnVUMjhjdnNVY3paaGhmZ3BteExMb0QzRWJBcXFoZ0pZUEdxMkV4?= =?utf-8?B?TTR5T2R3d1VNRnRLYzJYckRaSkowaGFPcm9Ibnh2ZFR5Wm9BZjl2S2hsSXpP?= =?utf-8?B?UzZrZTRQNFlFUVp5d3VFaEhmWU16TERZTXVySVhiLzUvLysvUDladVBHcmNl?= =?utf-8?B?LzdrY2JwZnpaWlNndWRkbmhwSH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ZXNTMHNld0RPbEZhVWdzT09KZzBKZlMydS9UZUhWYnRVN2xiMlorRVFN?= =?utf-8?B?T0JYeFJoQ0JCa2dtUEFmVGtsVkw3ZW5xQlBmbnBtNnNOSFl0V3pidDZDa3Vm?= =?utf-8?B?QU11dmkwL1p6cjlCQzZiellRYkdVcmRFcUdzN3V6bmVIcVRncHdBS0FQZ1ZF?= =?utf-8?B?cVBNdlFoNWVBZGRrL0ovemkzS3EyWW8xMkxuYnVMeDVHNzJObHVCdmxCczhM?= =?utf-8?B?UGE5cFQ5bWt2U0g0ekJqODMyOVhYYjlPdVYrUDIzcER5NElnS0pIRWFhdzU5?= =?utf-8?B?R2Q3ODluZXBDRURMbDFQcDhmcnMxbWNLUmJCUldmUWZiTS9jaDcyeGc3RjV5?= =?utf-8?B?TUVudUtscm9yR0FvQTlQY0tMMkJYZmU4OERJR0pvMWorMU9vVVdnd3U2bTBB?= =?utf-8?B?dGtTdDNtYjNtakZjS3Z4RE5MU1JxbmJ4MTk3YzZYUnU5ejFINlkrcy9LZm9Z?= =?utf-8?B?cmt1U1VZVHVBTnJLNmlLMWZsSExJcCs3U25iOG5OM3FTdEsyZ2s1NEZ1aThN?= =?utf-8?Q?VHCg=3D?= X-Forefront-Antispam-Report: CIP:198.47.21.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:flwvzet201.ext.ti.com;PTR:ErrorRetry;CAT:NONE;SFS:(13230040)(34020700016)(36860700013)(82310400026)(1800799024)(7416014)(376014)(12100799066);DIR:OUT;SFP:1501; X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2025 07:01:07.8280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 385f01e1-6533-49bc-6863-08de1d0242b0 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.21.195];Helo=[flwvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: BY1PEPF0001AE19.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ5PPFE654FA166 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251105_230113_848446_0C15D0E8 X-CRM114-Status: GOOD ( 33.40 ) 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 On Wed, 2025-11-05 at 22:53 +0530, Manivannan Sadhasivam wrote: > On Wed, Oct 29, 2025 at 01:34:52PM +0530, Siddharth Vadapalli wrote: > > The 'pci-keystone.c' driver is the application/glue/wrapper driver for = the > > Designware PCIe Controllers on TI SoCs. Now that all of the helper APIs > > that the 'pci-keystone.c' driver depends upon have been exported for us= e, > > enable support to build the driver as a loadable module. > >=20 > > Additionally, the functions marked by the '__init' keyword may be invok= ed: > > a) After a probe deferral > > OR > > b) During a delayed probe - Delay attributed to driver being built as a > > loadable module > >=20 > > In both of the cases mentioned above, the '__init' memory will be freed > > before the functions are invoked. This results in an exception of the f= orm: > >=20 > > Unable to handle kernel paging request at virtual address ... > > Mem abort info: > > ... > > pc : ks_pcie_host_init+0x0/0x540 > > lr : dw_pcie_host_init+0x170/0x498 > > ... > > ks_pcie_host_init+0x0/0x540 (P) > > ks_pcie_probe+0x728/0x84c > > platform_probe+0x5c/0x98 > > really_probe+0xbc/0x29c > > __driver_probe_device+0x78/0x12c > > driver_probe_device+0xd8/0x15c > > ... > >=20 > > To address this, introduce a new function namely 'ks_pcie_init()' to > > register the 'fault handler' while removing the '__init' keyword from > > existing functions. > >=20 > > Signed-off-by: Siddharth Vadapalli > > --- > >=20 > > v4: > > https://lore.kernel.org/r/20251022095724.997218-5-s-vadapalli@ti.com/ > > Changes since v4: > > - To fix the build error on ARM32 platforms as reported at: > > https://lore.kernel.org/r/202510281008.jw19XuyP-lkp@intel.com/ > > patch 4 in the series has been updated by introducing a new config > > named "PCI_KEYSTONE_TRISTATE" which allows building the driver as > > a loadable module. Additionally, this newly introduced config can > > be enabled only for non-ARM32 platforms. As a result, ARM32 platforms > > continue using the existing PCI_KEYSTONE config which is a bool, whil= e > > ARM64 platforms can use PCI_KEYSTONE_TRISTATE which is a tristate, an= d > > can optionally enabled loadable module support being enabled by this > > series. > >=20 > > Regards, > > Siddharth. > >=20 > > drivers/pci/controller/dwc/Kconfig | 15 +++-- > > drivers/pci/controller/dwc/Makefile | 3 + > > drivers/pci/controller/dwc/pci-keystone.c | 78 +++++++++++++---------- > > 3 files changed, 59 insertions(+), 37 deletions(-) > >=20 > > diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controlle= r/dwc/Kconfig > > index 349d4657393c..c5bc2f0b1f39 100644 > > --- a/drivers/pci/controller/dwc/Kconfig > > +++ b/drivers/pci/controller/dwc/Kconfig > > @@ -482,15 +482,21 @@ config PCI_DRA7XX_EP > > to enable device-specific features PCI_DRA7XX_EP must be selected. > > This uses the DesignWare core. > > =20 > > +# ARM32 platforms use hook_fault_code() and cannot support loadable mo= dule. > > config PCI_KEYSTONE > > bool > > =20 > > +# On non-ARM32 platforms, loadable module can be supported. > > +config PCI_KEYSTONE_TRISTATE > > + tristate > > + > > config PCI_KEYSTONE_HOST > > - bool "TI Keystone PCIe controller (host mode)" > > + tristate "TI Keystone PCIe controller (host mode)" > > depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST > > depends on PCI_MSI > > select PCIE_DW_HOST > > - select PCI_KEYSTONE > > + select PCI_KEYSTONE if ARM > > + select PCI_KEYSTONE_TRISTATE if !ARM >=20 > Wouldn't below change work for you? >=20 > diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/= dwc/Kconfig > index 349d4657393c..b1219e7136c9 100644 > --- a/drivers/pci/controller/dwc/Kconfig > +++ b/drivers/pci/controller/dwc/Kconfig > @@ -486,8 +486,9 @@ config PCI_KEYSTONE > bool > =20 > config PCI_KEYSTONE_HOST > - bool "TI Keystone PCIe controller (host mode)" > + tristate "TI Keystone PCIe controller (host mode)" This doesn't alter the build of the pci-keystone.c driver. From the existing Makefile, we have: obj-$(CONFIG_PCI_KEYSTONE) +=3D pci-keystone.o implying that it is only CONFIG_PCI_KEYSTONE that determines whether the pci-keystone.c driver is built as a loadable module or a built-in module. > depends on ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST > + default y if ARCH_KEYSTONE The default flag only specifies what should be selected by default, but it doesn't prevent the user from attempting to built it as a loadable module using menuconfig. Building the pci-keystone.c driver as a loadable module (CONFIG_PCI_KEYSTONE set to 'm') will cause build errors for ARM32 platforms due to the presence of hook_fault_code() which is __init code. The Kconfig and Makefile changes made by the patch do the following: 1. Allow building the pci-keystone.c driver as a loadable module for non- ARM32 platforms by introducing the PCI_KEYSTONE_TRISTATE config which is a tristate unlike the existing PCI_KEYSTONE config which is a bool. 2. Associate PCI_KEYSTONE with ARM32 platforms and associate PCI_KEYSTONE_TRISTATE with non-ARM32 platforms to prevent users from building the pci-keystone.c driver as a loadable module for ARM32 platforms. Regards, Siddharth.