From patchwork Thu Sep 22 16:12:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 608356 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C285C6FA82 for ; Thu, 22 Sep 2022 16:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231811AbiIVQNx (ORCPT ); Thu, 22 Sep 2022 12:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231863AbiIVQNm (ORCPT ); Thu, 22 Sep 2022 12:13:42 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70078.outbound.protection.outlook.com [40.107.7.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F44CE9CC0; Thu, 22 Sep 2022 09:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y/zmo8Nk6x0zeVyTS2LCv3zy/+gX4aw8l5Al3R+OD8y1KccmFGqMMQKlDt2LRxzqSE7Y1a8HqgQH0aTbcSAVAfhB/U/4rNC1Ih8MmspLJauppdj+RPdiOUod3q+WW7/YUHl1WwyEPdjRNjcfrcAEB8FnNYzKWSk4TurGCjaR7oSd1oxGqKxZ4iEYHsbCGWNwwgTftwInJOtVIjWz3vEBgsnKyNL/3K//j4CVXuaoFWJbUZw7iZAKxyAMjIT7TTMgKuA2PwHcp04OmA9lT9fwPBmGzqGKkem1k5Q1+UB3zTu9jAjpoxY0do94FP5lMPFSmWDesW9nClSlZPHjZ0dTkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=PxyZmoQ4HPxt9JAZN3QVzBllZWpIazPpqniEWrzTllw=; b=lwmFVn1dPzp/4W8qRptzTeZ34eI9wcC+7avtmekKhXQfEeLwe3jeertrZqwttL2eBOPG45qpxzbVn3GNM0ItqDDhWvYrj4heGpqHH97k9RuEkVxApRhbeUwRSvyl0khyRggdp3Ydg7zPx1KymICsibN86VujQfNe7q+27D+DTHKey88Oo/yiA0QF6oCNv3B2UGTRlC0ZoC1Y3WpRwLn7FONniteIbE0DxmOwW6Y7nfR3ePge13h+7wpLV2zD23zGaXbuyoODDwRsFXDJTv7o14itHp99UvuyNfZzjEwGFWSKzLFMwhPoF47NqmlODvlw2yFrLJRX2cy2AMybn8qDMQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PxyZmoQ4HPxt9JAZN3QVzBllZWpIazPpqniEWrzTllw=; b=Gv510G6rttoH24tUin5V31cUqP90ba1iRhuzMoKOxO6sWJrMTVurg3rKb7XcPpoliiCQ5Z342CzfdPjfxcF4uGv6ZXdV/2e7R4NCTtj1w5pG2Ho+JTdrafxf6FIPKE9s04Khe74IC4ZErnmYA2hIb53J3kVhwKZgGbEw/Z3stsc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) by AS8PR04MB7541.eurprd04.prod.outlook.com (2603:10a6:20b:29a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 16:13:37 +0000 Received: from DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428]) by DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428%5]) with mapi id 15.20.5654.018; Thu, 22 Sep 2022 16:13:37 +0000 From: Frank Li To: maz@kernel.org, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kw@linux.com, bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, peng.fan@nxp.com, aisheng.dong@nxp.com, jdmason@kudzu.us, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, ntb@lists.linux.dev, lznuaa@gmail.com, imx@lists.linux.dev, manivannan.sadhasivam@linaro.org Subject: [PATCH v12 2/6] irqchip: allow pass down .pm field at IRQCHIP_PLATFORM_DRIVER_END Date: Thu, 22 Sep 2022 11:12:42 -0500 Message-Id: <20220922161246.20586-3-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220922161246.20586-1-Frank.Li@nxp.com> References: <20220922161246.20586-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR05CA0016.namprd05.prod.outlook.com (2603:10b6:a03:254::21) To DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8789:EE_|AS8PR04MB7541:EE_ X-MS-Office365-Filtering-Correlation-Id: 719e01a0-125a-4322-b7ff-08da9cb56752 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yqkv+tJ5EVWUQq+hpZ0ScwAm4pOWAX/lAjEjunloBGrNIHBatfB7JtOQIiFssTYqSBhnMEhZWr2txJ4A+T10646hblJXT1yzQpT88BfWnj5gsYnVVhRTDJgl8ilC8tF8AvRZa09F3x+qnOuE8kWQj7WljvRLHXHAJfI8aPVB7GLhhQ/B3TFB9ym6GPRQcrer8TzXPX1qVB7zwUoNqifVYXYpTc2mxEUhtN4022nqO+G3nPZwTPcVAXtRJsk2bj8EkvfvJBSqhaR6/6DWpLVtZGOixSA5BNzo4NmeQUbREbv/L2uK+p9e7sU6nE4dQb/3V9pIny6tuuGO2/Hsx4imj21zSfmP6ZkrFptdrLdnaI4P/jsCZViFzO9ju4x1aOXqFAv9hJDcfqWGy9VbvSW9z8mBPdzRl1OjRmr+w4dufTUVt+ONIGmOFinDUH+vaLLlJ+vGbzuSbAQ7ii+NoXWQ96hkzT6b206PP3FttPRqZLSww5lkfduTnHMlUYUvSsMVsI0Dg9Pg2khdCaKW7CwieTxfeRDcvMe3ElHb6VCvC3iRxsycdUmN/o4WwEN7cbmbEicU2woeCgnEwXyNUEryDqRcE5gAlEwxxtrr0nj+vdLiAb4V+JOHmVMwojwugqTNe56AM+H9UlXUr8pE3SruSXX1+SDahjZbFz9AjMotpgczTPUi7bWjY+S2inxLGd0iY7A/fa5gZpS/zmcHm12+vww8zA3ceR1YiSw+bdnJbLRkrczGar1qxCNbVae5i1t8JqvSOHvsB0q8Qit5OmhiBw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8789.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(83380400001)(1076003)(2616005)(6512007)(186003)(38100700002)(52116002)(66556008)(38350700002)(66476007)(8936002)(5660300002)(41300700001)(478600001)(2906002)(6506007)(6486002)(26005)(7416002)(6666004)(66946007)(4326008)(8676002)(36756003)(316002)(86362001)(142923001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qx7XT1iS+nM4vh1YwVjuPfuZl9pJ/hthUKpjnf2FG2uWx3D9B0RBlSpeYqgTk/UTnh+5QGqUJINmCphx64T52cS58zk3LpGYqy0uNtaJmmHCXG0Ta87y/8ZmO3+bjKGjptkEEmNzQStfVPKTtMHggEJqmCTn2ar+QvOQ0GFMUv2usaL2fJD+9//nCS5bpOMC3NOeXBjGoAiDPm+3FgaoC1WRpEZHHXyud/C6XBiR9MEZFYSAjOjf3R00jQVqu7LL/liB6MIQMTesbwnAAvH1iNB4cl0ALLUsvWY+iJLrg+J1V+6zYmbzLIpn8qsmWgn7RWOktYYlhvBXTiQqAldZDXkzrSKP1UMVo/fH8O5ft+6lGdtdlxQnDwZDnLVL5/NhNzwsBrYP67IemUWmOF/nWVvfW2Y8lsArAnXE/r62xn/xSyW/LqQnsdo6zge5OpKocseHxV+ZW699l1D+AjfGO6VkpjF3WsaHeP2F0Re4Ctz9ZRRUw0IMoWcCxvg+g79Q2iCNSo63N28zf9VV/06IadTQKd7mVsmaZqP3IFKjzUQ5nIcPopVei9wP23XL/ibHKWHq3EHbiUgPJN5TbJfqy+QsoXouJk8qQ/t+CswPIq0gRs2wDCcLPBBI+4Ue8YZVgp8jc1QSLLRqX1mU6QvDL5TF3n0YGCTpXHU6b1B9OTyhzO1vsjVrQIjiJAejCcPAIVleNfxjLT7gjAv3xdQ96jz1g2gbdDAANVUtn4fEuSbXQL6Zwr7C8bJliNMcVW4+hyUudhBJT7+T+sHL+COzqSI+sWXqP0GOgw7yWRm/Z2P8I4/ctssMzpwSq38bK+8qQWiOSBtjG0kz2+m43co2XaQid9oJPffykmftZIxuGOQnO4fK6XgtMmiSkEFoymc8uNL4kv6HTdaLW8oH20kVKvqepjoodjAbM0+VFt/BdrwhsTVObsPRrZMvHhI7SJ/JkdtbZdXVMTmW7lx64m1tg2vZIER5t5kaWPQa0uZUTcx9UuAuavsfUoQs1PTwrXcSJgjHltLaz2fjRV4PmGiN8uH+FO3m/2QIkKh8fZqsJ7o7/tNAwOJIfwaeYXrisODIn/EkGwjG5w52OfMr11lDeccbBnZ5kx+0CEa88jzoHkxgVjjfToC/KKUvp6KotHfu5lRxfmJqvTgTfcd3GmYOtGye8WTJJsPZgajDz6Bqwv/KLKmiQgEUZ2fblELQGpyyy9SZAQyP900ly1l1EqVRQUr6UxpEdRo+H8sEFe7caMIEVrWZK7BUbIyHaUQA9Pv10JwGT+qam38CsUH5LMldzFfcDzIEVW4qFfjGIeOUdXg7OtruXbXki/o/Bg1gKEdpBwNL8R4UPjJ1I4NkReKqc2/L3jFiRGEKKikSlMlAMOda9RLV69yncodqcnJTHxT1tDa30g84gkPISvRGJUwb3qvohfl987MrclOPpBCfHCOA1M0bqPAy8vCzGJYwdIqagNnz734/ckERTDF+8LIqjMbWJUfk0hWLdNF/hGwq4UOVYpv2tDYVX/WlY8lK3ZfHjMS7vLQsqIgHoRPdOUSFa433zrKvXWJfQ84Q6EKZYTj11JsKcdKK9/dPZmbLFXCO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 719e01a0-125a-4322-b7ff-08da9cb56752 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8789.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 16:13:36.8927 (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: roD2UeHIRIjoD2yvT04LsLQBure2KsG5l38w7MSghcMXElk4jsKWQum7RnslUIMcvPRdempkrY9IznYIVFDHrQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7541 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org IRQCHIP_PLATFORM_DRIVER_* compilation define platform_driver for irqchip. But can't set .pm field of platform_driver. Added variadic macros to set .pm field or other field if need. Signed-off-by: Frank Li --- include/linux/irqchip.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h index 3a091d0710ae1..d5e6024cb2a8c 100644 --- a/include/linux/irqchip.h +++ b/include/linux/irqchip.h @@ -44,7 +44,8 @@ static const struct of_device_id drv_name##_irqchip_match_table[] = { #define IRQCHIP_MATCH(compat, fn) { .compatible = compat, \ .data = typecheck_irq_init_cb(fn), }, -#define IRQCHIP_PLATFORM_DRIVER_END(drv_name) \ + +#define IRQCHIP_PLATFORM_DRIVER_END(drv_name, ...) \ {}, \ }; \ MODULE_DEVICE_TABLE(of, drv_name##_irqchip_match_table); \ @@ -56,6 +57,7 @@ static struct platform_driver drv_name##_driver = { \ .owner = THIS_MODULE, \ .of_match_table = drv_name##_irqchip_match_table, \ .suppress_bind_attrs = true, \ + __VA_ARGS__ \ }, \ }; \ builtin_platform_driver(drv_name##_driver) From patchwork Thu Sep 22 16:12:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 608355 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D601EC6FA90 for ; Thu, 22 Sep 2022 16:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231963AbiIVQN4 (ORCPT ); Thu, 22 Sep 2022 12:13:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbiIVQNv (ORCPT ); Thu, 22 Sep 2022 12:13:51 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70087.outbound.protection.outlook.com [40.107.7.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE46371BC6; Thu, 22 Sep 2022 09:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OYkQOFSDGjHjRK6QHmgaQkVMq0OZrdpS/gNNoTrgLfeE3jUUByO3S0RNN6+Q31MQN8WvjXZFs74pqgFpUfh4eniyhuIdf8Ppo44trUkxZ+Q/L4dbmFQ1Zdsc9cHM6JbVLsEjlipdo6hsV+NznJQbsNwziPBfGjkyH4XhPvQh7+HJ0eycQPPI4QePo/8qd3QoyDxN4/EkJjzr3p7SB/YcyE3quGRhJWq8fxkPgPZDjr5Lec0m5S6KmykcaTeH1xyBg3/QdA7HKOkPB14AXIADE7S4qkX6P6tz6IllTRMNz+cQOJf3zDlbEEvwst3CbDK2y9OrJFL4QSkwPLDI1sC3bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=ankBqv4m+mipQUAqC6qml7eN2IMIGbUtiVkPxPMXbW0=; b=gtRbGtp7RfHJhir9674NQUtdtxoqbMLw8rwoEsvZLmaGx7cjkMvP3HYWd6hNqnL09Q+YFvwxhuXsmS/Pfmw8dBhmJuF53+J2SJ881jC2I4YnSLVCZUqK+fJoMdc4l5iUJdsHadsn4H/zpvA4lX7coIUlhRSh++10AEdR+XK2vif1IJ6rD9acKH4Y1aDhZxiKqJva9OSKcUG4Qo3uSz12LGxMm6f4tZYSaCtjSKAkVDiUF9iiN59Hzq8BNcSotZ2NRnLUTs9mtdn6bfM5tVBl16n2XDIGj2aa2OVyxlcsqSDO/UhtVZlFwMYumyIgAdpb+y8A9JzdcJPSqCYlAm8fmQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ankBqv4m+mipQUAqC6qml7eN2IMIGbUtiVkPxPMXbW0=; b=S6qwR5wZxVoiuqOW+mygiKB7bucAZioLX3suoC9Bc45+NPOyT+KTczaiuZqLpN+uUhdfRRT0iNTYD13aInQP5rdOmipCWzTKEDPZooh7arkUr1UBUR3DUKpPW9IRc6ykHjjcCcMn/hk5iaivMYrMkqiLocxzTSZmvMjcORveiKM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) by AS8PR04MB7541.eurprd04.prod.outlook.com (2603:10a6:20b:29a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 16:13:48 +0000 Received: from DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428]) by DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428%5]) with mapi id 15.20.5654.018; Thu, 22 Sep 2022 16:13:48 +0000 From: Frank Li To: maz@kernel.org, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kw@linux.com, bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, peng.fan@nxp.com, aisheng.dong@nxp.com, jdmason@kudzu.us, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, ntb@lists.linux.dev, lznuaa@gmail.com, imx@lists.linux.dev, manivannan.sadhasivam@linaro.org Subject: [PATCH v12 4/6] dt-bindings: irqchip: imx mu work as msi controller Date: Thu, 22 Sep 2022 11:12:44 -0500 Message-Id: <20220922161246.20586-5-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220922161246.20586-1-Frank.Li@nxp.com> References: <20220922161246.20586-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR05CA0016.namprd05.prod.outlook.com (2603:10b6:a03:254::21) To DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8789:EE_|AS8PR04MB7541:EE_ X-MS-Office365-Filtering-Correlation-Id: a48cd936-2f43-464e-c955-08da9cb56e37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aqqT1wUNLO9Z0QHJsFxDqYjIUTnEGuKoNwG7pLlqTS6gwPQUGTG48IMd4qWyEmMDqi0eRuHoOKfB+umfuxeuzmS2HyAsOap978ergdn2lh5y04i1IPWokHb3qxDUwZEUr2tZPX7SPQorNFA0oQUtwfCTQEyW+nplTD6BEbwW/hFTonUv5KoPuGBRJVtwm9y5D6mDA+9ZOEcb6BO+mxv72b8r5z8PlhCCyd4BDb8cJTeFTgbi+uhKl4HiXxJeADEJlmg0mKORthuBgUCYrMQgiB3VkKVoa+m0PfdMn4cm/I/Q2Np+1FaNadWYeKzqUMjIDTY1SbU5MRj6oaAl6rtPp9GZfi64FVzJZrPjuwI+jsJ6nlTO7tscTmO7QWxxUta8g18tlDNU1SnXx5rkMh6N1rWaaw+PTqN9UqiHB8ZcgS/8oTllBGGgcB6rhh/tK5Nn8DZJfM/G9msg8V23Fld0i7CiZdATio3m61em3PjSfmxmbRYYqb5E1Gsfn7eOM69WzyyYQe/5VgUYzeUy+aWjNZNnL8F7Gq0n5ta9plFQIuZMpfMP0zo/ix91PgBweKsl5X2JUR+hIk8G8xLhofYPfFBOB5oGHqev9Yu4oXdsDNoEYejk1qy/pV5UPEQYwh/RO/TBu7Xak966MeBQC2PuvDTudk7pzaaQp20PGcGtgO+GT/xh1HwMPTMlq7nY6c+zWWA5zWJKE+E9BwuGjjqq4ecoe/2VKeOACUPdcovaVzlb+w8CkHVyIZeeaqqUCsFA1ix3gpQUWSOiCZuXhjGiQjYqKr8XxBBRN01XiPYEMN14oRBxglNd75kiH0+4O2CQoLEcJphUmUdXeUyXM/+w1A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8789.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(83380400001)(1076003)(2616005)(6512007)(186003)(38100700002)(52116002)(66556008)(38350700002)(66476007)(8936002)(5660300002)(41300700001)(478600001)(2906002)(6506007)(966005)(6486002)(26005)(7416002)(6666004)(66946007)(4326008)(8676002)(36756003)(316002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SipQilz8ezxIxfbGB+Jm5lAN9055kUbKP7M5R4DcxWLHe2mtRbkdFUgiYsFBb8Cjd1MifRYacmj8UwNMTiHBYH2755mG1E49pANWYOKfLrXM1U2T4aXa6wte3d5NQ2HUOoVrWuQl7VTky7CLSe8mDkBDoR5okMMLuVXdcUXg+rQeuWnm6vWmtGXd9whEWAMx/I9zwg4ZqaYyVyFDuawP+IjzwRGDv07T6mCXBtKIz8wYY8aQfHOfeNJrtYw2c/up1VK3OTt25Mh1e2wCa3MSBcnrcBrRS0jE2WznB4RclAI+E51ziRDA0zS5FNqYMreKJQNQQWVPj8rFTNKLXrN6+ZrtClM1zXgWCNRis7clywLx1sIGSsm1ULdWSm3IAnUeUYV8ksN5xQq43VMg42YhOeXAXXyt7T7NFSKpFlgjhqfBalJj4XVO8LCNs8pqpVLfMI2tqt0HOALA+PK1WDk/333279A2j+A3cNhcpjKz6DkN/iinXxNQMEVepl90PyvxjCNjYOMEztY7OKeDpycDvFxq3pm5pts2D/VJOXGDLcxstVOopP2sbAW4sSCghyydnNDKG1Gsu4BeA3w5ZqZpeGDbEjUS30/thrxrWr+4vGudYsPaIHxAD08bUIE4/11wQmEXnXnjpUuNBVLAcnSWg2CL2YgOXL0g46SEtz7nlbqLBpA67KYGkIveg0nEnrGcet4zKQvX99VMarrUotOKpUr9Cs81aPjEfmLvwcxzxLx6O/SJ+xisrAJ2rSWwhhWiLUN4vqIE4sv11SIrCZg/1c5t+eH/9ELVy17os3tBByDunjpQSET6R9z6tZruLz+3dE/I6PTb1d/uU568r2wyvPlKPatbq5NlQyHomYHuBBPz9xoZiOVk3aNI8TakQ+PJShCxphepJYhlkdGgUhZVssPSNV1GPe5MSUZlFFDHt4cklxldomrGvm2Oh9iHYceUnScw4eohgx3LubJNmlqKm+g98JjWhmJOV58a+SrKTXV/hexEAPEMn5S44EwWF/O8Phzck7g2eF9Cf3Wyw/5WOKD4UjoRWM6dTA4vUjVs3oJSVZhVoGc3CCSHZ+mhJsPt0z5IKK9xAFXe6Mgrwnv3LX25oVDPdPhA/7X4m58aZb3f+Ce1mHaP4TsuRRIqBEjTmzTLs/icKv/7CFF+fYBpQuptVNNWM567ubQA2bVfK6A2Qwi4ooZ10pqt/k15LAz4ToqooUSNSd0jMp10DHl6nS3OBDRIkV42R3RGr2ycPkwHMR6Juu9YJQsoEdaFJW9IxDricZscjgw1TdBSprDfgYUWvHaKMgA7ZD2Iu4ZuIxoYfH4a1v3M+o9yMt3vbcoNLm6uK79s//c1K0bsGp7MAKQrUejXBF9dMTfi8Mvp73tvFPixakX/vV7TXjyGQNYbR8BK+4DTAJQ1AFC4iTdq5YBocXXhyY2HtZ7x7dzDHAIzILdwKGXB5C1rp6YjbMXRC+uyncHk5lV1K8UsGHIjnQSHRTkgcnAVrfxgS2E8Ykc9hnKUTh7yErqB+RQQgZBkIUQsOZMBdQ+cptrf+ZQNKUvJR5MnLj9SzDF8tNk1FQTujBSXu+vTWKrf5No9xuxe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a48cd936-2f43-464e-c955-08da9cb56e37 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8789.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 16:13:48.0383 (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: zCXc2zWnksyA0lXzg6qH9lQOB1i65Ry2oL6jvQGAKNRFXhNEhs3gLwI3/DhfhEUviFenaVY3tbhmMI2JNNX09Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7541 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org I.MX mu support generate irq by write a register. Provide msi controller support so other driver such as PCI EP can use it by standard msi interface as doorbell. Reviewed-by: Rob Herring Signed-off-by: Frank Li --- .../interrupt-controller/fsl,mu-msi.yaml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/fsl,mu-msi.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/fsl,mu-msi.yaml b/Documentation/devicetree/bindings/interrupt-controller/fsl,mu-msi.yaml new file mode 100644 index 0000000000000..799ae5c3e32ae --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/fsl,mu-msi.yaml @@ -0,0 +1,99 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/fsl,mu-msi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale/NXP i.MX Messaging Unit (MU) work as msi controller + +maintainers: + - Frank Li + +description: | + The Messaging Unit module enables two processors within the SoC to + communicate and coordinate by passing messages (e.g. data, status + and control) through the MU interface. The MU also provides the ability + for one processor (A side) to signal the other processor (B side) using + interrupts. + + Because the MU manages the messaging between processors, the MU uses + different clocks (from each side of the different peripheral buses). + Therefore, the MU must synchronize the accesses from one side to the + other. The MU accomplishes synchronization using two sets of matching + registers (Processor A-side, Processor B-side). + + MU can work as msi interrupt controller to do doorbell + +allOf: + - $ref: /schemas/interrupt-controller/msi-controller.yaml# + +properties: + compatible: + enum: + - fsl,imx6sx-mu-msi + - fsl,imx7ulp-mu-msi + - fsl,imx8ulp-mu-msi + - fsl,imx8ulp-mu-msi-s4 + + reg: + items: + - description: a side register base address + - description: b side register base address + + reg-names: + items: + - const: processor-a-side + - const: processor-b-side + + interrupts: + description: a side interrupt number. + maxItems: 1 + + clocks: + maxItems: 1 + + power-domains: + items: + - description: a side power domain + - description: b side power domain + + power-domain-names: + items: + - const: processor-a-side + - const: processor-b-side + + interrupt-controller: true + + msi-controller: true + + "#msi-cells": + const: 0 + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - msi-controller + - "#msi-cells" + +additionalProperties: false + +examples: + - | + #include + #include + + msi-controller@5d270000 { + compatible = "fsl,imx6sx-mu-msi"; + msi-controller; + #msi-cells = <0>; + interrupt-controller; + reg = <0x5d270000 0x10000>, /* A side */ + <0x5d300000 0x10000>; /* B side */ + reg-names = "processor-a-side", "processor-b-side"; + interrupts = ; + power-domains = <&pd IMX_SC_R_MU_12A>, + <&pd IMX_SC_R_MU_12B>; + power-domain-names = "processor-a-side", "processor-b-side"; + }; From patchwork Thu Sep 22 16:12:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 608354 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 107F9C6FA82 for ; Thu, 22 Sep 2022 16:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229631AbiIVQOf (ORCPT ); Thu, 22 Sep 2022 12:14:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbiIVQOV (ORCPT ); Thu, 22 Sep 2022 12:14:21 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70072.outbound.protection.outlook.com [40.107.7.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BE62102534; Thu, 22 Sep 2022 09:14:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kXebeBFGqN9oN/398IVvX8/cWo02xRCaEiHGezvogpv2s6QMg/6/zFSkEvmOLnz2EEKl2GEtVUM/NzxGIyyMnDFNUgRo9M6yWiVpMARd4CLm6jLvDSflfY372Xv5s7mkWrClT8ErXc0BWG5cv4Qnk5fU1wKBwLrSUSQ67GN/PR80kAI456dIqnkEhLkbReFWVTyWQqVHFDL84fSAtVPUCN4KtH5YPeZMPu3m4iq9mStMIi/ep0Z+4zpldXPfgAJB/nJlFcLVXhFkEUK3csJjDB9pcEXVi5BBj884nw+W2mqPhjebpTcO0kNpgCxVDdnELZrk4aMPKX8VbZFrxnQrUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=l8JUx96keiGr1tQ4OD3B9n3DTWQBrLQzOEmt0GmiB7M=; b=nSAWIBnH0Yvu1jpgs2ZoD6LQxTCQrd/mUCum1n2ysG3fo8t1Qi/2oGU4IoQdo1KfADXAZuQERzi65/GoGk8EdrE0b5fWrD+cuPpRyk7UYYwk8vJasC93PP1uIfe0zqHb/jcrN1q+JvaNRczGT2AJ19/+4CCNtElA+fia18jVh7VwayoXshRNHm2yUSIfNAvctYP15ihvn7JFTUXIK1hG4xkEmXrpIJXHaoZuZlurvOKUfBumTuqqecN2MbZh3Uvsga0upz9MMi7sWwf+Fzys6pKIdN3ItMXMPa42vLZaPyJC0FIh9bgSy3GSukocPzzMOUO0qFkNUNBMT3cwhsXXIQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l8JUx96keiGr1tQ4OD3B9n3DTWQBrLQzOEmt0GmiB7M=; b=Uw9XpGgg3RmoGPoo2V2yXSyswauisPO3dSMNdeH+l1E6KMx4zWMeKkvJAyZ0thnccl+BU8R9CegGtIuosSC4VGZDUJ0tYKsmBbXhzEoy6eyXSrQ0WczCQZ1vXMKalgKxOiXFCY6onYiZ8SZmqJ1eGnPhSaN60WtQVqTp5yTlBcw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) by AS8PR04MB7541.eurprd04.prod.outlook.com (2603:10a6:20b:29a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 16:13:59 +0000 Received: from DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428]) by DU2PR04MB8789.eurprd04.prod.outlook.com ([fe80::5c5d:d0e4:cd13:6428%5]) with mapi id 15.20.5654.018; Thu, 22 Sep 2022 16:13:59 +0000 From: Frank Li To: maz@kernel.org, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kw@linux.com, bhelgaas@google.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, peng.fan@nxp.com, aisheng.dong@nxp.com, jdmason@kudzu.us, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, kishon@ti.com, lorenzo.pieralisi@arm.com, ntb@lists.linux.dev, lznuaa@gmail.com, imx@lists.linux.dev, manivannan.sadhasivam@linaro.org Subject: [PATCH v12 6/6] PCI: endpoint: Add vNTB MSI support Date: Thu, 22 Sep 2022 11:12:46 -0500 Message-Id: <20220922161246.20586-7-Frank.Li@nxp.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220922161246.20586-1-Frank.Li@nxp.com> References: <20220922161246.20586-1-Frank.Li@nxp.com> X-ClientProxiedBy: BY3PR05CA0016.namprd05.prod.outlook.com (2603:10b6:a03:254::21) To DU2PR04MB8789.eurprd04.prod.outlook.com (2603:10a6:10:2e0::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8789:EE_|AS8PR04MB7541:EE_ X-MS-Office365-Filtering-Correlation-Id: e753f173-4b89-4095-057b-08da9cb574b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TrcDWnWEBo9Ffo0Z+ihQ3e22txuO1nRCVqOYjgKV2drw5cvKzSgUd28othD8nVHBs+CCWLhNo55Q0q9T5dSZj/CR31fB6XmJ/M1Imm9LKQPxxuBU/eNpEuz8EiTUyhqMZMzuK7r2oIRKJT2u7qzd9j86v7BaRL2fAgWMvO6+cQp5iq9xtD9D3Obknrn7NeuDtL3pPOohcozgcpnbAiRqum74gQEIF3q9bUEz8WwXF9yq/9dqGoaE++9fVcMwx8+gUAU+UMrMk6OYPxH3n0nTJSCqeBMti0n4E9nL1DoGSz82DjFvGh7jSHnGR0sp18OsIWqmIASYutjSZ87FolmBOHvEAwNrkmgaqXLQKmN0oEbKQ/4ekZm2o5HuxYuEQ5eyAOjouc/a8tF/6CZXPZns+hkET/FwUYWHiJWNXBPY13UwHu6HzMPw24Q9WjZSdeTmOUE4bGkb3qLhHsTzbAjv1f8UYIUmRerCcmgMpT79kcueFMuNoQljXfwu7bQn77ARxv0dlSNv6szuBpJu+4Ob/fKcfbzTUuip8xbHKzryd5r3PkeGpmW/dQUzVGeNNl3XrOQMv4PDu8nO+s9pjnG2LTguVCiCSum2vpfI6vT7mHc9HJ4EFmo8P3XyxY6f/DGYsiKv6ZKueHprYRz6VyPwNVcFPTp9+976CdPmp9DUDs1BjwQ+BYjm40pRQAKAqs3R5S9M2jwIExgzbOgZqemeLASlw2WnpYtcxts4Si/fsS1qyCsbXq0LC9tW+8JoneCL6NOWXMOBjWSh2UznREmysQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8789.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(366004)(396003)(376002)(346002)(136003)(451199015)(83380400001)(1076003)(2616005)(6512007)(186003)(38100700002)(52116002)(66556008)(38350700002)(66476007)(8936002)(5660300002)(41300700001)(478600001)(2906002)(6506007)(6486002)(26005)(7416002)(6666004)(66946007)(4326008)(8676002)(36756003)(316002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?kE1b2jN1DIlW6AHAoIWpuahO4QGf?= =?utf-8?q?RIOiBfLtrdbsX+GIDSaoPm4x6qc7w859PqW4P05tw/G+Lw2riFSvuxSZ44M+QPEvF?= =?utf-8?q?cQtqCKUfmKhi7RnvsptUpN4gKnSNXJprWulr7JsCJ3NBxrRDHsrwCg3fjbltzyo+q?= =?utf-8?q?xMpXjIrSvPdLQLdHatvo9zLopMyh3wyxPXLvlceHL/U9WqAUZ4B3wkcfEqn4nhvWB?= =?utf-8?q?WGKngIPdfecGb9PgCGWIMLwasR9BMGJUfDJqkTXs3u9gtTIHTp8UNpBwpBYBOzzO+?= =?utf-8?q?OxSNbTl93LoKBdkaWn85+2xhOGZfTGYZsL+gX9CydCEmdEgacE0DluQ9P2lHAgBR5?= =?utf-8?q?EvykLeJQ6OZ0w+SPaDslioJkxbVdQ9t8fwDraPVIs9A9PDsQV2SLM3ATtyrV3lTGl?= =?utf-8?q?uiuEN9Xbh28lIilWZge4BDZcGvBqbA140rL6J/qizoxpAUQ5U3N5bRyPymiH5BPEa?= =?utf-8?q?depJcSixqaLR4qSI8eyLTLIfTvfqsbMmpjpvOTeuGSSHnoOqQVYxWwyahh6U2weQi?= =?utf-8?q?Gx28xCKFzWYbT0V2ZYo+idA3AaqIEeD7dQJ7HxdApm037PUW0zRnq/AN2cap9Exlx?= =?utf-8?q?K2SGoYuOA/yBnPL9/qorBcrfFUKxlOW++LauaRC6aXVGtGqFG4cV4H85KG6fCfDfx?= =?utf-8?q?ekEIWh4SxGnyEJBOiHFJTzh8CA4ItEXqGsA+IztGOA/pcGCvga2qO2MM4IOcc6y5p?= =?utf-8?q?dktZPk7pZyghqDCXuz2qiE67S1PJxXrxcCGPPE8uYFXZxNGDDiRYK2U7ymPoyvdK/?= =?utf-8?q?WhtRlQqdctzX2iCmF1jM9Ivobwq0EmX8lPZ7zfX1FYCNjhBZ+DkrKGjOkviS25PRe?= =?utf-8?q?QP9eE4E9tzk+s9u5yphvX8Ah4XV+HwK66+M1Olymb4GlyqhPGap8Ze2GR4zDrwAHh?= =?utf-8?q?PPA6X5AnEFuSJ8EzQrTSH8V4mfDWfXS+dopjpZ6GpMdF2RpLXXG1pDSMN6/rWZAC+?= =?utf-8?q?Sr5ELl6xCsXl6Zg6r6OpkCsa5S5rrm3pfsJYwZ5KY/3vF6PARkXzZ+9aet9bYYWjL?= =?utf-8?q?5+DaxO7PgsATWRkcoHfRaMT2dS3DBv5W5SDCCZHEi4izM/f3pVMIqJhTbl0A2mneh?= =?utf-8?q?wsDgfIij4lFWQAI/ELQK2LIVzYl5nuokjneC45+hLZ/uKOrVl6TAemALfcTZvKz3i?= =?utf-8?q?jYUjqRq1143fmU7dsbKoIgPs5qNlypqKHpEgsRNITgSCTlL3WF40shrlWKmBELbt7?= =?utf-8?q?oxxeu/1EyWkYpXndcr4WRNb2+hHDbIh9BtOvKg3D4xprgbR3/M+GFNGtTGtuiHajF?= =?utf-8?q?zgI7TAFo3QwM7OQ+5m04I9ixYnGeHgQ/MeW4ZTwp0icRSejGuOUPBSi2y+TUo7AA0?= =?utf-8?q?q9J6w8GKz7fqVNeyQYhyYx6FmUPuHjFnXnq4p2tNy+AsoKR99KkvQ+17+ZuUDh3lP?= =?utf-8?q?WPi74eTDzvONZV8XMyHkbc7iFYuGPO9M78i3l0ioYaFtzOiqdRx4GWopm1MPzqxzo?= =?utf-8?q?gzyOoOtU2LUqU4gq0QduVRrDpo0/u+uByvBT7VhkZQ/kLFw320HrEj/Sc0EIXT0kg?= =?utf-8?q?eyK3/nhq4yxA?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e753f173-4b89-4095-057b-08da9cb574b3 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8789.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 16:13:59.0061 (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: q97chNE2FekQdpMvl+yvI3J89D2sKyJa+vCNbYX7yWbfNthLln7rHZIODF3l+nwK/BR9bTt2lCLYYm/YvIOVTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7541 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org ┌───────┐ ┌──────────┐ │ │ │ │ ┌─────────────┐ │ PCI │ │ PCI Host │ │ MSI │◄┐ │ EP │ │ │ │ Controller │ │ │ │ 3.MSI Write │ │ └────────┬────┘ └─┼───────┼───────────────────┤ │ ▲ │ │ │ ├─BAR_n │ │ └────────┼───────┼──────────────────►│ │ │ │ │ 2.Call Back │ │ │ │ │ write_msi_msg() │ │ │ │ │ │ │ │ └───┬───┘ └──────────┘ │ │ └───────────────────┘ 1.platform_msi_domain_alloc_irqs() There is no defined way of raising IRQs by PCI host to the PCI endpoint. Only define MSI/MSI-X to let EP notified RC status change. The memory assigned for BAR region by the PCI host is mapped to the message address of platform msi interrupt controller in PCI Endpoint. Such that, whenever the PCI host writes to the BAR region, it will trigger an IRQ in the Endpoint. Basic working follow as 1. EP function driver call platform_msi_domain_alloc_irqs() alloc a MSI irq from MSI controller with call back function write_msi_msg(); 2. write_msg_msg will config BAR and map to address defined in msi_msg; 3. Host side trigger an IRQ in Endpoint by write to BAR region. Add MSI support for pci-epf-vntb. Query if system has an MSI controller. Set up doorbell address according to struct msi_msg. So PCI RC can write this doorbell address to trigger EP side's IRQ. If no MSI controller exists, fall back to software polling. Signed-off-by: Frank Li --- drivers/pci/endpoint/functions/pci-epf-vntb.c | 148 +++++++++++++++--- 1 file changed, 127 insertions(+), 21 deletions(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c index acea753af29ed..8fdeac2201e29 100644 --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c @@ -44,6 +44,7 @@ #include #include #include +#include static struct workqueue_struct *kpcintb_workqueue; @@ -137,11 +138,14 @@ struct epf_ntb { struct epf_ntb_ctrl *reg; u32 *epf_db; + phys_addr_t epf_db_phys; phys_addr_t vpci_mw_phy[MAX_MW]; void __iomem *vpci_mw_addr[MAX_MW]; struct delayed_work cmd_handler; + + int msi_virqbase; }; #define to_epf_ntb(epf_group) container_of((epf_group), struct epf_ntb, group) @@ -256,10 +260,13 @@ static void epf_ntb_cmd_handler(struct work_struct *work) ntb = container_of(work, struct epf_ntb, cmd_handler.work); - for (i = 1; i < ntb->db_count; i++) { - if (ntb->epf_db[i]) { - ntb_db_event(&ntb->ntb, i); - ntb->epf_db[i] = 0; + if (!ntb->epf_db_phys) { + for (i = 1; i < ntb->db_count; i++) { + if (ntb->epf_db[i]) { + ntb->db |= 1 << (i - 1); + ntb_db_event(&ntb->ntb, i); + ntb->epf_db[i] = 0; + } } } @@ -464,7 +471,7 @@ static int epf_ntb_config_spad_bar_alloc(struct epf_ntb *ntb) for (i = 0; i < ntb->db_count; i++) { ntb->reg->db_data[i] = 1 + i; - ntb->reg->db_offset[i] = 0; + ntb->reg->db_offset[i] = sizeof(u32) * i; } return 0; @@ -517,6 +524,28 @@ static int epf_ntb_configure_interrupt(struct epf_ntb *ntb) return 0; } +static int epf_ntb_db_size(struct epf_ntb *ntb) +{ + const struct pci_epc_features *epc_features; + size_t size = sizeof(u32) * ntb->db_count; + u32 align; + + epc_features = pci_epc_get_features(ntb->epf->epc, + ntb->epf->func_no, + ntb->epf->vfunc_no); + align = epc_features->align; + + if (size < 128) + size = 128; + + if (align) + size = ALIGN(size, align); + else + size = roundup_pow_of_two(size); + + return size; +} + /** * epf_ntb_db_bar_init() - Configure Doorbell window BARs * @ntb: NTB device that facilitates communication between HOST and VHOST @@ -540,27 +569,26 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb) ntb->epf->func_no, ntb->epf->vfunc_no); align = epc_features->align; - - if (size < 128) - size = 128; - - if (align) - size = ALIGN(size, align); - else - size = roundup_pow_of_two(size); + size = epf_ntb_db_size(ntb); barno = ntb->epf_ntb_bar[BAR_DB]; + epf_bar = &ntb->epf->bar[barno]; - mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0); - if (!mw_addr) { - dev_err(dev, "Failed to allocate OB address\n"); - return -ENOMEM; + if (ntb->epf_db_phys) { + mw_addr = NULL; + epf_bar->phys_addr = ntb->epf_db_phys; + epf_bar->barno = barno; + epf_bar->size = size; + } else { + mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0); + if (!mw_addr) { + dev_err(dev, "Failed to allocate doorbell address\n"); + return -ENOMEM; + } } ntb->epf_db = mw_addr; - epf_bar = &ntb->epf->bar[barno]; - ret = pci_epc_set_bar(ntb->epf->epc, ntb->epf->func_no, ntb->epf->vfunc_no, epf_bar); if (ret) { dev_err(dev, "Doorbell BAR set failed\n"); @@ -719,6 +747,83 @@ static int epf_ntb_init_epc_bar(struct epf_ntb *ntb) return 0; } +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN +static void epf_ntb_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg) +{ + struct epf_ntb *ntb = dev_get_drvdata(desc->dev); + struct epf_ntb_ctrl *reg = ntb->reg; + int size = epf_ntb_db_size(ntb); + u64 addr; + + addr = msg->address_hi; + addr <<= 32; + addr |= msg->address_lo; + + reg->db_data[desc->msi_index] = msg->data; + + if (!desc->msi_index) + ntb->epf_db_phys = round_down(addr, size); + + reg->db_offset[desc->msi_index] = addr - ntb->epf_db_phys; +} +#endif + +static irqreturn_t epf_ntb_interrupt_handler(int irq, void *data) +{ + struct epf_ntb *ntb = data; + int index; + + index = irq - ntb->msi_virqbase; + ntb->db |= 1 << (index - 1); + ntb_db_event(&ntb->ntb, index); + + return IRQ_HANDLED; +} + +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN +static void epf_ntb_epc_msi_init(struct epf_ntb *ntb) +{ + struct device *dev = &ntb->epf->dev; + struct irq_domain *domain; + int virq; + int ret; + int i; + + domain = dev_get_msi_domain(ntb->epf->epc->dev.parent); + if (!domain) + return; + + dev_set_msi_domain(dev, domain); + + if (platform_msi_domain_alloc_irqs(&ntb->epf->dev, + ntb->db_count, + epf_ntb_write_msi_msg)) { + dev_err(dev, "Can't allocate MSI, falling back to polling mode\n"); + return; + } + dev_info(dev, "Using MSI as doorbell\n"); + + for (i = 0; i < ntb->db_count; i++) { + virq = msi_get_virq(dev, i); + ret = devm_request_irq(dev, virq, + epf_ntb_interrupt_handler, 0, + "pci_epf_vntb", ntb); + + if (ret) { + dev_err(dev, "Failed to request doorbell IRQ! Falling back to polling mode"); + ntb->epf_db_phys = 0; + break; + } + + if (!i) + ntb->msi_virqbase = virq; /* msi start virq number */ + } +} +#else +static void epf_ntb_epc_msi_init(struct epf_ntb *ntb) +{ +} +#endif /* CONFIG_GENERIC_MSI_IRQ_DOMAIN */ /** * epf_ntb_epc_init() - Initialize NTB interface * @ntb: NTB device that facilitates communication between HOST and VHOST @@ -1320,14 +1425,15 @@ static int epf_ntb_bind(struct pci_epf *epf) goto err_bar_alloc; } + epf_set_drvdata(epf, ntb); + epf_ntb_epc_msi_init(ntb); + ret = epf_ntb_epc_init(ntb); if (ret) { dev_err(dev, "Failed to initialize EPC\n"); goto err_bar_alloc; } - epf_set_drvdata(epf, ntb); - pci_space[0] = (ntb->vntb_pid << 16) | ntb->vntb_vid; pci_vntb_table[0].vendor = ntb->vntb_vid; pci_vntb_table[0].device = ntb->vntb_pid;