Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2468952pxb; Tue, 23 Feb 2021 07:48:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxh5n48Qi+ECg5wSNgKH4vTUzOx0U711m/jxkwg+FEhM+OuESPm6V06pHlJRAhArBgtOD73 X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr28709247edw.279.1614095285056; Tue, 23 Feb 2021 07:48:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1614095285; cv=pass; d=google.com; s=arc-20160816; b=QViwH+ofp1w0OEvwL5oOIFLUbiO7KlgG08jkqKbS/vWCdLjyYkgf5ETOtUGRs6Gg0C Cidu9V0N1xc1cbSwgr3T38pWPncDcoCSvsFztRKNWm40Tzsjs0TJlWIWhQtOb7klIgEH Gm2YDiIPVoxz2fd/i1XGNmkGGL+SwWkkpsyWVGCx5QAw0/y36jN4tJLa44xFKMJjoY3F r1Amr+A7vpR6DxZO5r+zY33/CzNYxZpmyZE5d686tay6t5BdH5dabTz29QwGGEMM9LAl Y+tmph3pNo+85kCfgA/ETtDoRRh1/gL8sUJQyfOpHD5lw8lpZJNhPuc0+9JPHlxtajXU RH1w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:envelope-to:dkim-signature; bh=AUfvZGq2R3laLwoADIZcoRAZWphyuzj0on6MmAUj5/U=; b=OFALImA+GdERTwzZL/T2AUKov42M3zItYksBbm/jIAQtTzxfywMIXMjUzCdz73tMtP gFVhfLY7Zfq1cIXi4zvQZJMGL00JXgmf6zpMI8/qitWJe/sgg90/IG7DGMyzV8AYLqx+ Mne0wDmURrKc0mTLk6/zwDi08WNq7CAh3FeJ0Dwv/IE6MnEtkoJYmU+fmYuk/qGIwrxP wh7HjTRNoEk3A141/orMY0SaG8HXMynrZTpIrNXsospbW/EKL8EXorkGdkbkKy7vpv4q xDaWxw5PUzKPS2kdeNM+7QlqLy1+U0dKDxFgtxpsi9FmmB7KHsOL+X73HZ+Zgq3yxwQY 6BYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=OzjixPup; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb39si2079569ejc.370.2021.02.23.07.47.36; Tue, 23 Feb 2021 07:48:05 -0800 (PST) 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=OzjixPup; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbhBWPpv (ORCPT + 99 others); Tue, 23 Feb 2021 10:45:51 -0500 Received: from mail-dm6nam12on2056.outbound.protection.outlook.com ([40.107.243.56]:46976 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233296AbhBWPpp (ORCPT ); Tue, 23 Feb 2021 10:45:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VmA22/D8d9tAiY7zWAd+2gz9WZzK4dJwlspc2dQ1ngzLaQKlpu+V+yuq5NKSyHzgRKQiVd0jqdcYBOphmd0peyTI9LA1ZJ3iAv6D416GOIx+twHTdQ4Qduwg07P2Mm6m4p/Vxav+quni+zXHWE22eazM5vxcZu3D1Ik47VpAaA4Ft9PgbwVEyGk8vTd8rsZWoxwwB5c36limR4lXkIjYYIK0/W5AwffjyBkEyWWE3kV6O7yfZ403tZgZWipihAEqCAhHiRwsUAAumaKMsaia5UGWJNweHXDGiTDp5NlgdngmHXabH8kMs3XHymWcCjL7k0PFGezBgrlzhP61h+5agA== 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=AUfvZGq2R3laLwoADIZcoRAZWphyuzj0on6MmAUj5/U=; b=SO2uoxMFKXi6UJYcOAXRXiuVvYVzUoAP0sZHa4zuOeaqGBkzLs8wIQIQNEJXD2pqe1xC4zYdmQnd/Buu99lxpd3Rq8CWWKQsHZFKzhs5s0t6rrpeEs63/60PjF3yF92BQ8OyvcWGFnj1CHb2xx0TABfPgIvn3prSQL7IAWSr5OYfQR5H8RMR7ppSUXNj8sjf9CzqQV7zp2MA16Ux8//CQBUFbVo7KzWip+tdPD5FCFQtx70TCmlu9K9hgwdRqGsqYA3S+3i6VZ3wG98fs9lJw9ynjiUxhZBmiImsnP1pgURmOz+6IofhHbCW3HMJ+qVIaiJTF35/70KSeCvy+reZhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=linaro.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=AUfvZGq2R3laLwoADIZcoRAZWphyuzj0on6MmAUj5/U=; b=OzjixPupF3WTTChRe59wdujT4zYri9QCJ8P+F3CHwZAda1js7dhHvgVt0RCuxq1DHkR+OEOZCGsf1yohIknbcG+mQ7JDs4YuEL92wEhRDe6inQfNxC2MV8mDHpwcKt4xA+SW4tGGRia1c8ptcn8+3m5RjaOLfTKdITUIvMzIess= Received: from SN4PR0501CA0081.namprd05.prod.outlook.com (2603:10b6:803:22::19) by DM5PR02MB3672.namprd02.prod.outlook.com (2603:10b6:4:af::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33; Tue, 23 Feb 2021 15:44:49 +0000 Received: from SN1NAM02FT035.eop-nam02.prod.protection.outlook.com (2603:10b6:803:22:cafe::1f) by SN4PR0501CA0081.outlook.office365.com (2603:10b6:803:22::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.9 via Frontend Transport; Tue, 23 Feb 2021 15:44:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; linaro.org; dkim=none (message not signed) header.d=none;linaro.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 SN1NAM02FT035.mail.protection.outlook.com (10.152.72.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3868.27 via Frontend Transport; Tue, 23 Feb 2021 15:44:49 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) 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.1913.5; Tue, 23 Feb 2021 07:44:47 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Tue, 23 Feb 2021 07:44:47 -0800 Envelope-to: michal.simek@xilinx.com, mathieu.poirier@linaro.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Received: from [172.19.2.206] (port=40282 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lEZrj-0006uk-9S; Tue, 23 Feb 2021 07:44:47 -0800 From: Ben Levinsky To: CC: , , , , Subject: [PATCH v26 3/5] firmware: xilinx: Add RPU configuration APIs Date: Tue, 23 Feb 2021 07:44:45 -0800 Message-ID: <20210223154447.13247-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210223154447.13247-1-ben.levinsky@xilinx.com> References: <20210223154447.13247-1-ben.levinsky@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9af19df-d647-48a7-b025-08d8d811f429 X-MS-TrafficTypeDiagnostic: DM5PR02MB3672: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:820; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1JQCyPONh+KCR4tZiAuEDvf4tl7+w7LUqaeI9VozDQqRb7UdHgzSAQrqRVEZcJ/8W3TPza96sUCPAAw6+nGPbzDWpY7PeECfphBNgZYul45ZY8R/5+0EeZ15YQ6dXk74prMgCH069TNpM8/bkZ991wStemG7GxxcEWw/YF3YQs+QJhc1NMjLXeMD4AThDAKePPcVo5+xsPIJZ0lAfhb83zWhIygTNK6B1lWVpEDQ1D6HeVeSyU0w8Q9sHwvuxajWOFVwfTYiKbzWmpKxpDY0YuwruXj6UiyQ3BpSN2gZ96/jzL2hHqxN6ehYF5nEv2+s+SkD+ohabdLiggwyKLwpXt93gSRMONRsibFbZlOTBrkDnnaWjP6hJifQ4WCIHbdXvj0MbturV98VieOFCHRojcFbAtDViPXIA3Dq/+v3/SuqmQlIqgN34/j6pWhZsjMkIc9Z84G0X4ZKN+ngSb8yn7zSkNqYjC9fkq4DmsrG5iN+opT6KrmnJBUDlDWBFGFOhVOuA0GLrzLj9xLn6dDFnih7/MVKpnAlhlXIi7+xSrSqzz5NPHG+j74eEVclp5X8F56X8QwK0IOuMfFA5VJ+3PGHqBPNBJJGgjmxngr70CfqeQD+jCtSeOOkCnKHPQ4fg/dphgjxeNPXoHVJDMC+q0vWhFPvSwSlFuZMePg4OEhd17tbkQwXLrQAuzaXfDbK 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:(4636009)(396003)(136003)(39860400002)(376002)(346002)(46966006)(36840700001)(186003)(36860700001)(336012)(82310400003)(356005)(316002)(26005)(2616005)(36756003)(36906005)(9786002)(6916009)(4326008)(1076003)(107886003)(7636003)(70206006)(70586007)(7696005)(47076005)(478600001)(5660300002)(8676002)(83380400001)(2906002)(54906003)(44832011)(8936002)(82740400003)(426003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2021 15:44:49.4551 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f9af19df-d647-48a7-b025-08d8d811f429 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: SN1NAM02FT035.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3672 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 --- 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 2d5c644cb570..22ccac1db9a9 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -389,6 +389,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) { @@ -553,6 +556,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