From patchwork Wed Dec 11 20:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13904201 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 56E9FE7717D for ; Wed, 11 Dec 2024 21:03:10 +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: Content-Transfer-Encoding:Content-Type:Message-Id:Date:Subject:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ZmsRwVwzrtUr4aOyGSQN7OHKMq0pigWl8nBTbZNKaqw=; b=SlSdFkiYbd47jU+KNzjS5Egfgn 5lCAfDpjkrineFaWYaL2oFkUqCXvoiwMvgIjT4UQnRwyfnboAU14m5k/RYotfwR4yIZ+jUjkD1YQQ nKP/DttgJQo+0NM9faBKpVlmljMDJGvBPuGfaOHiS1PvGMtIlFHb5h68PBoOATv1QGijD6j3OhBUg DgE56TR3VAqxLE06MS4kvOXxbNVZu0xu0hrf7vgoe5+CCEiSYThzYPCmj1ipZDRcfkvJv0Tb/px+o htkNHjhTsgJ6q3/phWJfrHI1Or6u30nhaKBRSqysrBeB5j/QKqavZOcPUmt5Q+EXcMhXtrA4Td5o2 8i1OdnbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLTrC-0000000G6yA-2FuS; Wed, 11 Dec 2024 21:02:54 +0000 Received: from mail-am7eur03on2061c.outbound.protection.outlook.com ([2a01:111:f403:260e::61c] helo=EUR03-AM7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLTmN-0000000G5Y8-0hht for linux-arm-kernel@lists.infradead.org; Wed, 11 Dec 2024 20:57:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dBYVxK3+/VSqhpm3n8L/tNDgRnndM/V+boV5ryluNAHf6LcdDNKARMupXpBQ6pBJmghm40cEbvr2fQjuIyngCz9KTNtMrF5sdr6vAxbpjiZCC2eGUCoV3uyUk2eLHzNVWrWExnPDQdt+c9886DtAOFtZn5NWjbzm89TObLg0DpfXQNGI3UFM7fcVrTeTFJWKmRf2UX2arPCQdrVO4ZcCv1S466qXTZk246Lfcw8dEuK0zmG4v+NF5o2M21ymWFMm60xPV421CN32HuJO/1IgEKvGlsvBZVNhWfzIu33AmVW1/uiV8sFH61krtIEP9C13VemWAYO0Cru197LoOLh6Sg== 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=ZmsRwVwzrtUr4aOyGSQN7OHKMq0pigWl8nBTbZNKaqw=; b=kAN7Ze94NfSNQfBPQU5y1uz3NCRLr0VOFpnIQEpLsEXAeZRwiWbD2e0eWtNI4ymsCrHd1PBl7dRKduBE8ENA0l2zxdJ0g5UnTHCSkX8GJsIVCgtRHGiyjN5kkup60/o4vd9fZld8aBpdQXN8+Spyy9ckLWKqngXvr50dy1j+PQ1PH4ajEiBY3M57YwZRCidKAzycfa73EL2hYS2EG/AdYN9ECBOCKNF5neN/POP34Fcx2g0/zHCUtz1ZGRNXKHXvr+xy1ts6zkXbCNfT1PLUkaY8h53NwgM7Rd4bbs3KcOzU4Zoebz+kvqJw/d1n1X1LPjUQ598AotLIAYie9MlZ+w== 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=ZmsRwVwzrtUr4aOyGSQN7OHKMq0pigWl8nBTbZNKaqw=; b=DJNSExPvhh52cXobVk8rSEZIgKdKq7PmDWwyntI9EiXkjHInFOnsSmCzVe8cunrFMCibjBBv+rnwmW046E5QwXWb32vRkM/L55OcmDsJ+B7ZiMZ4SroOkJXQ/c3I1VH4LGiY4/bZ6K3wPBKBmxQ9a1mfgBfCEOo7EcvntnuUP5FSNp63LfRF2sHwlTByScnVsBBtnA3uuUR6n9WCMBt3kcO0jQDIW1jadO+dzqILHD3Ti8N1hmDGEVJSbBeFxgm+lNEM1S7LCHvGMp2NhDIoLJ1R6Cn8Py1UmaTEz4ycAal9V8tkUQrBak0TF/BiFEvlF0uUpf910lipXJ+wCWNJ2Q== 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 AM0PR04MB7139.eurprd04.prod.outlook.com (2603:10a6:208:19d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Wed, 11 Dec 2024 20:57:48 +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; Wed, 11 Dec 2024 20:57:48 +0000 From: Frank Li Subject: [PATCH v12 0/9] PCI: EP: Add RC-to-EP doorbell with platform MSI controller Date: Wed, 11 Dec 2024 15:57:28 -0500 Message-Id: <20241211-ep-msi-v12-0-33d4532fa520@nxp.com> X-B4-Tracking: v=1; b=H4sIALj8WWcC/13RzW7DIAwH8FepOI8J881Oe49pB8CwcmgaJVPUq cq7j1QqIT3a8u8vG+5kTlNJM/k43cmUljKX61AL4G8nEs9++Em0YG0QzrgEBoymkV7mQm2Q0Qc hAoRE6vA4pVxuj6Sv71qfy/x7nf4ewYvYus8I9YxYBGU0JozWedAR/OdwG9/j9UK2gEV2SEBDs iIDBj1H5wK3R6R2BMw2pCryIJ2CyJAxc0S6Q8Ab0hVJlZ3hPInIX9YzPZINmYpQ+mi8zwF5PCL bI92QrUhnyNrmjBDCEbkdcSYacttNmmGIIoNCPCJgvdr3qz/IqDVRGFsl6lcGPXM7g+3ZpZDZW +FM6Ni6rv9Qy9sQRwIAAA== 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=1733950663; l=9098; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=blMI/+6GqgaeMH3OplTDWmsZjonmJ1vPWBWbWs6Lf2w=; b=XzL7GJw8Gp/TrnJM9pPU4YYZotl30MhgUb6ALEw9h3I1gEOIyMf9kCexj8977qqYJiUkRBjhP /q5DqmggnJYAzfAs3rMZHpZip8AfQfYyWCdMVrES0b3X+qzHpSNDKwd X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR01CA0037.prod.exchangelabs.com (2603:10b6:a03:94::14) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM0PR04MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 2442bef9-4727-4a11-57e5-08dd1a2677de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|7416014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?vdr1MYDoVRNjnGFL/AhkLWYyv5yz5Mq?= =?utf-8?q?iZhHcCjEQsD6rRcGjTvzOtwBxSf8zPrEYhfw4uG60OFpF2a2cTvzvShLH2CO9uX2w?= =?utf-8?q?fRqRREHIVW8I/dBJntd1KGyj4IKv2LImFhNxgNwMYLlYPEagvmA+OGpNWuKb6wssk?= =?utf-8?q?MEOJO5Gfyu5+x8d6jBvdLdivJO+LFOW5pJsGe6qmpslLpIvmoLPtAm4JaFHb4jCqT?= =?utf-8?q?CyJUhAdoKyBFsl+aNMi42357qPfWw0BVJg8EIYuOw3yI+GW5bvDwBDdhrVM64q/TJ?= =?utf-8?q?jX2bnhv6uQ6FXbSEGhIMpB57IJ92x1bB2ulVCNmqe8w5bnpf4i/Goztk295KMwWZD?= =?utf-8?q?rsF6OZlGewT83fi+mE+wUsq02FtZmHu/jt6UTxx+/UajN4vX/eUO7euN6sj+Ij4jt?= =?utf-8?q?hxx3EetEJSQ4S1qcTRF+Zf4VPQiv5RptvkhzdTmANbS4Ky912cX28vcuDScPBKofg?= =?utf-8?q?xEdZ1U3FUT1YjkvteApmwSXHXDmLOA+TXydYgS71w8mEvnXFHbHzfFqtL90jOKF9H?= =?utf-8?q?IeLDbIR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: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)(1800799024)(7416014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?afBVnnDeE9Rq0WexK4Ncy7630cDc?= =?utf-8?q?whOCaIMpObZvH0+OePhDfKqr7s33VBAr3LAzWbThRKR1TN+pa13wWympv2Ic/vH7C?= =?utf-8?q?HnLu7oSZntnB6jVQZ9AFzrAKTYpzFgQMkSWeHvuxiwqLrlhgj42hWr6tsKzGX6d7C?= =?utf-8?q?XHqJcNJC+Sjw3O7Sc3PvInvfM3uJnaOP9LW5tAOEyfJVqda+qKlsJx9+j8/5eqIfi?= =?utf-8?q?Uo4aNp39mnVzvv7yH04RTKVr5BnLW7UOomMBt4Wf892UPL49H59YiHznDY6RYhHVR?= =?utf-8?q?ErGeLQ08JkcV9Fv3RPTS2Xd7BZyhztUCUIw+Y6KDG5r+TcWluyu5s1lxt/fQbI8Df?= =?utf-8?q?aU8CMGK+GtGv0U9Wp++8PSbZJM0H/9+EO+ty4rQhhxQ6y4QDQDsX6S05MyNeEtIIc?= =?utf-8?q?TbvuYDow+2shtd/XB6sC9Z2BYuykILYZtk2kReSUWBGqtmqQTeiNeZDrsUZVm+JgM?= =?utf-8?q?0qhGRu9r9jNhTs8feqQiXyMeb4c+0yGKstlcohky21IMkUvT1mfgwwiWdek+ia+5A?= =?utf-8?q?IQ/4N75Utop/hOFhsO3EItPDIQdDrKr33Dhpq153Y+MKCwNE0lxDH0FDZBWmgYC68?= =?utf-8?q?T7FHBj53ApBaYzd3e7wNfpzgw7bJxrQO9+ihzsvo9UDMpA6NB/8GudlpdmjIaojUr?= =?utf-8?q?NNDH6OgwILh/cti6RucLedM3gx8Ihq0Wpiih5QjGiwvqYmb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Network-Message-Id: 2442bef9-4727-4a11-57e5-08dd1a2677de X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2024 20:57:47.9611 (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: HNjBrd3aypxMh5qxQkD5R6Ha6CxbX8co3m20fji7XxWT93m8On/NvIpAqascV3qzYswgVdMj8iNXwCeIrEOjqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7139 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_125755_357732_807375FF X-CRM114-Status: GOOD ( 10.51 ) 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 ┌────────────┐ ┌───────────────────────────────────┐ ┌────────────────┐ │ │ │ │ │ │ │ │ │ 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 v12: - Change to use IRQ_DOMAIN_MSI_IMMUTABLE and add help function irq_domain_msi_is_immuatble(). - split PCI: endpoint: pci-ep-msi: Add MSI address/data pair mutable check to 3 patches - Link to v11: https://lore.kernel.org/r/20241209-ep-msi-v11-0-7434fa8397bd@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 (9): 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 irqdomain: Add IRQ_DOMAIN_FLAG_MSI_IMMUTABLE and irq_domain_is_msi_immutable() irqchip/gic-v3-its: Set IRQ_DOMAIN_FLAG_MSI_IMMUTABLE for ITS PCI: endpoint: pci-ep-msi: Add check for MSI address/data pair immutability 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 | 3 +- drivers/irqchip/irq-gic-v3-its.c | 2 +- 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 | 153 ++++++++++++++++++++++++++ drivers/pci/endpoint/pci-epf-core.c | 44 ++++++++ include/linux/irqdomain.h | 8 ++ include/linux/pci-ep-msi.h | 15 +++ include/linux/pci-epf.h | 19 ++++ include/uapi/linux/pcitest.h | 1 + tools/pci/pcitest.c | 16 ++- 12 files changed, 471 insertions(+), 4 deletions(-) --- base-commit: 102a25797c66c8f4cf7fafe0b0de95cc7126b3fa change-id: 20241010-ep-msi-8b4cab33b1be Best regards, --- Frank Li