From patchwork Thu Sep 6 19:25:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Gong X-Patchwork-Id: 10590997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8C2C112B for ; Thu, 6 Sep 2018 19:24:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 918872B0CE for ; Thu, 6 Sep 2018 19:24:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85B362B0F4; Thu, 6 Sep 2018 19:24:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DFAE82B0CE for ; Thu, 6 Sep 2018 19:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=1+F6bcD9D5V/D4CGGoLAmKOvVOIhcZxpBsPXfKMWHoM=; b=lyt2Qzu3Qk2Dtl h+p6XykRKo7lLGFImHfsvzejWk7z73dO5tlx566l9N9TRs4Q8xs+VsK2/GXLqGXJFKU3pqWZx5ECR /GJLQK6wAzO22KMCKAXDedUd273pbPN73/O/nqPd+hdXSVBfJt8lbWum9B5oOtFbchA9oyG1K5LXU tpjO/0Z1PKUfutGa9fR8xo+BaBjh3UOPZmXvHD/HIcLUyXze8stEdQwYKmuSb3Hk8G+NA9ntuRY+i orBbHyAWzDxMBlZGMgkWYr8w1N/7fGb2OgMtr1VKjzgjgkWwSGkgwDEb7Y5VjXLEWiv6ZHhmwJnsr Nc1Q+HE5q0b98SovxbbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxztX-0003Ku-BC; Thu, 06 Sep 2018 19:24:47 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxzog-0007Yv-Vh for linux-arm-kernel@lists.infradead.org; Thu, 06 Sep 2018 19:19:58 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 12:17:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,339,1531810800"; d="scan'208";a="68939744" Received: from marshy.an.intel.com ([10.122.105.159]) by fmsmga008.fm.intel.com with ESMTP; 06 Sep 2018 12:17:28 -0700 From: richard.gong@linux.intel.com To: gregkh@linuxfoundation.org, catalin.marinas@arm.com, will.deacon@arm.com, dinguyen@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, atull@kernel.org, mdf@kernel.org, arnd@arndb.de, corbet@lwn.net Subject: [PATCHv9 0/8] Add Intel Stratix10 FPGA manager and service layer Date: Thu, 6 Sep 2018 14:25:02 -0500 Message-Id: <1536261910-16426-1-git-send-email-richard.gong@linux.intel.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180906_121947_532632_A6C95CA2 X-CRM114-Status: GOOD ( 16.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, yves.vandervennet@linux.intel.com, richard.gong@intel.com, linux-doc@vger.kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Gong This is the 9th submission of Intel Stratix10 service layer and FPGA manager driver patches. This submission includes one patch for supporting remote status update, the second Stratix10 service layer client. Intel Stratix10 FPGA manager, which is 1st Stratix10 service layer client, is included in this submission. The patch on defconfig for enabling service layer and FPGA manager was removed in this submission, since FPGA is not enabled currently in the upstream kernel. I have moved the stratix10-smc.h to include/linux since it is being reused. Header stratix10-smc.h defines a secure messaging protocol that used by Stratix10 service layer and EDAC/DWMAC drivers for: 1. FPGA programming. 2. RSU (remote status update). This updates some booting parameters that happen on reboot, before the kernel boots the next time. 3. reading and writing the secure registers. Stratix10 service layer patches have been reviewed internally by Alan Tull and other colleagues at Intel. Some features of the Intel Stratix10 SoC require a level of privilege higher than the kernel is granted. Such secure features include FPGA programming, remote status update, read and write the secure registers. In terms of the ARMv8 architecture, the kernel runs at Exception Level 1 (EL1), access to the features requires Exception Level 3 (EL3). The Intel Stratix10 service layer provides kernel APIs for drivers to request access to the secure features. The requests are queued and processed one by one. ARM’s SMCCC is used to pass the execution of the requests on to a secure monitor (EL3). Later the Intel Stratix10 service layer driver will be extended to provide services for QSPI, Crypto and warm reset. v2: add patches for FPGA manager, FPGA manager binding, dts and defconfig remove intel-service subdirectory and intel-service.h, move intel-smc.h and intel-service.c to driver/misc subdirectory. remove global variables. change service layer driver be 'default n'. correct SPDX markers. add timeout for do..while() loop. add kernel-doc for the functions and structs, correct multiline comments. replace kfifo_in and kfifo_out with kfifo_in_spinlocked and kfifo_out_spinlocked. rename struct intel_svc_data (at client header) to intel_svc_client_msg. rename struct intel_svc_private_mem to intel_svc_data. other corrections/changes from Intel internal code reviews. v3: change all exported functions with "intel_svc_" as the prefix. increase timeout values for claiming back submitted buffer(s). rename struct intel_command_reconfig_payload to struct intel_svc_command_reconfig_payload. add pr_err() to provide the error return value. change to put fpga_mgr node under firmware/svc node. change to FPGA manager to align the update of service client APIs, and the update of fpga_mgr device node. Other corrections/changes. v4: s/intel/stratix10/ on some variables, structs, functions, and file names intel-service.c -> stratix10-svc.c intel-smc.h -> stratix10-smc.h intel-service-client.h -> stratix10-svc-client.h. remove non-kernel-doc formatting. s/fpga-mgr@0/fpga-mgr/ to remove unit_address at fpga_mgr node. add Rob's Reviewed-by. add Richard's signed-off-by. v5: add a new API statix10_svc_done() which is called by service client when client request is completed or error occurs during request process. Which allows service layer to free its resources. remove dummy client from service layer client header and service layer source file. add Rob's Reviewed-by. add a new file stratix10-svc.rst and add that to driver-api/index.rst. kernel-doc fixes. v6: replace kthread_create_on_cpu() with kthread_create_on_node(). extend stratix_svc_send() to support service client which doesn't use memory allocated by service layer. add S10_RECONFIG_TIMEOUT. rename s/S10_BUF_TIMEOUT/S10_BUFFER_TIMEOUT/. fix service layer and FPGA manager Klocwork errors. v7: add remote status update client support. s/pr_debug/dev_dbg, s/dev_info/dev_dbg. add unlock buffer if s10_svc_send_msg() fails. add release channel if fpga_mgr_create() fails. handle invalid pointer at svc if the client passed an invalid name. v8: move stratix10-smc.h to include/linux from driver/misc. revert version 7 error code & smc function ID value changes at stratix10-smc.h. add a goto and common error handling at the end of fpga driver's. probe function. v9: remove a patch on defconfig for enable service layer and FPGA manager. resolve a issue found at git-bisect test. remove kernel-doc markups that aren't being built. Alan Tull (3): dt-bindings: fpga: add Stratix10 SoC FPGA manager binding arm64: dts: stratix10: add fpga manager and region fpga: add intel stratix10 soc fpga manager driver Richard Gong (5): dt-bindings, firmware: add Intel Stratix10 service layer binding arm64: dts: stratix10: add stratix10 service driver binding to base dtsi misc: add Intel Stratix10 service layer driver Documentation: driver-api: add stratix10 service layer misc: add remote status update client support .../bindings/firmware/intel,stratix10-svc.txt | 57 ++ .../bindings/fpga/intel-stratix10-soc-fpga-mgr.txt | 17 + Documentation/driver-api/index.rst | 1 + Documentation/driver-api/stratix10-svc.rst | 32 + arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 33 + drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 535 ++++++++++ drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/stratix10-svc.c | 1066 ++++++++++++++++++++ include/linux/stratix10-smc.h | 312 ++++++ include/linux/stratix10-svc-client.h | 217 ++++ 13 files changed, 2290 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/intel,stratix10-svc.txt create mode 100644 Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt create mode 100644 Documentation/driver-api/stratix10-svc.rst create mode 100644 drivers/fpga/stratix10-soc.c create mode 100644 drivers/misc/stratix10-svc.c create mode 100644 include/linux/stratix10-smc.h create mode 100644 include/linux/stratix10-svc-client.h