Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5869202ioo; Wed, 1 Jun 2022 14:31:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztA4wBrKJ8yh60q+oWnF1EwnBIwIAYmHAWz8Bz4ieTz8bM+8dkj7+SHe0Z3OZ9XHKBEsNr X-Received: by 2002:a17:902:7892:b0:161:61de:eaeb with SMTP id q18-20020a170902789200b0016161deeaebmr1404787pll.132.1654119089123; Wed, 01 Jun 2022 14:31:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654119089; cv=pass; d=google.com; s=arc-20160816; b=nElSyFrdmR+YfrkjbEq2SfS/6rULzgaAndP7HaSSu4nDpG9eoOHjeP/p7oNPbjYfKM AfkNhRKB2W4IHFGT9CymvM/BJHt1vqHVmCxi7s4uzA5TIumIGVmiyU/7nTWrybVRca07 QK+7GtyS14QOgjZlUVpfPbP28syKib9o9lEJf7dMPhhEV0P+ZUV98Fzc2doITiJ8I4rG HeDIiqUysbmiuRUXQiOBgcVaxRhKgli8Sgd4N/QztUOSlKlKAhqMbceNHf6QqwBuFUjU 3kHN00KfEG9nAQje4jwZ4bHu3JNHTJ6Y07P/BBYgdGZfSV23lHtx28qR/sWQMcynYHR9 5QXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :envelope-to:dkim-signature; bh=nC89ZYF5Me/HPJmMZlOM4ni0RuFOVzZJoL3kY8td57I=; b=LLucKNy4LqeYwGaLYrYkCW5MHxzq/NN8EJ5bMzu3HCN6cdGCltSzs7gTgy+29Nh8IF /+f1AB4pQaGfMuLAQGhBLfFzO1+itZ2BqSLjfRYzzeRvJY2nwzdmOA5cciySGBNX8xYV BWHUAcw17fcpKyVNYs2jK/frkwOhDTY8Mpr0kp9fROd51bVC/RXgIzcd+78nU6VCX2dS nc0OjX9OmpfjJBDCIqv56gTj7Qdfdr7vDAzMKm0j/KWvMi1y6PbS0zuWufwQNFp9h0ox l0vilxiXoVdwf2SJPQBvL/xNvhQ7c0NabybCordoz1ehakAgNPRafgCo6i5+9WMEZt35 Q4nA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=KNmM3N2k; 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 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id co18-20020a17090afe9200b001e312672c02si3494144pjb.30.2022.06.01.14.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=KNmM3N2k; 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 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4C80F2C06B3; Wed, 1 Jun 2022 13:19:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343815AbiFAQWU (ORCPT + 99 others); Wed, 1 Jun 2022 12:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356084AbiFAQVt (ORCPT ); Wed, 1 Jun 2022 12:21:49 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2051.outbound.protection.outlook.com [40.107.223.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D535C12AE4; Wed, 1 Jun 2022 09:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JoOrvxezsNgtwJEfQwUQ2xwuoJ2cst/7zEGqoIAIl5e2OmmbA3IhvC/NE9USzkxso7/CKFwWt8FrA3DwTW0yx2nYKyYq7LwpQ3gDGs2Druw9w4OKkfHBQj2fsCcMZ4AB04Q1yZ7D2PpRRN5CljEPDGc40l7uTm66uTQfv5BhOqfBJ6yP867qKOL8/vYKQsJUV/jfCDQJ5kqiDrH7N2GBYhACRoBBUXM0hNa5qmVyO4ymraXi8FkDviudQj8Nt6ryGy15KRiaT3aSvpbE/xQX0yf3v0JLaKxOERVtNYcZScoFA4Ncv7zlCjBnpbDoOupKZK+3PZzcCVu2qjPtOHs3lg== 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=nC89ZYF5Me/HPJmMZlOM4ni0RuFOVzZJoL3kY8td57I=; b=Lb25lujGEjfHwDmwq2nc5YiIv7tJLu1wOmjwT2L/9Av1YfTQRMOOrPf5OOGfWmQrVTvNQCONbyhOoxSy/shTNKAnTO3QU1+wNErwLaSNqEI13t5VfUK1t0nUvHTL4L43xA6tNDQOH4H98RbmYOKF/lNR4btmteAKqbsmdIIkm2ONn5mTy8zQlymTFtlY10tfxzmD3ER5kflsjGTD1bEKq9d8eGaZfX/t80Ov22tc7ji72Jqccv72SYZHEHQoheU0VEzhJtkD6wJZvflkgRkLcAPih/23xbbCyjkVx90mSRNZ3wNlflnaCMWtqoZB3Me56SPTOPGHny8EUiAQixKB6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.openampproject.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=nC89ZYF5Me/HPJmMZlOM4ni0RuFOVzZJoL3kY8td57I=; b=KNmM3N2k8SlEyBY4uHwmMej4P48dTVRRz7V4oucP/rVuPimX1+oSUU/ZVmO+39xCpsaz+t3DPcNgAuqHk6u3QzAeb9eYS/wGvDTVCJgEA1HV/noa9/PUFc8rGsA8s9f57CGibwUySjJVEbaocE/S86OFxeYXpoDvqeFnF8oo4ug= Received: from SN7P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:806:123::33) by MWHPR02MB2733.namprd02.prod.outlook.com (2603:10b6:300:109::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Wed, 1 Jun 2022 16:21:45 +0000 Received: from SN1NAM02FT0064.eop-nam02.prod.protection.outlook.com (2603:10b6:806:123:cafe::7) by SN7P220CA0028.outlook.office365.com (2603:10b6:806:123::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 16:21:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0064.mail.protection.outlook.com (10.97.4.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5314.12 via Frontend Transport; Wed, 1 Jun 2022 16:21:45 +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; Wed, 1 Jun 2022 09:21:38 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 1 Jun 2022 09:21:38 -0700 Envelope-to: openamp-system-reference@lists.openampproject.org, bjorn.andersson@linaro.org, mathieu.poirier@linaro.org, robh+dt@kernel.org, krzk+dt@kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Received: from [172.19.3.14] (port=50642 helo=xsjtanmays50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nwR6I-0003Rb-HG; Wed, 01 Jun 2022 09:21:38 -0700 From: Tanmay Shah To: , , , , , , , CC: , , , Subject: [PATCH v7 5/6] firmware: xilinx: Add RPU configuration APIs Date: Wed, 1 Jun 2022 09:21:11 -0700 Message-ID: <20220601162111.3505458-6-tanmay.shah@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220601162111.3505458-1-tanmay.shah@xilinx.com> References: <20220601162111.3505458-1-tanmay.shah@xilinx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3b41a954-e529-4d92-c36e-08da43ead24a X-MS-TrafficTypeDiagnostic: MWHPR02MB2733:EE_ X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8PfStP8KqDUOfJoI0C3l+G4WIngjSSzk9/GS5dZvwoViIDlrxxvZR6s3b3Vp9pmr8yBFKMzzFH4y9MfYfZJ1nn94G7utBOGrUWrGPCVfLzOGCbXCSISqTNOVKpfkwx7VrCI14ZkxFVDwoI4JtCorNrI6gA5bGLbq+NhqgMGPypw4fkToQnhBiCGTDljl1fkLIDLmceswGakBc+Bxy7BIXIRt5lcrQIvHj+PRgc1gYBl3ey/4iDLaGKzTvWIVn5ACB6RceTIlN0Df2FL1zCRY4PEq/9FbHGeKIfOdhozWW2xBLmjrmCH1e2a3D73MCK2AoaJAuFHy3wmlyi7MccnUpzqHbgM1NkzOhdYgzKqdQIuj/dnecPw3xPdDtnL0p4yharj4eJprEjP8+/UqHeCJ8UcCSaQkyU5VMcoGGZSxPsj+rxRVo+MKMnTo40ea6IRqJiZPEspiKNLKsI1DM8WDVnpRs1ZkLqlt/K9/lDhFxs8aBW/XyaUpYgZEP/WH8RPPJQMsxNKWzTwJeGGCqqyTpMb8YxRu3JIqk7wYYgnSEnyOV+skWayqQT2p/eK/2pgDoZNAsajeFf8Er5Lh+EVXbQ9lFvtp1q2f+eMPq9ceGhRbvi4WHFkvhJpwHDGIA7uoX2edbmXT0TBqJq7egrXtjn9+tsRwcmHGq37S3kVyAOcIKsUeOF8UQ3OPeDsokNuiLIWTmVs5rc2WqpLfrC1K9A== 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(47076005)(70206006)(2616005)(4326008)(70586007)(1076003)(7636003)(26005)(7696005)(8676002)(5660300002)(44832011)(8936002)(9786002)(356005)(83380400001)(6666004)(508600001)(54906003)(40460700003)(110136005)(186003)(316002)(36756003)(426003)(82310400005)(2906002)(336012)(36860700001)(7049001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 16:21:45.5088 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b41a954-e529-4d92-c36e-08da43ead24a 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: SN1NAM02FT0064.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2733 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Levinsky 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 Signed-off-by: Tanmay Shah --- Changes in v7: - None Changes in v6: - None Changes in v5: - None Changes in v4: - None Changes in v3: - Add missing function argument documentation drivers/firmware/xilinx/zynqmp.c | 62 ++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 18 ++++++++ 2 files changed, 80 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index fabdbac868f5..c66c9b48135a 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1067,6 +1067,68 @@ 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 + * @node_id: Firmware specific TCM subsystem ID + * @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 bce3465a70a4..ffc2cea7c604 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -490,6 +490,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 int zynqmp_pm_get_api_version(u32 *version) { @@ -764,6 +767,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.25.1