Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3544634pxx; Mon, 2 Nov 2020 11:42:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJyApm14yWJUFmT3NiAwFWdkyy6wEOtTQJhe30skK4bQdWmAJZjLeoxQLW1UP8TLEdrVHyhE X-Received: by 2002:a05:6402:206:: with SMTP id t6mr17813300edv.291.1604346127186; Mon, 02 Nov 2020 11:42:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1604346127; cv=pass; d=google.com; s=arc-20160816; b=D/ZTza3drwGFfrPfwvtg9Ak0h5VpwCjyWZU5BU5A1XIuSGDUkL+ofuSEL7+5xZprVW Z8x5ArRlo6QSxtdb33xaHTS3K6ss6UPSE3lwdx1kFAIvFhX3Gcte2uWIgaO4LA+SL1du PXNdPg9STIdVbWzDGe2Su4dQFdO33gN0BIyRFmYksmOSx0LPsVZwTwuQdiDsWcDTxtDZ L98L2OtaXdBZmI8bryVLcIQqv6J1uqRDocl/c2B5ytr5SFi/TGlaGLUOz2Yn6CmV/0uN B0NB/4jcsyuRDeo5mD1NUux6M42yxzmvgVGScLsA8ssmJ6ZLYwYHtPM+uiVhVuysZ0Oz PcyQ== 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=bkR8qk9KMMCVvaseziZJV/7pe2bYt77qI/wyvx77P5LE7uLbJVmsQUv/Ot6G8IS/08 QYjZM/2FdqOEDw7JWMcCw2w3ATve64vt7p5m3wvkqfQd3OVz3x/KE7jAkKWjegruhlYc zp+O0bzIOnBEdFp+0+LaPxiuh6Yae35Wq3+Csfm1CBhinBVx4Fft5pvDZg0rW/Ci+KNk Q5Q7NaxY11jOe8xB5bBwx8s1YxcYDpo9LibzhPHyczyq48AgKyLWFd3cCcpsqlY6u2qD 5PY7l08+iAHVrIxXbPP6GIGWU85mOQ5jjhNGSbRe4EoK27F7oBghXGGqxgctjbwzLa3b z7Gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=HmHZWaeQ; 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 q16si10771619ejr.545.2020.11.02.11.41.44; Mon, 02 Nov 2020 11:42:07 -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=HmHZWaeQ; 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 S1726920AbgKBTjJ (ORCPT + 99 others); Mon, 2 Nov 2020 14:39:09 -0500 Received: from mail-bn8nam12on2067.outbound.protection.outlook.com ([40.107.237.67]:10450 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726723AbgKBTjH (ORCPT ); Mon, 2 Nov 2020 14:39:07 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E1yYO/zHf+68Vfa6n3ne3ud+AO0kVceAyt8dHSL0vRGCVkTjwNZGIbCFgNWwPzSMbz6mcuFVCEqmfOs8Bffcq3ZrsiTf85k02Np64kHU2laOqneuxzvQZnHlPOdEKzsVHgzIURVDz/r6snCfS41CYyD+KZezK9qpB/MUdOnEIaPSwTY2TO0fzHyUcIWZ6Np/Kfvmu7qTxSPJKP303eRoV/gFEdpMqZS6GT20ddkh4mGqYvhymKSCYuuwPU/FcK2po3XtCaCpGp1AtRi6GUGOL1IllfX+O0dUSczWW3btqIEgQO+FSsTVFmxaVXZNe8/8qlsFmKNxuL098y43rFfO7Q== 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=TZHUkfHIDK4t/EcraJjA84TmUWayIpsvuiJfe7KdDLC8Mo4BvO4CLpKxrPBdPHZleRvWnjCILG8tTml4GMcPR0ak2L6td49xIsPmYvgR5jsXJCjzc5R0b5t1lMLoc2wkWIbBCr4ThLoZJ1vZWGMysFDmeSioSR+NyTKWnYO96zdgaxZ2IKWBVbpOXz6i4y1VHa8GvqBndo0VWcxojsdf6MojrpTk7wV9k4w5VNQpExvq9VUqs98y+Tqmp7bUC3b5Fv+Cn2XwMpbA8njyBb8i5qNS3ilMiQXI2VtBVfXqI1bZE9hXHRYL2xozRPTQ+BhQB1gS6wTndMuh3gJimeqt2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=ni.com 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=HmHZWaeQ5NBFRBW45TDmFWrAC+UoUtKOBJPQ+n1f4zDMaBxz541FmPEamyCQ+87dVD7bBFsHzn6YlMiYyfjGGCS4kjeBZh6um9mb38zTELBYT5ifG1mOJpeSDi33sVJY5OIyL4O0SsacdjdJZ8J5cwy/+WxLMn9+DhPGQCbEY7s= Received: from CY4PR06CA0070.namprd06.prod.outlook.com (2603:10b6:903:13d::32) by MW2PR02MB3801.namprd02.prod.outlook.com (2603:10b6:907:c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Mon, 2 Nov 2020 19:39:02 +0000 Received: from CY1NAM02FT054.eop-nam02.prod.protection.outlook.com (2603:10b6:903:13d:cafe::5a) by CY4PR06CA0070.outlook.office365.com (2603:10b6:903:13d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Mon, 2 Nov 2020 19:39:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; ni.com; dkim=none (message not signed) header.d=none;ni.com; 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 CY1NAM02FT054.mail.protection.outlook.com (10.152.74.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.15 via Frontend Transport; Mon, 2 Nov 2020 19:39:01 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) 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; Mon, 2 Nov 2020 11:38:59 -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; Mon, 2 Nov 2020 11:38:59 -0800 Envelope-to: stefanos@xilinx.com, michael.auchter@ni.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=58004 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1kZffP-0005Vs-OH; Mon, 02 Nov 2020 11:38:59 -0800 From: Ben Levinsky To: , , CC: , , , Subject: [PATCH v21 3/5] firmware: xilinx: Add RPU configuration APIs Date: Mon, 2 Nov 2020 11:38:57 -0800 Message-ID: <20201102193859.31090-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201102193859.31090-1-ben.levinsky@xilinx.com> References: <20201102193859.31090-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: cfd91a45-203e-467e-96ce-08d87f66f353 X-MS-TrafficTypeDiagnostic: MW2PR02MB3801: 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: 53HHqgPJ3DXALBJHi22RuqFY5D0Z9HbU/VZQQyP0uaA4RUb3fbfiR5GFZsDSxZmxCOtwb187ZOB787zwnyth0NedF4IGVuPTGNRwksulHTa5CuYT2YJF9nYAfSzKirTjQGSdUPF4wYEpcCHB7Uocegrf8NA3shfwD0ir3nQLeNd9RFDfMe7uY5IodQLgXbo73ZPMkyAWN4WClO3LbZOVTZDEwuvmkOPWQ2vBzNW6TivlkLL2e62v/zehS8LXuCHH0c4ZbCgYnzYC8BZE8pdQ1A7pY6OkU05cb23MZhvgJlXBerPecR+LexcyuXnx15ZekYbHYPYJbahZrnByAg56ZLEdg3DpeF3apKQ10jRJj4d1kA0wIeG6NliKwFzTC/5uhum/wR42VZvOl+EVlEcJFmhENZN2BAOTLoH5k9/H3Nc= 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)(39860400002)(46966005)(36906005)(5660300002)(47076004)(82740400003)(1076003)(356005)(9786002)(4326008)(70586007)(70206006)(83380400001)(44832011)(186003)(26005)(316002)(82310400003)(2616005)(110136005)(336012)(2906002)(426003)(7696005)(478600001)(7636003)(8676002)(8936002)(54906003)(36756003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Nov 2020 19:39:01.8028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cfd91a45-203e-467e-96ce-08d87f66f353 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: CY1NAM02FT054.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR02MB3801 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