From patchwork Thu Jan 11 17:22: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: 187456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1600323dyi; Thu, 11 Jan 2024 09:23:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxKmI5qxhxWE2R+EHvn/OpTU0ZDB5r93FA9mjodO7VOXm7y8B1488NfNY2CUDoU40k4Z5p X-Received: by 2002:a17:902:7488:b0:1d3:bceb:ba62 with SMTP id h8-20020a170902748800b001d3bcebba62mr1505360pll.45.1704993803929; Thu, 11 Jan 2024 09:23:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704993803; cv=pass; d=google.com; s=arc-20160816; b=XzRQhnKS48Ktbs3BnJjT6+LJTWiapqkiFpxYHkN0f6Q9aZBvbj4IcrneHW6xb2S6V0 K5oBR4cvp9mSA+u3DeANCtKKhvBEi/myzo1ZDqdWjJFWNwYirS1AMMrv7ko7JmLoYWzm Iv9ZlMcdSi4dVlYntCLCmGIpxgTAwI5MwiFJP8EpKNB+3m/wsldHwOyLF0/wqzhjRjjI VKWyVa2qgr726ed4F8IRbTwRZTD6XQ3QXoMaqZygGC6pwn5wTqfB8TaKkxFpsQOrqT++ TGVh6tiCZLQo0Smvgwo/jsTmAvUJXXhGEXhLOgRWJbqwGDALQyWfC6dVKF2a5dacJ8iQ i4Nw== 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=SPFgkHNVClUS7oF5jmYOECByqrV+O2iNTvBYPC0Ss6w=; fh=I2uyj/FGv8AYK4/OoIAKN+++gT5L7rBt4d086LrEHAQ=; b=kwmm6Id0zHUt5TP1edzu+D86xQCKfibjksCb0RSQYrsvszTPwoExPlve90o3re66nz R6bnbOg51JbY2CUT7B+uloOpKPE3pLZdTukpLMit650ZZUNicCK8z8pRU7VaaFa/2PWr jyMO1dpiUBNYpNyd5bjjejwXNso9dGMxTOTFhtZZmNAmRyQ92UinK2B0MnYh+CMBddpf h8PFla9sNbIZDl9/ESu/YCceNGY24M755B+CS0PpD0pqXmvkFE5n20/AnfT02ZJz6+0n lPbJEWAAPTtuDQZO+Oc8ihiYflO4KjjcOk6CqZ7h8bORAKsoLJCmRmA1u+giYrUSKXYy MB+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NW1jqLBS; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23927-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23927-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id iz19-20020a170902ef9300b001d58cbbfd78si1462226plb.7.2024.01.11.09.23.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 09:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23927-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NW1jqLBS; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23927-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23927-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A95522833A6 for ; Thu, 11 Jan 2024 17:23:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2DDD354278; Thu, 11 Jan 2024 17:22:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="NW1jqLBS" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2081.outbound.protection.outlook.com [40.107.101.81]) (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 5FC4151C33; Thu, 11 Jan 2024 17:22:31 +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=SNbgwitWcq1qhSrlwcALzSYxYMhXZdHtthrzIJkuvZB4+IcTgaHLaRv75aDf2kEHFWKocE4cykmh2oX4knh2kjNvQHXpm0v4DacCC8/v+K2Zo3JAZ2lC3sgMmfMa9FAQFSd7ZIAmnLfHFGo4zi6GY83TJ1BdKPbi2+sC/mm0wp0a3N2kKyvIKdqMUiYaOq6w7VOuUr5mwTQU6Y3YGtAxN8SLF58d8+k0w50xV1ghAWMLUF3AGGABXd4OxTHOK9QJJIBzKpCGlFFkPMEu64lM58q4r8hNoOX0d2rkEPpBNh3RBYfNJ7xpBr2/yV9saxzlPyGQYT7ANttYdvD8YQY5yQ== 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=SPFgkHNVClUS7oF5jmYOECByqrV+O2iNTvBYPC0Ss6w=; b=KIZ3rWZ6DQquw9gHGOSYo05VKtUJXcF1JCkPUlJWf7wJsFkybcck527EXwURvSFN7uvH45rF+cxXjM/beCeWGSw+M6Sm6HxQf6sScIDZVT0X9HGHajJ/eEB7YBZCMFTZbIBQPne0kbKS1GNY9OkkEU0+m1yhglO1Bdg9Q0TA7CNdO9O+Ou131gJ2A/6I4kC1iZrTPB2Sjs9W9hzBK7mBha/Cvwj4O//VhnE97EP1nL6ZvMmBn0af7T7HlkGJstRbapTJZ2zNOX+HiHwMoaBJUqm/flClWvYyGDr6OVAhJTVVinfXaNn0KS41/X7bxHVIykNbyk+U9kvKOcNZuj5UYA== 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=SPFgkHNVClUS7oF5jmYOECByqrV+O2iNTvBYPC0Ss6w=; b=NW1jqLBSa4Q3msWmwOa5t1nDyk7PMDvvX4NB0xiHfbncKpoTvMcPO8brDBciLPJ8LGqBOgzUFaHeG78eZcn+NMloz+/p7YRBcMe/Oft8xqcQ4Iww2Febm5oqJ/Y3mR+Q31Hlif4g7ZgxZMO0IKGYPU96MmQbBg0Y3INgIJaLBZA= Received: from SA1PR03CA0008.namprd03.prod.outlook.com (2603:10b6:806:2d3::7) by CH3PR12MB7500.namprd12.prod.outlook.com (2603:10b6:610:148::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18; Thu, 11 Jan 2024 17:22:29 +0000 Received: from SA2PEPF00001508.namprd04.prod.outlook.com (2603:10b6:806:2d3:cafe::9e) by SA1PR03CA0008.outlook.office365.com (2603:10b6:806:2d3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19 via Frontend Transport; Thu, 11 Jan 2024 17:22:28 +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 SA2PEPF00001508.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Thu, 11 Jan 2024 17:22:28 +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.34; Thu, 11 Jan 2024 11:22:28 -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, 11 Jan 2024 11:22:27 -0600 From: Ben Levinsky To: , , , , , , CC: , , , Subject: [PATCH v2 1/3] mailbox: zynqmp: Move of_match structure closer to usage Date: Thu, 11 Jan 2024 09:22:24 -0800 Message-ID: <20240111172226.1816105-2-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111172226.1816105-1-ben.levinsky@amd.com> References: <20240111172226.1816105-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: SA2PEPF00001508:EE_|CH3PR12MB7500:EE_ X-MS-Office365-Filtering-Correlation-Id: 218b71b2-7698-475d-4331-08dc12c9e311 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ARsAp58kLY5HT6vbUBnWk5AnVYDQz/5jXrfwDuI6wYSsoQHWARKbVR09yqNFetKpXegQj2xrTzLsZihmUnadSqxgA7X/g3uNl67uFYMpH9oNUCSHGsTIoOOt/r1h5cJ6fBJtt1gtGyIHGlS9VsoPVuMMRjH3Qub0l0BJ7MldSMEOM13zXXkNq1QwPizA2qpZBO02eQPfi6dri6TAEQ+Klk74O9sD+kbmyZkzFi0YMgy0y41EEb1+7g5YkHMQ69cOvoZsx2W/dt95SvE3fC2rpQiypB1RXb9iqEjNxr4FJNM9BBsnA7py75FPBvjfd7Hpyi6Te4HG/59zbItlPnCGSMowOEKmiLoLV0wlNuoZyW4nr15uzLSReYu4zwv0qkbpOLsRsQOijMFkPf6ug3AOm/XXvgEFkUbF4/v2/7tA4OBeHpEcsI/27+enOvxTI611FZSFkjGQIlJdEioIu4LNjobdzBPtALiTaaIY0KjrjuJN9Ig9lxne3QZ/cS8omX2YnR7pRLwiTTksufnMf5s1dykqO+Bp7zjOVILLeX/P9T6d8iRgc8LCWSb/DS3LxixkiV57uMl6yV+FoQovFBApjYNI4IgzCK3Fo2xYMmTbxqWTrX08cNMJMNl8Dgh9tBpG0ZSpZ5qkoWwlYokDVeatO3LfAGCFLWZbfBywjoogNQ2JUyHm8Ra4LbAmJJ2XD/l35W/MSLnzi6nru6vaSym31mFs9CH5LWOjZwr6wkGk5By/zENHgfxVqEf/D2U11WgbET1z3BUYPJKxXAAV8QsSXQ== 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)(376002)(346002)(396003)(39860400002)(136003)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(83380400001)(70586007)(36756003)(356005)(81166007)(86362001)(41300700001)(70206006)(36860700001)(1076003)(336012)(2616005)(26005)(47076005)(426003)(4326008)(6666004)(478600001)(2906002)(316002)(8936002)(54906003)(110136005)(15650500001)(44832011)(8676002)(5660300002)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 17:22:28.6428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 218b71b2-7698-475d-4331-08dc12c9e311 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: SA2PEPF00001508.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7500 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787815582790620495 X-GMAIL-MSGID: 1787815582790620495 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 e4fcac97dbfa..951389f0b90c 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 Jan 11 17:22: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: 187457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1602061dyi; Thu, 11 Jan 2024 09:26:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IExu8uKfKY8bud5sngcht7RezPMC6O5C1w44e/QjWyEBAIUEmWtHotMFmgn/Pg4XFznvfxh X-Received: by 2002:a05:6358:7596:b0:174:d950:529 with SMTP id x22-20020a056358759600b00174d9500529mr252023rwf.50.1704993989982; Thu, 11 Jan 2024 09:26:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704993989; cv=pass; d=google.com; s=arc-20160816; b=GYxhRWpLrxcuLNws6jH/I25QFHy+tupwVg+nCYKp9599aHiGgftTJJWAN0Ur6lIqI6 ln0jraEbl+HZi+jmnTWv5xkemeZ9feu8A2MePPb3GEE4OUCKGz3F2pYcyw9f4XEX+nm8 y+/7xiSUlHs/vNeCTh1LV3vzUkZl2UNyxe1MWT2Xwc5MiHzu/kAG116N8aD4w1lW+Oyo fBs/0vK0tTNE8TtgwJ734Tq6onp85q6c9X21xVyo9aFTtRjWAvSZ1PPZa9ITvgJnoLTP xEeUXlmHmGUy7hBVT4vxULr1+kIkudE5HtCCkjSyk1Jf4Hju9VVQwL9cXLMn53oFfXtd rqIQ== 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=AUXrcMYy4vwQm8cydCbjmiK9RdRAzCAl1eZ03Tf+x9U=; fh=I2uyj/FGv8AYK4/OoIAKN+++gT5L7rBt4d086LrEHAQ=; b=g8QWIVn24UMl895HBhzmjjmPaGQQSOqHg5FIgndS/OzlkSTlfFNSLlrosQMPIJMfCA 9zboaI6d5EdBO5TF86H5BfMU0ZeKeEKqO7aSYQGHtF+n0Frxx3+SZL8Qrsr2H9szDQKq ff/pCvelWSUHkZQyEQaoYppSLKTZ2RGFNpNUV0lR5++3D9GKF7KUvmLES9EoqGJVUOLk X/56C6Et1BDS+9ujaielLgdmWOqpFBaTmhi8nR2LBrZkCo+6a+dnhIOYInmY1agvrTT5 fYgg8mvmGmao8iqG2WpGHy4m/Ton5QXGXYgTZSHmM1MVwfNDWIkpV8ob8tzBBKSg1mSW RWSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=D5YrtaqD; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23928-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23928-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 y24-20020a637d18000000b005cda7635397si1509405pgc.70.2024.01.11.09.26.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 09:26:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23928-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=D5YrtaqD; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23928-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23928-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 92DB8B242B8 for ; Thu, 11 Jan 2024 17:23:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6065A54BF2; Thu, 11 Jan 2024 17:22:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="D5YrtaqD" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2066.outbound.protection.outlook.com [40.107.237.66]) (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 6D54D524A9; Thu, 11 Jan 2024 17:22:33 +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=myCGBSkbqAQyqb5jiyOKnr2HkNTfCJbO2eS/RtnimoOKZjpLIEcgVekx+enA/1H1IBE+WijBZGgFw7GNx4ofxkhcAy+4xfgLopJGe+vRreK7huQL472c4j1ykvD19yBVBELlZn6Tvis+7BHv9um+WsdjNQ/IoZY9CK1Pai4F7Lnq03416/LK9gHfaJYuxjDCXPct2NWuJ8Gd0qNAhxk4SftbJafMklQageNijlxMxOBe1zCs7yutnjpEAfCAKo5uqdO1iwFtwIajzobQD8xEwfKeKN8z1KlfgBRNx3XpwMzbeP3Pz9cios+6sYiNTVq6WQWhtOG0YFIG/WTFDjSDBQ== 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=AUXrcMYy4vwQm8cydCbjmiK9RdRAzCAl1eZ03Tf+x9U=; b=Tj2FatBUT4DFgJrtNXT6v7gilnAkf4xCK8bcBS+zjulng1zkY45lKVy8+EcLpdOYUrRXq2cucsIummmtS45Dnpe4GmtzG9hJ//YGvstR9jVRKkkvT/Hju2h27HjfQJ/k59PTHLbSDZttHZegEmr8ppd1jKGy9o6LH2yvRx/hAWkBtk+k61IPiBBqmp1VG+nxdyeou52cw9EAk9jOMW6UqK4f8TujC3h3tpT9KgtBUi07JVuxBu/CUdx8C4M9n7UY+sAbm1G6P+fmVN6tigh9vj1IO4z9RRaW/IMG21FoObX8AeLTwg3uSUxC17WmIIKin8hgwFLUlFraheWcfBPWmw== 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=AUXrcMYy4vwQm8cydCbjmiK9RdRAzCAl1eZ03Tf+x9U=; b=D5YrtaqDHPpNGetzgL9GPD4soqz7fhyYmNGtI2iZ4P0L8MT/ay4/fNtxDA1N5UDgG91A3uSQ1TJrjydzxfLdWja3uhXyqgzP25x69VAmVyap20uPkdPZp8vcg9ClI0gE4DUvGNeCoERAUqpDyfyV/rq5f9i1UE9lKKXa6NC03PE= Received: from SA1PR03CA0022.namprd03.prod.outlook.com (2603:10b6:806:2d3::27) by SA0PR12MB4382.namprd12.prod.outlook.com (2603:10b6:806:9a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Thu, 11 Jan 2024 17:22:29 +0000 Received: from SA2PEPF00001508.namprd04.prod.outlook.com (2603:10b6:806:2d3:cafe::2f) by SA1PR03CA0022.outlook.office365.com (2603:10b6:806:2d3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19 via Frontend Transport; Thu, 11 Jan 2024 17:22:29 +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 SA2PEPF00001508.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Thu, 11 Jan 2024 17:22:29 +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.34; Thu, 11 Jan 2024 11:22:29 -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, 11 Jan 2024 11:22:28 -0600 From: Ben Levinsky To: , , , , , , CC: , , , Subject: [PATCH v2 2/3] mailbox: zynqmp: Move buffered IPI setup to of_match selected routine Date: Thu, 11 Jan 2024 09:22:25 -0800 Message-ID: <20240111172226.1816105-3-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111172226.1816105-1-ben.levinsky@amd.com> References: <20240111172226.1816105-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: SA2PEPF00001508:EE_|SA0PR12MB4382:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ba1eb12-242b-4774-0256-08dc12c9e392 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8v9q4U2d/EfUqNhVJdBv2T+2ZHb3qO0is34aU9/37WKKDyQVxWGykdGWby2ptkZYhYotI5/vB2ohR4klHVWCXIjWw9Yfvm88d+SMk6Rk8f/w4etoV+Wmr+e/IjV0yf0yWSia9w8g7i1R3pAj7i2hL+NBu+I16kvZp4fAZs/LJQFpBfHYQXFO6qKgSmPWGJ7UjhjFcZENjl3kLiqR+wCVTClNr69fWXcdUuM2axVCKC+V4KbDrrrZHSFOF5ZymrIRZLzUPPhkholMIwhcff2UTZfF3VZ2I5rv8WTUP4+/8oWJDrlcEJuQwMH5OQMsGfiwBqJL0gq4N4dZgtQlTlVlTfvjxvUxk2z5inOgM4SIc/QEMNfTWvD07nJA7srUOiaB+hv4umvPJ09TSrkGd2ySVgc1fSiHFS/ezTXQCHw4Glqc6+70SSm3kmzBzzGES9s/2X9+MndKnDtlJ5plSelxanWzQf0SNRecfUZ0DblbTOcnKYY8RPu4rB2LZ1aIjrSM+o9IgRuoy6BJfta6AKiVFtRbaimzFvCCXhbYuJW2O/lRoR7uP8dIuf6vzn9xTEwH6dKfJnsmHfHhlc5YdOkAmfdUmp/MR3kjzanuQb231GDqpKYmLopX5UAGnjNBbY86o7lzG5Lqy2cSInJcP49DMBYGeJH8uj5sNxiCugIp00tKN48FNJlqXZ1xvVBlr3ZPP1SK15Zu6qlcAHaCOg+Z/vYzEXyQyGQt1+AyZOW0B18pZHn1XHkBsaj/OlATMUb8EEcgeyLKLSNdE/tZmODCWw== 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)(39860400002)(376002)(136003)(346002)(396003)(230922051799003)(82310400011)(64100799003)(1800799012)(451199024)(186009)(40470700004)(36840700001)(46966006)(40480700001)(83380400001)(40460700003)(8676002)(54906003)(44832011)(4326008)(8936002)(70206006)(2616005)(316002)(70586007)(36756003)(110136005)(82740400003)(478600001)(47076005)(26005)(336012)(1076003)(426003)(81166007)(356005)(36860700001)(6666004)(86362001)(15650500001)(2906002)(5660300002)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 17:22:29.4866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ba1eb12-242b-4774-0256-08dc12c9e392 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: SA2PEPF00001508.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4382 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787815777886289344 X-GMAIL-MSGID: 1787815777886289344 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 | 123 +++++++++++++++++++-------- 1 file changed, 88 insertions(+), 35 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 951389f0b90c..720da91b9efd 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,74 @@ 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, *dev; + struct resource res; + 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 +636,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 +667,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 +688,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 +745,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 Jan 11 17:22:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 187458 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1602123dyi; Thu, 11 Jan 2024 09:26:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxbxuT3C2bzaNFSo385SJRtUQFLZjnJ/0ad1pc7muva9vqM6G+eSN4BkBzQyY4usFylnUj X-Received: by 2002:a05:6871:a0cb:b0:1fb:75c:3ff1 with SMTP id vr11-20020a056871a0cb00b001fb075c3ff1mr50960oab.81.1704993999801; Thu, 11 Jan 2024 09:26:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704993999; cv=pass; d=google.com; s=arc-20160816; b=k7sBm2WL1CLiS347t++xR1QHcBHre97EsAqaZPAMU2ZJCUfBGN5kRziC+CddV8SLsx CVHTaNPondcApbD4TlytP2oFAcj44upKZekRPZ8nzbsi/UrBsrHgH9r78v861FgdCTht oTrMFxTfnx+SfPzoT7CrMQUrLGwhVHhqYkwPyimrrppzvlgJ6di+cqauRN+Wgzms1XtI +oxWD7sxnuRAWrsrSF7DuOvO04QXPFiPAtTpO4aKhv4znRpgYsgEiCoLJg6490lqYdpj hQ+st4gP0dy9NMQlaXCY1jNgQZABN72HYT/E6T3FzWdvkPy9FVlFkJbW3wFBzkb1omKF slPw== 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=c7hjYKVewll6cWe/pWI6xUYo78ow+vkxPjGWO3wZ8Rw=; fh=I2uyj/FGv8AYK4/OoIAKN+++gT5L7rBt4d086LrEHAQ=; b=w009ReQeAiTy0EPRkGq5oY0rcfe6zjfwAoTGu4L62lLikV9N8mo8qK5gTc7YmAo1X0 omn6hDQO/VK4owbXbAFmyV0jWa+0aihocH0dHCqgsyL5D6nLDKN4lW+QbiiU9mslGxdg uKyRBqSR8SMGQkRGYfIZV6qm30ZzNuHxUhnUWDepPkMieEM4L7x6u0+3SEAIXgtzix1b RzfPridrjGnE+7UsHoGpMnR69VmoyQW/5ZfwtCqQo4mpGP2wEN6FjZFA5pIwWza9HSPF PE1EkHArO37LDHy/dUKIbKK5r7L/kQalSnldRgz1u87qdejyntkUGu4uoYBPMAYcAcys uLBA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jnWVSRFA; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23929-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23929-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 a19-20020a63e413000000b005cdf940a0d9si1433900pgi.489.2024.01.11.09.26.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 09:26:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23929-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=jnWVSRFA; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel+bounces-23929-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23929-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 13423B24691 for ; Thu, 11 Jan 2024 17:23:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E12F55778; Thu, 11 Jan 2024 17:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jnWVSRFA" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) (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 5A4CD52F7B; Thu, 11 Jan 2024 17:22:35 +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=Io+5qOyDHbxOuRk3tl0Yvz1iQS646avmBAj3hL28wZtTE8P8wmV30fsL0HHw61NpuDHaCMnMpbVdCeb9+6MUOrrS06QCltk+PusGCPUPNRtIfe5hAKNUrIPOdEgc20h47JGN2PjLkB7RnnC7y7khha+vZyDiErZbfOGGa++Ks4kz45wl0Eda0W3aKcNE5RXmhK0IxHAwGNeSiZYavpgsS4nzNnG509h0DXcpZXKmJtgf+PJ4OyfklDOU4GINd4KdW2bvthgdd8HrL0S1OCkzQfUdmWgNslLYctrJswkIYOJw6OaZrUA9emDfib+oCYH4/bLTwd1PJozbbrAD1CgPoA== 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=c7hjYKVewll6cWe/pWI6xUYo78ow+vkxPjGWO3wZ8Rw=; b=JCcyrSFGWy4oe6zdpAiKY+mbguYXEey3wKNiEikiqvKknZILwNSLYWON+adu+CQL5x+uL35eOJUtploEUFm5AasdnNaf+iT4Jy7WQXLFcg97a8tASmxvu9FTuP84sKGYzMpKp0mnjDYogohV2gzCsq515pj5oIjj9yx2FKeVindXqklecWtlo+MOw1qNkuC3XnDQbesKG9oixbIW4je2YFp4FD/bxZhbw1I+bOVKYKWmHpNLe2HzWWeGvvqZAtI9wWTewjtuJZDDBB5fnC1HuHePNe1AMLweNa1nK04xOw5ddDXLXVTxq/ZRGSdgwhpnoNVsPsJCwiebweiaKxpXTA== 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=c7hjYKVewll6cWe/pWI6xUYo78ow+vkxPjGWO3wZ8Rw=; b=jnWVSRFAM98LvX62E1Mm/i6x+lKRz1jUkKb9q7cFIjRymI946wyLGePC3fo5l/S1KVQ6wZGyQ2XL4O6AJBH6exACtfY6DK591VthfaH6K69s/PEVm6KGnuwCnYyw4XfsGWHksaSZlpzZuGyak/6UDXy+Y8wurikPNrQuUoPGXls= Received: from PA7P264CA0289.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:370::6) by CYYPR12MB8653.namprd12.prod.outlook.com (2603:10b6:930:c5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Thu, 11 Jan 2024 17:22:32 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10a6:102:370:cafe::9d) by PA7P264CA0289.outlook.office365.com (2603:10a6:102:370::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18 via Frontend Transport; Thu, 11 Jan 2024 17:22: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 SA2PEPF00001507.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.7181.14 via Frontend Transport; Thu, 11 Jan 2024 17:22: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.34; Thu, 11 Jan 2024 11:22:30 -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, 11 Jan 2024 11:22:29 -0600 From: Ben Levinsky To: , , , , , , CC: , , , Subject: [PATCH v2 3/3] mailbox: zynqmp: Enable Bufferless IPI usage on Versal-based SOC's Date: Thu, 11 Jan 2024 09:22:26 -0800 Message-ID: <20240111172226.1816105-4-ben.levinsky@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111172226.1816105-1-ben.levinsky@amd.com> References: <20240111172226.1816105-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: SA2PEPF00001507:EE_|CYYPR12MB8653:EE_ X-MS-Office365-Filtering-Correlation-Id: 4713882b-57dc-4ca0-5606-08dc12c9e44a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MOSaXF+KDk4+fTNXTJv5fQwIJ6e4jKJzxsIljECdikpHadbQRKUSZIQhS5gU0h6oSQwpA1zFxtyxO1Fobea0yVnzMfDM3iQE7lhaPqSdTAcbYhDhH7IG/ViAWQ2u/rg9yRobILjOgfYgxF6C1942KYPRnEt9KcttkZiLtrrqal+ATSz7EPx3/z4CHGqWpEX6io/73hRBAVvfKUaKPHeAEAOPGuJdkI05SIjPnnu2d4d/VpWWf9zFO03fNX/1hJIdHCs0AFgAjDZlc/IHJUhxdOcVnrVh3dh1asKkYe8M9TnLiXAjDV9vIVVsEGAo6uTRsLzJzYcsAW6VZ4G8Pay3Y4AD7vpbk5piSm1TanB59dJ6l4F8mMtqSESrfwe1XAgz6tS6SFO9yl7YMEdRGhKq0AJKCons1k0SLTU+GDxePfwedrJbhWdFNlJLTMqDdE5kn+nxSCpmfjneeH5kjcGnBbIx7cJ+pX5316zXmNSKyKqLvMgTs4NbA+ygyh4rtVBke4TGIJdIW5IH4TLIHqdWNZO/cH4Iqw7QTR1yMsX2a2OJFfuw53V+Tw1ryQSJY92snlpEqxfn5Wp2+/cPKI1QmYjObPyXD4sIz6TCL7Uae19b7qayLVu36DaizlM5JdalespcpKWZ7E8jWKwf02tOf40GvaC6YbsU7miEpqfFee/aw+i7NlKo9P564JoQWTWhAxhty097+MBC6Be+B/4V09fW0dYA4x8eqUxdoCE0VWL+tEVEaFSfL1BNxLKyz16TbZx414dIbdzA/gF2PEbDgj2lxDM+T4Bqvg7aGdjPH8qOBnfCBlFE5KO9l92/Bh8r 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)(376002)(39860400002)(346002)(136003)(396003)(230922051799003)(186009)(82310400011)(64100799003)(1800799012)(451199024)(36840700001)(46966006)(40470700004)(83380400001)(26005)(43170500006)(336012)(54906003)(1076003)(2616005)(36860700001)(47076005)(426003)(82740400003)(15650500001)(44832011)(8676002)(8936002)(4326008)(2906002)(5660300002)(478600001)(110136005)(6666004)(41300700001)(70206006)(70586007)(81166007)(316002)(86362001)(36756003)(356005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 17:22:30.6946 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4713882b-57dc-4ca0-5606-08dc12c9e44a 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: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8653 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787815787909862910 X-GMAIL-MSGID: 1787815787909862910 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 | 130 +++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 7 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c index 720da91b9efd..d5092c9ed180 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, @@ -639,6 +648,110 @@ 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; + } + + return 0; +} + /** * zynqmp_ipi_free_mboxes - Free IPI mailboxes devices * @@ -748,6 +861,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);