From patchwork Wed Apr 26 20:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 677177 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 DAFA3C77B60 for ; Wed, 26 Apr 2023 20:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233315AbjDZUfE (ORCPT ); Wed, 26 Apr 2023 16:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbjDZUfD (ORCPT ); Wed, 26 Apr 2023 16:35:03 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2048.outbound.protection.outlook.com [40.107.13.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC9322121; Wed, 26 Apr 2023 13:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UZR6NzBv5r/gKiTIMB7e3Ul891aPv1cDUrqQD8GYLjQU2jvhirI7sQCI5NhOEkqX+3EOaI5wBleesQKqkJm3cuLGOZjKLyVtCVXohzg5kqYG0LM6+yZ1+Uu+Y9JiS0luL8leUNhy7kKFQDCmJ5+JsEsVSjtH3G828BNvj377sVAZkNGH6oa5/wQEDZEUhsnqxJiqRGgK+YJhbkDKwbni5OAhAg2UupS2wrQD21g0gfAB1baSuPiVye7f/GCJdw280A24c+kei7XSPjt9saXiYrtjzjHZyyRxb+yeptu4cZVm67+NZqaNKwSnkeyJcRRpBUBKOu9fGYRy/VgaoEjX8g== 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=SiVHaMhmDj61Kp1nQXMKb39/IpM3UW+bl6bbn3rc+8c=; b=LFgSEPDeU9oHk6yZ/jCoc/X1mMyKcbQtcgKU5FADpjJkx/1g1NxElmx9GMEDPz5A6jdaJ61MEludY76PrL68VZhBmBDtK8Ti6nmZ5QQWiL5+VHUuri2xafQncJBV413FOK5HVhgsVJuMJqfXVKyxozFAxYIH+/7yNR+BrSJUosWBucJNgFcgcMIFSZTQglC0B+5o13JaKqsfdgmqteeNzQIAIg+qCpKj3McwvV5pGJdPI2KNh7Nk2WCvzNaz6lXPVtYq8G3RuE68H4z6Ia4SMRc2dh7PuR2MYmT9y7vdIZdKcmXoajMmVYTYvdYqmjC2q1NN0DZZlkUDEsG98y3VTg== 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=SiVHaMhmDj61Kp1nQXMKb39/IpM3UW+bl6bbn3rc+8c=; b=i5EQPGC9OZojkaPEP6X7D6H3MK+fG9j+QJPcE3cMTnnLfH0DAro3L4cLVPiDGzSfQGQ7buqDmu9f6zg0my98l4lks2bpiXTUwJx010d6KSGQxj+SMKaIsustQHo5B9W+xiBHjYnIgU9n9kGijyiBgKmG4Kc+OQjD6hwji8Sgqx8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) by AM0PR04MB6867.eurprd04.prod.outlook.com (2603:10a6:208:182::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.22; Wed, 26 Apr 2023 20:34:56 +0000 Received: from AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::f1d6:f05f:b8c6:4353]) by AM6PR04MB4838.eurprd04.prod.outlook.com ([fe80::f1d6:f05f:b8c6:4353%7]) with mapi id 15.20.6340.021; Wed, 26 Apr 2023 20:34:56 +0000 From: Frank Li To: tglx@linutronix.de Cc: aisheng.dong@nxp.com, bhelgaas@google.com, devicetree@vger.kernel.org, festevam@gmail.com, frank.li@nxp.com, imx@lists.linux.dev, jdmason@kudzu.us, kernel@pengutronix.de, kishon@ti.com, krzysztof.kozlowski+dt@linaro.org, kw@linux.com, linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, lorenzo.pieralisi@arm.com, lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org, maz@kernel.org, ntb@lists.linux.dev, peng.fan@nxp.com, robh+dt@kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org Subject: [PATCH 0/3] Add RC-to-EP doorbell with platform MSI controller Date: Wed, 26 Apr 2023 16:34:33 -0400 Message-Id: <20230426203436.1277307-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR03CA0030.namprd03.prod.outlook.com (2603:10b6:a03:33a::35) To AM6PR04MB4838.eurprd04.prod.outlook.com (2603:10a6:20b:4::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB4838:EE_|AM0PR04MB6867:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c934bd1-919e-4bc0-4c0c-08db4695b29b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HNLuxTTKRPUnLoTN3vKFo+YXRMGOwLF9kPBRHzcTsPuIOWM0MxkJeP5tz+8UHr5r/R88Foj8ezwWQIeZm5rkGmOicG0jXyBKJ9eFYuQnXmFunOF+TiZsnkTA3eCWMRtiotJBLScHJTFjXO1J1odZejiPNlB67c1QesVBuXSrmxRf4bweIzjQBYc/zReCkyXJvJBqkSsVuPJwzpOoScBwrbrsUymdUFy/ykeopVQ0zphhetvx8G3sT+ISRCrGl8x3AnG5PzwQF8JW0WjHoM9QW6ksXMyQ0Cg7nXyWVeSHjxEgL1NlCj2P6SMUn5VzQjV25zwgVat3D6wyiwStS2ItD6xGv3xi766WseZ2897m1EysJZnbEJaG+5R+oH11aSq8fzGTXcNwcqyEiJVWUUUaDBq1dOVppHeb86UQYb4FU91VZt0/5rSKUUMC7pJOsVBuqz52K4tVyRMWNTGoR3EjpQcxnzwXsW6ULPqntWBwPndiC6IVq9Dxv+nPR/tMBACeDzqNnaqnuMCHDoheXx8bIsoa8L0BlNWzHlvGxPNxBJwExbdKWqIP9p41u9Z9IRbjwYt3MeUCb4kOVnSmxb5EWRxm+JhWT2Ny511+pH0K9tE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB4838.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(366004)(346002)(396003)(39860400002)(451199021)(316002)(6506007)(186003)(1076003)(66946007)(66556008)(66476007)(6512007)(4326008)(26005)(6916009)(966005)(7416002)(36756003)(5660300002)(86362001)(478600001)(8936002)(8676002)(38350700002)(83380400001)(6486002)(38100700002)(6666004)(52116002)(2616005)(41300700001)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wj+BC1IHZ06Kh68d2EgClFXVnnCg?= =?utf-8?q?8JprSHEumoT/0a/u5+JZ+WH6ZIp0D7GpGLyiKRy2MZDTQ20e4FwrEB58p5uWvPb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?rWyxtiMiiBcMx8MRiqWwpHJdtU3vlhxkU/zUYDcPDLtPYBNoTpPoXt7lrYAKvaBzs?= =?utf-8?q?uIfK6GQqWIJ4rTJ6vqLsMRkNLPgbOe4nqOy60SU55DlEnbEGVfipeP6UC+LmgLIMW?= =?utf-8?q?gArSFuLqZAklzKBEG1VI78uI4VjUoBKqYzmbBAmZcyT4z7T0rK9OJAZFIQZWo/6Wq?= =?utf-8?q?kXVt/BGwBfigpK+RGdaZjPXA1Zwr/TzJZGHSH8Q2CUX1QJdNvpU7Bmz3c55smruU/?= =?utf-8?q?A7YCCrLa2OlqKqyNB1ETw6JhS2JcIyckQiuVzkZ+98jXNpy98PdPDYXZdlsFpMQca?= =?utf-8?q?2wnmJdsU/ADiI8d+bQk2eYnm2Q56kYTlcMpu29XkrxHrb1Tev7vilnfWYlnZBGYk6?= =?utf-8?q?xI9d0ePPDjglijzRKQ0RVmW3PUp89lkZb+H1VHJfCLHKfuIX2Xqc5sZ8s6ZNLIXbS?= =?utf-8?q?4Hnuz4sC6eQ5dgMQBaHVO/fASvFGN/aaJ0szngeKcBCgBxLvKLYLK5O7F2CuhFZtP?= =?utf-8?q?efQlsZC39UrsROgdDKBYHIs3xMPICSkQemhTeFMelQa8nTUoWLCnQcxVjsqCwxOg0?= =?utf-8?q?VLbD5dz8J+Ca?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c934bd1-919e-4bc0-4c0c-08db4695b29b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB4838.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2023 20:34:56.6011 (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: vtWzb46rXu0SPBsQjyeW2LPZwFLZbqqe19cpqUdO9mSlqUwMyLXR2dJQeCTHGpu2I2h24aCaCVth4alsDFvglg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6867 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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. The key point is comments from Thomas Gleixner, who suggest use new PCI/IMS. But arm platform change still not be merged yet. git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git devmsi-v2-arm So I still use existed method implement RC to EP doorbell. If Thomas Gleixner want to continue work on devmsi-v2-arm, I can help test and update this patch. Frank Li (3): PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller misc: pci_endpoint_test: Add doorbell test case tools: PCI: Add 'B' option for test doorbell drivers/misc/pci_endpoint_test.c | 41 +++++++++++ drivers/pci/endpoint/pci-epf-core.c | 109 ++++++++++++++++++++++++++++ include/linux/pci-epf.h | 16 ++++ include/uapi/linux/pcitest.h | 1 + tools/pci/pcitest.c | 16 +++- 5 files changed, 182 insertions(+), 1 deletion(-)