From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E14C388F7 for ; Tue, 3 Nov 2020 18:24:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2231D20786 for ; Tue, 3 Nov 2020 18:24:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="grJHhL6+"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="WDRAHLXi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2231D20786 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CuTlfRANEsH1HS+1ef6wIHE3Rp3eswmcPiDT8VKKrWU=; b=grJHhL6+X7Wxhox9WjzQx2y8b +CFKHOG8jyNp+CHMrJHtFsayW8JurPyuQpjyR88rTFX9Uf4kDL3NaDGp1BfC/qPmvkGUgPMjgeLOQ 2izUNoDLS762jR8BtBdDV2kRb7++BLpGWy/yigmfyjP4SWpNRJTBJQs4bwBMGItR1VPt2PNK6oJtb Vuq3Gcs0dDueW/WRgY1AXFEfNY+0C33zaepPnZ12zPM205sxqmdjpIEf8r0EXIvtM8cDuZ15xpjfp 87uczmLrmhHDKAe+qso5C9GlfCki+s5pKP/6T5LviMH5TLNUKw2pT00CdB5+asNuds1NA5YEkyziz lImYcgUKg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ka0yE-0003jF-RW; Tue, 03 Nov 2020 18:23:50 +0000 Received: from mail-bn8nam12on2070.outbound.protection.outlook.com ([40.107.237.70] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ka0yB-0003h9-Bo for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 18:23:48 +0000 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 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: , , 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_132347_430355_DA65722B X-CRM114-Status: GOOD ( 16.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel