Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1359711pxk; Fri, 4 Sep 2020 07:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpgCxGYQO4Td3I4GFdM/vG0EFW2JpFjTrRtWVGwund1+KZXBcPHa3zOuJJYQO1i0/NwY22 X-Received: by 2002:a05:6402:1151:: with SMTP id g17mr9034525edw.227.1599230028602; Fri, 04 Sep 2020 07:33:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1599230028; cv=pass; d=google.com; s=arc-20160816; b=Nn0NEj9vIbx0N85lIMFAkxHopHtNfDC1tssjh7WdgKY1obo2ZVG+C89W05M/kij2JV dwSUxIqZPQPccMUe0DWxx9p5z4JjLq006tPnzIsAC49L5Kl8hzMogONOTz947jcSKppq L7lsQXkv6nFaIuSzMFTYdPSA3ZsRsKRu0mkJA4X+jkgtmdfHpr4NZ0pG6MDyfUZZHjzJ DgOMGG1VdWC0wb5GQHZhynIqBEPgf17pGQ1eShbVNW1N+yxP5u6lFna7ZKoDl+evhlTm SuijXX8u8lldLEeKc5l/rAFHc7JqVz/8AoJcSd2CwUQxxUlp0OuDktcy2TE+p73kyNoY yOuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ogHvixDvPvbJmCfm9PXktN6mt2iU69iG4kwJAU8l84s=; b=gEyj2IX019RuEmmkFmOv9v2LtPi0UqMzIJBPbvoB3/maTOur/rt/sJx4gn3mm6wvPj 3ODtKeVhw20OxUk1Qh9QiWBwM6ZKpkLGtxBZQAci2L6Dc4apSwJkdC+4bEA9IUoD7cnb nasIondBLzliwmWaUaWF2Q0x+FciIOPG0KdJ+a7qp6Qa/OHxCHwtdGJULSqhot0cHr3S R+4X4EvXljF6yMGqVbrfqt0ghg6qFyHy4h6D05mLJIz+26o3vqDb/05v0ol9QTeLSRU5 LAGYherCYWOfYYBdUo1ita21o9pXGQzEtpuWQFbOjr2jYK+NrYApetXnPgAAacSotj/V sppQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=hSsI6phG; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq23si4147994ejb.116.2020.09.04.07.33.25; Fri, 04 Sep 2020 07:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=hSsI6phG; arc=pass (i=1 spf=pass spfdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730641AbgIDOcj (ORCPT + 99 others); Fri, 4 Sep 2020 10:32:39 -0400 Received: from mail-eopbgr750043.outbound.protection.outlook.com ([40.107.75.43]:12270 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730520AbgIDOcT (ORCPT ); Fri, 4 Sep 2020 10:32:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gBVuX1dd1W5/HlfxXUAFztDaSau4AXwTYjGkzWCUJY4fZtlCmTJHn3o6QoW8mvGyttwJ6zVDhJLWPQ0d58qLzhIMhtS6HljGHK+mYP8HvLfTbCuc2sSieIXe58BcE4byvpW4WdU2c8aER2z4z2466W14lU0Elqnm5+J9obh1XZaOZzEvekJTNaZtByI6dhpYfcCSDgtCJ+gXmu/u7jxKP6Nc9OuMQbSZUitnYT70WjJ3qwkPWLQ5r4zaShZMkVQsEF7r107lrSfoozAPF88FR06sBKxeDP3II/wq6n1nmRWXwbHoQtnN7JDWZBjpH7sX93LimLSFUhPDKr2kOrXtpA== 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=cBhXg66Hj6VswV2jYpYkjaqldDj6vb7LFLOu1ZJN4YJIhVXJWe0V9TiqRNth2t77ApkHMsARNKNC7QgBNENiXQQC+dHP06ia8ubTIC7ZD1g4V/SctPUB/dMDLTVXKhBNvdKK/VI7ucayxI623/JuSQyWNoOlsLW4BPFIO8S4xzyq2uaJtl+ivud6eujchU7uUShDvf9V9q+cfK2Tomq2UkXlnuWqqJESpEt8WWXam9PGxghKAL5jt051o84dIbe8Sh7pOhfaeU4mmDL55ysBMvdri9K3qCjJ962t4QdPeFOxy2P5od5+7UdoQfEtgiyU+Lt9FngkM/PMGUizcCbclw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=toshiba.co.jp 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=hSsI6phGY1myKr25yEnY8XH2VgzT0AgvVbIcI+8L4eYW8UAsjbdn4XI2C14p2LwLnO8VPo7bKo1w8e8yBLj4KVnBnJrNFaqpY68qnuzvdZcb+9B+3X/eTJxzAek9tLueCos38dJdml/Q/TJoeVAxohZAApIPyNPBgxyCPee82qE= Received: from DM5PR12CA0022.namprd12.prod.outlook.com (2603:10b6:4:1::32) by CY4PR02MB2392.namprd02.prod.outlook.com (2603:10b6:903:d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.15; Fri, 4 Sep 2020 14:32:16 +0000 Received: from CY1NAM02FT039.eop-nam02.prod.protection.outlook.com (2603:10b6:4:1:cafe::19) by DM5PR12CA0022.outlook.office365.com (2603:10b6:4:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3348.16 via Frontend Transport; Fri, 4 Sep 2020 14:32:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; toshiba.co.jp; dkim=none (message not signed) header.d=none;toshiba.co.jp; 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 CY1NAM02FT039.mail.protection.outlook.com (10.152.75.140) with Microsoft SMTP Server id 15.20.3348.17 via Frontend Transport; Fri, 4 Sep 2020 14:32:15 +0000 Received: from [149.199.38.66] (port=38223 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kECl5-0002aI-Qp; Fri, 04 Sep 2020 07:32:07 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kEClD-0003ng-Am; Fri, 04 Sep 2020 07:32:15 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kECl7-0003lx-Oc; Fri, 04 Sep 2020 07:32:09 -0700 From: Ben Levinsky To: punit1.agrawal@toshiba.co.jp, stefanos@xilinx.com, michals@xilinx.com Cc: michael.auchter@ni.com, devicetree@vger.kernel.org, mathieu.poirier@linaro.org, emooring@xilinx.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, jliang@xilinx.com, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v13 3/5] firmware: xilinx: Add RPU configuration APIs Date: Fri, 4 Sep 2020 07:32:07 -0700 Message-Id: <20200904143209.31235-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200904143209.31235-1-ben.levinsky@xilinx.com> References: <20200904143209.31235-1-ben.levinsky@xilinx.com> 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 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8c07c38a-0622-4e28-ec0e-08d850df51f4 X-MS-TrafficTypeDiagnostic: CY4PR02MB2392: 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: FkBG8l7uvePHyfCljiQcWhCPHXt6vjVJp2kMSz/RnefmhDsS3gh/USQw3lsyW0+1zLaF5zUwURtWJ+gvPJmNZLWIiGbAdxtb0nVxULdb5Os1ikKvSoOLLDDaLV6zu7O/UiGfnqAW0MhkpTSm4oc9HUA9fHCMIdxxfl/AZglhUUA1cpvKgNQvtRA4VYt2aWknQopTmJ0l/uHdBqxzfkEvpwyrRIfi4GrbqD8PsTje9re92QJlICQCwEJK+m9w7xF/ue1eD1TqaYkJtarIL3uvUEG+Fg1iB5nJBYvnK1qpt66UNziW+dZPIwUQFNWy93opTxsE3lo7bRlLdF1VJqyifFUo0+T2Ag9WChcZDNQJs3sz+N+QNW4F8HDXKx3OFQM5qza1zO2426RIl1ZC5b0WQQ== 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:(346002)(39860400002)(396003)(376002)(136003)(46966005)(9786002)(26005)(2616005)(36756003)(316002)(4326008)(44832011)(82740400003)(47076004)(356005)(81166007)(2906002)(6636002)(478600001)(186003)(7696005)(1076003)(5660300002)(336012)(8676002)(70206006)(8936002)(426003)(83380400001)(70586007)(82310400003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2020 14:32:15.5750 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c07c38a-0622-4e28-ec0e-08d850df51f4 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: CY1NAM02FT039.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2392 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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