From patchwork Thu Dec 14 21:13:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13493688 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 55F96C4332F for ; Thu, 14 Dec 2023 21:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H9+DWlBRNYUqiycm/1Jwa5cde4klrBJyjz+sLMxeEE4=; b=pXAelsLnEak1Pj Ta7AUnD81FNI4l23sm8pao00K0Z1GMByK2YCuOY3afPGYOlzAus5soEdTSl6ZNzttdpRTQ8TJnaaD nAL2Co3EWLGGoBThc5HVzq/mbajK4IwgDNzttN7ZZswDWvRmKbjETv6SLKjk4aiOyviLMFJk/Es+y 0RzgD0JUKZHWrgeHwtuVN5fgUfjjYUpIRy1xry93A47GLO6S8PPabuyE8r6EC/KU5Pzmd6ijck1WT gyCTuhJe4cCiEy6GaYSLkia0faauAResqGu5HWoTVjWZa95EBtbfeNQ8BvXc2nCH+yt8bdTnerTiY ZyiZLNOy2YkL/Z8ZUtdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDt20-001JSa-13; Thu, 14 Dec 2023 21:14:08 +0000 Received: from mail-sn1nam02on2061e.outbound.protection.outlook.com ([2a01:111:f400:7ea9::61e] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDt1x-001JRS-0x for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2023 21:14:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lY0WaXNUyBYkI27kPJ6h1o51FwOZjdHJCsOw0C3stBllC9Quk0FxQZet6o2EWm0WgiegP2C/OsYyOhEIBC4q9wmqWlD6kmMMj1PvChgh6J2kVhIsiyrbr+AX63+OfHwbdkcIIrQw0GUKjVSxJtNXzOrkYPB/of8/s3GupLZxKD2MCm2t3ex9x6zE7/v545WjU4IWdbx5w73TJ7Q89fN+i3kkXnnC4P0EEFqT06TUXH7T3LYT18AAlRJsCzlQIfNoS5FJcLESowYtvyXMEFaGyAiWcIw172bPNEqUNYAql+snLzTm3ZqQ85mrTMYRrvk6yNaYuCKcMl7dRTwITSxzvA== 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=GJaW3xmFHW6u2hIIQXXhRYmYvsNTroIdrN2SHojrJkc=; b=TAlgTP+jbD7tuh/Hyc5OOC9DT4ozEpj/3WRx8dSJCsXyu4B+V2h5/6a8Sl85QA6rELVkrlsdFnD5ceQ43k4m3pqU0caOBNKDJKbJn1LxxftCoa639XNjOhnrNF9JP/fkt2i7yvgHOZ/lYBTwB5788wkQvBGxdTXuraYh4CLsbJlpc9eXLhtsPsWtU/4pg09wBUm88Rw7UWHSvSBcHFhZ9i8/Iv4HB93t9mnQP9dCr9NolsyN8atBZTWhyi7SutDA07UNyCF4od+llZm5S1sk/mdgu2TwBysZkr5TY7z2WmktHmZSvkwUKR5QAPuC05PIHYgV0xRSR1Ibv+j6IZ0IVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJaW3xmFHW6u2hIIQXXhRYmYvsNTroIdrN2SHojrJkc=; b=ajUXps82BgIsUHHBBgdh3XpBxwpdnXCKLf3YdiXNl/WIRaa/fJlJC6lCbIlhKOM16o/7VokepAix6LM2qbXMaK/kQfaLEZxr7uUa7/A64/QgEidIWynUw8HEh891z7c/iWC87xLy32vdaIOPZFfc2O+sv8Tp6plUldBXoYw3imU= Received: from MN2PR19CA0023.namprd19.prod.outlook.com (2603:10b6:208:178::36) by SA0PR12MB4463.namprd12.prod.outlook.com (2603:10b6:806:92::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 21:13:56 +0000 Received: from MN1PEPF0000F0E1.namprd04.prod.outlook.com (2603:10b6:208:178:cafe::f9) by MN2PR19CA0023.outlook.office365.com (2603:10b6:208:178::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 21:13:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MN1PEPF0000F0E1.mail.protection.outlook.com (10.167.242.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 21:13:56 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:56 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:55 -0600 Received: from xsjblevinsk50.xilinx.com (172.19.2.206) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 14 Dec 2023 15:13:55 -0600 From: Ben Levinsky To: , , CC: , , Subject: [PATCH 1/3] mailbox: zynqmp: Move of_match structure closer to usage Date: Thu, 14 Dec 2023 13:13:52 -0800 Message-ID: <20231214211354.348294-2-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214211354.348294-1-ben.levinsky@amd.com> References: <20231214211354.348294-1-ben.levinsky@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E1:EE_|SA0PR12MB4463:EE_ X-MS-Office365-Filtering-Correlation-Id: 63570b73-a785-4db4-6f1b-08dbfce99530 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bSLDt/cEiKwEoPvfHStbmtjKhdcvEIs8NiHKhpxL7MLfeUkMFZW6hKdI0TVtrVD2SiQmW9VYiTsHKwUhTgysiTltogvLDbN3+xupRpunh+UnDKgnDhWW9sBZk12Ua0yvFUhXuKRjUoPolhfnz4vK6hRgoayP7mX+1XWl8gp6NNlVNZfinnbdTZjHWnrz2+G1WYXKAbaVASwxfzuVubiarqbn1QFK2AYJ116p7C5+uOejUlZ9nD+2VqufuGLGOfjMbIW8uvpI62RhzWB1+LCL+8EEibBVr59i+jGhJiNia4vlk2QymfgwTu5IK16gublDsWFJYQGatd3YNGQ4HX5enYWNDrtWDs+gPSco/oZ9zigryt1Q2CU/+1b3vj617M/jMGNfZHUXlEO/CuaSFfWXHDpoxkFVrGOzUy7FspICdeOWoe+6nSJLYcoNLs/4jT5KmgxJ0GPh5DITxZCCyz5Y5eqLbM+NKHTHkAM8wxIWZt1Dr+1+v3UvKbrBP3b4PK46BdCcMZMctuaB2jwIabTDgG0dAitE2JcD5KJvw2qym7Hr3fz03BXV+cYJY6vHXME7UDlCQQs3j1wNRcgGpMqtMB7o7NX1KIM9ulqRlAeYuJtdA+VORV5783nYauheL0aWJb7v9+tSecdw0Z7PyFHKTjzeLrhr7EgDC8SiKJg/M1WxNiHNROUCQDuJoMsoeh1StT3gJqqMAKu1Cq1HD5J8EGpng+r+jUKY4P1YiiTgFTW1Gh46SAa0mzI83kHIackN8L10b/oaN26/hs43CD/zKg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(82310400011)(46966006)(40470700004)(36840700001)(44832011)(5660300002)(40480700001)(15650500001)(6666004)(478600001)(2906002)(82740400003)(356005)(26005)(2616005)(81166007)(86362001)(40460700003)(36756003)(1076003)(70586007)(6636002)(54906003)(316002)(70206006)(4326008)(8676002)(8936002)(110136005)(41300700001)(426003)(336012)(83380400001)(36860700001)(47076005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 21:13:56.3147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63570b73-a785-4db4-6f1b-08dbfce99530 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E1.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4463 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231214_131405_456162_E90AFC3D X-CRM114-Status: GOOD ( 12.71 ) 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 The of_match structure zynqmp_ipi_of_match is now adjacent to where it used in the zynqmp_ipi_driver structure for readability. Signed-off-by: Ben Levinsky --- drivers/mailbox/zynqmp-ipi-mailbox.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 7fa533e80dd9..2c10aa01b3bb 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -416,11 +416,6 @@ static struct mbox_chan *zynqmp_ipi_of_xlate(struct mbox_controller *mbox, return chan; } -static const struct of_device_id zynqmp_ipi_of_match[] = { - { .compatible = "xlnx,zynqmp-ipi-mailbox" }, - {}, -}; -MODULE_DEVICE_TABLE(of, zynqmp_ipi_of_match); /** * zynqmp_ipi_mbox_get_buf_res - Get buffer resource from the IPI dev node @@ -698,6 +693,12 @@ static int zynqmp_ipi_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id zynqmp_ipi_of_match[] = { + { .compatible = "xlnx,zynqmp-ipi-mailbox" }, + {}, +}; +MODULE_DEVICE_TABLE(of, zynqmp_ipi_of_match); + static struct platform_driver zynqmp_ipi_driver = { .probe = zynqmp_ipi_probe, .remove = zynqmp_ipi_remove, From patchwork Thu Dec 14 21:13:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13493689 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 29C04C4332F for ; Thu, 14 Dec 2023 21:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=weev0fsBp1uSucgkzJbAEtJtYAjp2LBGEzWxcmZebdw=; b=S90JB8X/LweKz8 hWvAJUvFn92fGQpKaRLfgZpb43fguzu8TQTkjtSIV+p0PZEx+x7zzE6RzunwPBgKmeKEfTyB7VAjg b9XrEki3ECMqATX4hc7+uraNgYbjtw2C6d7tPMvEVaWMo9jSgKtVJU+MDkk9TdSrNXAIm+2jDJLK8 dmVFsUIPl59J1eSSuiz8Mp7dAqw7CUwPzMxJFe+AbB22PJnqXtKFhcPArUCD7MwjiXlGMO1gabnzE mEmwnza8JBwaY/YSbPsO+HUQytNmYr3wVqG/x+0AigQmA7ts8De/ATyPpPzYXc3XBPyMGBIBM/SuS XPSp4YWRwQVeDiAf5i2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDt20-001JSm-2t; Thu, 14 Dec 2023 21:14:08 +0000 Received: from mail-dm6nam11on20621.outbound.protection.outlook.com ([2a01:111:f400:7eaa::621] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDt1x-001JRT-1k for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2023 21:14:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhMYMmMBCmZFR2vDN7Xmg3SNo8NHSO9QB2Qj1YFT3ufDVo3sqzfTgs1oQ78JChtQFYJcrc40pdZoAW8mWqZCmTIoKH3MAkUIzdLXyElZoQhhtm30hz8zmzCgO71Nykt6JkCsdp64jwR1eRJqQ59Gd/3Ivyr8tfobBUdxUqChaxrpFyJhVcwzQBAJydROrZaDQEoeBchrmHDflkotAdLqMdCpVnky4SdfCqcp/cxUejdPVbo8ms0Hmig/BVZ893tL6KKx07QrLkdUC3XA2Pfz+rc5VqRX7TUa9UpwX4k+0L6FTksyPRXIR5SaYHxvAmGn3yXBFLE2X72uWq1fmarFkA== 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=GyrNABH8i+zlt1Op3QBbr3feAzm1f1Qlzc1kvPCmUhQ=; b=HWvI7qvxVUv0eepl7y0a+EsdYuolc2bor7NF+D82E3UYne6dPFbf7pSr8xYpBUBhyUcTCnxR/NaJvuwp1+RmzXEm5karWf6WHOyZH9WDkcGOHtRgP9sSsOc9REFdoZG4PQp3lhjMst/LIMvIuM1YCn6XR0IRt55P7dKtwfIAvAIns8iCz8C0rVI2idM+SCDHcz0EaJu6jf+HNmbiLa+DE63pdI0BsS8kvs7XXsFKqw1Hk3MlE8jbpO/gtieEnR482WBmwOL8Bi2zFO1RmsfOufvhPUbhG+2OljwI/DPNnJGX2lIZ5GEq0FvCR7QzYxFJkexg69EemA20zQPDKO45hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GyrNABH8i+zlt1Op3QBbr3feAzm1f1Qlzc1kvPCmUhQ=; b=d9YxhpUpVRfy9vmNzGjSsf3WuHkDss44B74U9uVQMEdc+xfVKWvEKi8rWpIzc5zNV95gGLCfFz3ra6wOjLHX5hoKp/gHEismuzUXQiql+vXOTtCIC8Wn40MamgTzM6Nm7zQ2JRYu/5JlRssOXeJHIxweQCWuz+p6Xy0DO2gYf1U= Received: from SA1PR05CA0011.namprd05.prod.outlook.com (2603:10b6:806:2d2::13) by SN7PR12MB6742.namprd12.prod.outlook.com (2603:10b6:806:26e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.28; Thu, 14 Dec 2023 21:13:57 +0000 Received: from SA2PEPF00001506.namprd04.prod.outlook.com (2603:10b6:806:2d2:cafe::71) by SA1PR05CA0011.outlook.office365.com (2603:10b6:806:2d2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.8 via Frontend Transport; Thu, 14 Dec 2023 21:13:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00001506.mail.protection.outlook.com (10.167.242.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 21:13:57 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:56 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:56 -0600 Received: from xsjblevinsk50.xilinx.com (172.19.2.206) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 14 Dec 2023 15:13:55 -0600 From: Ben Levinsky To: , , CC: , , Subject: [PATCH 2/3] mailbox: zynqmp: Move buffered IPI setup to of_match selected routine Date: Thu, 14 Dec 2023 13:13:53 -0800 Message-ID: <20231214211354.348294-3-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214211354.348294-1-ben.levinsky@amd.com> References: <20231214211354.348294-1-ben.levinsky@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001506:EE_|SN7PR12MB6742:EE_ X-MS-Office365-Filtering-Correlation-Id: c7752571-ded2-49ae-9bd5-08dbfce995c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rXnJgyEVZnaW0yH2yol+BMhrhhAKApIOY7DqXsHC8hBkjNDJid1ukI4nqNKilW+ufgTGX1JTM9E+TfBswAkv+xYf61ncFQDmHLNmD+LL/JTOm0vCY5apln1WDZ1Kfuxk5Icvyv/5tin7z9KmbtX6NL76bf3ZTYtsnnf8hwkhBIQnfWMQSBpCfq67+cZv0D8jw4cb7k5+AUTEY2yAvsp9AZg7B92N2S8nd6cRzfhUIoAwNQdjVzqeMZNK0WeKDDP1GxRf10Zz8HMUUGbZuALGkf95+Usm7JoSnWLmSbq+G0buRlnAxj39kF9tlohtANCp2MyTg6vTmFjQ9l8M3d3sRx1dDgo+E+4y/S6oKM2KHOGVKp9VgOAX4m1cGQmWzAv/cmnVuBiNzioVBqW/S8vlFZbFhZ8VmZJ80FSP4+8ASiSuHftJbNX4JaFJzduD1cKz+P7UghVNWYN+bX/n4hAWc+uHqijRWY9iq7ItTtjr1vAdco8El4aRrjKQ2yegI/EjMg61rDVtRZ4lKAiFoxs43faHbrZ0DSwQW4VrwbydqDfmBDz8/f179Jf6LMuisCA8R90YqAHxknF1BNJs/S86oqy6xKMjLZUmXRxeL5WCHXXn4HeuDmk6PUotUuFkg3B2DNwNw8Q8Yi/n1uI2Be3Xp2VJXmV5hrnRoIe3g9WqoIvmn7mbzwcOhjdfh/45GptAoOW3nMffC8l9zqz05J8BRggyg9KNShgeA+Ibi8uICzR6Z6uM7Kfw4vhb1yLf1yMAX6aCmFHSidiRw2tCAekVBA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(136003)(346002)(376002)(230922051799003)(64100799003)(82310400011)(186009)(451199024)(1800799012)(40470700004)(46966006)(36840700001)(41300700001)(1076003)(478600001)(2616005)(36860700001)(336012)(26005)(86362001)(70206006)(70586007)(40480700001)(426003)(54906003)(6636002)(356005)(81166007)(40460700003)(82740400003)(316002)(83380400001)(110136005)(36756003)(8676002)(4326008)(8936002)(2906002)(47076005)(44832011)(5660300002)(15650500001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 21:13:57.2636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7752571-ded2-49ae-9bd5-08dbfce995c3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001506.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6742 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231214_131405_605054_44E610C6 X-CRM114-Status: GOOD ( 22.12 ) 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 Move routine that initializes the mailboxes for send and receive to a function pointer that is set based on compatible string. Signed-off-by: Ben Levinsky --- drivers/mailbox/zynqmp-ipi-mailbox.c | 124 +++++++++++++++++++-------- 1 file changed, 89 insertions(+), 35 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 2c10aa01b3bb..edefb80a6e47 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -72,6 +72,10 @@ struct zynqmp_ipi_mchan { unsigned int chan_type; }; +struct zynqmp_ipi_mbox; + +typedef int (*setup_ipi_fn)(struct zynqmp_ipi_mbox *ipi_mbox, struct device_node *node); + /** * struct zynqmp_ipi_mbox - Description of a ZynqMP IPI mailbox * platform data. @@ -82,6 +86,7 @@ struct zynqmp_ipi_mchan { * @mbox: mailbox Controller * @mchans: array for channels, tx channel and rx channel. * @irq: IPI agent interrupt ID + * setup_ipi_fn: Function Pointer to set up IPI Channels */ struct zynqmp_ipi_mbox { struct zynqmp_ipi_pdata *pdata; @@ -89,6 +94,7 @@ struct zynqmp_ipi_mbox { u32 remote_id; struct mbox_controller mbox; struct zynqmp_ipi_mchan mchans[2]; + setup_ipi_fn setup_ipi_fn; }; /** @@ -466,12 +472,9 @@ static void zynqmp_ipi_mbox_dev_release(struct device *dev) static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, struct device_node *node) { - struct zynqmp_ipi_mchan *mchan; struct mbox_chan *chans; struct mbox_controller *mbox; - struct resource res; struct device *dev, *mdev; - const char *name; int ret; dev = ipi_mbox->pdata->dev; @@ -491,6 +494,75 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, } mdev = &ipi_mbox->dev; + /* Get the IPI remote agent ID */ + ret = of_property_read_u32(node, "xlnx,ipi-id", &ipi_mbox->remote_id); + if (ret < 0) { + dev_err(dev, "No IPI remote ID is specified.\n"); + return ret; + } + + ret = ipi_mbox->setup_ipi_fn(ipi_mbox, node); + if (ret) { + dev_err(dev, "Failed to set up IPI Buffers.\n"); + return ret; + } + + mbox = &ipi_mbox->mbox; + mbox->dev = mdev; + mbox->ops = &zynqmp_ipi_chan_ops; + mbox->num_chans = 2; + mbox->txdone_irq = false; + mbox->txdone_poll = true; + mbox->txpoll_period = 5; + mbox->of_xlate = zynqmp_ipi_of_xlate; + chans = devm_kzalloc(mdev, 2 * sizeof(*chans), GFP_KERNEL); + if (!chans) + return -ENOMEM; + mbox->chans = chans; + chans[IPI_MB_CHNL_TX].con_priv = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; + chans[IPI_MB_CHNL_RX].con_priv = &ipi_mbox->mchans[IPI_MB_CHNL_RX]; + ipi_mbox->mchans[IPI_MB_CHNL_TX].chan_type = IPI_MB_CHNL_TX; + ipi_mbox->mchans[IPI_MB_CHNL_RX].chan_type = IPI_MB_CHNL_RX; + ret = devm_mbox_controller_register(mdev, mbox); + if (ret) + dev_err(mdev, + "Failed to register mbox_controller(%d)\n", ret); + else + dev_info(mdev, + "Registered ZynqMP IPI mbox with TX/RX channels.\n"); + return ret; +} + +/** + * zynqmp_ipi_setup - set up IPI Buffers for classic flow + * + * @ipi_mbox: pointer to IPI mailbox private data structure + * @node: IPI mailbox device node + * + * This will be used to set up IPI Buffers for ZynqMP SOC if user + * wishes to use classic driver usage model on new SOC's with only + * buffered IPIs. + * + * Note that bufferless IPIs and mixed usage of buffered and bufferless + * IPIs are not supported with this flow. + * + * This will be invoked with compatible string "xlnx,zynqmp-ipi-mailbox". + * + * Return: 0 for success, negative value for failure + */ +static int zynqmp_ipi_setup(struct zynqmp_ipi_mbox *ipi_mbox, + struct device_node *node) +{ + struct zynqmp_ipi_mchan *mchan; + struct device *mdev; + struct resource res; + struct device *dev; + const char *name; + int ret; + + mdev = &ipi_mbox->dev; + dev = ipi_mbox->pdata->dev; + mchan = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; name = "local_request_region"; ret = zynqmp_ipi_mbox_get_buf_res(node, name, &res); @@ -565,37 +637,7 @@ static int zynqmp_ipi_mbox_probe(struct zynqmp_ipi_mbox *ipi_mbox, if (!mchan->rx_buf) return -ENOMEM; - /* Get the IPI remote agent ID */ - ret = of_property_read_u32(node, "xlnx,ipi-id", &ipi_mbox->remote_id); - if (ret < 0) { - dev_err(dev, "No IPI remote ID is specified.\n"); - return ret; - } - - mbox = &ipi_mbox->mbox; - mbox->dev = mdev; - mbox->ops = &zynqmp_ipi_chan_ops; - mbox->num_chans = 2; - mbox->txdone_irq = false; - mbox->txdone_poll = true; - mbox->txpoll_period = 5; - mbox->of_xlate = zynqmp_ipi_of_xlate; - chans = devm_kzalloc(mdev, 2 * sizeof(*chans), GFP_KERNEL); - if (!chans) - return -ENOMEM; - mbox->chans = chans; - chans[IPI_MB_CHNL_TX].con_priv = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; - chans[IPI_MB_CHNL_RX].con_priv = &ipi_mbox->mchans[IPI_MB_CHNL_RX]; - ipi_mbox->mchans[IPI_MB_CHNL_TX].chan_type = IPI_MB_CHNL_TX; - ipi_mbox->mchans[IPI_MB_CHNL_RX].chan_type = IPI_MB_CHNL_RX; - ret = devm_mbox_controller_register(mdev, mbox); - if (ret) - dev_err(mdev, - "Failed to register mbox_controller(%d)\n", ret); - else - dev_info(mdev, - "Registered ZynqMP IPI mbox with TX/RX channels.\n"); - return ret; + return 0; } /** @@ -626,6 +668,7 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) struct zynqmp_ipi_pdata *pdata; struct zynqmp_ipi_mbox *mbox; int num_mboxes, ret = -EINVAL; + setup_ipi_fn ipi_fn; num_mboxes = of_get_available_child_count(np); if (num_mboxes == 0) { @@ -646,9 +689,18 @@ static int zynqmp_ipi_probe(struct platform_device *pdev) return ret; } + ipi_fn = (setup_ipi_fn)device_get_match_data(&pdev->dev); + if (!ipi_fn) { + dev_err(dev, + "Mbox Compatible String is missing IPI Setup fn.\n"); + return -ENODEV; + } + pdata->num_mboxes = num_mboxes; mbox = pdata->ipi_mboxes; + mbox->setup_ipi_fn = ipi_fn; + for_each_available_child_of_node(np, nc) { mbox->pdata = pdata; ret = zynqmp_ipi_mbox_probe(mbox, nc); @@ -694,7 +746,9 @@ static int zynqmp_ipi_remove(struct platform_device *pdev) } static const struct of_device_id zynqmp_ipi_of_match[] = { - { .compatible = "xlnx,zynqmp-ipi-mailbox" }, + { .compatible = "xlnx,zynqmp-ipi-mailbox", + .data = &zynqmp_ipi_setup, + }, {}, }; MODULE_DEVICE_TABLE(of, zynqmp_ipi_of_match); From patchwork Thu Dec 14 21:13:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13493691 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 4F2E9C4167D for ; Thu, 14 Dec 2023 21:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u/WfStJ4n4wMtLYfnsJ1+cWYEDA4kJIY74eu16wXU9E=; b=o5QRnWCL/1rjS9 jtqJxcTw+pcIfCv0AM4du3l6pwdv4YFLSD8dv7mZO3CDFz4wrghQhmmMDnbYfTRBnjsGRvkMQZ+cg 6qBehoW7HP9HKbqu5dIn9iD09t7N5kxzlabBWhG/PjfKgtVB5fV/XLCIIJxLsyFTVUAKNpMTi9Up1 c3zYYYpEyqXSjKsVttWfIPbblK77BfY6BKK2FmbYf7MAAH/3kdwwwWNsHUdce2PizWaEi/VUgVaTS kJXmP14OJ5DOhVEwM+OBOm+JYnYKk684wu9RTAYe6TPa4P7rjwqFNRww9YSe8gjJgiPGGoP3fBCus c1epTxzNgXlSq5mS17xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDt2B-001JVq-17; Thu, 14 Dec 2023 21:14:19 +0000 Received: from mail-dm6nam04on20601.outbound.protection.outlook.com ([2a01:111:f403:2409::601] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDt1x-001JRP-23 for linux-arm-kernel@lists.infradead.org; Thu, 14 Dec 2023 21:14:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5UQUG2tMLeBUuOTEZXgo9JHKCPkEP46+bZWricWtwRwlvwvvahflodAyZMVCZLxjBssQ+GXLtzKTfKS7vMa8d4awoO0S0eJV7iCMIemSYGOmhLYCYAcpsPDlFEu7GkntxfK78kSOqiteHeosh6rAUSpd/zf3ri7JMSVZyp1HbiSDyqWPJBcIxipekPRZWdhyZIkotHhKa2P500NF45wZ8QIDFJDfAHCvFU+JGefQ8bDQwuZF1d2lKK1kmZjiXVkdhrpff4aite+/e641+fHski7MAvSnVVCdhXlqZbGtxhz32mXDrqhep5YUZedWDwDCb4S89lZvNEjbd0mau3bYg== 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=xsSAgkByxi1E/H41WVLR/a+MWiHNOG4RqH4g4/cMbPg=; b=WPY4J30UzvQuDQGoIRysDITIqkaH+Laaoz5qnp/L4mH/CSU8/gY7OB7eawdMFZ8C2e8fJ7X/S9vHNcfDWk9FIfyBWXgTY0GBOXRu3FRyvK8QmXXjP0LL2OLsgpDQ3y85EPYDVzYj5svk2kyvfCcMtILexgT2Q0FDc9qAUrzIvTMICcWe3NobBA9JAx8n97H/siB/+bs2KDD/uHF3fMqp7EV+RBt1HApUtiRPsJ+Jv9UnFx+Y6+uEL+gTQZG5w1F+qj8QaciiRf0SEXxFpWZI2svjT9A6PUS1xKppuevkKUdM+AI6rGqrSoH4rbHq14TnXx7hkeBO/DH6kJHRK8hVsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xsSAgkByxi1E/H41WVLR/a+MWiHNOG4RqH4g4/cMbPg=; b=IdbdtTniUPcB/eW1MN02t3dtRuhaXwsyfAQj+kVOLLrMSPL5biKWsjASkMyZYAs9MVshe7648qa0fT2SlI4An+0YODQkl19AkxEW3FFxbDTZha7L1R7Fvds4r5cahAuUm3hWEFsl9+AZtyEyubwWzoEVmtdM/VlZ8mT5CGlmtuM= Received: from BL1PR13CA0163.namprd13.prod.outlook.com (2603:10b6:208:2bd::18) by IA0PR12MB8973.namprd12.prod.outlook.com (2603:10b6:208:48e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.38; Thu, 14 Dec 2023 21:13:57 +0000 Received: from MN1PEPF0000F0E3.namprd04.prod.outlook.com (2603:10b6:208:2bd:cafe::8a) by BL1PR13CA0163.outlook.office365.com (2603:10b6:208:2bd::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.8 via Frontend Transport; Thu, 14 Dec 2023 21:13:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MN1PEPF0000F0E3.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Thu, 14 Dec 2023 21:13:57 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:57 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 14 Dec 2023 15:13:57 -0600 Received: from xsjblevinsk50.xilinx.com (172.19.2.206) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Thu, 14 Dec 2023 15:13:56 -0600 From: Ben Levinsky To: , , CC: , , Subject: [PATCH 3/3] mailbox: zynqmp: Enable Bufferless IPI usage on Versal-based SOC's Date: Thu, 14 Dec 2023 13:13:54 -0800 Message-ID: <20231214211354.348294-4-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231214211354.348294-1-ben.levinsky@amd.com> References: <20231214211354.348294-1-ben.levinsky@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E3:EE_|IA0PR12MB8973:EE_ X-MS-Office365-Filtering-Correlation-Id: ca005360-5db6-43bb-7ebf-08dbfce9960a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zAWpzFKYQ9IPyt3HH0GF7pJIGvuGA99D3H9LNqbRtPs+RpdydEp0uBG3t/t0s0U8A3LA72LFTWJOl2TUvtz8ktpy06PEvV5WJHWH6zF3Tr3hmRS+W5bHygk5XMusmAyUqLJIkdlToTtBhk8ZlWEnFAUGscuhZ9cLKR6GGhQ8anxNM66Ayo0afoPoJitzWepzGvAqCrcisbGjOSoAbue1y20e1CWAkIy91saVGN6g5Wf4hFYefXkUvikWJZS1lvDpsSjKPwWDbdGqnzW5Z1UBZmfG8Rj3eXWL0GqrgxpoQRrtniNeP/W9v2peCUuDDSokmHE6kG7J6afOExbMsyz5qnHTExOE9Dgwj3Hohc/8fjmgEJu9uQe33RsupulL+KDB2GO0dKyL94kPiwlxLMdWdn9Sa1igC8T60eFtGoatbqiOMynb3JQSKCYb4KBKQR20U3MkpiZpwr5ahjfJy6wA4/5Ayr7EAEibR3IRCZWKQ0YVbfREsAy2kkf70cBuRBVe1uc/1JbW9fnpT+Ox/+2s37W3MG0Wm/2b8vsxIwGgOHTwta0qoKJGQTjWhCJIBxelR5m1PtoNdP2g7n8JB4ECZ8raihINFa+Cq/A4Y8G1i3Xz6kLuGpSeTUC6cfwmgX6fbmzQAWLNgV3HO447IqImIMYCjRjS83a7L3leAqvs6qoRrD7y/IVcdxDU2q4a5mW6WINUHTKa2A3sAdbnVn3MLQn/a8OAPTFNETg4PItdOfx5+x7O+lU8g5bS2JEL/Vjg3FgEo6w7A3N8EBeqCJCektfaNGAjsvpXqnqTc9sUGUo= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(346002)(136003)(230922051799003)(186009)(82310400011)(451199024)(64100799003)(1800799012)(40470700004)(36840700001)(46966006)(41300700001)(15650500001)(2906002)(44832011)(5660300002)(40460700003)(36860700001)(82740400003)(81166007)(356005)(70206006)(70586007)(54906003)(6636002)(426003)(40480700001)(43170500006)(336012)(26005)(110136005)(83380400001)(316002)(2616005)(36756003)(1076003)(86362001)(966005)(478600001)(47076005)(8936002)(4326008)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 21:13:57.7438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca005360-5db6-43bb-7ebf-08dbfce9960a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8973 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231214_131405_678190_889F2FB1 X-CRM114-Status: GOOD ( 23.80 ) 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 Xilinx-AMD Versal and Versal-NET, there exist both inter-processor-interrupts with corresponding message buffers and without such buffers. Add a routine that, if the corresponding DT compatible string "xlnx,versal-ipi-mailbox" is used then a Versal-based SOC can use a mailbox Device Tree entry where both host and remote can use either of the buffered or bufferless interrupts. Signed-off-by: Ben Levinsky --- Note that the linked patch provides corresponding bindings. Depends on: https://lore.kernel.org/all/20231214054224.957336-3-tanmay.shah@amd.com/T/ --- drivers/mailbox/zynqmp-ipi-mailbox.c | 146 +++++++++++++++++++++++++-- 1 file changed, 139 insertions(+), 7 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index edefb80a6e47..316d9406064e 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -52,6 +52,13 @@ #define IPI_MB_CHNL_TX 0 /* IPI mailbox TX channel */ #define IPI_MB_CHNL_RX 1 /* IPI mailbox RX channel */ +/* IPI Message Buffer Information */ +#define RESP_OFFSET 0x20U +#define DEST_OFFSET 0x40U +#define IPI_BUF_SIZE 0x20U +#define DST_BIT_POS 9U +#define SRC_BITMASK GENMASK(11, 8) + /** * struct zynqmp_ipi_mchan - Description of a Xilinx ZynqMP IPI mailbox channel * @is_opened: indicate if the IPI channel is opened @@ -170,9 +177,11 @@ static irqreturn_t zynqmp_ipi_interrupt(int irq, void *data) if (ret > 0 && ret & IPI_MB_STATUS_RECV_PENDING) { if (mchan->is_opened) { msg = mchan->rx_buf; - msg->len = mchan->req_buf_size; - memcpy_fromio(msg->data, mchan->req_buf, - msg->len); + if (msg) { + msg->len = mchan->req_buf_size; + memcpy_fromio(msg->data, mchan->req_buf, + msg->len); + } mbox_chan_received_data(chan, (void *)msg); status = IRQ_HANDLED; } @@ -282,26 +291,26 @@ static int zynqmp_ipi_send_data(struct mbox_chan *chan, void *data) if (mchan->chan_type == IPI_MB_CHNL_TX) { /* Send request message */ - if (msg && msg->len > mchan->req_buf_size) { + if (msg && msg->len > mchan->req_buf_size && mchan->req_buf) { dev_err(dev, "channel %d message length %u > max %lu\n", mchan->chan_type, (unsigned int)msg->len, mchan->req_buf_size); return -EINVAL; } - if (msg && msg->len) + if (msg && msg->len && mchan->req_buf) memcpy_toio(mchan->req_buf, msg->data, msg->len); /* Kick IPI mailbox to send message */ arg0 = SMC_IPI_MAILBOX_NOTIFY; zynqmp_ipi_fw_call(ipi_mbox, arg0, 0, &res); } else { /* Send response message */ - if (msg && msg->len > mchan->resp_buf_size) { + if (msg && msg->len > mchan->resp_buf_size && mchan->resp_buf) { dev_err(dev, "channel %d message length %u > max %lu\n", mchan->chan_type, (unsigned int)msg->len, mchan->resp_buf_size); return -EINVAL; } - if (msg && msg->len) + if (msg && msg->len && mchan->resp_buf) memcpy_toio(mchan->resp_buf, msg->data, msg->len); arg0 = SMC_IPI_MAILBOX_ACK; zynqmp_ipi_fw_call(ipi_mbox, arg0, IPI_SMC_ACK_EIRQ_MASK, @@ -640,6 +649,126 @@ static int zynqmp_ipi_setup(struct zynqmp_ipi_mbox *ipi_mbox, return 0; } +/** + * versal_ipi_setup - Set up IPIs to support mixed usage of + * Buffered and Bufferless IPIs. + * + * @ipi_mbox: pointer to IPI mailbox private data structure + * @node: IPI mailbox device node + * + * Return: 0 for success, negative value for failure + */ +static int versal_ipi_setup(struct zynqmp_ipi_mbox *ipi_mbox, + struct device_node *node) +{ + struct zynqmp_ipi_mchan *tx_mchan, *rx_mchan; + struct resource host_res, remote_res; + struct device_node *parent_node; + int host_idx, remote_idx; + struct device *mdev, *dev; + + tx_mchan = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; + rx_mchan = &ipi_mbox->mchans[IPI_MB_CHNL_RX]; + parent_node = of_get_parent(node); + dev = ipi_mbox->pdata->dev; + mdev = &ipi_mbox->dev; + + host_idx = zynqmp_ipi_mbox_get_buf_res(parent_node, "msg", &host_res); + remote_idx = zynqmp_ipi_mbox_get_buf_res(node, "msg", &remote_res); + + /* + * Only set up buffers if both sides claim to have msg buffers. + * This is because each buffered IPI's corresponding msg buffers + * are reserved for use by other buffered IPI's. + */ + if (!host_idx && !remote_idx) { + u32 host_src, host_dst, remote_src, remote_dst; + u32 buff_sz; + + buff_sz = resource_size(&host_res); + + host_src = host_res.start & SRC_BITMASK; + remote_src = remote_res.start & SRC_BITMASK; + + host_dst = (host_src >> DST_BIT_POS) * DEST_OFFSET; + remote_dst = (remote_src >> DST_BIT_POS) * DEST_OFFSET; + + /* Validate that IPI IDs is within IPI Message buffer space. */ + if (host_dst >= buff_sz || remote_dst >= buff_sz) { + dev_err(mdev, + "Invalid IPI Message buffer values: %x %x\n", + host_dst, remote_dst); + return -EINVAL; + } + + tx_mchan->req_buf = devm_ioremap(mdev, + host_res.start | remote_dst, + IPI_BUF_SIZE); + if (!tx_mchan->req_buf) { + dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); + return -ENOMEM; + } + + tx_mchan->resp_buf = devm_ioremap(mdev, + (remote_res.start | host_dst) + + RESP_OFFSET, IPI_BUF_SIZE); + if (!tx_mchan->resp_buf) { + dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); + return -ENOMEM; + } + + rx_mchan->req_buf = devm_ioremap(mdev, + remote_res.start | host_dst, + IPI_BUF_SIZE); + if (!rx_mchan->req_buf) { + dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); + return -ENOMEM; + } + + rx_mchan->resp_buf = devm_ioremap(mdev, + (host_res.start | remote_dst) + + RESP_OFFSET, IPI_BUF_SIZE); + if (!rx_mchan->resp_buf) { + dev_err(mdev, "Unable to map IPI buffer I/O memory\n"); + return -ENOMEM; + } + + tx_mchan->resp_buf_size = IPI_BUF_SIZE; + tx_mchan->req_buf_size = IPI_BUF_SIZE; + tx_mchan->rx_buf = devm_kzalloc(mdev, IPI_BUF_SIZE + + sizeof(struct zynqmp_ipi_message), + GFP_KERNEL); + if (!tx_mchan->rx_buf) + return -ENOMEM; + + rx_mchan->resp_buf_size = IPI_BUF_SIZE; + rx_mchan->req_buf_size = IPI_BUF_SIZE; + rx_mchan->rx_buf = devm_kzalloc(mdev, IPI_BUF_SIZE + + sizeof(struct zynqmp_ipi_message), + GFP_KERNEL); + if (!rx_mchan->rx_buf) + return -ENOMEM; + } else { + /* + * If here, then set up Bufferless IPI Channel because + * one or both of the IPI's is bufferless. + */ + tx_mchan->req_buf = NULL; + tx_mchan->resp_buf = NULL; + tx_mchan->rx_buf = NULL; + tx_mchan->resp_buf_size = 0; + tx_mchan->req_buf_size = 0; + + rx_mchan->req_buf = NULL; + rx_mchan->resp_buf = NULL; + rx_mchan->rx_buf = NULL; + rx_mchan->resp_buf_size = 0; + rx_mchan->req_buf_size = 0; + } + + return 0; +} + /** * zynqmp_ipi_free_mboxes - Free IPI mailboxes devices * @@ -749,6 +878,9 @@ static const struct of_device_id zynqmp_ipi_of_match[] = { { .compatible = "xlnx,zynqmp-ipi-mailbox", .data = &zynqmp_ipi_setup, }, + { .compatible = "xlnx,versal-ipi-mailbox", + .data = &versal_ipi_setup, + }, {}, }; MODULE_DEVICE_TABLE(of, zynqmp_ipi_of_match);