Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1982247pxb; Sat, 14 Nov 2020 08:52:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeDBavrBpuos75GzLbEGFS8l3CaZu/Hb+clU9CRzpWQC944mJzc166VUi+gA8vd8Mc1dVZ X-Received: by 2002:a05:6402:236e:: with SMTP id a14mr8164530eda.103.1605372750228; Sat, 14 Nov 2020 08:52:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1605372750; cv=pass; d=google.com; s=arc-20160816; b=BZtJ3vIKo11pp/OQJ+tQsu1RPmzcRL4/fCE3cxaIDWfRM6+KS+HbzniYLUGRhzlyhM BZo1zthi53qaNFfpv9fXSy9WIz2KW2PsFYyYRW+x7kW/p1SSbUBxMiWkn6ow70+qn2cm cgQqhW7uRwRahrLu+v7bOJdEk58qerM/AkmdPg6cmxTYTV7cN8sRQgBXprPTXEkFcZMs UE4CTWUBPrIw1a5SgnF2HwAO+gp5W+dtih7CS1oRlpsY1mfAOuD1AZlnFw8I7LvMx6+H YxFy86xRyqfjy0n4HywMVTtx1eTtP2Gddjcc426jw6rTl/i9BQHY6kmsEjwS4Q/Ke/xl S2FA== 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=kr0NvWD/GogzVD/4zzyykPefBLU11CbMyDNZXWCWLLU=; b=H64CNFjb3Kgk8u+W0R5YqA79cv8nFrwSmi6n9pPdNL0p7UrZPQYhKCLN1UNhvaVeTC tN8HiIrmrODrGk15yjTwppQVrgrMQwQd2SBYz1+iQjyglUfGfPMPSNNuYB/3ZByCF1h1 aOFOLzLb1rskdNWPDbYtpC6xSQL04D3hcG9X4sqd2RA4WF5rZVN7c1L2L2Hdsz+fqnDr Xuu59plPlRhdsNFPb1RdqjVmCX0fiuuW/lXItbJVT2VDK/JzmHS4ynUJqvJIK0sYE1Cy haNnLIeCZ/pDAliDhyMqgAzVKRQPGreYR2XQhp99Mdk0xSa9H01DcLv0WVQACyT4HGbb dVHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=sUtj1kYm; 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 se23si8272602ejb.220.2020.11.14.08.52.07; Sat, 14 Nov 2020 08:52:30 -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=sUtj1kYm; 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 S1726773AbgKNQti (ORCPT + 99 others); Sat, 14 Nov 2020 11:49:38 -0500 Received: from mail-mw2nam12on2069.outbound.protection.outlook.com ([40.107.244.69]:43233 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726522AbgKNQt0 (ORCPT ); Sat, 14 Nov 2020 11:49:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d1a02mrnH1ErRQI9cieHW/pOgebe5nZ8KaDE1uPdlYr7847Jz+tGRWOVbdRdsVLjI+xAUVIk4ckBzFI4zgRVkJiwTRrm8GxCK0HuGYYR6Y+8jPPiC6VkCMWjqAyuY/fJrH+mYgjeTVEl5Wjtw94DEi0OfpNXHrZURmDQh+UOUK8z8mbTOIBk/AVCaUqq8sF3x4ZhgzyRHTAwmn9IL4Z09zcrgt5p9BN/Z3lEwdN5X1uu7TuK9lwlel0bWVYKX3jZVCQD6NJte3Sl/PLtwcpFJPk0ctD73v2mdusR+fCU4ku7yoTDyxm0M3+2qV6dQXF5dDXIo9RWRNKbRYlKx0ktaw== 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=kr0NvWD/GogzVD/4zzyykPefBLU11CbMyDNZXWCWLLU=; b=GTmwTSkA+8gWSHIHBvnfY26v351bA9v1aktG7EZ+Y67immBDZWtYLiE+dOgf4QqbcmlcozKztUvgYzEmHkBW42xiWHUAO1jg1cCAkgRqnVOuDByvZN5eWbCIweaFW6Il2apRVaBtMppfCNFInQ9RGXExRxNVhhMdkUCGZgpw1eHye7pIVG9EpURpiqBOQ3GOQ+xVe6E+UyUGVq6z+sFZd8hZDu1fDC6LVKMU5pFQsDJpjMVrVO7DqVuncTe1MSnoc5Fd6PCexn1BLPtfCzC6BTdxDbi2KbzLqqMfUksmS5e7LtsNfTbW5CFPe4eFSvAQ61rOkkr25KybN7PHeU2Otg== 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=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=kr0NvWD/GogzVD/4zzyykPefBLU11CbMyDNZXWCWLLU=; b=sUtj1kYm10+gHl5/a7VxnsjhAUKRsm/VAr+AYhUjIwuKlfQ78opi1oFEkFWyNPI4Z/1WJjzNLVfu1hPf8dFCHQqQBWc2idj6CcF8sh3T+z1n1w8zI47bUkz+IujFArbr6f651QeBETzKEcjIcPl03yPNNBR51k5efJzTYSjnPGI= Received: from SA9PR10CA0018.namprd10.prod.outlook.com (2603:10b6:806:a7::23) by SJ0PR02MB7597.namprd02.prod.outlook.com (2603:10b6:a03:319::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25; Sat, 14 Nov 2020 16:49:23 +0000 Received: from SN1NAM02FT009.eop-nam02.prod.protection.outlook.com (2603:10b6:806:a7:cafe::dc) by SA9PR10CA0018.outlook.office365.com (2603:10b6:806:a7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3564.25 via Frontend Transport; Sat, 14 Nov 2020 16:49:23 +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=bestguesspass 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; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT009.mail.protection.outlook.com (10.152.73.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3564.22 via Frontend Transport; Sat, 14 Nov 2020 16:49:23 +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.1913.5; Sat, 14 Nov 2020 08:49:21 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sat, 14 Nov 2020 08:49:21 -0800 Envelope-to: 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=38914 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kdyjp-0007Ai-HW; Sat, 14 Nov 2020 08:49:21 -0800 From: Ben Levinsky To: CC: , , , Subject: [PATCH v23 3/5] firmware: xilinx: Add RPU configuration APIs Date: Sat, 14 Nov 2020 08:49:19 -0800 Message-ID: <20201114164921.14573-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201114164921.14573-1-ben.levinsky@xilinx.com> References: <20201114164921.14573-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: 33815586-b20c-4eb4-40ae-08d888bd3d71 X-MS-TrafficTypeDiagnostic: SJ0PR02MB7597: 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: QYa7vxcjt5BLb47l0AG/REKnsFGJyjtgtvD+A050zBhO4n53PWUy+M9wHjpxvFSKId8HH3yezLIlzYliPTN/kaQPzZwrjwvefX30Rf8MOS3AmrsDmlWXQvh5fX8KaOo+gbTIg0EUbBlsQj1zjMMGZ0SIdz++u5rOwtpybXwppgNa/mjVbvRtZcjZG4kFyIRu6c/u3C51hRN5cfH+O0JdtylFkEoIoY7DYYyCmt4IiLq55p8c5qqLYvxEEYc0m8wLVBm5rXRklbvztt3t/kqkLIYcCQIlxZr8apEZm5HxOvC3fvaAX0i3k40ZF9UY4LBa/XXbjka0ZlZMCjbzqSqNiUXrDoM9jQZlHaEFxi5bDdhY3oW6ftLvn3ohf2BmkS+LIxTfrPKNeJPMgiqc6dTIQDxHynASa0uPROOXlJ2I5NM= 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:(4636009)(136003)(396003)(376002)(346002)(39850400004)(46966005)(5660300002)(8936002)(54906003)(47076004)(4326008)(8676002)(26005)(186003)(7696005)(82310400003)(7636003)(426003)(1076003)(36756003)(44832011)(6916009)(316002)(356005)(336012)(82740400003)(2906002)(70586007)(36906005)(83380400001)(478600001)(9786002)(70206006)(2616005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2020 16:49:23.3144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33815586-b20c-4eb4-40ae-08d888bd3d71 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: SN1NAM02FT009.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7597 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 0cc862b26263..0104d9b8dfd9 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