Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1613832pxx; Fri, 30 Oct 2020 14:30:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqDDDK46TvlyRquZa3+TSR7KoVz3KOjPrQAdDO/EUef2AjsBX+TyBAgGmrQw5L4y6eIpt4 X-Received: by 2002:a50:e087:: with SMTP id f7mr4522952edl.96.1604093433675; Fri, 30 Oct 2020 14:30:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1604093433; cv=pass; d=google.com; s=arc-20160816; b=0y2bf8EHilWWcJEwYHGcxHMUC6vFCSMBfoa/hLEffHmU+A4Uz8MTD0+0FWzJU44h+F ZufFNfHdSb92FQzTj/+8ckoRNAWvBWUhRYEwZNi8jOc5GuXS0FbbWpPJuxHAVvGz6Sjn Crr9EN8zHhZ3h3/TbZrh3oQ1xzeezbCOQN5BDfcxR2YiniaQKJ/GRIsp6awpk5lJGjYF Le2kKvjhe3QAd1ZGsE6JEAC0HOvAUxKqo8ODLTD68cCE8LcYgnA69bYZ56TLSg0MTnR8 xxb1Uw1Zw1S7A8j1EfE1Nzpa23pOAOAGYWMXzWTdSWcvGtQzLOgFf/TvqjATeMia5Gb+ 0NRQ== 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=r2Do4r27cWJECnVSSikp85Ccuyf/oXixg8hF0D9rUCE=; b=Gq1zZXVlOlUdwYncoXEiWVLhuX3G5PJwMJQusAX7k8hhPvmYMLejx4Jg65LSU+6wl2 NLp57Y8BYmdCJA+XJVSWk6W+Gc4kz4qpPUcRLc9DyLAQq7ChCrhi7FFDHUDVxnxmkWeo oM70MwhJi7fGZmue8UdoF0dKR2Bnu4zrIfL0cdYhHzCLy1xh5fg0PNcHab37WQCWZW2Y dlf4Hz+lHf+XJ4cxcuUXFmgEO8nwnMwQ65hBGg8zOYCalLXmYpgKDM4FMzpVejF9dyUx 431poedaWnGa0LnXpDyMrwdSRhryy9gAPRbo4EtJPR6TeVnwN8OmUyU+mprpgmIg/TzM ggrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=FGtJMagT; 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 b6si1893374edy.197.2020.10.30.14.30.10; Fri, 30 Oct 2020 14:30:33 -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=FGtJMagT; 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 S1727856AbgJ3V2n (ORCPT + 99 others); Fri, 30 Oct 2020 17:28:43 -0400 Received: from mail-eopbgr770044.outbound.protection.outlook.com ([40.107.77.44]:59286 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727727AbgJ3V2k (ORCPT ); Fri, 30 Oct 2020 17:28:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XVczcBkR36sfjQOSqcdVYGgA3K8JJJAkaz5KTHE7IUGPByGiJHrqO8K7+gTKKR35XWBbD7ee7zuA9ufcA0z2f1uJjWxLLKIa2+78eCPrpBPzJQl9Zp+5zm7ZLJREp1v4yvs6NRk2BVFvFdecydOHDwIZaQ8I7fTGeNOv7VVH1V4/t7iOsLfQLxL9HEWEyemhmpecK9KUJbPTb7HjhOWcQv5Of/y0lyST2WKBym/NC0lr2iwLZgSgOsgPjvYCXLlhqAUYyA91yJFmMkRWREPoaKXVHf+yns7bR+UbKWexb2vz/kaRk8IaSW+il33k96Egj6FDmVnXO3LJsuYZ9UZrSw== 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=r2Do4r27cWJECnVSSikp85Ccuyf/oXixg8hF0D9rUCE=; b=BNGLYK97GyoblgfkRSJNoyeEILvn6t6JzatH89M69WRD2kzvqS3yCcXIHUjDZ6RzH0AxwR0VwOZE5jzFGUNhzsFxWR5lupUtJucjNK2/PqP+xYlmpDFGGb7vb65lGDOyXDbDK7GT1kWZNVqZeppBIKv+UqtqsTp2hZbxvzcV0wqBo8xTF8h9OjvEiJ/0KwcgCkCxF9ZBrIr7Q7/UaUT/HUCzKAlXCW1kou0Xih2daWdaafnm3zx/ooHdLiZVAikovXoi88E09BaJTbfpX7PvJgw8RjguGrHs+0V6ldH6PjviHoDBiinA/Ftwl8qS6wBFpID5m29H6ibne+bjJzds0g== 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=r2Do4r27cWJECnVSSikp85Ccuyf/oXixg8hF0D9rUCE=; b=FGtJMagTkjGkO/nDekg0HKr24fqU5EtYX2dl82j7w7Xb5ByppHZ91Eq/WCrEKpTGEWe/rBQhJyFkX2AfAZf+hICvOH4LKMyBIYlJ9HXU6Mdt5qFJTpxChFpAaT5PAAps3g42f2u43hJKykGidlXTsQcIgYmP9U1u7CJR6bz9SGQ= Received: from SN4PR0701CA0045.namprd07.prod.outlook.com (2603:10b6:803:2d::21) by BYAPR02MB5064.namprd02.prod.outlook.com (2603:10b6:a03:71::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.28; Fri, 30 Oct 2020 21:28:37 +0000 Received: from SN1NAM02FT064.eop-nam02.prod.protection.outlook.com (2603:10b6:803:2d:cafe::35) by SN4PR0701CA0045.outlook.office365.com (2603:10b6:803:2d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Fri, 30 Oct 2020 21:28:37 +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-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT064.mail.protection.outlook.com (10.152.72.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3499.20 via Frontend Transport; Fri, 30 Oct 2020 21:28:37 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) 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; Fri, 30 Oct 2020 14:28:34 -0700 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; Fri, 30 Oct 2020 14:28:34 -0700 Envelope-to: stefanos@xilinx.com, mathieu.poirier@linaro.org, devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Received: from [172.19.2.206] (port=56470 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kYbwo-0003JM-EY; Fri, 30 Oct 2020 14:28:34 -0700 From: Ben Levinsky To: , CC: , , , , Subject: [PATCH v20 3/5] firmware: xilinx: Add RPU configuration APIs Date: Fri, 30 Oct 2020 14:28:32 -0700 Message-ID: <20201030212834.18270-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201030212834.18270-1-ben.levinsky@xilinx.com> References: <20201030212834.18270-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: f62b2ae4-4349-4342-aff6-08d87d1ac38d X-MS-TrafficTypeDiagnostic: BYAPR02MB5064: 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: Mhf3U6zSrjgw/sFN5cmeCGCEkwBkDzcb5EBYn/pib2mChZix9muhYsFnr0WQOcSvkK28wM9yb3+nw68ijxgthu2bMIasajx6oOFzucmo6PFubK361zCeBvIHEoWdFDuE9x+zFgRpiFuOv9G30fyWtMiq0TnGAtt9fETpjzKHYuUHKA7oC5tyUffdbv/y7r3sYGwRSc/dPCP90476kvQQdpjuAAfEkYSZPGJrZjZwzkIiUCHSVegVcVb0D8EFv4hK690QqLf9LDAMOjU4LtIhyULKafkn5OAMDNDen+oI4RZfgZIFnlYmqrwhaCUwS3+fqNpyx5zzDabj/BByI/kPK3ePQK+p1fa8ejjXzEiWTaXqxNevRRnHjHB489nHjkQv0wh4M6yUgRkg0tcRcN1qJu20QANWGwK8oOAljPntboQ= 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)(39860400002)(376002)(346002)(396003)(136003)(46966005)(82310400003)(26005)(70206006)(70586007)(336012)(83380400001)(47076004)(7696005)(82740400003)(8676002)(8936002)(356005)(9786002)(44832011)(4326008)(5660300002)(54906003)(36756003)(426003)(1076003)(7636003)(316002)(2616005)(478600001)(2906002)(36906005)(186003)(110136005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2020 21:28:37.5579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f62b2ae4-4349-4342-aff6-08d87d1ac38d 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: SN1NAM02FT064.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5064 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 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