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: 178907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8856949dys; Thu, 14 Dec 2023 13:15:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMJ0Ze+BTnT4WyeGzPuo7JruYQa3RabmfETYzi0sBZqDefQWwSAhB4qqbMhLaT7GwBJX/Y X-Received: by 2002:a92:6f0c:0:b0:35d:5995:1d75 with SMTP id k12-20020a926f0c000000b0035d59951d75mr12788073ilc.58.1702588552537; Thu, 14 Dec 2023 13:15:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702588552; cv=pass; d=google.com; s=arc-20160816; b=V9/TxFlG2rsG6jfhbf76AitOXZga5LAFb8VyK5y0uWeG7omk1hkjqcMozHb/GuXjng r5jwaPDrQaA/SzVlAnh8+V6D1UqaLphXUSN+wNi8raS6vfzKZ/WLijLgcl5L/AfABgY2 K1F7fBiLiiCDYnKYgLQy537VPPwEtKI/g70H16q5Vn5RUJ2CEWNqRne7aXAuK9BFzQAA 3gQ3B3nGGF2qARoq6COqsqkF5WoT9vibyMGmrXSn3RNzj58tokYY38J7fF+4qkDp+XoY nZSsBqWM3jU5sqjngu0LdXzNJSZ3/THy9hB+7XSTsHWBE0I0Vmv8pKKrlt+Y5MG4Ye1e tiNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GJaW3xmFHW6u2hIIQXXhRYmYvsNTroIdrN2SHojrJkc=; fh=KH8R4nJL2R35si/07IYW6kKjogIdY6+0DacN39OmlO4=; b=x2K8UXu+42SAGCqnsLbRX0DHwLBRR282C3tKXEUY+8qDA7GRSR9tl2+kgwzbZanAAW d+OWvmZj/O+q1EfekbKSLl+UHe39KBgsIvAfmbvYNtt5CsYvutssvuZA1rWP2A0TuBZU FNaePIxYEtNS1u5jHbrpvOsdRoxGNLP4fHID5jfTwwtsuSI1/zYl2nzIIXhnMkW1srdP Xl5Ak4n5FFqzYfRzb54SGjw+zLyWTkTSetK5uQsOaqWINk8dLtYRJEDez6nTMTIqTdkc QF6MoG7FyfhB/38LaxSEFmvW9A/wBwy/BiKdWP1Ew9Dmpm2BHLBfp5YinCB0Y4DMWRdx lmCw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ajUXps82; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-116-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 17-20020a631651000000b005c6921c1ccasi11774204pgw.600.2023.12.14.13.15.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 13:15:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ajUXps82; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-116-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BA4CBB21884 for ; Thu, 14 Dec 2023 21:14:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 22DAA6D1DE; Thu, 14 Dec 2023 21:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ajUXps82" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2056.outbound.protection.outlook.com [40.107.96.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAF04273FD for ; Thu, 14 Dec 2023 21:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785293494081215003 X-GMAIL-MSGID: 1785293494081215003 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: 178908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8857134dys; Thu, 14 Dec 2023 13:16:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7uqxEBUnuUAPP2iffD3efuyoNMO4TN6RCGpDsLVYavw8W9wNWZm9X/iUT4sMOKBaF/X41 X-Received: by 2002:a05:6a21:789c:b0:18f:97c:8a33 with SMTP id bf28-20020a056a21789c00b0018f097c8a33mr14589269pzc.94.1702588571562; Thu, 14 Dec 2023 13:16:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702588571; cv=pass; d=google.com; s=arc-20160816; b=AoyIVry3i3PYsTvYEX9CPBD5PMwvXc8Km91tNheuVpujMrRXh8o1/eGkb80RMvvSV/ XkL+GhGeZoLfnL71iBe8xjWMu5OOWWJ3Jrbgg/DoLfp/DHHdbRUoR3XsjuqTwouNVdyT XXn8vMtpjNjnSX4xWTffJH6aiSZBmg36oHKmumifNuG6r9t9Jn79tOUsbozpVa7VM/Pg 8/+J0jQLkplyXvK7HmnLe73KySSrRpyl/L6A6YKOpc+fQrUHCNyDmXG2Pm4JX0KPyYVK yechjGh/ATjOS8LPN/HkpUs0poJ1XUsWHu/ek4fY+/tlS1xP46qQhJQM2SlJoR/mqrsd MC5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GyrNABH8i+zlt1Op3QBbr3feAzm1f1Qlzc1kvPCmUhQ=; fh=KH8R4nJL2R35si/07IYW6kKjogIdY6+0DacN39OmlO4=; b=OGAIDxcjmjXHl7/hTS6bc5al1YIQ2M69X/CLEsso0WwBRUb2zLvTWEoizDKIKmctgJ T74y2hAzrMSqqV0EJFyEmUci51f3Z8RaN3ZHYJ4VdIOz5z+YkWTjIt1ZGdZ/z+uu+O56 zTV4holbUDzpSg5a6wSfFqkw22HXtVDsEuh4E+iEVwV9GJbIl0sFJUkRpWa6pYlrRdUK PNrzDRZW8HwyGXyOg1zzaHgdd/QwiO/cQvHnB4XiC79xO6BJJS6NMyCY3qRn4rVNRWWa stZ8W4J9Ucp7mj/6OOzo041NU4hAh1IpGwBJxWW9Z7yHObRI1gfvNU7jmUQ6BfDxqZuI xdNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d9YxhpUp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 27-20020a630f5b000000b005c6260b688esi11778736pgp.606.2023.12.14.13.16.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 13:16:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=d9YxhpUp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-117-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 86476B21D30 for ; Thu, 14 Dec 2023 21:14:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8F226E2BD; Thu, 14 Dec 2023 21:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="d9YxhpUp" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A53B2BCF6 for ; Thu, 14 Dec 2023 21:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785293513581072804 X-GMAIL-MSGID: 1785293513581072804 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: 178906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8856675dys; Thu, 14 Dec 2023 13:15:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkr0rh97lzk2c8uO3rs69TMxccnopuLi9/BTi9c89ejwiEyAk7QHGptSLKqWUC6ZCw5Qmn X-Received: by 2002:a05:6808:3089:b0:3a9:ba39:6d6e with SMTP id bl9-20020a056808308900b003a9ba396d6emr12627337oib.0.1702588524418; Thu, 14 Dec 2023 13:15:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702588524; cv=pass; d=google.com; s=arc-20160816; b=rpEUAKldGGRWUAsQJH+viYuPuyFwcg87nyucnibKdgShZpq86G7us8hG15eXFemYmr xewqLbs3syQxQsMRicdug0lcY+HZ814tam+cwNLIaHoSOURUmYPW1qH37P/EEPST7v8z 8tWlMrnoGtFgHC0Rd3aGKfD7QOJoIPPEqcYLdE/1W6aZc0KODlo74JNzco6rpWQ9gV1p xOCh28aA414Eo7oc/X7qf/PbltNR8Qi5Mx5cycC4Tv4r72ycX9LUsZ8tHvUO4roNqAHS PbXlpnprJOryKbnpOANGJv33g4wYVVVQ0/qhziJS9aBA8HwJ0LqGGoRKAo8zSd3vSsYg eYTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xsSAgkByxi1E/H41WVLR/a+MWiHNOG4RqH4g4/cMbPg=; fh=KH8R4nJL2R35si/07IYW6kKjogIdY6+0DacN39OmlO4=; b=TdNkjAWoEkR4WEdEYETJiwvxKboosClqgi2r557jl7IymKf3S9otptnS3OVPDKPlCQ keXUzIiP7AIkPUYX/Q+mwnxcJ4wYFDML6krqVHs58IvFZjWurthhFf5I9mapwdWceqiO YbzhFuMcidoPSVD1rULWDABD27d8baksenknICZOdusHChAmnFawZN9/fykwUk5Osczl jy60JUusKpGvJrj+77JiPfcQaS5VzA6VoeaBfhRLmoILBHJveCSf6RG7RtK9l2k+XicH TRKYPbE1ALvUvKoOFApGMvQqHWZ8fZosINnvGjl/SyzkE6o5hpFQ4I02evnGKaTsZ4Vk 6BOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IdbdtTni; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-118-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j9-20020a0cf309000000b0067f082c087bsi2389117qvl.394.2023.12.14.13.15.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 13:15:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IdbdtTni; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-118-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6D9A31C21CCB for ; Thu, 14 Dec 2023 21:14:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AFE46E2C2; Thu, 14 Dec 2023 21:14:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="IdbdtTni" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2077.outbound.protection.outlook.com [40.107.243.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C6E2BCF9 for ; Thu, 14 Dec 2023 21:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785293464703229537 X-GMAIL-MSGID: 1785293464703229537 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);