From patchwork Mon Dec 9 17:48:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13900112 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2066.outbound.protection.outlook.com [40.107.249.66]) (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 648C1140E34; Mon, 9 Dec 2024 17:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.249.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733766522; cv=fail; b=j+IbUhwP4vQG8uylMo0pYdbCXB5a6rDoa0xkKonO9rBnIBr0rFVTJrqM/JomPJsIpo89FGoUnxB989FSeSWf1pksGTuj4vQTuIn2emm0pvPKAKhi+cnXIQLcmVe7EUoH25KTsERSEKEhSuvitZqkHD6KQ97yCOveSWmlrJhQ9Rc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733766522; c=relaxed/simple; bh=LwZKkgffD4LQgun+GAdCSYBbNjFFRo6II4pFFwHjCfE=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=uPs308PFS4NKvbYOdgHpOWumMvw2RrAp+XmmdsGXpgHztbDHnjcs9yybqYjz+3ulVr8qT5FLOBQLMeufwNxxJxss51PMe5HKcqr0MCAfxpufgZ/ThYjCLg3klheGXpbYaPbPEvqcRoUar0fUh/efhW9l/pjdFlGsTwuVO//ilyc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=fEec73pH; arc=fail smtp.client-ip=40.107.249.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="fEec73pH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NAtNm55Xl/dUwlQmDhaa6UXt4IwriCwKZtb5g4LxmcYblHEkMoCimKfEZjVi8Eub7NPwtSoVVcGoG9Q7CUM9kImrOObjQwcLshk1uLWhtX8nN1L+5XoPmXSnnQb4jugRMMZamo9KWGRBzYfEa2y+Q6W/H/26Ma5v/nkknVriWbjv5M5XBEIyW9wQKKM1jL/FFJlBucWX0VpUkH1yHGme23rzSbcrKrdk7SoGGfAiS5d1bYhdEfn3AwZwRXGkVM/OtcVz+FRPJjVOXd873tNyjxq5RN6GiR6zSWnbjfBbklG9gyTU+KgqlcPcjolTQtSI5Q9Z4utLSAbo5kcgRpKQow== 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=RJIfaPd45JflIwKJaxgB1f6UjHuV3xSNtxbfq5Z3Yjw=; b=Z/cxVDVxk29tdl/ZlPg8K7/9jWVZhgSNF6qzQ8B5ATKWmHKKsvA00+PprIvli1fJOi3BnWWthIbKJj+AaAvDOJNfc+S8V38kWOQ5VaREolgyrlh7h9NGEjSVpcR7/CTGAytukmVHUKgVhdWjUEE0TvDnqfbj1J0GqdkzAj6+7CO6qXE6HtV/9nsheiPy0jsU2kMAuE2Nk5j/iKRuMuhBoU/ADJYs8cyiI3ChN2b/eEqgMR9SfNhSGEB+R4yJBEKCsnXKRGWoKnNd/wWoxX5vkc8awYf/sHeZPgbgCxgJ2XnxZnzjMT26swhfjjZyzA4+RVOKmxcq+UZgn/UNoKX3/A== 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=RJIfaPd45JflIwKJaxgB1f6UjHuV3xSNtxbfq5Z3Yjw=; b=fEec73pHgRPQLC1RD5EqvjlFc5e7l7scCNss4IGtzaE2KAnliNc7PyrMJuAY3O8uztU/zWDpJDuU/EC/ERhUYCecBJZVYfaMrYJs1xRmjR+ygQsvFoVTXzmoFlVLtxUxr3aQQNJsA6xLSQrud5ayhefLZ2VQl2b5XZdU30xAyTtfwhCT9snqXiWgzX+MxxMqrM6VSatrfXtmSgP2qe5ZkGOrJned3uXYlFyLU1E0XX/dTpcNW9DCX9fF9BQd6wkuXERohIw7jWTkfvhYra01pmfQP/SexTPc5mJSVq8wzXcw7W87yfidnDyJa0wkhzoBSGEblXylObyNny9xJ9hbgQ== 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 GVXPR04MB11017.eurprd04.prod.outlook.com (2603:10a6:150:21c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Mon, 9 Dec 2024 17:48:35 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.8230.010; Mon, 9 Dec 2024 17:48:35 +0000 From: Frank Li Subject: [PATCH v11 0/7] PCI: EP: Add RC-to-EP doorbell with platform MSI controller Date: Mon, 09 Dec 2024 12:48:13 -0500 Message-Id: <20241209-ep-msi-v11-0-7434fa8397bd@nxp.com> X-B4-Tracking: v=1; b=H4sIAF0tV2cC/13RzW7DIAwH8FepOI8J801Pe49pB8CwcmgaJVPUq cq7j1QqITva8u8vW36QOU0lzeR8epApLWUut6EWAG8nEi9++E60YG0QzrgEBoymkV7nQm2Q0Qc hAoRE6vA4pVzuz6TPr1pfyvxzm36fwYvYuq8I9YpYBGU0JozWedAR/MdwH9/j7Uq2gEV2SEBDs iIDBj1H5wK3R6R2BMw2pCryIJ2CyJAxc0S6Q8Ab0hVJlZ3hPInI/61neiQbMhWh9NF4nwPyeES 2R7ohW5HOkLXNGSGEI3I74kw05LabNMMQRQaFeETAerXvVz/IqDVRGFsl6o6t6/oHax+biBACA AA= To: Manivannan Sadhasivam , =?utf-8?q?Krzy?= =?utf-8?q?sztof_Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , Arnd Bergmann , Greg Kroah-Hartman , "Rafael J. Wysocki" , Thomas Gleixner , Anup Patel , Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, imx@lists.linux.dev, Niklas Cassel , dlemoal@kernel.org, jdmason@kudzu.us, linux-arm-kernel@lists.infradead.org, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1733766511; l=8586; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=LwZKkgffD4LQgun+GAdCSYBbNjFFRo6II4pFFwHjCfE=; b=2WwrUQwmk7UUG0NJhUNX+9mQF5fSk889VGmrFCCSKgmvPTMQU/QhOz0MPuf+OEteWpLU1p7Z6 ZEMNAvxsDL5ByEdpuiU1GB4G8NOXECWSWGnTo0oALw6WKWlooMgNCye X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR17CA0070.namprd17.prod.outlook.com (2603:10b6:a03:167::47) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|GVXPR04MB11017:EE_ X-MS-Office365-Filtering-Correlation-Id: fb00ea6e-2c3e-4afe-0411-08dd1879b446 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|366016|1800799024|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NGFlvW9bIouLWuLIWKDpyI8RAjgkbid?= =?utf-8?q?Iwo1DCt+9XaEtecjf28d0/1XpK9AppnALgP2kuwtJnYt3NYdLJitkz5P0P5k+IFEv?= =?utf-8?q?wcZXHrnd1j5wFqaRZ3ZyuUJPozFsyj5iOQqJxRG0IdlhfbF+3mgziGCFtTcqV78Ka?= =?utf-8?q?AOn34x2CVRS0/JJC0cdfjBO2LNeUtx9yNqoLBCKZ5pNgSDRD/rnLT2FcDtLIenM9Z?= =?utf-8?q?dU1W6C2cyDjHVzB/vpCSI0rSLaVgO8ZjiTkvhd4r0lbpXZXZ3x7L3QB+AKWTT+1wV?= =?utf-8?q?qLES0/iTh0lYh51kAHBQW8IlBYWT8jq+17muN4F8n7vP57a/xIJYg0KLOmoT6ZUCU?= =?utf-8?q?hV74GN2NrHp1ThxcOOh+5co3GvUOAbeLCc3mRNPJLxoxfIPK4KIQNyaA4mOu9J3z1?= =?utf-8?q?CimSLaQiJRV1T+O3OnR24fPYOqxfF/xjZ8iBIoclgepdhkgDVqaWS1JJtlz7D/ZZn?= =?utf-8?q?QAvMJ7cshlGJ7k/uof3wWQ2ybvanwCn8NyAh6inFNaNIOzWUiDy5QyOWrpwj5mEk6?= =?utf-8?q?ISH9O/b6vgTK2HPOYMl5H6rEb4HjndQz1f/Np5+hwx38+TVHIwHqSSn3izjSh9tWj?= =?utf-8?q?aDwJ+4sZ4w/qU9dPokovM3xISjDCOd5ATUscNkkhj5tYQ2yW5k6BDgDlfb/dtY1XS?= =?utf-8?q?svTiSOwK0yY94FGXmsSnJzSrUALi9qhOENR+kDGVHPx442jstFZUKsLNg3wgc0gWc?= =?utf-8?q?RRpqdjz7xosA52BcEfArkoaNNj+5rZJUoosLPOLMg4OOrFIkQVN4706H7sVKUnQmG?= =?utf-8?q?qz79u//J8FqQiqM6momXGm83k8yCfGUvEMYX6sNBxuhgCpEnt1IqTmXZXlJ6nwJWo?= =?utf-8?q?J6n1UXJFFLjBbdvrSXpMv7jcaPM8UIoTIWTr4/d08ZYJ39RxmA4UsFZVYTXr4FcdW?= =?utf-8?q?aM/daS/Iu/dVjGHTnTUEj7K/pJjvcvC2dux/Stmk6WfMQhcMiTCzaG3bZLtkrcCFG?= =?utf-8?q?4/8Py9oOEN7za//lhV3arRHue6EqdNYSLReOS9s5aakXqp+EOUIsPbFR7Q5ssMc3R?= =?utf-8?q?dLl+5vGyFlUceYUXgcPX9Z05p3Gajv1i5YswDkfstt4h8y2E9qTYkq5yzoCtI654R?= =?utf-8?q?Ypfz6GBR7/kZzg9BHTCrgAgIE4XJCwVs5JK1tpERDv30yvg8o2IM1dboV2EbZsUxd?= =?utf-8?q?VQDdoHgbUhnEJe/dKYNxwKQy/6Je1WgH81wGV3VM/+rIvweB3wqBcMeq/3EpaL1mp?= =?utf-8?q?t1YYU/fW2KjxjeyvkqOxOtCTBBysQmW5bmGub8nsJYy99Op8n/x7PaGnmd8pN1630?= =?utf-8?q?TBXhCywbdgvS5GJHWGJjb4yKgrD2r3ZmV1Y9HheilUkc0viRq5Zkc60SIHTo+6x8X?= =?utf-8?q?8VgBs+TGTckRfpC/jppN+2bw8jRzaYyeE/tYbZ6sojDsi5xKVVKAnek=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)(52116014)(376014)(366016)(1800799024)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?yWS7fpoqSaVQ5Ws5kmuCw2iHdLyI?= =?utf-8?q?PG1paDhStP7cndVDm3rUq6tXn+muRSIepEU7brHpC4c75fRcxU8+0L0Fl6ilidRev?= =?utf-8?q?mILmKWHz/x+loSzJ2MEnaN0/ZX7bD/CRmdnS7iWQrPIRX09rSVJ6FDdsSDnScqCD1?= =?utf-8?q?eW67HbMzdoiGA1htLO2cpaWDdbXbfhAa+AhQfZh95D3fKRpShUhHqBpfYJrWZgGFu?= =?utf-8?q?UE2bdsZyUTcajyoUjRqqTszUtp0zX3lKwsMR5Ekuj1QIuo2VkHprIx9+otBKNxN1J?= =?utf-8?q?I0j6TU8cgcit39Cvgwj1XuU6a2z2iH064/Aoimx2hLsGD/XblpQ19Tz3L1NavxPeP?= =?utf-8?q?VkiVF0qmsEPETn92b9vPwPKq04R2XOwXbryFyY7d9mY7HzFnAJLQLyVq5kaI0cUQW?= =?utf-8?q?Ae3cggeIA0MrV8kzcdp11TNxgEp8aW3x+iKLFZnS+ROucAGkI/nXdXgFV3rhNwWRs?= =?utf-8?q?nlJsdpLOoxnFClxyzFAlwSJY+wELn0QqyUIA96Xb8021QwkctvNbavaPODaM4vM9q?= =?utf-8?q?OG2gIxmLQ0+oXypVIG77I1ZSskhNgBPhVINJlbKgCVybCYbPsrI0cyQentvXUqIAK?= =?utf-8?q?HSt+MOWNEERj6+mJeZsIbryIAW/nl7P+nWFvBh7AX6TN2OaD25Dg4467Mo2r3fdgl?= =?utf-8?q?t+UhLIkMXy6YEDkZubGcP+SYynMU+kbTizSUC7ilNXR7m09DNjkaW8AujfLfCAqMD?= =?utf-8?q?l25SvxPD5trp1t0kdoh0tDppE5lm/kLJhCN1H4j4zB/HLBUrPnvFUxAy+ZACk4fHz?= =?utf-8?q?WClq5QA5SujnuaJaYcyUND/nJcoUx8p+HS+Md3xnsyce5hO2XlcPftIkBUEyheyzZ?= =?utf-8?q?WPmDaLTbkYW/BHZ/u55Yq9+kb2RX1Yl4URfoIw6d0ZfLNzshKayZ6tDKNXn03iO2W?= =?utf-8?q?JjQMrcLR+jlxQKp8cqrpyXob9AE1mZ2WI2X+MIe/Gq4NU3DtSlWVZFAZZ22RQregb?= =?utf-8?q?wNKWe5aREyHJhsOMc4TlEJthSuzgzMo+yj9IqcK3fvHfg42jTav9sHpzEbpmClf6S?= =?utf-8?q?HUOfCwIEsaOlNtPSpiGM2p/3IYW1aMKXABLIqUUf25I88hXI7cFFIKf/Tqs9wRxt1?= =?utf-8?q?u5tryPtj8W3sda7uEOMQUrtSHwt/+GuaiuLA19yGQ10Ii2oTwPib0VdBZXW44gCQv?= =?utf-8?q?mouT5Aii6olkb5HchVaBR1x5cd4MWBybQ+pfHx0M/IWZAFqlJIvjzx97CaE2akzrE?= =?utf-8?q?Ck2EHdtmjxOa3JeA/ukoEGJgP70e7dQrHeDYE3f9g5gtmN/WUR4sX2YCY6tlrInpN?= =?utf-8?q?Xmhq6A6ZrsdphrNT4U3fnkKHW4VyVr+ygUKaFXKkYg4TcxgpV52EgvyrlLlAHr3HD?= =?utf-8?q?GkEIZ5c8367BRvRh8XDvX69BSGWq7C5pwIgFvAf2eES3xqnXHOm+nJ9EqHB9a4hoG?= =?utf-8?q?XsKp1ZT+Cotv8Se9fWEFotCkLegpiuSlkjIW4lF9JHdte0fUFA7g0ZM+nAwMYwJIi?= =?utf-8?q?tVLRt7s3Ckq8ruZbj+qdTPAE5wYkRyPMP776w6C3TIOLTtBbNAuLb6Ns=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb00ea6e-2c3e-4afe-0411-08dd1879b446 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 17:48:35.2175 (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: tb6EdcZmePclHBcT9Ha3snpEIusL7//67YBvmTw+r6F1txrpUDi+gK0RROUv4Au4LIKA91wfKzYQle40n+Q+Wg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB11017 ┌────────────┐ ┌───────────────────────────────────┐ ┌────────────────┐ │ │ │ │ │ │ │ │ │ PCI Endpoint │ │ PCI Host │ │ │ │ │ │ │ │ │◄──┤ 1.platform_msi_domain_alloc_irqs()│ │ │ │ │ │ │ │ │ │ MSI ├──►│ 2.write_msi_msg() ├──►├─BAR │ │ Controller │ │ update doorbell register address│ │ │ │ │ │ for BAR │ │ │ │ │ │ │ │ 3. Write BAR│ │ │◄──┼───────────────────────────────────┼───┤ │ │ │ │ │ │ │ │ ├──►│ 4.Irq Handle │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────────────┘ └───────────────────────────────────┘ └────────────────┘ This patches based on old https://lore.kernel.org/imx/20221124055036.1630573-1-Frank.Li@nxp.com/ Original patch only target to vntb driver. But actually it is common method. This patches add new API to pci-epf-core, so any EP driver can use it. Previous v2 discussion here. https://lore.kernel.org/imx/20230911220920.1817033-1-Frank.Li@nxp.com/ Changes in v11: - Change to use MSI_FLAG_MSG_IMMUTABLE - Link to v10: https://lore.kernel.org/r/20241204-ep-msi-v10-0-87c378dbcd6d@nxp.com Changes in v10: Thomas Gleixner: There are big change in pci-ep-msi.c. I am sure if go on the corrent path. The key improvement is remove only 1 function devices's limitation. I use new patch for imutable check, which relative additional feature compared to base enablement patch. - Remove patch Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() - Add new patch irqchip/gic-v3-its: Avoid overwriting msi_prepare callback if provided by msi_domain_info - Remove only support 1 endpoint function limiation. - Create one MSI domain for each endpoint function devices. - Use "msi-map" in pci ep controler node, instead of of msi-parent. first argument is (func_no << 8 | vfunc_no) - Link to v9: https://lore.kernel.org/r/20241203-ep-msi-v9-0-a60dbc3f15dd@nxp.com Changes in v9 - Add patch platform-msi: Add msi_remove_device_irq_domain() in platform_device_msi_free_irqs_all() - Remove patch PCI: endpoint: Add pci_epc_get_fn() API for customizable filtering - Remove API pci_epf_align_inbound_addr_lo_hi - Move doorbell_alloc in to doorbell_enable function. - Link to v8: https://lore.kernel.org/r/20241116-ep-msi-v8-0-6f1f68ffd1bb@nxp.com Changes in v8: - update helper function name to pci_epf_align_inbound_addr() - Link to v7: https://lore.kernel.org/r/20241114-ep-msi-v7-0-d4ac7aafbd2c@nxp.com Changes in v7: - Add helper function pci_epf_align_addr(); - Link to v6: https://lore.kernel.org/r/20241112-ep-msi-v6-0-45f9722e3c2a@nxp.com Changes in v6: - change doorbell_addr to doorbell_offset - use round_down() - add Niklas's test by tag - rebase to pci/endpoint - Link to v5: https://lore.kernel.org/r/20241108-ep-msi-v5-0-a14951c0d007@nxp.com Changes in v5: - Move request_irq to epf test function driver for more flexiable user case - Add fixed size bar handler - Some minor improvememtn to see each patches's changelog. - Link to v4: https://lore.kernel.org/r/20241031-ep-msi-v4-0-717da2d99b28@nxp.com Changes in v4: - Remove patch genirq/msi: Add cleanup guard define for msi_lock_descs()/msi_unlock_descs() - Use new method to avoid compatible problem. Add new command DOORBELL_ENABLE and DOORBELL_DISABLE. pcitest -B send DOORBELL_ENABLE first, EP test function driver try to remap one of BAR_N (except test register bar) to ITS MSI MMIO space. Old driver don't support new command, so failure return, not side effect. After test, DOORBELL_DISABLE command send out to recover original map, so pcitest bar test can pass as normal. - Other detail change see each patches's change log - Link to v3: https://lore.kernel.org/r/20241015-ep-msi-v3-0-cedc89a16c1a@nxp.com Change from v2 to v3 - Fixed manivannan's comments - Move common part to pci-ep-msi.c and pci-ep-msi.h - rebase to 6.12-rc1 - use RevID to distingiush old version mkdir /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 echo 16 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/msi_interrupts echo 0x080c > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/deviceid echo 0x1957 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/vendorid echo 1 > /sys/kernel/config/pci_ep/functions/pci_epf_test/func1/revid ^^^^^^ to enable platform msi support. ln -s /sys/kernel/config/pci_ep/functions/pci_epf_test/func1 /sys/kernel/config/pci_ep/controllers/4c380000.pcie-ep - use new device ID, which identify support doorbell to avoid broken compatility. Enable doorbell support only for PCI_DEVICE_ID_IMX8_DB, while other devices keep the same behavior as before. EP side RC with old driver RC with new driver PCI_DEVICE_ID_IMX8_DB no probe doorbell enabled Other device ID doorbell disabled* doorbell disabled* * Behavior remains unchanged. Change from v1 to v2 - Add missed patch for endpont/pci-epf-test.c - Move alloc and free to epc driver from epf. - Provide general help function for EPC driver to alloc platform msi irq. - Fixed manivannan's comments. To: Manivannan Sadhasivam To: Krzysztof Wilczyński To: Kishon Vijay Abraham I To: Bjorn Helgaas To: Arnd Bergmann To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Cc: imx@lists.linux.dev Cc: Niklas Cassel Cc: dlemoal@kernel.org Cc: jdmason@kudzu.us To: Rafael J. Wysocki To: Thomas Gleixner To: Anup Patel To: Kishon Vijay Abraham I To: Marc Zyngier To: Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Frank Li --- Frank Li (7): irqchip/gic-v3-its: Avoid overwriting msi_prepare callback if provided by msi_domain_info PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check PCI: endpoint: Add pci_epf_align_inbound_addr() helper for address alignment PCI: endpoint: pci-epf-test: Add doorbell test support misc: pci_endpoint_test: Add doorbell test case tools: PCI: Add 'B' option for test doorbell drivers/irqchip/irq-gic-v3-its-msi-parent.c | 4 +- drivers/misc/pci_endpoint_test.c | 80 +++++++++++++ drivers/pci/endpoint/Makefile | 2 +- drivers/pci/endpoint/functions/pci-epf-test.c | 132 ++++++++++++++++++++++ drivers/pci/endpoint/pci-ep-msi.c | 156 ++++++++++++++++++++++++++ drivers/pci/endpoint/pci-epf-core.c | 44 ++++++++ include/linux/msi.h | 2 + include/linux/pci-ep-msi.h | 15 +++ include/linux/pci-epf.h | 19 ++++ include/uapi/linux/pcitest.h | 1 + tools/pci/pcitest.c | 16 ++- 11 files changed, 468 insertions(+), 3 deletions(-) --- base-commit: b66d92bfe0a9e86a622e77a12e420b69af633d1d change-id: 20241010-ep-msi-8b4cab33b1be Best regards, --- Frank Li