From patchwork Tue Sep 22 22:39:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Levinsky X-Patchwork-Id: 11793463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 07C0559D for ; Tue, 22 Sep 2020 22:41:37 +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 BF41D2076E for ; Tue, 22 Sep 2020 22:41:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PlY+Bazr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="fpFBJqNI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF41D2076E 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+patchwork-linux-arm=patchwork.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=PlY+BazrkBLP6BjDkP4Fuss1U V6gJficUnWNWusNrzIEv+Q+i2ZkaoPyQ2VBh3pHAeGpGi8P0WDIOsjFqSig6PsPGz/5w0HjBdMJSm XT/zGJZEeq+FhxPqXZU29cyt0bmi9ZhtCq5HDnMvVDLSiGph6YX78P7mWMN6gqxUm/vVQG8xUPd1P vbgsxNXw6ihsEHoiOGagoRsmK+5Xj+z8xUl5i1zy4+3KqvCB22Sp0Fo/XdFwj+fee9spZsrt/IKlB SRhqyevhZNff5IoobpYgm+7Fj6cArd9usiU6rXDbOzfjbm6s9apz6TewlLtjq4MESAaNp9mvptKk6 3BjJQ0y1Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKqwx-0002Pp-Ig; Tue, 22 Sep 2020 22:39:51 +0000 Received: from mail-dm6nam08on2088.outbound.protection.outlook.com ([40.107.102.88] helo=NAM04-DM6-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKqwo-0002MM-7F for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2020 22:39:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPduP0PybeETh8Tx2vivwEs1bdbEvi1ddORCBKEU3AZ+rDUM7BmhmA1oxRBsmDDkqeSPhHCQTF1BlUg50qZLUGYw+A+gJMfrtrVi70Nh4+R20PVBgmhSmSAOkHhyyDSDSt9IUrpEcu6qnXA59l5cKkM+PuCPs+nGj+aYBHbmGnYUuh6QNjTLYNkGVcAwfcY/3bBhGFEkPBPKJ2gXSxdG6v9s+60qR+aTMtlIcpVVY4Z3T6Iom/cJpCKk2TIvT18ZBQnM8PdgYi5AWPEjEWTNx3/sXJg6dghfiFManT4ZGTquiXnhA+OjhnzVCip8WZFPDytzEkjQeW6jWea30tm0EA== 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=EkkjTZdvmR3VLCckU+KzXF97NZEOTnzNI2OKmsOdzeh3jFxGtjWMf13KmeKcTHL7svhHxvh/SbvIQ1TxtL55ENTVJ7zphxWq3xM7CnGc/jCSL+OU7j0yt9X2BYNjtQviTEt2dzDOyzPRr8ycWCEKF9iewu5hlyVzLF6TWp6yEsSq3FfDDVz//NJFmeAxToVu3TDKMkGUs5i6ndKLSMnr/4W6Xtw/7RheIh2Vs/2xze4sdtaCAeDOKhWuikEgbCn9LS33oZB9hHyrzhup9dZt6ZjTY1Avo/kAlHafLGDoXgAaNleHNOKI8+bluThxxdqLm3FC3dfhexWOCPwNCRAqgw== 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=fpFBJqNIPwdUHMyLIyVmaT1NLxOAtYVjRbHNxEleRdJQHlkEW9DOUaJbtUXH0blcTUYyFRneCfcS1UbG4qkhV81nC1eEn3EMa0NUSzFeAEeQhs/1koIU77rXY0PqnHnnkByBn+6SceCRwW6otuCMRJfceozeYxwcK6RleERvcfI= Received: from CY4PR02CA0030.namprd02.prod.outlook.com (2603:10b6:903:117::16) by BL0PR02MB5585.namprd02.prod.outlook.com (2603:10b6:208:8f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.11; Tue, 22 Sep 2020 22:39:38 +0000 Received: from CY1NAM02FT044.eop-nam02.prod.protection.outlook.com (2603:10b6:903:117:cafe::74) by CY4PR02CA0030.outlook.office365.com (2603:10b6:903:117::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14 via Frontend Transport; Tue, 22 Sep 2020 22:39:38 +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 CY1NAM02FT044.mail.protection.outlook.com (10.152.75.137) with Microsoft SMTP Server id 15.20.3391.15 via Frontend Transport; Tue, 22 Sep 2020 22:39:37 +0000 Received: from [149.199.38.66] (port=42749 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kKqwU-0000pb-DH; Tue, 22 Sep 2020 15:39:22 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kKqwj-0002tQ-8U; Tue, 22 Sep 2020 15:39:37 -0700 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 08MMdUmP014078; Tue, 22 Sep 2020 15:39:30 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kKqwc-0002rc-Ba; Tue, 22 Sep 2020 15:39:30 -0700 From: Ben Levinsky To: stefanos@xilinx.com, michals@xilinx.com, michael.auchter@ni.com Subject: [PATCH v16 3/5] firmware: xilinx: Add RPU configuration APIs Date: Tue, 22 Sep 2020 15:39:28 -0700 Message-Id: <20200922223930.4710-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922223930.4710-1-ben.levinsky@xilinx.com> References: <20200922223930.4710-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: 731bc385-0c2a-454d-283d-08d85f4862f3 X-MS-TrafficTypeDiagnostic: BL0PR02MB5585: 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: 7X7lpwiAWdhKpE2YJ+ut3n9aLzfJuVn4yuIJkVwyCeDbuSIn/KYE9JNqKrpKfd8lSXFrzTDP310kUtTd5GgPY9Yry2H4KZFslwZHhGyq/9S4ZZwIv6j3j0jxUQBr5UO/OUs7GbS2H41YUIGgvk929UX9Z+G9ong5eb7LJans50ito3qZtvWloszHrmc7s13dygfdqbFYU3QfExyrdIIZxCDaqEpm3JkQWoknuGT7e8dR+lV+F8feJcF7rr7bE1PNLcbvgyV5zJ2j1tbOh5zYBQRB4a/SvaMJK6LZzv5+FBavgL0HAAQaOOQD23PNVMsEsPgzgIAivCbywNajGMzvZaUXCnEh2A55hqRv8TZsejwJj9xz9BPuG7tXqtx2qB2RiIWatSL9YHVGOP2xNdPk4OCuIyZts7dohC98PZTmBS6AIkUdwuPJB7k5XMOb2u0F 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:(39850400004)(376002)(136003)(396003)(346002)(46966005)(9786002)(8936002)(36756003)(82310400003)(5660300002)(186003)(44832011)(70206006)(336012)(70586007)(26005)(1076003)(7696005)(478600001)(47076004)(83380400001)(356005)(316002)(81166007)(8676002)(426003)(2616005)(2906002)(4326008)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2020 22:39:37.5102 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 731bc385-0c2a-454d-283d-08d85f4862f3 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: CY1NAM02FT044.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB5585 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200922_183942_308713_87F3E636 X-CRM114-Status: GOOD ( 19.74 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [40.107.102.88 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [40.107.102.88 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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__ */