From patchwork Wed Apr 10 17:08:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13624865 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 7AA1CCD1297 for ; Wed, 10 Apr 2024 17:09:00 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k6y6A1ryoRHbRnwiLaQYLRMLqM55MrLaGok5Ug+ezRc=; b=vE1+UF+xC74c2p 5fZg5EveEFJYTn1veq5XWbzK802eohgF/XfpKLUAkP/IqsJkpyZa0xXdFWRGpL73SnrGo3aOnw/yn hDWalq4JyPIumwMDzGqBz9VSElQb773oNz5DeHhoFXlVZHTToJleKgGa5XogYa9ksWvYVcRYooTCT NQ0UaI+XPrkGvjZ0XMkraDgTqXp17dimCbmDOMylvd08i03EOkA9PvwjKbBaqZGN8HyxPlGj1Eu8Y dTx8eBucPCEveOpdbLDCGxMZe/w4n5v8+GEo2nInsALLloCERDl+pN7Vik8XSD1AUzR3+42NYScD5 KFwESI/NW+Y/JrNnbbnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRK-00000008AQL-2AXv; Wed, 10 Apr 2024 17:08:50 +0000 Received: from mail-dm6nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:2417::601] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRB-00000008AM7-2CzR for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2024 17:08:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BdqKRJhIlzqaMEvZ+obFcoKsuj9hHdAy7szzRh/bY3Ph0Az9qgMhITBeyABsjHw4s+e3uT3/VQfDFcV8KutRRfO3ElDwKiOBHR6aVvu69YdWtM3vpapCZY289DklM2T0wp1BNSq6RGPWcficuDPaXSESGPowqSto7dmD2AcXWihvBAfJb6FOIxhjbflvHHLHEINz+4oVWYA0ixJ9LkaLMZt83/h1nxd4LSRgIjaxdSnQi4bSkVRfFKVao3achauppJYX+vQ2G1He48n0XIvybSeEBHV4oAHDC1F2ZRjKv5EGwNA2wkRJtR8gcil7l0rvgrWH4180XgbS0a2FUfW5nw== 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=/y5+UefAlgIIas46Ne2sxo2p/QW+AUVqmBsHw/XJMic=; b=DcTbWBMcsKHPs92POUpaOAVbwJGrHds79Vsy6ngbaZT143yg75dIWbRA9aHXQ5Oei2cfe1Af9viEuX5WMuGa7rhQH792E3z7HuKBGNW9snCU2y6bhxQoZpAPXXnd3xgHZBu3dA11qzD3vnp5imh7kSEwnNJecsHKdGBtqv8cdK1Q8xnd89Z8NB3oDYtZpwlvlS3GgxD4Nr3NTqiQfgPGG4lCe2j6EoXMip3GxGWqzQIhrWRGbPxftus+0Amzxnn24Q0HXc9bHGeqsjB8u7WUdphe+ir5aIpC/nm7pY6pu329zBYQGe6c6fleMMEz63rxYl0f6UJDra8XImtmcCkTJA== 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=/y5+UefAlgIIas46Ne2sxo2p/QW+AUVqmBsHw/XJMic=; b=ahcKjWq925HDkpQeuSF59sseq95oi78uGDNgw8FsJ4iUTxzv40QHGGaRItutse+UvKfC+a6dNq/JhJPm4M1DNUEAQYyVWRNLe91J15uOkgzxw1K7N1lFdAOf6o2uz7LG60EjLfy94kVjraQJLdIyTFAAIuWzuhg/W6UTghTKJCY= Received: from MN2PR14CA0001.namprd14.prod.outlook.com (2603:10b6:208:23e::6) by BY5PR12MB4148.namprd12.prod.outlook.com (2603:10b6:a03:208::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 10 Apr 2024 17:08:31 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::f6) by MN2PR14CA0001.outlook.office365.com (2603:10b6:208:23e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.34 via Frontend Transport; Wed, 10 Apr 2024 17:08:30 +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 BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Wed, 10 Apr 2024 17:08:30 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.35; Wed, 10 Apr 2024 12:08:27 -0500 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.35 via Frontend Transport; Wed, 10 Apr 2024 12:08:26 -0500 From: Ben Levinsky To: , , , , , Subject: [PATCH v3 1/3] mailbox: zynqmp: Move of_match structure closer to usage Date: Wed, 10 Apr 2024 10:08:23 -0700 Message-ID: <20240410170825.1132324-2-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240410170825.1132324-1-ben.levinsky@amd.com> References: <20240410170825.1132324-1-ben.levinsky@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: ben.levinsky@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|BY5PR12MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: 22c1b72b-d562-4a33-6116-08dc5980d89b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 76s5irjoESpTeKv64mzZ9Jo7/8ba+a/2bQsxgZAeCZSGSrOxG8XDrUjWKlSsc2Vvg0Bg/NWM3zseoFfJpKp+X6+mssBMh7EexH1Sy9KP7rxdCp/v+YP2T4mbaHqfFl1C6C2u/3RycMm9NvZY8p9KHVv+dDGAHanJwplXNHzwkZEzs0bqCQbmuQm2Ab5clkHV4Z+XqI566YmcvgV0WwjFCBIKVip0+n5uGvyH/G7U89K7Wl3vE4hDEzfHmfhDG3smmGV4+0M1LoVRu2rEDL83BRKqex0ChiuWHla2mwbDRxm14vlFHhLJWGmT8OFnWYCcBuCckJdGjXdTzuoujt0B6Ze+4q8VmM24LTuKVFprGKUkUlFM6aXYryKmsPAOPQ7I5XH51h/ZXGsZNhWS70Rk1oDjMlDsJP8zSDQciM0Oeg/E5/8sFwx99qcAesJ8P/o/tjf0hv7rAefiAXqIxfWDoLpLurtT+NPcSOFH9stcwISZ1O2qIziwiovaeOTDgYoytyzcaSwy7ciCMuREuJ4na1xh2pFhoTMFyQ5roUlDzbecoguZRbHuZlxmHStzuXf57Hlv13Fu02Y/z5ppJXK6M56c82Pn0OjYjEbHmSNm6eVQvs0kNQaek8aq7w9w7xkbYyDxkKlubivhfbcyECfp0+ozaDfUtfFMROdUegYULkOx1RDkrwSMaTz67A8qPxVZCkyDGXARbJfnAuqTrZXgTgKQJlIXAdpkHr+HLaBMka2hQARpTDZaS0JXfcc6jotI 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)(1800799015)(82310400014)(376005)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 17:08:30.3577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22c1b72b-d562-4a33-6116-08dc5980d89b 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: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4148 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_100843_900651_A2E556CE X-CRM114-Status: GOOD ( 13.81 ) 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 25c65afc030a..c7ce0826383f 100644 --- a/drivers/mailbox/zynqmp-ipi-mailbox.c +++ b/drivers/mailbox/zynqmp-ipi-mailbox.c @@ -415,12 +415,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 * @@ -695,6 +689,12 @@ static void zynqmp_ipi_remove(struct platform_device *pdev) zynqmp_ipi_free_mboxes(pdata); } +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_new = zynqmp_ipi_remove, From patchwork Wed Apr 10 17:08:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13624866 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 A7BEACD11C2 for ; Wed, 10 Apr 2024 17:09:02 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+WWvItn1GSSXYJuJLRt2OTJ8eAoj2lwDop44eiKM4U0=; b=HIYLUCOxSDjT4x q5U5wVPj0UVtCsbwRtS3iEZN0B9qRtkytvKXgwAVoYEtSfiJB5rNpFW61JTCWROlXn5yiDeInMxf+ 9lzrQamDqE6U//W2bEdh7WQXrJOYOo0Rpm/Tmh4dMkwZo8TKJGkwCcitwvfTu4A8wz6RU0x4D0aVT 83MNgkfoXFV1ZJ4YKbiZ41D0cILNRdH1GqOjT+aRTZ/M6092Q+xiJKScyseNgnEV7cA2mD5anNivB TtFh/RJrXjwGG1XhqQXpYoYP44+6sQjS/qX5mbctsajKmoJXMa1EyaWoD+StGr6lsQ1inh+7vUN99 oZrLm84e50X9eWngkA9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRL-00000008AQv-440F; Wed, 10 Apr 2024 17:08:51 +0000 Received: from mail-bn8nam04on20601.outbound.protection.outlook.com ([2a01:111:f403:2408::601] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRE-00000008AMq-1V6P for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2024 17:08:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RVSuMCBofsV7WiLrcQuBKIzB2LtKUypsboj8HHF594Kb6L2w6SalJxKJuPMv3pV6mNLJigctr7T9dRAtirNgCdDU6vHvLMbrA7WhP4ZrmgzatkE/B1HBlsp3bbVRyz6Znh0dhAV62eEzOpj4fleh/OGFKDrwXtKC9YT1XcID1hgExVs1RLSKAtKQMfFJZi8pTst0aI2tHrH82UyZvoXgrydRYVLNSeKdXiFuV2VhfM1EH6RKZIxQyx6OlIcUHWhTqXijJmL/GaVjBfRXB1WYTwn0uE3zFTZk38WvqwVRz+oK0/nbknkFuwY6WphEQTI+Bh9SfpzNNhSrXI4fMgg11Q== 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=RMUrhmPaUuglFn+QghKD/ocMN2CGGdwUlNU8B0OpfPU=; b=m1bjEvQTlybMNug0OsGdvYMZguuWaXknVrEH8ysCJW5GmWS6buX7UjSQUaX2azLZYh+wFhf/HNLobHg2RmK9vIrMdoYMneib/By0dFXckKigjXZjs+W0M3wP5wWgo09JbzsxIZn0gvFouWQIDTDCVJ7Wz4VmM4MI76GMnph3dk17r9Unpj2KwJcJk9VVk1z1bBnSbtAmm7S5ywNKl6fCDugfy6+Me6t9GoKjkxKJ/ejDRDfcJI+ol83qT6GWfxe8pn5sTgmp0BXq2HYpKYcxHGOGN5v4qhMSmDOA5+jcwlY2YshCkOIU2V4axkn7bhxPUW6ax8u4jwIqKKzuWOke9w== 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=RMUrhmPaUuglFn+QghKD/ocMN2CGGdwUlNU8B0OpfPU=; b=SrUc9foHCNWama8gxZTVGQst4L3e3Rs0bcIL2pCIy6AVVM4w4ms8VuWy8DBEyWfNNV+aEY9t38atMcCVPaVrg7IKyHqLHTatIZfCd1dfpCEL+Y38LW4VzNMDs7GY7fG4G7K4wgCPsD+xW7MfvsgVgl0Abg1LXnOjD0VMcArK2JU= Received: from MN2PR14CA0010.namprd14.prod.outlook.com (2603:10b6:208:23e::15) by SN7PR12MB7978.namprd12.prod.outlook.com (2603:10b6:806:34b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Wed, 10 Apr 2024 17:08:31 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::b8) by MN2PR14CA0010.outlook.office365.com (2603:10b6:208:23e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.34 via Frontend Transport; Wed, 10 Apr 2024 17:08:31 +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 BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Wed, 10 Apr 2024 17:08:31 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.35; Wed, 10 Apr 2024 12:08:27 -0500 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.35 via Frontend Transport; Wed, 10 Apr 2024 12:08:27 -0500 From: Ben Levinsky To: , , , , , Subject: [PATCH v3 2/3] mailbox: zynqmp: Move buffered IPI setup to of_match selected routine Date: Wed, 10 Apr 2024 10:08:24 -0700 Message-ID: <20240410170825.1132324-3-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240410170825.1132324-1-ben.levinsky@amd.com> References: <20240410170825.1132324-1-ben.levinsky@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: ben.levinsky@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|SN7PR12MB7978:EE_ X-MS-Office365-Filtering-Correlation-Id: f5ea1052-cc1d-4bb7-80b6-08dc5980d93d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eNpzqTw+sokpgrFNoATA77bTMR0aEkQRd2k1fmCdVFoNYVRq0zHCdjliB3cSXOk8KU4FDWGFEItViiWB/84u6yeAYtDQKGC/J+0s2GkL424zV8co4FprTMarJbOqhCAyUEDAYFiyDpW/qwXZb865YTke6mwBzpH8212T0ZbLQxdaX4sMPlHf8qBdLUVUBZhP8oWrcaHvvKXYaVq1XBwjR2MA/D10q0vHBYKUSZhZIyn+SOuBS8htmlaPNdILH+NcQjMzb7GiXBVYLIfKb4UzvYR2KpCFbF8uwfYIWlExLAQwXU+hGiJIMVet6GI1UTA4iFHPOV2jaBVBb8NhBQqVmtXQwOfbrcWwCJFc+QbrWwRXAXA5xWL0iA8mxgCaItpQfKevKvcUyGRuHK5effHPgrPgPYj9vqHGxjtIzyWFIcwzydeqOPAnpKZWtI9dxf8YsGiDj8CbHlZA5ChM4mWpzhu+X3SN7HoEuFEOv68OgRFSbv8e7SRDgx4nZUadkFt60m64vHuSsVY3jwNM7jx8Rh1qGex2KUXUb3zRDaJ6wGGdTPvNOAPGxZ/1POBMdsnehCa/2Uilz0gvVdNPZhGq951Gc1AS/Yv+56RzOn16oFEPSVuBcPUGPOCyaimO39bQNP9b/ZSjJute2E9IC6GnaeIpYVJV1uTsRM253X3Bkgp7mAILevT9LK0bLSwtyDzBHYyY8QFbXw53UmP70zI1419Wc4a6CUVz0UhUqyPu+KxaMsl5c5HtMkUBQ2o6nm9z 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)(1800799015)(376005)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 17:08:31.3890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5ea1052-cc1d-4bb7-80b6-08dc5980d93d 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: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7978 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_100844_931662_40136BF7 X-CRM114-Status: GOOD ( 22.99 ) 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 | 122 +++++++++++++++++++-------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index c7ce0826383f..56ba7135db54 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. @@ -81,6 +85,7 @@ struct zynqmp_ipi_mchan { * @remote_id: remote IPI agent ID * @mbox: mailbox Controller * @mchans: array for channels, tx channel and rx channel. + * @setup_ipi_fn: Function Pointer to set up IPI Channels */ struct zynqmp_ipi_mbox { struct zynqmp_ipi_pdata *pdata; @@ -88,6 +93,7 @@ struct zynqmp_ipi_mbox { u32 remote_id; struct mbox_controller mbox; struct zynqmp_ipi_mchan mchans[2]; + setup_ipi_fn setup_ipi_fn; }; /** @@ -464,12 +470,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; @@ -489,6 +492,73 @@ 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; + const char *name; + int ret; + + mdev = &ipi_mbox->dev; + mchan = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; name = "local_request_region"; ret = zynqmp_ipi_mbox_get_buf_res(node, name, &res); @@ -563,37 +633,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; } /** @@ -624,6 +664,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) { @@ -644,9 +685,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); @@ -690,7 +740,9 @@ static void 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 Wed Apr 10 17:08:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 13624867 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 485C7CD128A for ; Wed, 10 Apr 2024 17:09:07 +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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AYvso2B782RI4pwChywQrsYJA9niJ3WZVheMQ4UGL6o=; b=C570WVMhLoYT4j yZpxN4ig+fqnPfEKHk3NzdWMi72j6DGuIsM8B85d1xA4hUx5um9pQpXJmPUUzyzCDldNUTbPvEgBZ e1f17PpqLZaVqRc1lI41dIQODVdDn595spTgvj1ZA+lZkYx14dsidlKcneqJQGUzGumE+kYHjGyxj DYqmfoA69OrUVSvD4zDBsa80SuGeJhZEWdHN6Nz0vUpj6Dy8gDUzvszrdkk03mZ0vC4bldmJPBqig Gev+w80OE2k1T/GDw9rwNH8z/ee6tLZVKv2dEHqCSDzHq9VuGFMoqPp9vlwqZwjHW+pQYqIEVBdrs +GFSqIhz3mdjnaVa6zZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRL-00000008AQc-124I; Wed, 10 Apr 2024 17:08:51 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rubRD-00000008AMu-3QD7 for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2024 17:08:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WSCFCW+L2ecLlJ5oeAzDMwwgBCEhpnMsrZFQxFuid3kcB4KNymRMAIOGszB0y88P/S9MjMZwqWyhL60nMdj7Cnj5ipvapNXR4Q/b9I6LTDr4CLyZ4u6qvfxArRjIk//q7M1IUunjzreJKFzHO76lkNOOcADfkty7Sbbg65y/csimH8a2yGUGcwPrHKaJeyMDVpW8W+VWvWlGINN4tnhRK9jFH/aoUqtcT83sxeH0WkeKc3aFAi3u/D9eiSNYBGPTFUFL0gTQ2gpJuVSDxwakPRDAI/LT72f7tUjGzkFVkdir71e/s5Ave/yFWlO0PmsUgTcGHRYqtQ26SriOIiRe/Q== 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=2U9KxhEuOPUx29dgjnUhwx6UpGhQeu4UBiizLPwMITs=; b=XQsGkikWEdJrbmub8kWzydea0ffDYKJnGrkIm04RZ9e74YV6q/KGTR5BC3h4nXQimdLeQockWjUnQQyi/GYU3HMfgczkkL8MYR4aJaM0/6bjXn6R6axFNciRIiXVCTrurSPEVfiiJ3COhKv//Qu6XaxMUUM7x2LGQX9/aXu1qa7ajIWv5OpcnxUHY0L/vtaiGxn2kXlfAQ2yRwACNUychavLGmAb7g/5VGZP7HmFWYiHsnyroiEIgkuLdexU1m8S6sACm6h4cm+16vPneSBRU2vz9IjCUuhiTmlzYG4e4Dv6BbkZaAVUiCaL9inzzC/CdJK0Mj2em3lUrdDd08fWAA== 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=2U9KxhEuOPUx29dgjnUhwx6UpGhQeu4UBiizLPwMITs=; b=qS1g22zp/GHJt+kVDEc38YzfsRg/ocAWg/xiGCKbKDQL+/WmB259yH+J9+jXckx6HGcG7zDEiBwoMkiTYkUqT7nH66P+IWKz9wHyi5AUE5DTYtzu+VDjBMrfX6w8RFdnVrNyPqRB4C47puIuTiQEs5K4Dvheb3BA/ayi7Fddl28= Received: from MN2PR14CA0013.namprd14.prod.outlook.com (2603:10b6:208:23e::18) by DS7PR12MB8275.namprd12.prod.outlook.com (2603:10b6:8:ec::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Wed, 10 Apr 2024 17:08:32 +0000 Received: from BL02EPF00021F6D.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::f7) by MN2PR14CA0013.outlook.office365.com (2603:10b6:208:23e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.34 via Frontend Transport; Wed, 10 Apr 2024 17:08:32 +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 BL02EPF00021F6D.mail.protection.outlook.com (10.167.249.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Wed, 10 Apr 2024 17:08:32 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.35; Wed, 10 Apr 2024 12:08:28 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Apr 2024 12:08:28 -0500 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.35 via Frontend Transport; Wed, 10 Apr 2024 12:08:28 -0500 From: Ben Levinsky To: , , , , , Subject: [PATCH v3 3/3] mailbox: zynqmp: Enable Bufferless IPI usage on Versal-based SOC's Date: Wed, 10 Apr 2024 10:08:25 -0700 Message-ID: <20240410170825.1132324-4-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240410170825.1132324-1-ben.levinsky@amd.com> References: <20240410170825.1132324-1-ben.levinsky@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: ben.levinsky@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6D:EE_|DS7PR12MB8275:EE_ X-MS-Office365-Filtering-Correlation-Id: 424fefad-df0b-435c-3f87-08dc5980d9be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZcxS2boPYhC+Qs4ZivdJMiMiukwOX9FL7mJ9ufIBPatbmBiKQwjwqCsZ94/Qp/9M7Cjjm/9IHRmoHsWqzK6Vn7vYiOibVUtzCsqh7TjOdrk54P7SzQMX91DDllsFWOX8elYHaJYL04T8p3Q5e/ax8CNbmYeEJO2TMt+V14yMESRey5hPP7Y4BpWpTXtw/iloIUXwwdjJc7GCr7EgLE71m13FsekaVpzANGsM2bFSKlBgEmxIr0cEZoTA3OaYx1VkhQFuGMf3rHMtCS09dtAbkC/KakeE0vffB6w2PYGxzSALMf+m6Zye4ZGsB2TGIHwYEV8GxlZs/ajqVPiJP18/j/F/2YON75E2YMr5JiQkvDSCD/96MXhveM5sKAhopQINVgsmbO3oJcDzzeRocmMmvmMitREho+D5Vv8I3hVZON78k7otuavXMVmNYS3qvcYp1fayW0LFwUzukBT3HJfTrzihS9Nvty1skSb4Z6BiUGD9dZ7dco/NtLE8Pud+sGOqDvOoVaRrVCCrznARgNDipoiuowOZEiCaNtVQ9yac8zTE/jFv1bKoqn6mGBnaKfCqeT4TkUu3lqeJEhDAKpW++pfdkkIlsf+91S3rMALiEi63iu9QxvQkeGUN2hvjhxbr82wQv3Hz1WesKvGVlZp11pmWMYj6YPy4b8LU4JhRKkLLk404RxrHrdXcDiDZsYaoqJgusL9S+5wmmeQBiIBULdB4gUp5BYSUxhFVW49xXGysuR3dOkg5XYSoeX4ubzkh 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)(36860700004)(82310400014)(1800799015)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2024 17:08:32.1390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 424fefad-df0b-435c-3f87-08dc5980d9be 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: BL02EPF00021F6D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8275 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240410_100844_601515_CD2735B7 X-CRM114-Status: GOOD ( 23.90 ) 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 --- drivers/mailbox/zynqmp-ipi-mailbox.c | 129 +++++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 7 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 56ba7135db54..1cb553cced90 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 @@ -169,9 +176,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; } @@ -281,26 +290,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, @@ -636,6 +645,109 @@ 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; + + tx_mchan = &ipi_mbox->mchans[IPI_MB_CHNL_TX]; + rx_mchan = &ipi_mbox->mchans[IPI_MB_CHNL_RX]; + parent_node = of_get_parent(node); + 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; + } + + return 0; +} + /** * zynqmp_ipi_free_mboxes - Free IPI mailboxes devices * @@ -743,6 +855,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);