From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8148C433E2 for ; Thu, 17 Sep 2020 19:45:28 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4CAA522211 for ; Thu, 17 Sep 2020 19:45:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XFnKxgbq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="Q96ykpK/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CAA522211 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3opw3anKdI+cuf9qhAChVit41mNL5Wmc2W9NIGf10L8=; b=XFnKxgbq24xjOaumyuyy6QYu6 tC88HqVS/CyifoB692b2IeW1kLhCTbbv6iduOl4iTWBZ3QyIX8H+5wtzv0USkCNWIVyxlbMxLC7KZ sT9LaoREzwobVSMTH3dbzeHR0boJnKNpOl4IS3+RHFfYwvTaE9WhISrR+4WB4ny5YPrg6Yd25Urcp DG9a5QVpbAud2Gj0ZxzfrpguR+wFurMuYc/rxgsmulsY9F7aydMYAdHYP/4SAQf6g+w85oYSMy8u/ BGTGcwYUxcve/ITaud/jOlrpM6TyuqPY5lFqq/84R6+OrxvUDhr9pYhrrlT1BCMeFqM3F/L6LRCLI qFY4iFzsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIzov-0007wc-BE; Thu, 17 Sep 2020 19:43:53 +0000 Received: from mail-mw2nam10on2057.outbound.protection.outlook.com ([40.107.94.57] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIzoq-0007uh-PQ for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 19:43:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hiqTyrm0jWmOPvdkfwuBIMl+a/XPxHiN6MCtndyGPabRMPbAx3Jfn+CW7hjDWmnHRap0o+12AVJj7vHVGZvvNf0qY7Foaq4NaySItl5/dVaK2tzMq6s0t6zFxWbRkaTdIAS5gkc7Cg6ThDUowUOh+dec3jLTLOgfzD3nh0fhAkgSdRnuvw+HQW1i6iHh6FFj3PS84mpRm8cLHPxexrLlqlECsu7P8cEMQmbI13mW4Rl4tXPK/MLnDBFIhL8HQWeKLIAL4YblgX+4Lo/Iss4qKOFpG03i/VRG2osRm9CB1v94dyPAgNoB0EQ6N0Q9X0pt4qNNG+5pdZmQrxn6XFBrOQ== 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-SenderADCheck; bh=ogHvixDvPvbJmCfm9PXktN6mt2iU69iG4kwJAU8l84s=; b=gNRXbLsfrwmo0JxQujylGt65m02WglsgVzsmHFr8bZL8qlyvXInGtV+xEV1GpApsEYeaXT5Q/9SpISsAMRZafs1S6Y9Hw0yPmWCpkBMHHzjfQubCz9tFhZX2/WgSb8tBYechCxt4Hk7h8RNLu5/EfBvs27dllUlddN7G1DmJoXvgwnGOPLl0BLQAIHxrOs6DVgxl4wUtQSn8wuScRlXl36qAT5Yb7Ed4TFVsBOnDB12soK7EJDjCrapWsjiBixzg9jqm6aeswNP2+VElrxLlDifs4Nb6nIYyewRcxJIspFvF1552JfcJAb530uTRhw5aIy/AD20LH7IzcROT+CAIkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=ogHvixDvPvbJmCfm9PXktN6mt2iU69iG4kwJAU8l84s=; b=Q96ykpK//aoBPFMB7156hvQl+jSFnwgkgDlY0/odqZlPNi7DcPeNMXV0jDpDwlyFx7dpCKeyMWndz+XSKGDE8BiUklfxjgZ0CXiaQ/jha53ayGZCgs38wEWc4+W1VzfPg0op46QrKm9EYNeN/1jxTSg52nm+lVC7rzPYYmKHJJ0= Received: from SN4PR0201CA0017.namprd02.prod.outlook.com (2603:10b6:803:2b::27) by DM6PR02MB5418.namprd02.prod.outlook.com (2603:10b6:5:33::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11; Thu, 17 Sep 2020 19:43:45 +0000 Received: from SN1NAM02FT036.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2b:cafe::ba) by SN4PR0201CA0017.outlook.office365.com (2603:10b6:803:2b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11 via Frontend Transport; Thu, 17 Sep 2020 19:43:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT036.mail.protection.outlook.com (10.152.72.149) with Microsoft SMTP Server id 15.20.3391.15 via Frontend Transport; Thu, 17 Sep 2020 19:43:45 +0000 Received: from [149.199.38.66] (port=43983 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kIzoe-0005ZA-H2; Thu, 17 Sep 2020 12:43:36 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kIzom-0005P5-UI; Thu, 17 Sep 2020 12:43:44 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 08HJhg4h028243; Thu, 17 Sep 2020 12:43:42 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kIzok-0005OV-3s; Thu, 17 Sep 2020 12:43:42 -0700 From: Ben Levinsky To: punit1.agrawal@toshiba.co.jp, stefanos@xilinx.com, michals@xilinx.com, michael.auchter@ni.com Subject: [PATCH v14 3/5] firmware: xilinx: Add RPU configuration APIs Date: Thu, 17 Sep 2020 12:43:39 -0700 Message-Id: <20200917194341.16272-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200917194341.16272-1-ben.levinsky@xilinx.com> References: <20200917194341.16272-1-ben.levinsky@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: db5fa2e7-dc5c-4611-a36b-08d85b41fd56 X-MS-TrafficTypeDiagnostic: DM6PR02MB5418: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:179; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0ONivSSjNmS2EaNKE1xQQ03iaZSQrVUL9wUe7CWHb6+qtS7y3TveeGoMwmoccJ8Xr4cfdg+N65cPoOSrkRYgTYjRXquFD+x12nzA4ytlImzbYmSWy5haQaoQfbPPwUDzAQscvosPTKsiIAdPbNeLFwUfcANNBny4EcYfmez6fiFk6NmzV5Q89d6YCnWtyetESC5uoePlwmbFvwyPDMLBl3LmTBeqZ6JNWJPwWDIOHf7Q/frvv3trcapusQgWb1CA4K4ziMTqBG/Ccxlo5ULGRXUbC2bJJPmHR2HEb117SmL+NgyOYAI49iakYYAiXH0Fz04uqtGbS1L7xLV4NNC1mE0NVAOdsU4DeqGL8wZK2CXURJ2aM9gMPvJXrNy/bz15ROoKmokj71h8mwNKZyfA0Maa+CLw7Vc3hfuV0zep2klSpyTCsmgq9tNRqOKQrDgo X-Forefront-Antispam-Report: CIP:149.199.60.83; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapsmtpgw01; PTR:unknown-60-83.xilinx.com; CAT:NONE; SFS:(39860400002)(376002)(346002)(396003)(136003)(46966005)(336012)(426003)(26005)(2906002)(186003)(81166007)(9786002)(8936002)(2616005)(44832011)(47076004)(82740400003)(356005)(4326008)(5660300002)(36756003)(7696005)(70586007)(82310400003)(70206006)(1076003)(316002)(8676002)(83380400001)(478600001)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2020 19:43:45.4130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db5fa2e7-dc5c-4611-a36b-08d85b41fd56 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT036.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5418 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_154348_972529_EA688C0E X-CRM114-Status: GOOD ( 19.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, emooring@xilinx.com, mathieu.poirier@linaro.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, jliang@xilinx.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds APIs to access to configure RPU and its processor-specific memory. That is query the run-time mode of RPU as either split or lockstep as well as API to set this mode. In addition add APIs to access configuration of the RPUs' tightly coupled memory (TCM). Signed-off-by: Ben Levinsky --- v3: - add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct v4: - add default values for enums v9: - update commit message - for zynqmp_pm_set_tcm_config and zynqmp_pm_get_rpu_mode update docs for expected output, arguments as well removing unused args - remove unused fn zynqmp_pm_get_node_status v11: - update usage of zynqmp_pm_get_rpu_mode to return rpu mode in enum - update zynqmp_pm_set_tcm_config and zynqmp_pm_set_rpu_mode arguments to remove unused args v12: - in drivers/firmware/zynqmp.c, update zynqmp_pm_set_rpu_mode so rpu_mode is only set if no error - update args for zynqmp_pm_set_rpu_mode, zynqmp_pm_set_tcm_config fn arg's to reflect what is expected in the function and the usage in zynqmp_r5_remoteproc accordingly - zynqmp_pm_get_rpu_mode argument zynqmp_pm_get_rpu_mode is only set if no error --- drivers/firmware/xilinx/zynqmp.c | 61 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 18 ++++++++ 2 files changed, 79 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index a966ee956573..b390a00338d0 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -846,6 +846,67 @@ int zynqmp_pm_release_node(const u32 node) } EXPORT_SYMBOL_GPL(zynqmp_pm_release_node); +/** + * zynqmp_pm_get_rpu_mode() - Get RPU mode + * @node_id: Node ID of the device + * @rpu_mode: return by reference value + * either split or lockstep + * + * Return: return 0 on success or error+reason. + * if success, then rpu_mode will be set + * to current rpu mode. + */ +int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode) +{ + u32 ret_payload[PAYLOAD_ARG_CNT]; + int ret; + + ret = zynqmp_pm_invoke_fn(PM_IOCTL, node_id, + IOCTL_GET_RPU_OPER_MODE, 0, 0, ret_payload); + + /* only set rpu_mode if no error */ + if (ret == XST_PM_SUCCESS) + *rpu_mode = ret_payload[0]; + + return ret; +} +EXPORT_SYMBOL_GPL(zynqmp_pm_get_rpu_mode); + +/** + * zynqmp_pm_set_rpu_mode() - Set RPU mode + * @node_id: Node ID of the device + * @rpu_mode: Argument 1 to requested IOCTL call. either split or lockstep + * + * This function is used to set RPU mode to split or + * lockstep + * + * Return: Returns status, either success or error+reason + */ +int zynqmp_pm_set_rpu_mode(u32 node_id, enum rpu_oper_mode rpu_mode) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, node_id, + IOCTL_SET_RPU_OPER_MODE, (u32)rpu_mode, + 0, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_set_rpu_mode); + +/** + * zynqmp_pm_set_tcm_config - configure TCM + * @tcm_mode: Argument 1 to requested IOCTL call + * either PM_RPU_TCM_COMB or PM_RPU_TCM_SPLIT + * + * This function is used to set RPU mode to split or combined + * + * Return: status: 0 for success, else failure + */ +int zynqmp_pm_set_tcm_config(u32 node_id, enum rpu_tcm_comb tcm_mode) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, node_id, + IOCTL_TCM_COMB_CONFIG, (u32)tcm_mode, 0, + NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_set_tcm_config); + /** * zynqmp_pm_force_pwrdwn - PM call to request for another PU or subsystem to * be powered down forcefully diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 6241c5ac51b3..79aa2fcbcd54 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -385,6 +385,9 @@ int zynqmp_pm_request_wake(const u32 node, const bool set_addr, const u64 address, const enum zynqmp_pm_request_ack ack); +int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode); +int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1); +int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1); #else static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops(void) { @@ -549,6 +552,21 @@ static inline int zynqmp_pm_request_wake(const u32 node, { return -ENODEV; } + +static inline int zynqmp_pm_get_rpu_mode(u32 node_id, enum rpu_oper_mode *rpu_mode) +{ + return -ENODEV; +} + +static inline int zynqmp_pm_set_rpu_mode(u32 node_id, u32 arg1) +{ + return -ENODEV; +} + +static inline int zynqmp_pm_set_tcm_config(u32 node_id, u32 arg1) +{ + return -ENODEV; +} #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel