Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4286590pxk; Tue, 22 Sep 2020 15:41:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiBiRBvAN0rlIcqN4tPCCqNWxcMjvXhyHOsQrhTlnj/8rBTlYXJBMW2RYn3L1yqVkRfnF4 X-Received: by 2002:aa7:d296:: with SMTP id w22mr6547751edq.327.1600814481723; Tue, 22 Sep 2020 15:41:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1600814481; cv=pass; d=google.com; s=arc-20160816; b=l80BLs6IEmSwJpmff5qsjD+v2FYNxIj0fInnDGlrcxSy5pTM20aCo3v8jL2FmWUnE4 LkKNsvq75NebI8VVmxBZkNqm3YZugBGE86+pHny6quYZ8smXgnSPgPI/TvX6eEdMFPUo 4rcZxHQk1SDgEqMLvoyW4gJPhINkOFNaEgvn6FLOr+I69R7LJ5d+DhvQtWUDGnL3U7Tn iEbqgBaPwmbpSmckk5uHzpIFzZ0XHpzzajZ2NXvOtkmYGDxNSRbwMDU9j8Q+2JCbLjIS uJmy7SSDNkv19BxrRyCpbTbVlw0pb1AJpbvkyHLm5oL3hwvk+Ynr81LMPJa2ZrhNsnSz Nctw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=xDzdrLTRE2CdWdMr9MYew14p7TfCO7bEXsotJ4JLK7g=; b=xgpjyMzjFqA9fM6iKISWHDekWxz3/BXnfiCGHHIzYb4oxBJnsUDqt6kK7BdfB1F/81 9vN2sXuaJhV+xVnddGAtVZAfnY86nECduUpQNEUEeI/maNYIsUQxIQiG1BtOdObjZNR9 fYgZYq43qwjDZ5Knc6IgiiMGyE+Gbp74EQmaRUbwj4obpZzMkdI7gkzCOLEZdU2+3LAD BTp/hB3JBgj30pbwWcxuIOG50q/g/Fg7U1PvgNifSDTxjKYkqI12urfcJ9aCngihin/d +e8nCynjD2W7MKV0zgZEmBIgU97dGW7zAh/0uC9ZXQG1e3JDwjru7HUsr9VIJnWL1XWT jjkQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=ecwpXhLm; 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 dx14si11175999ejb.501.2020.09.22.15.40.51; Tue, 22 Sep 2020 15:41:21 -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=ecwpXhLm; 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 S1726779AbgIVWjs (ORCPT + 99 others); Tue, 22 Sep 2020 18:39:48 -0400 Received: from mail-co1nam11on2059.outbound.protection.outlook.com ([40.107.220.59]:1504 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726739AbgIVWjn (ORCPT ); Tue, 22 Sep 2020 18:39:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n8B+GhGspVnYiz7AuA/r7vHfkGsmt2VKf5KKn7T9XHJ1Ow5/al9HWxg923jwUGjfgyAz3SDRwFhX2os2E5U/rNVD/R2g+vbmEDdaSiVdAmVSRvlGCrBOzLOGd9zp0a+IcwKF3EIKaHHM86KNSm32Ggzt4NaFrxhW1SPADcMcbS9aWowEFLbDlnzVG+y3MyQjSKXOuM0hYn9DG34wtJneb2VKX3fi71v17cqTLRKkHAANTBdm6pV2j0XPd0JRglh8LrApZSBvas1b5QbwioVRgRNbvytcVCClzltK13FvJhUjvc/gxWkhtQQTYRmHaFz8IK6lZ3QwK1G+SG0mYZSvUQ== 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=xDzdrLTRE2CdWdMr9MYew14p7TfCO7bEXsotJ4JLK7g=; b=AmfhxQCsR+c/OwAnAzEdNL/eeaeTEFey0jDxj2prnjVBRfDOgal55PphwP+gviSzh76V0mUCSyyxvCqYmuGydTcpJyOju7paTibojVlhrluq5gqg52UN8//nUdxBiI7Q0x45mYcBaMHL2ags0DBdVlm+t3aEl+NVyuu+n7FNyaZv5pGNXnhW2Nu3oKabpRbEA5sJrQNm4t9fY6cxfw/duCB1QSvbutkyCwt4U1Qancj4g3aQszr2P2djWcmAXthXLJKWROmj600nmKAIjd1jJS+Y8rtEVzSVEAQMsCgCuQVkCR1pHM/En4aWxOcmFtBV/8uLZ0e2bh+ksWwgR9pGWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=lists.infradead.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=xDzdrLTRE2CdWdMr9MYew14p7TfCO7bEXsotJ4JLK7g=; b=ecwpXhLm0+7mrTZaYMZTiQsrYXo5D5CyEHJqZ5r0pVUv+wpmTTTFdvC3/CFBhQkEb6XRrrMH5YbzCFTMA9zpNs1xoNp392iPiRBCPcOQvP1cPkG8jT6YJzTExS9nfijP8OfeUMzsDifwQPlVhOQgUNF00Gsf6RJJJ5lVsH8dWyE= Received: from CY4PR12CA0036.namprd12.prod.outlook.com (2603:10b6:903:129::22) by MN2PR02MB6848.namprd02.prod.outlook.com (2603:10b6:208:1d6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.15; Tue, 22 Sep 2020 22:39:38 +0000 Received: from CY1NAM02FT049.eop-nam02.prod.protection.outlook.com (2603:10b6:903:129:cafe::c1) by CY4PR12CA0036.outlook.office365.com (2603:10b6:903:129::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Tue, 22 Sep 2020 22:39:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT049.mail.protection.outlook.com (10.152.75.83) with Microsoft SMTP Server id 15.20.3391.15 via Frontend Transport; Tue, 22 Sep 2020 22:39:37 +0000 Received: from [149.199.38.66] (port=42787 helo=smtp.xilinx.com) by xsj-pvapsmtpgw01 with esmtp (Exim 4.90) (envelope-from ) id 1kKqwU-0000pq-T4; Tue, 22 Sep 2020 15:39:22 -0700 Received: from [127.0.0.1] (helo=localhost) by smtp.xilinx.com with smtp (Exim 4.63) (envelope-from ) id 1kKqwj-0002tQ-OP; Tue, 22 Sep 2020 15:39:37 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 08MMdUfT023302; Tue, 22 Sep 2020 15:39:30 -0700 Received: from [172.19.2.206] (helo=xsjblevinsk50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1kKqwc-0002rc-6I; Tue, 22 Sep 2020 15:39:30 -0700 From: Ben Levinsky To: stefanos@xilinx.com, michals@xilinx.com, michael.auchter@ni.com Cc: devicetree@vger.kernel.org, mathieu.poirier@linaro.org, emooring@xilinx.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v16 0/5] Provide basic driver to control Arm R5 co-processor found on Xilinx ZynqMP Date: Tue, 22 Sep 2020 15:39:25 -0700 Message-Id: <20200922223930.4710-1-ben.levinsky@xilinx.com> X-Mailer: git-send-email 2.17.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 45ffa157-6866-4b73-868a-08d85f486338 X-MS-TrafficTypeDiagnostic: MN2PR02MB6848: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5DXxCK3CL/HMdrw47/BOMBptuk/q7pFmKyFyofeDpsTgrBRYdkjkBZN7MIHKiWbwrMK3FHap9lu0q4cklNOna/gqHsiOmut0sq4mGCXZT+du0gOV6O3LanrDV67ZfhW78c6k8LvHfFoeWR0aK1gyWfbYJEvjZ5Bt0a6LRGAttUJJ2IjyQvKIK7Mw3+hcrMMd+sL8VRuvrzz1PUd6M8KmRUX+sUReOyooRqvk/qkQ8uSsO62U232bFvfqBKQi8OXroEYVOE7/LZL1KhBR7uR5Vas52sJWPQAbtj19Bc0lWLdQc/WNJozfmrJyAqlateVIzFmGipueQ9rKBlcNgywuYAhmsXvkuESgrPMCOG3uAmwqNwf3FJ0tjf5SU/aigDPWKxUF4yPWY7SLMN6cpKNDrFcdXAah5yfc3pjzfISO4z/uHFvxZCKebG5OWO6pqC/U X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapsmtpgw01;PTR:unknown-60-83.xilinx.com;CAT:NONE;SFS:(39850400004)(396003)(136003)(376002)(346002)(46966005)(83380400001)(4326008)(8936002)(2906002)(426003)(478600001)(316002)(82310400003)(186003)(9786002)(5660300002)(26005)(47076004)(36756003)(336012)(81166007)(6666004)(70206006)(70586007)(82740400003)(8676002)(356005)(1076003)(2616005)(44832011)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2020 22:39:37.9768 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45ffa157-6866-4b73-868a-08d85f486338 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT049.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6848 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver was tested on Xilinx ZynqMP QEMU For sake of ease of review, only support ZynqMP. Once accepted, then add support for Versal platform and R5 loading onto OCM. v2: - remove domain struct v3: - add xilinx-related platform mgmt fn's instead of wrapping around function pointer in xilinx eemi ops struct - update zynqmp_r5 yaml parsing to not raise warnings for extra information in children of R5 node. The warning "node has a unit name, but no reg or ranges property" will still be raised though as this particular node is needed to describe the '#address-cells' and '#size-cells' information. v4: - add default values for enums - fix formatting as per checkpatch.pl --strict. Note that 1 warning and 1 check are still raised as each is due to fixing the warning results in that particular line going over 80 characters. - remove warning '/example-0/rpu@ff9a0000/r5@0: node has a unit name, but no reg or ranges property' by adding reg to r5 node. v5: - update device tree sample and yaml parsing to not raise any warnings - description for memory-region in yaml parsing - compatible string in yaml parsing for TCM - parse_fw change from use of rproc_of_resm_mem_entry_init to rproc_mem_entry_init and use of alloc/release - var's of type zynqmp_r5_pdata all have same local variable name - use dev_dbg instead of dev_info v6: - adding memory carveouts is handled much more similarly. All mem carveouts are now described in reserved memory as needed. That is, TCM nodes are not coupled to remoteproc anymore. This is reflected in the remoteproc R5 driver and the device tree binding. - remove mailbox from device tree binding as it is not necessary for elf loading v7: - remove unused headers - zynqmp_r5_remoteproc_probe:lockstep_mode from u32* to u32 - device-tree binding "lockstep-mode" to "xlnx,cluster-mode" - remove zynqmp_r5_mem_probe and loop to Probe R5 memory devices at probe() - remove is_r5_mode_set from zynqmp rpu remote processor private data - do not error out if no mailbox is provided since mailboxes are optional - remove zynqmp_r5_remoteproc_probe call of platform_set_drvdata as pdata is handled in zynqmp_r5_remoteproc_remove v8: - remove old acks, reviewed-by's in commit message v9: - if zynqmp_r5_remoteproc.c pdata->tx_mc_skbs not initialized, then do not call skb_queue_empty - update arguments and documentation for zynqmp_pm_set_rpu_mode - in fn zynqmp_pm_force_powerdown, change arg 'target' to 'node' - zynqmp_pm_request_wakeup update code style - edit 3/5 patch commit message - document zynqmp_pm_set_tcm_config and zynqmp_pm_get_rpu_mode documentation to include expected return val - remove unused fn zynqmp_pm_get_node_status - update 5/5 patch commit message to document supported configurations and how they are booted by the driver. - remove copyrights other than SPDX from zynqmp_r5_remoteproc.c - compilation warnings no longer raised - remove unused includes from zynqmp_r5_remoteproc.c - remove unused var autoboot from zynqmp_r5_remoteproc.c - reorder zynqmp_r5_pdata fpr small mem savings due to alignment - zynqmp_pm_set_tcm_config and zynqmp_pm_set_rpu_mode uses second arg - zynqmp_r5_remoteproc.c use of zynqmp_pm_set_tcm_config now does not have output arg - in tcm handling, unconditionally use &= 0x000fffff mask since all nodes in this fn are for tcm - update comments for translating dma field in tcm handling to device address - update calls to rproc_mem_entry_init in parse_mem_regions so that there are only 2 cases for types of carveouts instead of 3 - in parse_mem_regions, check if device tree node is null before using it - add example device tree nodes used in parse_mem_regions and tcm parsing - add comment for vring id node length - add check for string length so that vring id is at least min length - move tcm nodes from reserved mem to instead own device tree nodes and only use them if enabled in device tree - add comment for explaining handling of rproc_elf_load_rsc_table - remove obsolete check for "if (vqid < 0)" in zynqmp_r5_rproc_kick - remove unused field mems in struct zynqmp_r5_pdata - remove call to zynqmp_r5_mem_probe and the fn itself as tcm handling is done by zyqmp_r5_pm_request_tcm - remove obsolete setting of dma_ops and parent device dma_mask - remove obsolete use of of_dma_configure - add comment for call to r5_set_mode fn - make mbox usage optional and gracefully inform user via dev_dbg if not present - change lockstep_mode from u32* to u32 - update zynqmp_pm_set_rpu_mode and zynqmp_pm_set_rpu_mode documentation and remove unused args v10: - add include types.h to xlnx-zynqmp.h for compilation v11: - update usage of zynqmp_pm_get_rpu_mode to return rpu mode in enum - update zynqmp_pm_set_tcm_config and zynqmp_pm_set_rpu_mode arguments to remove unused args - use enums instead of u32 where possible in zynqmp_r5_remoteproc - zynqmp_r5_remoteproc: update prints to not use carriage return, just newline - zynqmp_r5_remoteproc: look up tcm banks via property instead of string name - print device tree nodes with %pOF instead of %s with node name field - update tcm release to unmap VA - handle r5-1 use case - device tree binding r5 node to have link to TCMs via meta-memory-regions property - fix device tree binding so no warnings from 'make dt_binding_check' v12: - update signed off by so that latest developer name is last - in drivers/firmware/zynqmp.c, update zynqmp_pm_set_rpu_mode so rpu_mode is only set if no error - update args for zynqmp_pm_set_rpu_mode, zynqmp_pm_set_tcm_config fn arg's to reflect what is expected in the function and the usage in zynqmp_r5_remoteproc accordingly v13: - zynqmp_pm_get_rpu_mode argument zynqmp_pm_get_rpu_mode is only set if no error v14: - rebase off v5.9-rc3 kernel - concerns were raised about the new property meta-memory-regions. There is no clear direction so for the moment I kept it in the series - in device tree binding, place IPC nodes in RAM in the reserved memory section - change zynqmp_r5_remoteproc::rpus and rpu_mode to static - fix typo - zynqmp_r5_remoteproc::r5_set_mode set rpu mode from property specified in device tree - use u32 instead of u32* to store in remoteproc memory entry private data for pnode_id information - always call r5_set_mode on probe - remove alloc of zynqmp_r5_pdata in zynqmp_r5_remoteproc::zynqmp_r5_remoteproc_probe as there is static allocation already - error at probe time if lockstep-mode property not present in device tree - update commit message as per review - remove dependency on MAILBOX in makefile as ZYNQMP_IPI_MBOX is present - remove unused macros - update comment ordering of zynqmp_r5_pdata to match struct definition - zynqmp_r5_remoteproc::tcm_mem_release error if pnode id is invalid - remove obsolete TODOs - only call zynqmp_r5_remoteproc::zynqmp_r5_probe if the index is valid - remove uneven dev_dbg/dev_err fn calls v15: - change lockstep mode device tree property from acting as boolean, to instead being used as, if it is present, then r5 is in lockstep mode. otherwise in split. - add safeguard for if 2 rpu remoteproc instances are provided then err out Ben Levinsky (5): firmware: xilinx: Add ZynqMP firmware ioctl enums for RPU configuration. firmware: xilinx: Add shutdown/wakeup APIs firmware: xilinx: Add RPU configuration APIs dt-bindings: remoteproc: Add documentation for ZynqMP R5 rproc bindings remoteproc: Add initial zynqmp R5 remoteproc driver .../xilinx,zynqmp-r5-remoteproc.yaml | 120 +++ drivers/firmware/xilinx/zynqmp.c | 96 +++ drivers/remoteproc/Kconfig | 8 + drivers/remoteproc/Makefile | 1 + drivers/remoteproc/zynqmp_r5_remoteproc.c | 777 ++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 60 ++ 6 files changed, 1062 insertions(+) create mode 100644 Documentation/devicetree/bindings/remoteproc/xilinx,zynqmp-r5-remoteproc.yaml create mode 100644 drivers/remoteproc/zynqmp_r5_remoteproc.c -- 2.17.1