Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp714256pxb; Tue, 3 Nov 2020 10:27:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJw1CIZ9SdQFmDt30/EWEgg70wryBJmJsp1gbaN6fwNe/kSL6oF+9QNmvplfOvhOoZDoIeKv X-Received: by 2002:aa7:c40b:: with SMTP id j11mr13472772edq.151.1604428044568; Tue, 03 Nov 2020 10:27:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1604428044; cv=pass; d=google.com; s=arc-20160816; b=GiX8lmMDxDQ5dB4RmEVc6sIoUL7IqlnR4DpoOP7S3rJsL2rsMr9CiA/a7YdG8V4j6s fl8q6j+cm2z0satvGgCsk9u8GZ4kDUq4sr5AxzuwOAgOJR0alzeCDpFD1uSyxUEWbPbF a3yZ5jgg117k3CAm2zI0g9EOVOz+zolxhsMzFB3rlyg3AfpRxr+x4fR9KA9zXkHri5Pb vbPYtv+OVaQ7w29lH8E6AlbSwuZa1ywBflmdyjdxi9NyfxFawXpul0J2w3o8aleCwssk /WBqGufNrEEJub/J8vxm7GXOpey78bZpblWdxYS7Q5OGu6rPGlBAMFHWVBfwPkyzP9ZQ wcOA== 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=M8ZKdL81oAWUGqlLBCaXWwfHYkyashQn5CyaYJKIHWJIaao2lVwUZUPTfp9xYfsvVY Fd26bX2PP+TG1lBQgeUiedp4h0/rg9sTZen2nW6KqNMat8hekPfk39DmGb4QjDvu1IgG jkx0uipZ+Oj5qHoC6JHT59BaXMdVN1s+mhK4ij43AddfWA1YkJ3MRbLFYRV+96XBcOZR Gwyk0wJghTzdeUBeUuBWHUfwfyRSVRMb0TPdhXpy0ic0DRRYo8c0TaZmdDNraZHombVx Lqgdcc1q9a31/TtFT9mtz6Uh9Cb/8/E2gPVHtqlPgEl+nAE+Zqy8tThwJY81tTRdD4lZ 4a+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=WDRAHLXi; 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 v1si14124472ejd.624.2020.11.03.10.27.00; Tue, 03 Nov 2020 10:27:24 -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=WDRAHLXi; 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 S1729401AbgKCSYA (ORCPT + 99 others); Tue, 3 Nov 2020 13:24:00 -0500 Received: from mail-bn8nam12on2067.outbound.protection.outlook.com ([40.107.237.67]:2017 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727901AbgKCSXp (ORCPT ); Tue, 3 Nov 2020 13:23:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjKb09T+yIOXo3ue/OhMMt/EV93r1UGZJP9AkMUN7niZDaaOQFQ6ArsU1QpQ9Blxtx//dGCkYA2aq04N6yw4hzTegNYjuubJBvxm4aQwHq2OKEHnPjb08DE9DHkysnvure831AKlXiVtMrvZ1Hi7Ks172TMUo9Y06n9v9lWl0Tyofe1FF5Qvi/OeRsYBre6dbIrQ14wYTuGNWfF3qoG7RAwZShU0zzBWM02Kur2m6MGjPJnOEItk8VeLn1IaYNYJKNkUUq55A+FQS5OJ2p9nSjdCpL4Y25b4Ny69yHkeHPbPEBtH7apODylemPns479qgm0z7hBT5Rvad79vwRnheQ== 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=m0uOfRjvSzExtfAq8jb3iX9KqiJsWL3+V0qKgTmsxplZDgwyNHDYlZvRC8NU4gHGF3NvMXGBvZbtlD7gkofiSrsW/lKls4FciuG/Rd3UAtBI5cuyG6WOfVlTKa7q3ubNGOOtA1Cri5X/7K4g0aY/+oYoDg3cRAad263oGtRZyirq852NyCPEDU19d6CtXkASLkTZfH2f27sFgoTEVyPPqQyZeqIu0VGTxYygE4i9/alr/Ih4eafKjMFh/aRHArEJT3zX17XwWUnUm9Ex/8GOh4u0J9NwpBvy+KHttJr2+0B153QiyXJbqf2yEX+oKrtNCYY7pXqeKQA8h9uvmf7bVg== 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=WDRAHLXiwG7tmk+ACHbMfSUwcGwH7/srmun0WAg2xwSqPi6Zn0+dev3CxyyRALQfBK48WDnKztCKMnojaxVgHVVX4uJU2Zv6+jsgXW/SeWiehTWhVh36ERuVDggL+0aoa4vt62eigNOj/vAF9q42KKgyG8ra5H5GPL+ut3PRfec= Received: from MN2PR20CA0003.namprd20.prod.outlook.com (2603:10b6:208:e8::16) by MWHPR02MB2366.namprd02.prod.outlook.com (2603:10b6:300:5d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.29; Tue, 3 Nov 2020 18:23:41 +0000 Received: from BL2NAM02FT045.eop-nam02.prod.protection.outlook.com (2603:10b6:208:e8:cafe::16) by MN2PR20CA0003.outlook.office365.com (2603:10b6:208:e8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 18:23:40 +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-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT045.mail.protection.outlook.com (10.152.77.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.15 via Frontend Transport; Tue, 3 Nov 2020 18:23:40 +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, 3 Nov 2020 10:23:40 -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, 3 Nov 2020 10:23:40 -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=58698 helo=xsjblevinsk50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ka0y4-0002gB-1I; Tue, 03 Nov 2020 10:23:40 -0800 From: Ben Levinsky To: , , CC: , , , Subject: [PATCH v22 3/5] firmware: xilinx: Add RPU configuration APIs Date: Tue, 3 Nov 2020 10:23:37 -0800 Message-ID: <20201103182339.14286-4-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201103182339.14286-1-ben.levinsky@xilinx.com> References: <20201103182339.14286-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: 5fc717d2-96aa-43c9-d00a-08d8802596cf X-MS-TrafficTypeDiagnostic: MWHPR02MB2366: 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: Dv+qHgal1uDdWwwiJmVpCrVH+WxVBMAc1NrJyrsHPt8uIWmK/uJ+NIIPek6cIoXOQ02Qjp2H57DNlE3ivL5kAhbzIsEIcy4QPcDBTgGMZ20hpIINzsuShQWelq5VWZ8BO3OkL87vC+ZcEoYhJVeOLgy6M+JZkRU/pkYFQaER46LHKfjhSVwPDh3SrkYjgUwKrnijMoC2ug5cUUU5mjEUAsz8ZLZs+6GpbLjQevZCcvvm2JVRcc0udCSKLjbglm1BtrWTEVR3gc0GNL+OsGZ8SciYnr1878cdQsH/DgYdgXkR9K1tQg1PmZnoTqXc/akgc4mDzCeBDKeGi76yxPjyYLyr9izk7fNttyXyj76YPN5zR4pA84oqT244eENN/bOjGgsod08r0NrMGNIuy5FAsac/6WSOfc79pIcg4s8HEOo= 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)(346002)(376002)(136003)(396003)(39860400002)(46966005)(70586007)(5660300002)(1076003)(26005)(186003)(8676002)(70206006)(336012)(8936002)(2616005)(82310400003)(6666004)(4326008)(426003)(316002)(36906005)(83380400001)(82740400003)(478600001)(2906002)(36756003)(7696005)(9786002)(47076004)(356005)(54906003)(7636003)(44832011)(110136005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 18:23:40.3852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5fc717d2-96aa-43c9-d00a-08d8802596cf 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: BL2NAM02FT045.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2366 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