From patchwork Mon Oct 25 08:23:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62B97C433EF for ; Mon, 25 Oct 2021 08:27:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A86260EBC for ; Mon, 25 Oct 2021 08:27:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2A86260EBC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ADN+QFSoZdL+9s53Lkw2X3fbTOI+fk7pdFhMYwygPTI=; b=W4sP6RGed9p0z0 LQ/FVjoCv4TEhVScHIgqV41qlt/AYgu6esrQkvGT36U6i29RUD9LKxQBVeRAco/0SzwDBJyd7xjca GqVEoRp/GlvXSXQkSWwd4j0JhH2GugFg6DWENMkhlmpjvNl5CKVholYbyVbzMAMRHTguG06/2DWUs n9EhOo+7ulvMRzGPXi3Ed7K48qSol85JPiEi/PgIZFBVlcMW9z/tU9oD2BOAH21CPNSYvsrVyMVAi rx4cth+p6mGXiaB8pnfGdxMpOHX7WyxQxalWEc1EaDFMdUL1PNVB2J0i4rwsizJurwrEd44fzSzxz OMpqKuqwrS5uf1nUtGAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevI2-00FnI9-B8; Mon, 25 Oct 2021 08:25:06 +0000 Received: from mail-bn7nam10on2068.outbound.protection.outlook.com ([40.107.92.68] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHR-00Fn7d-DN for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:24:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=akkziMRPqJtEntYDX0b/dn4J7D438iK9cPSDkBW9mmcnFEP1rQ/SmjzqaMdNCtkQMwiu8vHGsNrB/njRlZltNcUynkyeF8QYdPlgbQqxLITHDa+lJPF0grxkgPpMTX90nIoCLOgXn+sZWSbgcAI6k0lmEOn7Q2t8oEluGykCVAXDpUEpJmgSuwgy2yhJwqH+yN3/WiFpzTdWdcC9Hr1XzARkIBaD70buuSYXC/mmqP7k2JIT7K9fR+lqs7xTj7grQzkNRHspImJtmPzKeEP4AAlXNDR05jodIie5lRcsgrGI24o07OYJ2JzIWwePnKLUK8P9oV5L3nVecId+hCahAw== 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=cM9emv0lTyFOrIqaDjft5PsTbF5ugxOuiYrM6PXVbwE=; b=VzFkhPD1V7zgmtu1v7NdheKO7s9PgLWbFjKMlFRIpMQ+kZ+yxUdMs5F2PJPbtU54p/E3T8eDLthVj553u0La0ZaXSr6rFUlugXQ0oGCrm9m/5Hm8mI7HYSCBn4BZbfG1CfOvY1qdDuf5JAIPNXCawOJMjPmXfIOn+dCTNtS2atrXmXrjiB4eQyPcQ6591m1UJtYLngKthRGixG+m8CjonK5aZ4UAVY4pa6eyKkWCZY+NuO/TEWfjJ4nmdSpSG30nRjIjqyPfNejrvWmS58DaHP6+Zl7qpyso2DKtA6ldw5NnBDrflh6/ELygCIE0ds1swUT6saECCdBbkBQ6GPnB8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cM9emv0lTyFOrIqaDjft5PsTbF5ugxOuiYrM6PXVbwE=; b=BYQuQP4aKhQy0tfl4+G3b6MJe3zvGD3rbwgzhKjmugF/AO+4CBN+PTRSeFbJRNy/LX+PZZTB1f1Ws6yaSib3mX/n0PvXsd/hODH3C6xlsCF+bEGzG+6HFGdSwJAVeIINACQjhTqW6TTl46tCquj9u7lyJwFBLpjfPGk4XnQE+6g= Received: from SA9P221CA0014.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::19) by SN6PR02MB5055.namprd02.prod.outlook.com (2603:10b6:805:67::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Mon, 25 Oct 2021 08:24:26 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:25:cafe::2a) by SA9P221CA0014.outlook.office365.com (2603:10b6:806:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:25 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:24:01 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:24:01 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-Jn; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , , Tejas Patel Subject: [PATCH v6 1/6] firmware: xilinx: add register notifier in zynqmp firmware Date: Mon, 25 Oct 2021 01:23:45 -0700 Message-ID: <20211025082350.10881-2-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d9792a3-6b91-4b0c-1e35-08d99790db0e X-MS-TrafficTypeDiagnostic: SN6PR02MB5055: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S6x0vL0NSVYknE1UJWsLUzlQYI/r+GBUhlh+ApWNp1ZTuazaqQNSxN4XsRK384Ch+Ul3zhakr9wwkIivZRp/pEnJBMSqPdVJKAE7MislCeuX/ytBJmFVkjfOycHfeiRhQmyai5rgy00P37W0SLoRhdkeqYUUJBTe1VmgvpvXPtYGfD7j7ym4uW14dGTvdHkuoiZhqcxKZkxvqQYNz3/qTF9VqBwFLm9zN1A6lQpKORIZR8rVun7KJwGn+XNPis9qCLl7ip7gr5FRp82a2gc1MASm8cP1lqUFHtg98G0B6WL2+3502SZ8wMm3c5XLb9rCWjnEQeIqWTHstrrfVA6aZ01ue5S7gOMpuA/OMW6TvpPaGwUVyUWS0bJ4KBx4zbXBgpmYcUAe9Ivco+BOPYc9nv6ay4lX2F8o7XSrpZiRCIE3b98LcTVTWxkKi3BEojuMl6NQlguiZjL9IqeJJGbNosIIrWvYTVpZTGBviKu4P60/UfeTpr4+F68XWsmwgtwmYxW63KynTk50UYIDcJQZ1IHP7WxdBf9/AxV5vBfHLQYFNo79NmDIrQjpscgfZ94WksujCUbCi1JYVbNBEiRZCWEbP+PYVV/axA1AiJqpYr4x7auYBbbK/U6y8Yc16inyXTv2ogPSiXIHha5Byj69h4dGrcJ91hgWmeNAH1Z+2qVdqaLDElzYMmeF3GvOChLSs6lQxue4uAgZuU/VecjkOEn4sGihR2RApUnNWSkF9xw= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(47076005)(356005)(7636003)(186003)(82310400003)(508600001)(26005)(336012)(426003)(2616005)(70206006)(70586007)(4326008)(5660300002)(36860700001)(9786002)(7696005)(6916009)(83380400001)(54906003)(1076003)(36756003)(107886003)(6666004)(8936002)(2906002)(8676002)(316002)(36906005)(44832011)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:24:25.5046 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d9792a3-6b91-4b0c-1e35-08d99790db0e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5055 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012429_502080_234189CC X-CRM114-Status: GOOD ( 14.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In zynqmp-firmware, register notifier is not supported, add support of register notifier in zynqmp-firmware. Signed-off-by: Tejas Patel Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - Minor fix Changes in v5: - None Changes in v4: - Rebase on latest tree Changes in v3: - None Changes in v2: - Removed updated copyright year from unchanged files. --- drivers/firmware/xilinx/zynqmp.c | 23 +++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 11 ++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index a3cadbaf3cba..6e653e9cea2d 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1053,6 +1053,29 @@ int zynqmp_pm_aes_engine(const u64 address, u32 *out) } EXPORT_SYMBOL_GPL(zynqmp_pm_aes_engine); +/** + * zynqmp_pm_register_notifier() - PM API for register a subsystem + * to be notified about specific + * event/error. + * @node: Node ID to which the event is related. + * @event: Event Mask of Error events for which wants to get notified. + * @wake: Wake subsystem upon capturing the event if value 1 + * @enable: Enable the registration for value 1, disable for value 0 + * + * This function is used to register/un-register for particular node-event + * combination in firmware. + * + * Return: Returns status, either success or error+reason + */ + +int zynqmp_pm_register_notifier(const u32 node, const u32 event, + const u32 wake, const u32 enable) +{ + return zynqmp_pm_invoke_fn(PM_REGISTER_NOTIFIER, node, event, + wake, enable, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_register_notifier); + /** * zynqmp_pm_system_shutdown - PM call to request a system shutdown or restart * @type: Shutdown or restart? 0 for shutdown, 1 for restart diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 56b426fe020c..96aaadc44c3f 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -2,7 +2,7 @@ /* * Xilinx Zynq MPSoC Firmware layer * - * Copyright (C) 2014-2019 Xilinx + * Copyright (C) 2014-2021 Xilinx * * Michal Simek * Davorin Mista @@ -66,6 +66,7 @@ enum pm_api_id { PM_GET_API_VERSION = 1, + PM_REGISTER_NOTIFIER = 5, PM_SYSTEM_SHUTDOWN = 12, PM_REQUEST_NODE = 13, PM_RELEASE_NODE = 14, @@ -416,6 +417,8 @@ int zynqmp_pm_pinctrl_get_config(const u32 pin, const u32 param, int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param, u32 value); int zynqmp_pm_load_pdi(const u32 src, const u64 address); +int zynqmp_pm_register_notifier(const u32 node, const u32 event, + const u32 wake, const u32 enable); #else static inline int zynqmp_pm_get_api_version(u32 *version) { @@ -632,6 +635,12 @@ static inline int zynqmp_pm_load_pdi(const u32 src, const u64 address) { return -ENODEV; } + +static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event, + const u32 wake, const u32 enable) +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ From patchwork Mon Oct 25 08:23:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580957 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4CE5C433F5 for ; Mon, 25 Oct 2021 08:26:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8042F60EE9 for ; Mon, 25 Oct 2021 08:26:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8042F60EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lIg4HPajxpa+x/riCWQ6tZT6ltFJYrYiFqjre5dNE1c=; b=VN6cUAtmIEfFhf GFVsnfsqrwSymDTPPBdZ/E0UG+A2GCzUTzx3Z34yz9+eAdpEwhEpGkaHHKGTdHhvv+nvFrrtjeTfm +h8sDllyjsgShmLlMtGK4Xei7v5sLyFscWvTsIZd4i8AEI7iyY0Jst1ZDrfR+NRZl+4JreMxYDoXC /GgS1qkOTseM74NuyrDODPgc9rq4GIr2TgAJXnb9XDTVNx4mLPNtReABzmwk/ITygpdDFrVZDWQM5 7mCcauJSFBkP77lmLuK0751mZvKSC/DBT+YhqlCp0xMpSpMQD/YiqpAL0tIBMc1z2LYs61goZBzcl nZ1v7qPilrhL5mXQhrZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHI-00Fn5M-Lm; Mon, 25 Oct 2021 08:24:20 +0000 Received: from mail-bn7nam10on20625.outbound.protection.outlook.com ([2a01:111:f400:7e8a::625] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHE-00Fn3g-V6 for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:24:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYYCRMobKmxXmikJZZXzeIODuq6+46LT090eUzfStUT02J5VirGLFuGRMwXyaHVoTXBwix3hGedr1GNksPmWBkEqkyP3vdI58vHlfxEuLDOoSovdG7ZztaBWPzhQsdyj0wP3GM+zYKGBIymLrP3OfcQyk41QkZfxVHZV0schQIryuQwiYS3+H4X5qHgzXvrRqZac/BtT/0rzBf88qtatfBu3tYu1Hqe42u9emzi8S8661Plz/xNRcK9j2H/F/L9fV6XI8qbPxuCAviMVyUYci5FmDc9CyaOnl5ywyXH0d44pdvYyIDQv58lNdelfKNJUDBk17EWYE8RPIonu300Tsw== 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=aXr7MBlef96wSbs7/CeJMH/h9JL72sRfrYbRMfuxWYg=; b=Te3yV045IeM3UqcROTAIEiIhejdOB38B11GBbyPw5CmK6h4ypyFwDV/GthJWMtYu9U5Tv0wxrX26YV9ZO+9H/b/jTvbk9YqqLdVId+dS2qp819y6XNs4uBR79GODaHUAdG+fPu0kOzTnqepMOzNvx5AumrEB1twyQxAcGzinc7tYXFTQy3JKvTx8ElB4XrTGTfNwQzis30ZdpcOgWB2e+JFHC1qxjzmcHFiwhcd54liwXdArEbv/P3XC016S0SEjJHD5iSkkgUM1H3WA5qdBMEORx91Pft1C+EYFj3zuZjgZvikby1a56IUhXvVhnnVofW9pTbe1UlD6g+H02TA0/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aXr7MBlef96wSbs7/CeJMH/h9JL72sRfrYbRMfuxWYg=; b=dQbA2cEi/2r4TB9bg2BEDnONCCLBLJery1MKhcIzXuSW9lKZvH61QKOdghsHuw/UQVea3Q5nYDUjRBc6q/thQ74WZq2PuMDdbtHuavcw8lQeRWry+pELLV2GAczriY2S4FNIwAn8lD40MF+FgWc+HAPuGYxtM9oB8wTckzFj5K4= Received: from SN7PR04CA0176.namprd04.prod.outlook.com (2603:10b6:806:125::31) by CH2PR02MB6837.namprd02.prod.outlook.com (2603:10b6:610:ae::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16; Mon, 25 Oct 2021 08:24:12 +0000 Received: from SN1NAM02FT0003.eop-nam02.prod.protection.outlook.com (2603:10b6:806:125:cafe::4c) by SN7PR04CA0176.outlook.office365.com (2603:10b6:806:125::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0003.mail.protection.outlook.com (10.97.4.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:11 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:24:01 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:24:01 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-Kt; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , Subject: [PATCH v6 2/6] firmware: xilinx: add macros of node ids for error event Date: Mon, 25 Oct 2021 01:23:46 -0700 Message-ID: <20211025082350.10881-3-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7b973f6e-b4b6-44fc-3788-08d99790d2cd X-MS-TrafficTypeDiagnostic: CH2PR02MB6837: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: af/Z98ozOnk2bXN9ZcrJ5dQQeCqCMnYnEgFKfsoeUxPvPn7JQxtq7IpO9iuD5b7cOkFSd/TQEFNdDadMtUYqGs0ccQOTp5+YGldy/xkMpXaUyo/FK12XYqV9LnKHLgWDY5PySydKYv9ExUDsaH3MJpA3shREc0PVNF7SZFbMUF+xoaCQ8mp+/zjnBxHQ6q4ASKLAHdy8Z21/slkXyICkxOOlgP11AFpUfibhP6emDFKQKhtYNweNPjXVsy4ms359DZWGjmyP3/2LNO+Qm+lAM68oZ/x+rAYgvNYyO/dRrrUN7f+sdbQwlZbIDZ9fWK9Gm7lcIsBmVbse7+rsizBVvOG/ko+KXzn3XcUm5q57QoT1EWzmyutPHg8QlVsXLyFt/GYuTXeimOVRjE8yQqh1SIk8s8croI4zQjnGgOJEt9eMm0zkOOXhSSumyWkQGcp3lOj21/JsAyQcP/RkjXXrLN2mPac54QI4bBbObRSSwyXaekvEjaAfz5A2tAg4n2etXe5FKMVMLjDcrHzicmPp3Ilqrxt3pofA7OgEVV64ORdzNXxsy/m/pTqHNy/L++rSuV6Jg7Ewgwptu3dX2OZLL7wHAisnO3uOx1ZWrEApofqjVw8WTw1Ii76oE700L8+ofhG5yTCS87LnWxUah41d8Ydv8Rb3C9ye+GtghqUk30c8m+JQPaBMBxUgWA2iEDFCZumjhl2VbmXp8ALI2lMnlSQ5WJev+Eff5NEob0tGOLE= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(8936002)(1076003)(5660300002)(36756003)(4326008)(2906002)(336012)(44832011)(8676002)(6666004)(82310400003)(508600001)(2616005)(356005)(26005)(186003)(6916009)(7696005)(83380400001)(7636003)(426003)(316002)(36906005)(70586007)(47076005)(54906003)(70206006)(9786002)(36860700001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:24:11.6585 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7b973f6e-b4b6-44fc-3788-08d99790d2cd X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0003.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6837 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012417_054695_16C8296F X-CRM114-Status: GOOD ( 10.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add macros for the Node-Id of Error events. Move supported api callback ids from zynqmp-power to zynqmp-firmware. Signed-off-by: Rajan Vaja Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - None Changes in v2: - As per review comment add PM_ACKNOWLEDGE_CB in pm_api_cb_id --- drivers/soc/xilinx/zynqmp_power.c | 6 ------ include/linux/firmware/xlnx-zynqmp.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c index c556623dae02..76478fe2301f 100644 --- a/drivers/soc/xilinx/zynqmp_power.c +++ b/drivers/soc/xilinx/zynqmp_power.c @@ -46,12 +46,6 @@ static const char *const suspend_modes[] = { static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD; -enum pm_api_cb_id { - PM_INIT_SUSPEND_CB = 30, - PM_ACKNOWLEDGE_CB, - PM_NOTIFY_CB, -}; - static void zynqmp_pm_get_callback_data(u32 *buf) { zynqmp_pm_invoke_fn(GET_CALLBACK_DATA, 0, 0, 0, 0, buf); diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 96aaadc44c3f..bfd87ae35b2c 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -64,6 +64,20 @@ #define XILINX_ZYNQMP_PM_FPGA_FULL 0x0U #define XILINX_ZYNQMP_PM_FPGA_PARTIAL BIT(0) +/* + * Node IDs for the Error Events. + */ +#define EVENT_ERROR_PMC_ERR1 (0x28100000U) +#define EVENT_ERROR_PMC_ERR2 (0x28104000U) +#define EVENT_ERROR_PSM_ERR1 (0x28108000U) +#define EVENT_ERROR_PSM_ERR2 (0x2810C000U) + +enum pm_api_cb_id { + PM_INIT_SUSPEND_CB = 30, + PM_ACKNOWLEDGE_CB = 31, + PM_NOTIFY_CB = 32, +}; + enum pm_api_id { PM_GET_API_VERSION = 1, PM_REGISTER_NOTIFIER = 5, From patchwork Mon Oct 25 08:23:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE264C433EF for ; Mon, 25 Oct 2021 08:28:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B517660EE9 for ; Mon, 25 Oct 2021 08:28:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B517660EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H+gAMPn7ZfZJJpmTrscv72RaSTo4WlfLkumJE2I6Xwo=; b=puclhxzBgzYsQm CC4O6/BgN0psf3MYqLdqWCLwYEoK3AaHDM3VaxXTDxtT57ngYWSXy/SDTTuEbUYfWvhEevhtCQcZ+ HIeM6PnxaSs/Mn5z9GS7MZtlDkisOt/+oDg5ZQKl2+3UsLAYvFPzE+TyveTrG7Mv2gPPIEg4V/X8F beLvzYaJjxdEQELk3Yestj5LitZ/fH4FTBSEA4obmUCV7wsW1Y7P2EJECL6oJZU5ehcocLinO76Ub kg+jMduch/noCcpe4fcvtDjkAn+z+WNM3yTlPYkSd5osq5m7GLGCHT+qlZUiOtLNBR7J6Wgy7zkJY UqpUDbcDsL0ghFbhkI7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevJJ-00FnhC-II; Mon, 25 Oct 2021 08:26:27 +0000 Received: from mail-dm6nam08on2080.outbound.protection.outlook.com ([40.107.102.80] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHT-00Fn8L-3I for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:24:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Th/boPkkHvrjLU0qaJIqUDXLa2X77RBJxDyP9y0gAJUN7RDdXUF7+mUwlN2+v1jd/bjAPxogUrazGLAdlMlatYX3xSAdo9udMDz6qwu00T6Y6RkvD1C6f2vmdzb+cE4NlNikfxB6+2ZoN4vsTr8AbSsShg4pMtUzcQFQYsKi/Z8ejRCJdpn4xP/i7GimGQMH6+HfbTw3x6prWIwFyJnK/iBSAR4kTZ/Uihc6zzkokvoFTWY5yDBs0hukiOw52Kq07/BLS/WbKV5UVjb4iodaIZzi6fN2SkpHNpBHI7g9moYU1yMUfbDfRWwQuV9k0dz//plL2PHhkESWufRIErsUBA== 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=WnkOKf8hsBMX61WrQq4DkGdqC/cZzEx9c5yxRkS9ZQg=; b=glZoWakPxSWtU4+x2lLrhDRBDT4HEbt7i9tGfkpkl6HVY/ADBZI0yZOnpUJELEhlKaOYrP0uNyHfmC54/vMisd9Do7kYneQQXdu+xJYy+Zo/UE7OiAsMyZ+9KAJYHG5eSZ44BsIC4NJYWRtaphxHV6yNYJ67aWr0Njid5bzhHvkuHPA277Ac0eGbdehIS0y0aK5ErGs4Q4EjnjWDVOn75kcj2rRTToLCi2drMq20L9toWJs33tBcxMrPT6hQCOAaGadPBjA8z51wvvoyWM0u7LU8ZpDvose4p3tUrAaWIBSGt8An2QcggY4ou5MYUaeZYYNX+TkyJkYQt5L1bV29WA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WnkOKf8hsBMX61WrQq4DkGdqC/cZzEx9c5yxRkS9ZQg=; b=TQv/Ooaonbz4TFp/pRAyyrZE8IO+cLPpCCHfD8HpNrO//ZEq5dhtwJ9X9UGRakIEypv12v5IEcoptKpzkaxoGaA+V6DWwq0ozzBezrsV1V82ttGcyzMi8ncJYPWJJj0PLwl0uuZkVpml+qNtX8pOjfQa524la6UP1H73hZifbkA= Received: from SA9P221CA0027.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::32) by BL0PR02MB4611.namprd02.prod.outlook.com (2603:10b6:208:40::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Mon, 25 Oct 2021 08:24:28 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:25:cafe::33) by SA9P221CA0027.outlook.office365.com (2603:10b6:806:25::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Mon, 25 Oct 2021 08:24:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:27 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:24:01 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:24:01 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-Lu; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , Subject: [PATCH v6 3/6] firmware: xilinx: export the feature check of zynqmp firmware Date: Mon, 25 Oct 2021 01:23:47 -0700 Message-ID: <20211025082350.10881-4-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce0ed3a4-8cfd-420f-cd4c-08d99790dc5f X-MS-TrafficTypeDiagnostic: BL0PR02MB4611: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3PQastSADCfB63N+QBrkX2yzsgZw1TPKKNmxWQcYuD3cZYliK5PCSMmz6QLTHKXwnSgzpXT29nIBwFr4svxQ9BNpOEwoBAW/Ig5SB6hBvZczFfZ1UWSC4bHt2vashg/NiVmxBkcHBqJAmsdgLUjUIZc5RW+hx9hF7w5KSpAzw/LH+W29fKDzCDU9MKy1BuTxtiNrwHPP7xR4Vla1niRXcAEsKITeLnTO0BaxbhGzJ4bcIeAzVD1OvANJ4kKoYh5eAX7+lpGKz2yUvE6UbG6P2Yf6XXkRyVj+wD47+zhfEI0ggeIjHxSeNu7Ao3QN1THD/Piwdz/dRkx/Ws4MOVTTSSCnG10l3xl1hPXMSSeAu3Xri8o7mQdOQCs8JZoxdJyOcyt2uMa6ytezyLpju3eLfevb+/7Q+PKJ4RYqVrz3sUrxDHtG+ayhyMDKNsxBWWZppQbM74GOOteHpht9sOVFgZ3PLF5Xfb9vpE7Z4Ep4GzIB4IXKAcPio8jyvEYwvBqgv4cu/1BEdPmWSFykGSVZDgZVjkRNMjQE8erFhMLnilsh+SBvr3Sq/Yz1HFOlTsNyTjU7cVJkaeTCoFrK6CoYoQowd8uNGySM8TUgRKi04Dclq9iK6CCgvDQPXlvX2ODlAUm7p9+DrY5+x5yMSQmIzmxsDeuXF1NQ+WhKZYajCrAIAYgXSVAFdaB7hwhDz/KzLw7G12u0js6CMi96PIY0GH7O8tKNR1hzj9/VAG81AOQ= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(36840700001)(46966006)(356005)(7636003)(70206006)(7696005)(4326008)(36906005)(36756003)(47076005)(9786002)(336012)(426003)(508600001)(8936002)(2616005)(82310400003)(36860700001)(1076003)(8676002)(83380400001)(26005)(5660300002)(186003)(70586007)(6666004)(6916009)(316002)(44832011)(54906003)(2906002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:24:27.7186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce0ed3a4-8cfd-420f-cd4c-08d99790dc5f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012431_203609_7FE3E9ED X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Export the zynqmp_pm_feature(), so it can be use by other as to get API version available in firmware. Signed-off-by: Rajan Vaja Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - None Changes in v2: - None --- drivers/firmware/xilinx/zynqmp.c | 3 ++- include/linux/firmware/xlnx-zynqmp.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 6e653e9cea2d..e2c55f48b93d 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -153,7 +153,7 @@ static noinline int do_fw_call_hvc(u64 arg0, u64 arg1, u64 arg2, * * Return: Returns status, either success or error+reason */ -static int zynqmp_pm_feature(u32 api_id) +int zynqmp_pm_feature(const u32 api_id) { int ret; u32 ret_payload[PAYLOAD_ARG_CNT]; @@ -190,6 +190,7 @@ static int zynqmp_pm_feature(u32 api_id) return ret; } +EXPORT_SYMBOL_GPL(zynqmp_pm_feature); /** * zynqmp_pm_invoke_fn() - Invoke the system-level platform management layer diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index bfd87ae35b2c..591bdbb4290e 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -433,6 +433,7 @@ int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param, int zynqmp_pm_load_pdi(const u32 src, const u64 address); int zynqmp_pm_register_notifier(const u32 node, const u32 event, const u32 wake, const u32 enable); +int zynqmp_pm_feature(const u32 api_id); #else static inline int zynqmp_pm_get_api_version(u32 *version) { @@ -655,6 +656,11 @@ static inline int zynqmp_pm_register_notifier(const u32 node, const u32 event, { return -ENODEV; } + +static inline int zynqmp_pm_feature(const u32 api_id) +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ From patchwork Mon Oct 25 08:23:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93224C433F5 for ; Mon, 25 Oct 2021 08:26:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 53BA7604AC for ; Mon, 25 Oct 2021 08:26:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 53BA7604AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1ZxYuaXAHG30yQtwV2J0d12EqaQFwmSVWMamcI6Qi4k=; b=bGrKw4YuUZEbjw 83M12y8h0J5a9oYzGkUfJKfKKtnukM+hU4rKQlP5723wM6StT7AahDl6XJ10wAj90gGCM5Q98UT4S q58y4r4LSHGyk1UzJGRBSLI+LJpy4E0dtklPleUST1FSCp2I/LoK5X0MwWMD50eOM26v5h/WqXQCV GSSAG8z2s+A3Lgk8a7I+dnCi8cyJWLiMXT9GMIefFuXcbV0HXHrrqLzrhWHYFZj/wLXqTKF33is7H 4FFduALqTbn8/ASHwhYInjerpqsNaN3pSD0WK6ppD7l3f2TSzU+SrFbDZY7pc571zOoDmIGZRJrWV 20EUHx2cPqa/zXoYJwuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHZ-00FnAA-JY; Mon, 25 Oct 2021 08:24:37 +0000 Received: from mail-sn1anam02on2088.outbound.protection.outlook.com ([40.107.96.88] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHE-00Fn47-Vc for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:24:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vs115aG/cx+O9enaF/vIUqlwLDyCPDLdtptZQDrgqp2Noz1bn9qjQEcMdQHNiFBJfx/xzc+u2EzVEwewqedfqkTKxTQ33w7oORJVR/cddRpkH3+IFrUBylrMBj7vTwXWcycSBsot19MeZUQdQ0st1QSWHj1Ho8I0DQl6rYgZjNvE4YOcg/rjoVeCjAc0dpS9muqc4qxa+ibO+IF7noDOCQh7db029IN+JSMV6Ankwx8xMlDTXBwvlGbtu9s8EU6dC6yfLSEk52F9FmLxEEW30mboDFSMoK9DWxRjs9IYSWJuPOrt5RYUSCcadwQWUVjpOoiQpKN7wElEpEw1atmyrw== 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=kLnv9WdyODy0fc1qtO0IWmkcDQtXA1z5uDpFHDKKJjY=; b=Cv2B3zaONOz8iX4WyRMPVa2AF4KgaJpKU4f64v1h8sykc3wMPFkGMQd8ZTvd0IXKR+JlHbVtu1xqy71CFpBXhLf4ewWPXf0AAqe58ZBSQxGHWUP2SxQsEcbITDVu0Ut2MD7/2XH5Bq9h1L3J31v9TgVmiGiwTUGiubVn4gwbHZkgZXH3vFODZeJR21wy5o/iRxube5qN+qTdPQ42tyLL+AxTz9ZU8RXhrdE5AmlYApogF+i8r8V9M0pviyJ//6anHT8DygEN6EWXpq9/6eJdJdv6VWucHFliSiik51oCe/N2Dmw/dAhqvvT2XCyg7gjW/4CaF6NVi8znrRPKMu01VQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kLnv9WdyODy0fc1qtO0IWmkcDQtXA1z5uDpFHDKKJjY=; b=Xewl1s3ZgZeuOUdZYn/OuBlYMSjq576zu7Em3ofsJTSfC2gZPuUIZodXat95L+/vebqpLiFMrzEUS/FuPRWoGRXfxj8DICmJl1VIV+t1+39W/lnht2p0eIKcgBxsalg7+WgHcCMRTO8zXd6J6PPalf0KcmyXj5etUUPglRkSd3w= Received: from BN1PR13CA0011.namprd13.prod.outlook.com (2603:10b6:408:e2::16) by BY5PR02MB7027.namprd02.prod.outlook.com (2603:10b6:a03:23e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Mon, 25 Oct 2021 08:24:10 +0000 Received: from BN1NAM02FT013.eop-nam02.prod.protection.outlook.com (2603:10b6:408:e2:cafe::18) by BN1PR13CA0011.outlook.office365.com (2603:10b6:408:e2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.11 via Frontend Transport; Mon, 25 Oct 2021 08:24:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT013.mail.protection.outlook.com (10.13.2.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:09 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:24:01 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:24:01 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-NG; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , , Tejas Patel Subject: [PATCH v6 4/6] drivers: soc: xilinx: add xilinx event management driver Date: Mon, 25 Oct 2021 01:23:48 -0700 Message-ID: <20211025082350.10881-5-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 572e9b67-2f9a-478c-bc1a-08d99790d1b1 X-MS-TrafficTypeDiagnostic: BY5PR02MB7027: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:50; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J351REXchB3OZpoP0MPJGxt7h9e+hQjG/YhgGUqtf4yoT7HXu4zF+c03m7yynhGkg76iRK8jyLzr6rdUSrFnb0POTlwa/7YfL6U2Ub9hAE5Ea+ynvKYaobNGrIINB7KBgFo+Z/JmPNBYiF10b8nJ9IJR7HEFg2TQ9Mga/hbrEv69yPAPTWkF0tclMVsxGWuncO1ONyxAKfvVAbP5vkOCxnSLMYJafa7YLdFBcS21vumaW210C2nEeZQOe0mBvW6b9dF+x7r0TF8AbSKA52OtlSJhVwHp9QBSWBhlWZ4NXLpt0iFGcIWlTKoKOPDfmKzun89F5m47MelXgdzz9+OdzesDCN9UD5uBkVHCWBkIV1ojjO2/nEyiqvmWCj8XjiEWsy+2XciqMyOjbfeVRqhTXQmIEXwGfO7jcxqG4FLuiYKsKlSfuGCg1bIJPM2vlXEZ47PXKb5CQCPGBGnRRt+w5H8ZzkoPZrwPiiqtZUeM7JfWaqw661d6vpFzBa7H8qvcOc8zLvDoemmPeuW/sDNSdbSzlHCsH1L/O+zCdgTM+6ANevX6lhi73MBYLj8JHG9pOGNnChbTZW/fhlJ/jZYxDNf6/W7jmwuBU0V41Gi5SYlwPq/LL57G9EWOEl9kU7d+ZYt2wrToNTimiIvhfT58MX/BR68hmdfmwW+juuJXogyhletHnkFgg+WmflwEqgxJ/5aEhyrGiBRODtApVs0OGdZ8CAwpr3DJM3bvMycj+yesxZUdHxpfDQACl6e4LcdQF4J1RCZF7C0tNyvYGVzlPwxcMckoa2B7nJ6gSCR3BxR6HAWiFCp3NsuWi95ZnfIl X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(36840700001)(46966006)(83380400001)(70206006)(107886003)(316002)(7696005)(36906005)(1076003)(356005)(82310400003)(8936002)(7636003)(4326008)(2906002)(54906003)(36860700001)(5660300002)(70586007)(26005)(6916009)(508600001)(47076005)(44832011)(8676002)(30864003)(36756003)(336012)(186003)(9786002)(6666004)(426003)(966005)(2616005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:24:09.7397 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 572e9b67-2f9a-478c-bc1a-08d99790d1b1 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT013.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB7027 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012417_129744_C34C3640 X-CRM114-Status: GOOD ( 30.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Xilinx event management driver provides an interface to subscribe or unsubscribe for the event/callback supported by firmware. An agent can use this driver to register for Error Event, Device Event and Suspend callback. This driver only allows one agent per event to do registration. Driver will return an error in case of multiple registration for the same event. This driver gets notification from firmware through TF-A as SGI. During initialization, event manager driver register handler for SGI used for notification. It also provides SGI number info to TF-A by using IOCTL_REGISTER_SGI call to TF-A. After receiving notification from firmware, the driver makes an SMC call to TF-A to get IPI data. From the IPI data provided by TF-A, event manager identified the cause of event and forward that event/callback notification to the respective subscribed driver. After this, in case of Error Event, driver performs unregistration as firmware expecting from agent to do re-registration if the agent wants to get notified on the second occurrence of an error event. Add new IOCTL id IOCTL_REGISTER_SGI = 25 which is used to register SGI on TF-A. Older firmware doesn't have all required support for event handling which is required by the event manager driver. So add check for the register notifier version in the event manager driver. Xilinx event management driver provides support to subscribe for multiple error events with the use of Event Mask in a single call of xlnx_register_event(). Agent driver can provide 'Event' parameter value as ORed of multiple event masks to register single callback for multiple events. For example, to register callback for event=0x1 and event=0x2 for the given node, agent can provide event=0x3 (0x1 | 0x2). It is not possible to register multiple events for different nodes in a single registration call. Also provide support to receive multiple error events as in single notification from firmware and then forward it to subscribed drivers via registered callback one by one. Signed-off-by: Tejas Patel Signed-off-by: Rajan Vaja Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - Update the commit message. - Fix the debug print. Changes in v2: - make sgi_num as module parameter - Add info print for SGI registration --- MAINTAINERS | 6 + drivers/soc/xilinx/Kconfig | 10 + drivers/soc/xilinx/Makefile | 1 + drivers/soc/xilinx/xlnx_event_manager.c | 600 ++++++++++++++++++++ include/linux/firmware/xlnx-event-manager.h | 36 ++ include/linux/firmware/xlnx-zynqmp.h | 2 + 6 files changed, 655 insertions(+) create mode 100644 drivers/soc/xilinx/xlnx_event_manager.c create mode 100644 include/linux/firmware/xlnx-event-manager.h diff --git a/MAINTAINERS b/MAINTAINERS index c79388b78818..cd3571ff1abe 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20635,6 +20635,12 @@ T: git https://github.com/Xilinx/linux-xlnx.git F: Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml F: drivers/phy/xilinx/phy-zynqmp.c +XILINX EVENT MANAGEMENT DRIVER +M: Abhyuday Godhasara +S: Maintained +F: drivers/soc/xilinx/xlnx_event_manager.c +F: include/linux/firmware/xlnx-event-manager.h + XILLYBUS DRIVER M: Eli Billauer L: linux-kernel@vger.kernel.org diff --git a/drivers/soc/xilinx/Kconfig b/drivers/soc/xilinx/Kconfig index 53af9115dc31..8a755a5c8836 100644 --- a/drivers/soc/xilinx/Kconfig +++ b/drivers/soc/xilinx/Kconfig @@ -25,4 +25,14 @@ config ZYNQMP_PM_DOMAINS Say yes to enable device power management through PM domains If in doubt, say N. +config XLNX_EVENT_MANAGER + bool "Enable Xilinx Event Management Driver" + depends on ZYNQMP_FIRMWARE + default ZYNQMP_FIRMWARE + help + Say yes to enable event management support for Xilinx. + This driver uses firmware driver as an interface for event/power + management request to firmware. + + If in doubt, say N. endmenu diff --git a/drivers/soc/xilinx/Makefile b/drivers/soc/xilinx/Makefile index 9854e6f6086b..41e585bc9c67 100644 --- a/drivers/soc/xilinx/Makefile +++ b/drivers/soc/xilinx/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_ZYNQMP_POWER) += zynqmp_power.o obj-$(CONFIG_ZYNQMP_PM_DOMAINS) += zynqmp_pm_domains.o +obj-$(CONFIG_XLNX_EVENT_MANAGER) += xlnx_event_manager.o diff --git a/drivers/soc/xilinx/xlnx_event_manager.c b/drivers/soc/xilinx/xlnx_event_manager.c new file mode 100644 index 000000000000..b27f8853508e --- /dev/null +++ b/drivers/soc/xilinx/xlnx_event_manager.c @@ -0,0 +1,600 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Xilinx Event Management Driver + * + * Copyright (C) 2021 Xilinx, Inc. + * + * Abhyuday Godhasara + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number1); + +static int virq_sgi; +static int event_manager_availability = -EACCES; + +/* SGI number used for Event management driver */ +#define XLNX_EVENT_SGI_NUM (15) + +/* Max number of driver can register for same event */ +#define MAX_DRIVER_PER_EVENT (10U) + +/* Max HashMap Order for PM API feature check (1<<7 = 128) */ +#define REGISTERED_DRIVER_MAX_ORDER (7) + +#define MAX_BITS (32U) /* Number of bits available for error mask */ + +#define FIRMWARE_VERSION_MASK (0xFFFFU) +#define REGISTER_NOTIFIER_FIRMWARE_VERSION (2U) + +static DEFINE_HASHTABLE(reg_driver_map, REGISTERED_DRIVER_MAX_ORDER); +static int sgi_num = XLNX_EVENT_SGI_NUM; + +/** + * struct registered_event_data - Registered Event Data. + * @key: key is the combine id(Node-Id | Event-Id) of type u64 + * where upper u32 for Node-Id and lower u32 for Event-Id, + * And this used as key to index into hashmap. + * @agent_data: Data passed back to handler function. + * @cb_type: Type of Api callback, like PM_NOTIFY_CB, etc. + * @eve_cb: Function pointer to store the callback function. + * @wake: If this flag set, firmware will wakeup processor if is + * in sleep or power down state. + * @hentry: hlist_node that hooks this entry into hashtable. + */ +struct registered_event_data { + u64 key; + enum pm_api_cb_id cb_type; + void *agent_data; + + event_cb_func_t eve_cb; + bool wake; + struct hlist_node hentry; +}; + +static bool xlnx_is_error_event(const u32 node_id) +{ + if (node_id == EVENT_ERROR_PMC_ERR1 || + node_id == EVENT_ERROR_PMC_ERR2 || + node_id == EVENT_ERROR_PSM_ERR1 || + node_id == EVENT_ERROR_PSM_ERR2) + return true; + + return false; +} + +static int xlnx_add_cb_for_notify_event(const u32 node_id, const u32 event, const bool wake, + event_cb_func_t cb_fun, void *data) +{ + u64 key = 0; + struct registered_event_data *eve_data; + + key = ((u64)node_id << 32U) | (u64)event; + /* Check for existing entry in hash table for given key id */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, key) { + if (eve_data->key == key) { + pr_err("Found as already registered\n"); + return -EINVAL; + } + } + + /* Add new entry if not present */ + eve_data = kmalloc(sizeof(*eve_data), GFP_KERNEL); + if (!eve_data) + return -ENOMEM; + + eve_data->key = key; + eve_data->cb_type = PM_NOTIFY_CB; + eve_data->eve_cb = cb_fun; + eve_data->wake = wake; + eve_data->agent_data = data; + + hash_add(reg_driver_map, &eve_data->hentry, key); + + return 0; +} + +static int xlnx_add_cb_for_suspend(event_cb_func_t cb_fun, void *data) +{ + struct registered_event_data *eve_data; + + /* Check for existing entry in hash table for given cb_type */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, PM_INIT_SUSPEND_CB) { + if (eve_data->cb_type == PM_INIT_SUSPEND_CB) { + pr_err("Found as already registered\n"); + return -EINVAL; + } + } + + /* Add new entry if not present */ + eve_data = kmalloc(sizeof(*eve_data), GFP_KERNEL); + if (!eve_data) + return -ENOMEM; + + eve_data->key = 0; + eve_data->cb_type = PM_INIT_SUSPEND_CB; + eve_data->eve_cb = cb_fun; + eve_data->agent_data = data; + + hash_add(reg_driver_map, &eve_data->hentry, PM_INIT_SUSPEND_CB); + + return 0; +} + +static int xlnx_remove_cb_for_suspend(event_cb_func_t cb_fun) +{ + bool is_callback_found = false; + struct registered_event_data *eve_data; + + /* Check for existing entry in hash table for given cb_type */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, PM_INIT_SUSPEND_CB) { + if (eve_data->cb_type == PM_INIT_SUSPEND_CB && + eve_data->eve_cb == cb_fun) { + is_callback_found = true; + /* remove an object from a hashtable */ + hash_del(&eve_data->hentry); + kfree(eve_data); + } + } + if (!is_callback_found) { + pr_warn("Didn't find any registered callback for suspend event\n"); + return -EINVAL; + } + + return 0; +} + +static int xlnx_remove_cb_for_notify_event(const u32 node_id, const u32 event, + event_cb_func_t cb_fun) +{ + bool is_callback_found = false; + struct registered_event_data *eve_data; + u64 key = ((u64)node_id << 32U) | (u64)event; + + /* Check for existing entry in hash table for given key id */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, key) { + if (eve_data->key == key && + eve_data->eve_cb == cb_fun) { + is_callback_found = true; + /* remove an object from a hashtable */ + hash_del(&eve_data->hentry); + kfree(eve_data); + } + } + if (!is_callback_found) { + pr_warn("Didn't find any registered callback for 0x%x 0x%x\n", + node_id, event); + return -EINVAL; + } + + return 0; +} + +/** + * xlnx_register_event() - Register for the event. + * @cb_type: Type of callback from pm_api_cb_id, + * PM_NOTIFY_CB - for Error Events, + * PM_INIT_SUSPEND_CB - for suspend callback. + * @node_id: Node-Id related to event. + * @event: Event Mask for the Error Event. + * @wake: Flag specifying whether the subsystem should be woken upon + * event notification. + * @cb_fun: Function pointer to store the callback function. + * @data: Pointer for the driver instance. + * + * Return: Returns 0 on successful registration else error code. + */ +int xlnx_register_event(const enum pm_api_cb_id cb_type, const u32 node_id, const u32 event, + const bool wake, event_cb_func_t cb_fun, void *data) +{ + int ret = 0; + u32 eve; + int pos; + + if (event_manager_availability) + return event_manager_availability; + + if (cb_type != PM_NOTIFY_CB && cb_type != PM_INIT_SUSPEND_CB) { + pr_err("%s() Unsupported Callback 0x%x\n", __func__, cb_type); + return -EINVAL; + } + + if (!cb_fun) + return -EFAULT; + + if (cb_type == PM_INIT_SUSPEND_CB) { + ret = xlnx_add_cb_for_suspend(cb_fun, data); + } else { + if (!xlnx_is_error_event(node_id)) { + /* Add entry for Node-Id/Event in hash table */ + ret = xlnx_add_cb_for_notify_event(node_id, event, wake, cb_fun, data); + } else { + /* Add into Hash table */ + for (pos = 0; pos < MAX_BITS; pos++) { + eve = event & (1 << pos); + if (!eve) + continue; + + /* Add entry for Node-Id/Eve in hash table */ + ret = xlnx_add_cb_for_notify_event(node_id, eve, wake, cb_fun, + data); + /* Break the loop if got error */ + if (ret) + break; + } + if (ret) { + /* Skip the Event for which got the error */ + pos--; + /* Remove registered(during this call) event from hash table */ + for ( ; pos >= 0; pos--) { + eve = event & (1 << pos); + if (!eve) + continue; + xlnx_remove_cb_for_notify_event(node_id, eve, cb_fun); + } + } + } + + if (ret) { + pr_err("%s() failed for 0x%x and 0x%x: %d\r\n", __func__, node_id, + event, ret); + return ret; + } + + /* Register for Node-Id/Event combination in firmware */ + ret = zynqmp_pm_register_notifier(node_id, event, wake, true); + if (ret) { + pr_err("%s() failed for 0x%x and 0x%x: %d\r\n", __func__, node_id, + event, ret); + /* Remove already registered event from hash table */ + if (xlnx_is_error_event(node_id)) { + for (pos = 0; pos < MAX_BITS; pos++) { + eve = event & (1 << pos); + if (!eve) + continue; + xlnx_remove_cb_for_notify_event(node_id, eve, cb_fun); + } + } else { + xlnx_remove_cb_for_notify_event(node_id, event, cb_fun); + } + return ret; + } + } + + return ret; +} +EXPORT_SYMBOL_GPL(xlnx_register_event); + +/** + * xlnx_unregister_event() - Unregister for the event. + * @cb_type: Type of callback from pm_api_cb_id, + * PM_NOTIFY_CB - for Error Events, + * PM_INIT_SUSPEND_CB - for suspend callback. + * @node_id: Node-Id related to event. + * @event: Event Mask for the Error Event. + * @cb_fun: Function pointer of callback function. + * + * Return: Returns 0 on successful unregistration else error code. + */ +int xlnx_unregister_event(const enum pm_api_cb_id cb_type, const u32 node_id, const u32 event, + event_cb_func_t cb_fun) +{ + int ret; + u32 eve, pos; + + if (event_manager_availability) + return event_manager_availability; + + if (cb_type != PM_NOTIFY_CB && cb_type != PM_INIT_SUSPEND_CB) { + pr_err("%s() Unsupported Callback 0x%x\n", __func__, cb_type); + return -EINVAL; + } + + if (!cb_fun) + return -EFAULT; + + if (cb_type == PM_INIT_SUSPEND_CB) { + ret = xlnx_remove_cb_for_suspend(cb_fun); + } else { + /* Remove Node-Id/Event from hash table */ + if (!xlnx_is_error_event(node_id)) { + xlnx_remove_cb_for_notify_event(node_id, event, cb_fun); + } else { + for (pos = 0; pos < MAX_BITS; pos++) { + eve = event & (1 << pos); + if (!eve) + continue; + + xlnx_remove_cb_for_notify_event(node_id, eve, cb_fun); + } + } + + /* Un-register for Node-Id/Event combination */ + ret = zynqmp_pm_register_notifier(node_id, event, false, false); + if (ret) { + pr_err("%s() failed for 0x%x and 0x%x: %d\n", + __func__, node_id, event, ret); + return ret; + } + } + + return ret; +} +EXPORT_SYMBOL_GPL(xlnx_unregister_event); + +static void xlnx_call_suspend_cb_handler(const u32 *payload) +{ + bool is_callback_found = false; + struct registered_event_data *eve_data; + u32 cb_type = payload[0]; + + /* Check for existing entry in hash table for given cb_type */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, cb_type) { + if (eve_data->cb_type == cb_type) { + eve_data->eve_cb(&payload[0], eve_data->agent_data); + is_callback_found = true; + } + } + if (!is_callback_found) + pr_warn("Didn't find any registered callback for suspend event\n"); +} + +static void xlnx_call_notify_cb_handler(const u32 *payload) +{ + bool is_callback_found = false; + struct registered_event_data *eve_data; + u64 key = ((u64)payload[1] << 32U) | (u64)payload[2]; + int ret; + + /* Check for existing entry in hash table for given key id */ + hash_for_each_possible(reg_driver_map, eve_data, hentry, key) { + if (eve_data->key == key) { + eve_data->eve_cb(&payload[0], eve_data->agent_data); + is_callback_found = true; + + /* re register with firmware to get future events */ + ret = zynqmp_pm_register_notifier(payload[1], payload[2], + eve_data->wake, true); + if (ret) { + pr_err("%s() failed for 0x%x and 0x%x: %d\r\n", __func__, + payload[1], payload[2], ret); + /* Remove already registered event from hash table */ + xlnx_remove_cb_for_notify_event(payload[1], payload[2], + eve_data->eve_cb); + } + } + } + if (!is_callback_found) + pr_warn("Didn't find any registered callback for 0x%x 0x%x\n", + payload[1], payload[2]); +} + +static void xlnx_get_event_callback_data(u32 *buf) +{ + zynqmp_pm_invoke_fn(GET_CALLBACK_DATA, 0, 0, 0, 0, buf); +} + +static irqreturn_t xlnx_event_handler(int irq, void *dev_id) +{ + u32 cb_type, node_id, event, pos; + u32 payload[CB_MAX_PAYLOAD_SIZE] = {0}; + u32 event_data[CB_MAX_PAYLOAD_SIZE] = {0}; + + /* Get event data */ + xlnx_get_event_callback_data(payload); + + /* First element is callback type, others are callback arguments */ + cb_type = payload[0]; + + if (cb_type == PM_NOTIFY_CB) { + node_id = payload[1]; + event = payload[2]; + if (!xlnx_is_error_event(node_id)) { + xlnx_call_notify_cb_handler(payload); + } else { + /* + * Each call back function expecting payload as an input arguments. + * We can get multiple error events as in one call back through error + * mask. So payload[2] may can contain multiple error events. + * In reg_driver_map database we store data in the combination of single + * node_id-error combination. + * So coping the payload message into event_data and update the + * event_data[2] with Error Mask for single error event and use + * event_data as input argument for registered call back function. + * + */ + memcpy(event_data, payload, (4 * CB_MAX_PAYLOAD_SIZE)); + /* Support Multiple Error Event */ + for (pos = 0; pos < MAX_BITS; pos++) { + if ((0 == (event & (1 << pos)))) + continue; + event_data[2] = (event & (1 << pos)); + xlnx_call_notify_cb_handler(event_data); + } + } + } else if (cb_type == PM_INIT_SUSPEND_CB) { + xlnx_call_suspend_cb_handler(payload); + } else { + pr_err("%s() Unsupported Callback %d\n", __func__, cb_type); + } + + return IRQ_HANDLED; +} + +static int xlnx_event_cpuhp_start(unsigned int cpu) +{ + enable_percpu_irq(virq_sgi, IRQ_TYPE_NONE); + + return 0; +} + +static int xlnx_event_cpuhp_down(unsigned int cpu) +{ + disable_percpu_irq(virq_sgi); + + return 0; +} + +static void xlnx_disable_percpu_irq(void *data) +{ + disable_percpu_irq(virq_sgi); +} + +static int xlnx_event_init_sgi(struct platform_device *pdev) +{ + int ret = 0; + int cpu = smp_processor_id(); + /* + * IRQ related structures are used for the following: + * for each SGI interrupt ensure its mapped by GIC IRQ domain + * and that each corresponding linux IRQ for the HW IRQ has + * a handler for when receiving an interrupt from the remote + * processor. + */ + struct irq_domain *domain; + struct irq_fwspec sgi_fwspec; + struct device_node *interrupt_parent = NULL; + struct device *parent = pdev->dev.parent; + + /* Find GIC controller to map SGIs. */ + interrupt_parent = of_irq_find_parent(parent->of_node); + if (!interrupt_parent) { + dev_err(&pdev->dev, "Failed to find property for Interrupt parent\n"); + return -EINVAL; + } + + /* Each SGI needs to be associated with GIC's IRQ domain. */ + domain = irq_find_host(interrupt_parent); + of_node_put(interrupt_parent); + + /* Each mapping needs GIC domain when finding IRQ mapping. */ + sgi_fwspec.fwnode = domain->fwnode; + + /* + * When irq domain looks at mapping each arg is as follows: + * 3 args for: interrupt type (SGI), interrupt # (set later), type + */ + sgi_fwspec.param_count = 1; + + /* Set SGI's hwirq */ + sgi_fwspec.param[0] = sgi_num; + virq_sgi = irq_create_fwspec_mapping(&sgi_fwspec); + + per_cpu(cpu_number1, cpu) = cpu; + ret = request_percpu_irq(virq_sgi, xlnx_event_handler, "xlnx_event_mgmt", + &cpu_number1); + WARN_ON(ret); + if (ret) { + irq_dispose_mapping(virq_sgi); + return ret; + } + + irq_to_desc(virq_sgi); + irq_set_status_flags(virq_sgi, IRQ_PER_CPU); + + return ret; +} + +static void xlnx_event_cleanup_sgi(struct platform_device *pdev) +{ + int cpu = smp_processor_id(); + + per_cpu(cpu_number1, cpu) = cpu; + + cpuhp_remove_state(CPUHP_AP_ONLINE_DYN); + + on_each_cpu(xlnx_disable_percpu_irq, NULL, 1); + + irq_clear_status_flags(virq_sgi, IRQ_PER_CPU); + free_percpu_irq(virq_sgi, &cpu_number1); + irq_dispose_mapping(virq_sgi); +} + +static int xlnx_event_manager_probe(struct platform_device *pdev) +{ + int ret; + + ret = zynqmp_pm_feature(PM_REGISTER_NOTIFIER); + if (ret < 0) { + dev_err(&pdev->dev, "Feature check failed with %d\n", ret); + return ret; + } + + if ((ret & FIRMWARE_VERSION_MASK) < + REGISTER_NOTIFIER_FIRMWARE_VERSION) { + dev_err(&pdev->dev, "Register notifier version error. Expected Firmware: v%d - Found: v%d\n", + REGISTER_NOTIFIER_FIRMWARE_VERSION, + ret & FIRMWARE_VERSION_MASK); + return -EOPNOTSUPP; + } + + /* Initialize the SGI */ + ret = xlnx_event_init_sgi(pdev); + if (ret) { + dev_err(&pdev->dev, "SGI Init has been failed with %d\n", ret); + return ret; + } + + /* Setup function for the CPU hot-plug cases */ + cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/event:starting", + xlnx_event_cpuhp_start, xlnx_event_cpuhp_down); + + ret = zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_REGISTER_SGI, sgi_num, + 0, NULL); + if (ret) { + dev_err(&pdev->dev, "SGI %d Registration over TF-A failed with %d\n", sgi_num, ret); + xlnx_event_cleanup_sgi(pdev); + return ret; + } + + event_manager_availability = 0; + + dev_info(&pdev->dev, "SGI %d Registered over TF-A\n", sgi_num); + dev_info(&pdev->dev, "Xilinx Event Management driver probed\n"); + + return ret; +} + +static int xlnx_event_manager_remove(struct platform_device *pdev) +{ + int i; + struct registered_event_data *eve_data; + struct hlist_node *tmp; + int ret; + + hash_for_each_safe(reg_driver_map, i, tmp, eve_data, hentry) { + hash_del(&eve_data->hentry); + kfree(eve_data); + } + + ret = zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_REGISTER_SGI, 0, 1, NULL); + if (ret) + dev_err(&pdev->dev, "SGI unregistration over TF-A failed with %d\n", ret); + + xlnx_event_cleanup_sgi(pdev); + + event_manager_availability = -EACCES; + + return ret; +} + +static struct platform_driver xlnx_event_manager_driver = { + .probe = xlnx_event_manager_probe, + .remove = xlnx_event_manager_remove, + .driver = { + .name = "xlnx_event_manager", + }, +}; +module_param(sgi_num, uint, 0); +module_platform_driver(xlnx_event_manager_driver); diff --git a/include/linux/firmware/xlnx-event-manager.h b/include/linux/firmware/xlnx-event-manager.h new file mode 100644 index 000000000000..3f87c4929d21 --- /dev/null +++ b/include/linux/firmware/xlnx-event-manager.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _FIRMWARE_XLNX_EVENT_MANAGER_H_ +#define _FIRMWARE_XLNX_EVENT_MANAGER_H_ + +#include + +#define CB_MAX_PAYLOAD_SIZE (4U) /*In payload maximum 32bytes */ + +/************************** Exported Function *****************************/ + +typedef void (*event_cb_func_t)(const u32 *payload, void *data); + +#if IS_REACHABLE(CONFIG_XLNX_EVENT_MANAGER) +int xlnx_register_event(const enum pm_api_cb_id cb_type, const u32 node_id, + const u32 event, const bool wake, + event_cb_func_t cb_fun, void *data); + +int xlnx_unregister_event(const enum pm_api_cb_id cb_type, const u32 node_id, + const u32 event, event_cb_func_t cb_fun); +#else +static inline int xlnx_register_event(const enum pm_api_cb_id cb_type, const u32 node_id, + const u32 event, const bool wake, + event_cb_func_t cb_fun, void *data) +{ + return -ENODEV; +} + +static inline int xlnx_unregister_event(const enum pm_api_cb_id cb_type, const u32 node_id, + const u32 event, event_cb_func_t cb_fun) +{ + return -ENODEV; +} +#endif + +#endif /* _FIRMWARE_XLNX_EVENT_MANAGER_H_ */ diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 591bdbb4290e..ecc9d6ab1117 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -138,6 +138,8 @@ enum pm_ioctl_id { IOCTL_READ_PGGS = 15, /* Set healthy bit value */ IOCTL_SET_BOOT_HEALTH_STATUS = 17, + /* Register SGI to ATF */ + IOCTL_REGISTER_SGI = 25, }; enum pm_query_id { From patchwork Mon Oct 25 08:23:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD89C433F5 for ; Mon, 25 Oct 2021 08:29:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B863604AC for ; Mon, 25 Oct 2021 08:29:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9B863604AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XCi/RJeV9Ef0oOQnKE4kanmLV2vKZdq1Cioxhux6T9o=; b=R2+qOfRH6kV6Ap 5awT4+NlMbiOJCJXM5PxMpFRd0DfQYGOLcwpKTRojdU1Rr/dagWDHH6qbL/m2GRdwVAvnDMRMBGy/ lq32MRmSmIKQ0Ucj0A2UafNdMw9BJjPUVA6ObaI9jqzbuW7W5D30FbBycHv2ag6aK/dUlYfwZ3do+ MGQXtS6eGwFlSSCJTNs09uzdFI/1zJ5MNsQ2qGxJavkKCFRHtQdfFuULZPSBlKtljkq6CGdKzEmke cIhkFCkfyPJB/QXXvBlTCH6aIPcCeYBqdcR2SidfO5PcZONNJL6Uk46ZAj73MXYWimg46D9uTc5oL HuSrFlYrm8MEar442sJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevKx-00FoEm-8E; Mon, 25 Oct 2021 08:28:08 +0000 Received: from mail-dm6nam11on2084.outbound.protection.outlook.com ([40.107.223.84] helo=NAM11-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevII-00FnMe-Eg for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:25:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L4VqZrJNHLM+diRDkTRqKBtOkPH+Cmd7s8DvKOtuOQdBhNmtNQTLLnDKLYU/jRDoOXTt/j4RrPxwoi/BPM886SYEdVcFkXcJyYJyruk94J+UjQzoP6kmNoKN3i8ZqRrcIGnlY4dglW648KvANjakZer4bViZhSz8DYtcPx9IRPlimGIFfBoLzucuuphaIuKhyRc+8J+2HQ6MPIuxAXTTVJjMkKEC9sInglCq0PCEvEgIZAd6Hfecundmgd2PwC5CPmDFTYvoBKNiLB5hB4mOG2LAzu+piwVTv/HSrsfr0mxdm1OJ4X2JkqVcxW2GXMF0Sgsn6tb4I7zgl/MOTQf0wg== 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=rFoG+HHiBoTuu86X0HKIE40f5O6StXnVqxAges578Lw=; b=PZ//STfWlzClLSPOAufjlGM/9if7zaCIGeKEhYMPquBOXxm/wHuHeRECrSpVE0ynPMKM/GsZiLRk0A+4ihqjSDnd7Fv/KwNb4uyej8hQE7MchrPtetXSDcef69q5kFZfxdmbzwzIA1HjkiopEpY/Xx3HDEBlRu6BRlIyceb1yb+M1aNVrhJrryutS2+lTgai9Fr4R/Yxq3tB93D1XOyMYNs7apzXZV6DedIOrbNi6q/Ytur6aeLZqmj+bHFZCWFGULeVDw7DEE0ZZs0BTOp3ivLLo6LfaZM+KWfTqBdAjDyYzROBBa+uyQWKDzdmI7mz+7vX6BUQH7jR1p0DAhwkAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rFoG+HHiBoTuu86X0HKIE40f5O6StXnVqxAges578Lw=; b=PgcrbQD2GfoRqVcydFQHU9XikscTjfOXwyySFZcsGsJIVlt9/U0ZdlopuD7ydIkrZRM0YLbzS0w9O6ZDTleKAacy3gcAZSaJYEMi4Pgfzg8tdlOKvpY0a3K6HaLBjTZaIixOW7BhXcEuYd0Mqfa1H2mFYwtZVuV0uUDmESTIL50= Received: from SA9PR13CA0011.namprd13.prod.outlook.com (2603:10b6:806:21::16) by BL0PR02MB5491.namprd02.prod.outlook.com (2603:10b6:208:37::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Mon, 25 Oct 2021 08:25:17 +0000 Received: from SN1NAM02FT0021.eop-nam02.prod.protection.outlook.com (2603:10b6:806:21:cafe::a6) by SA9PR13CA0011.outlook.office365.com (2603:10b6:806:21::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.12 via Frontend Transport; Mon, 25 Oct 2021 08:25:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0021.mail.protection.outlook.com (10.97.5.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:25:17 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:25:14 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:25:14 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-PW; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , Subject: [PATCH v6 5/6] firmware: xilinx: instantiate xilinx event manager driver Date: Mon, 25 Oct 2021 01:23:49 -0700 Message-ID: <20211025082350.10881-6-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2128c48-1913-4a86-05fc-08d99790f9d4 X-MS-TrafficTypeDiagnostic: BL0PR02MB5491: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M1Xu0ngRmvcGIqiabemJTnAtvEc7KTcz2/qm9TFybXiJuWU0FqmJ33IBkFYNz2Rhzq2AJGaQltLApUeOChNjJxAILG8nKxjEYORC3y7pXs98HZQHvRkY2tFoN77pI1dN4KFe1dlOJtEPJe0KIF+9uqY5CTTNE00htV0qvNJ06Ov38/2r3QSr106HMQhSkPN+Pn9NBnPmTQVtdYy/yeY3KGM5b9U+ouXFgWjmoJLC1eD7Yu0sQ1+463GJvC9l0/tS1B1OM+ly8zOywrnG+2LoQC868fkXR9eMbFwPakKlSydXnM3x9sTYfD1HbN7Ajzaxxctn5awVyFkKgEzMT9L222oR9r95erXcPweKadrQpGcclLvJB278fR9irCEUVGuPESJKrGJT1R1LirQghoKfk/ypGtUFnJKwDNhEoOe1eRFs8prEfF3EH6iKzFBsX0kslxYk0bW9QF7zHxbbX6yOufUAT7bT13sXDeCw0CO4UHN4Ujs++2iJmPcS1khmupjoicBZMWel+Vgk5f2NmsdQtPeEKj/MP5N3+Clxo22Qg1xkM3rW0NBTZt38nurVbmFc1XiVGjMk/hA3oxCUSQYyemiBQU3RaJbpWz/9lUenPkII6x6XCK43wDfY/N+Vx/4hTwWcFV+L1BjKZ2nraYCGizYpIodvMmaDOHk0GcXU/kwsqMpYinFPQklW3Awp9jLAodbBS3q+G0GwXirWCrslxGDBU+/hVWnOPwI8dob/tls= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(356005)(36860700001)(7636003)(36756003)(7696005)(36906005)(6916009)(83380400001)(2616005)(44832011)(8936002)(5660300002)(316002)(1076003)(4326008)(426003)(2906002)(26005)(336012)(47076005)(9786002)(186003)(70586007)(70206006)(508600001)(6666004)(8676002)(82310400003)(54906003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:25:17.1342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2128c48-1913-4a86-05fc-08d99790f9d4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0021.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB5491 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012522_636246_D645BA90 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Register simple platform device to instantiate Xilinx event manager driver. Signed-off-by: Rajan Vaja Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - None Changes in v2: - Use em_dev instead of pdev in PTR_ERR. --- drivers/firmware/xilinx/zynqmp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index e2c55f48b93d..f3cf4535463b 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -23,6 +23,7 @@ #include #include +#include #include "zynqmp-debug.h" /* Max HashMap Order for PM API feature check (1<<7 = 128) */ @@ -31,6 +32,8 @@ static bool feature_check_enabled; static DEFINE_HASHTABLE(pm_api_features_map, PM_API_FEATURE_CHECK_MAX_ORDER); +static struct platform_device *em_dev; + /** * struct pm_api_feature_data - PM API Feature data * @pm_api_id: PM API Id, used as key to index into hashmap @@ -1429,6 +1432,15 @@ static int zynqmp_firmware_probe(struct platform_device *pdev) zynqmp_pm_api_debugfs_init(); + np = of_find_compatible_node(NULL, NULL, "xlnx,versal"); + if (np) { + em_dev = platform_device_register_data(&pdev->dev, "xlnx_event_manager", + -1, NULL, 0); + if (IS_ERR(em_dev)) + dev_err_probe(&pdev->dev, PTR_ERR(em_dev), "EM register fail with error\n"); + } + of_node_put(np); + return of_platform_populate(dev->of_node, NULL, NULL, dev); } @@ -1446,6 +1458,8 @@ static int zynqmp_firmware_remove(struct platform_device *pdev) kfree(feature_data); } + platform_device_unregister(em_dev); + return 0; } From patchwork Mon Oct 25 08:23:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhyuday Godhasara X-Patchwork-Id: 12580969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1100C433F5 for ; Mon, 25 Oct 2021 08:29:06 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FA1F604AC for ; Mon, 25 Oct 2021 08:29:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8FA1F604AC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OcJHRPLkV6tkVby0BFSnBDupcTFw8Aj42FJa0QS277U=; b=TdtiqnTRssy5gp t8bCYhLcxq2OsmN8ugTWfJlwaDnPjCW5WsKMAPPncAtAA4ZEYrtqQ5711Gr/HyVWcp+u0jiag8m1u aoLOc8LTYLesnnobLbE6/Ct4/Rm4Z6aEyxscwv8MbyGAmjonsGBDA+qkDJHzzU0Omab3l8It5FE+A Ru++MxEK46MKl/b/K0LP1d3InfeRI1K2MRFYC7v9aIL2IX+x+emUo+kLZusLppvO6e2ylk9LjcRFS hKN/J8X7UrbJK7mywOqUGuUeXutfJY4+d4CBbssbDy1fR7AjPD+hsxcNVdjbWAp9RYzgMHpeNL5G7 bhljD/3jodf9RFSZE8HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevJy-00Fnuo-Cb; Mon, 25 Oct 2021 08:27:07 +0000 Received: from mail-co1nam11on2060e.outbound.protection.outlook.com ([2a01:111:f400:7eab::60e] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mevHU-00Fn8d-Da for linux-arm-kernel@lists.infradead.org; Mon, 25 Oct 2021 08:24:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkJIB+AljU8FGcDtCrchYynee1vJQ6zaRFfeN2VYssfoqZjlpQJ/88b1t8Te8in7+qLFH8Xj1SQeJL92fKiNYhnk9kx4F6JHt7NfKE/Tx3xYpf07gx68ZZWAU+h8M0NfIaL9ghyKAtOc23uKkotv7Gfa6nikJKd64NZUDPKVTpZIO4paK5dMICFO/Y5nXzOiR6MfxG28/YeHKX738Rem5O1Aff2Ufg0bRxAcDfAXZ0F0IybX/5nXzw/9qrwGI9vljmLlqf5nTjnAxSLKfZQGCJ622S+ipQBsMGkab4k10m8E7ftWf5ijbyIx8coPZRua//fvtelVkhGcLlGKtExvMA== 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=i7pL7vuoMsp2eOHRIqG38HLJzIBtaXdOiw4BWfb+bZ0=; b=aXKqq4IAkTA/TlNJSlFD/uY4szeR2/s7HDqxSrw0thi8/ODDEs3pw0jPEaq3epPc5UgIWwhYf2XxtQN2wIVyoxAfziWLrDUinFK7m9SJnbl55tKN+LBcncG3m0yXD1ZaP/paQDVC0gi0vBZJFA23x089FY/VIBpWJKhMIH3M+vJkmpVawQF+AGeHgeWMs8L+QWphMvUs1csRjwEKQQ7fLNcCgb620NKZPC3cSiBnSL2L2ycuwo8GPgd7qTDKZ15EksWPXuHmwX3tG4K5rsBEd5l0qfRe3JzQcQPhHLb/Ei2DWwGI9e0JDBf0ohiw6KptxTKw81HZDigpTidfkRuMww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i7pL7vuoMsp2eOHRIqG38HLJzIBtaXdOiw4BWfb+bZ0=; b=VU0pcByvZqSXZBcW/icekOD/dPBEE/SZ/qbNSzW/Dvnb0asNbLJ0q1AodZaSMpCZXhtfkPfO0ggqlr9xUXPADrOxOWCd9wvnzay6DYKVB/GoyMa3OSe2mCQrdtO1+y7kaU9FgnnnWJ2ybKhohDxESQ0kUaTb5KibhakgWkK9yUo= Received: from SA9P221CA0024.NAMP221.PROD.OUTLOOK.COM (2603:10b6:806:25::29) by DM6PR02MB6986.namprd02.prod.outlook.com (2603:10b6:5:22e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Mon, 25 Oct 2021 08:24:29 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:25:cafe::58) by SA9P221CA0024.outlook.office365.com (2603:10b6:806:25::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.20 via Frontend Transport; Mon, 25 Oct 2021 08:24:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4628.18 via Frontend Transport; Mon, 25 Oct 2021 08:24:29 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 25 Oct 2021 01:24:05 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Mon, 25 Oct 2021 01:24:05 -0700 Received: from [172.19.2.91] (port=37006 helo=xsjjollys50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mevGz-0003vt-Qm; Mon, 25 Oct 2021 01:24:01 -0700 From: Abhyuday Godhasara To: CC: , , , , , , , , , Subject: [PATCH v6 6/6] driver: soc: xilinx: register for power events in zynqmp power driver Date: Mon, 25 Oct 2021 01:23:50 -0700 Message-ID: <20211025082350.10881-7-abhyuday.godhasara@xilinx.com> X-Mailer: git-send-email 2.32.0.93.g670b81a In-Reply-To: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> References: <20211021134644.14407-1-abhyuday.godhasara@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25c00394-43ac-4401-90c2-08d99790dd58 X-MS-TrafficTypeDiagnostic: DM6PR02MB6986: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z9ZVBz+3b7RePcRXyeOPj2g0zCjLaQ2AN5MJGnSXbHqeVlkmX3Dv8QjesFhjeVBtDEhCSnQ73Z/J5E4j6PV+UPme8a9ZJDzjPcG1jrebOWLZq6/wY0oe3Qh1Ot4X83WHLyjwuqZtIZ6EkDrFvy2q16O6qmHiWDWdsSyBhX+oap2mLdul0ezr2MWXLmLAOiLoJoj/eFpKsbkSgtkhWhGenihWedVlg9ruBbaHnJylbehT3iN8yiH7rIW0KXv41R3n4Xj67XV0L1BInhZktJnHDI2ekhKGb/xOJpee+jc4ny46Ez1CNufEgoJoRKZ9Nf7Njk/wMOzuyOvy8XhWwrMAY5dxCqHHYgmMj1C6umiVuOn+CODgsniySOxTgxT6GSDFqiTWSk0n8EfaHBC/0w5DLlOxt8Vgv2NqwENO/Zj0VseVJPuZ9qOOnG1APfdGoYdscdiiMi6dg2aHytdyl0BkeKMlO6cYC65Zd4cYVyfUqtkQySaAFZBFFp+Liq/JMBUDg4p6e19SWABzak56GqZIniPZa7RfsU5DV2pHatdjw+qXmTOe5L00bz3bs70F7FQRlR9rtrWf6LZFgWMkRj5TyYXtMQUYAAC2wIzArFmUsXk4L3g5BQwTOT7jgmAvHfZ5Cudc9viOuZ+l7rmOt45ezJ2DAjvgJ4Z2ziHFf1vG2tSIZ4k3Rev1iZiGstC6qD/0QC8FR+j4+sfMofkiUc1i+mZ4Ty/yV4BBK8VhmVBa464= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(46966006)(36840700001)(508600001)(36756003)(6916009)(9786002)(83380400001)(6666004)(70586007)(26005)(1076003)(4326008)(8936002)(336012)(44832011)(356005)(82310400003)(36906005)(8676002)(7696005)(5660300002)(186003)(47076005)(70206006)(2616005)(7636003)(36860700001)(426003)(316002)(2906002)(54906003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2021 08:24:29.3489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25c00394-43ac-4401-90c2-08d99790dd58 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB6986 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211025_012432_532311_AB1D4336 X-CRM114-Status: GOOD ( 19.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With Xilinx Event Management driver, all types of events like power and error gets handled from single place as part of event management driver. So power events(SUSPEND_POWER_REQUEST and SUSPEND_SYSTEM_SHUTDOWN) also gets handled by event management driver instead of zynqmp_power driver. zynqmp-power driver use event management driver and provide callback function for Suspend and shutdown handler, which will be called by event management driver when respective event is arrived. If event management driver is not available than use ipi-mailbox rx channel or IPI interrupt IRQ handler for power events (suspend/shutdown) same as current zynqmp-power driver. Signed-off-by: Rajan Vaja Signed-off-by: Abhyuday Godhasara Acked-by: Michal Simek --- Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - None Changes in v2: - None --- drivers/soc/xilinx/zynqmp_power.c | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/soc/xilinx/zynqmp_power.c b/drivers/soc/xilinx/zynqmp_power.c index 76478fe2301f..fe7be176b226 100644 --- a/drivers/soc/xilinx/zynqmp_power.c +++ b/drivers/soc/xilinx/zynqmp_power.c @@ -16,6 +16,7 @@ #include #include +#include #include /** @@ -30,6 +31,7 @@ struct zynqmp_pm_work_struct { static struct zynqmp_pm_work_struct *zynqmp_pm_init_suspend_work; static struct mbox_chan *rx_chan; +static bool event_registered; enum pm_suspend_mode { PM_SUSPEND_MODE_FIRST = 0, @@ -51,6 +53,19 @@ static void zynqmp_pm_get_callback_data(u32 *buf) zynqmp_pm_invoke_fn(GET_CALLBACK_DATA, 0, 0, 0, 0, buf); } +static void suspend_event_callback(const u32 *payload, void *data) +{ + /* First element is callback API ID, others are callback arguments */ + if (work_pending(&zynqmp_pm_init_suspend_work->callback_work)) + return; + + /* Copy callback arguments into work's structure */ + memcpy(zynqmp_pm_init_suspend_work->args, &payload[1], + sizeof(zynqmp_pm_init_suspend_work->args)); + + queue_work(system_unbound_wq, &zynqmp_pm_init_suspend_work->callback_work); +} + static irqreturn_t zynqmp_pm_isr(int irq, void *data) { u32 payload[CB_PAYLOAD_SIZE]; @@ -179,7 +194,32 @@ static int zynqmp_pm_probe(struct platform_device *pdev) if (pm_api_version < ZYNQMP_PM_VERSION) return -ENODEV; - if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { + /* + * First try to use Xilinx Event Manager by registering suspend_event_callback + * for suspend/shutdown event. + * If xlnx_register_event() returns -EACCES (Xilinx Event Manager + * is not available to use) or -ENODEV(Xilinx Event Manager not compiled), + * then use ipi-mailbox or interrupt method. + */ + ret = xlnx_register_event(PM_INIT_SUSPEND_CB, 0, 0, false, + suspend_event_callback, NULL); + if (!ret) { + zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, + sizeof(struct zynqmp_pm_work_struct), + GFP_KERNEL); + if (!zynqmp_pm_init_suspend_work) { + xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, + suspend_event_callback); + return -ENOMEM; + } + event_registered = true; + + INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, + zynqmp_pm_init_suspend_work_fn); + } else if (ret != -EACCES && ret != -ENODEV) { + dev_err(&pdev->dev, "Failed to Register with Xilinx Event manager %d\n", ret); + return ret; + } else if (of_find_property(pdev->dev.of_node, "mboxes", NULL)) { zynqmp_pm_init_suspend_work = devm_kzalloc(&pdev->dev, sizeof(struct zynqmp_pm_work_struct), @@ -223,6 +263,10 @@ static int zynqmp_pm_probe(struct platform_device *pdev) ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr); if (ret) { + if (event_registered) { + xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, suspend_event_callback); + event_registered = false; + } dev_err(&pdev->dev, "unable to create sysfs interface\n"); return ret; } @@ -233,6 +277,8 @@ static int zynqmp_pm_probe(struct platform_device *pdev) static int zynqmp_pm_remove(struct platform_device *pdev) { sysfs_remove_file(&pdev->dev.kobj, &dev_attr_suspend_mode.attr); + if (event_registered) + xlnx_unregister_event(PM_INIT_SUSPEND_CB, 0, 0, suspend_event_callback); if (!rx_chan) mbox_free_channel(rx_chan);