From patchwork Fri Nov 6 02:23:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russ Weight X-Patchwork-Id: 11885713 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C0DD139F for ; Fri, 6 Nov 2020 02:23:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25EB72075A for ; Fri, 6 Nov 2020 02:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725839AbgKFCXX (ORCPT ); Thu, 5 Nov 2020 21:23:23 -0500 Received: from mga07.intel.com ([134.134.136.100]:20920 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbgKFCXX (ORCPT ); Thu, 5 Nov 2020 21:23:23 -0500 IronPort-SDR: XiJz9OZVGXukmoTT6vU0i5yCe5bmamwSY/zRo1vey51bwomduOatjt4z8GBIubtp8kZlMUE85y 6t10ma0KUh6A== X-IronPort-AV: E=McAfee;i="6000,8403,9796"; a="233658512" X-IronPort-AV: E=Sophos;i="5.77,454,1596524400"; d="scan'208";a="233658512" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 18:23:22 -0800 IronPort-SDR: abElKfMayXFvJnv/31fO6QU2s132PpJoWelRiIkTFyjbuf3hIe8JWfh5iGXA1lTlJKXMkggrAP dwg6ZuKSemjA== X-IronPort-AV: E=Sophos;i="5.77,454,1596524400"; d="scan'208";a="364549657" Received: from rhweight-mobl2.amr.corp.intel.com (HELO rhweight-mobl2.ra.intel.com) ([10.254.65.158]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 18:23:21 -0800 From: Russ Weight To: mdf@kernel.org, lee.jones@linaro.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: trix@redhat.com, lgoncalv@redhat.com, yilun.xu@intel.com, hao.wu@intel.com, matthew.gerlach@intel.com, Russ Weight Subject: [PATCH v4 0/6] Intel MAX10 BMC Secure Update Driver Date: Thu, 5 Nov 2020 18:23:13 -0800 Message-Id: <20201106022319.13991-1-russell.h.weight@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org The Intel MAX10 BMC Secure Update driver instantiates the FPGA Security Manager class driver and provides the callback functions required to support secure updates on Intel n3000 PAC devices. This driver is implemented as a sub-driver of the Intel MAX10 BMC mfd driver. Future instances of the MAX10 BMC will support other devices as well (e.g. d5005) and this same MAX10 BMC Secure Update driver will receive modifications to support that device. This driver interacts with the HW secure update engine of the BMC in order to transfer new FPGA and BMC images to FLASH so that they will be automatically loaded when the FPGA card reboots. Security is enforced by hardware and firmware. The MAX10 BMC Secure Update driver interacts with the firmware to initiate an update, pass in the necessary data, and collect status on the update. This driver provides sysfs files for displaying the flash count, the root entry hashes (REH), and the code-signing-key (CSK) cancellation vectors. These patches are dependent on other patches that are under review. If you want to apply and compile these patches on linux-next, please apply these patches first: (7 patches) https://marc.info/?l=linux-fpga&m=160462501901359&w=2 If you have an n3000 PAC card and want to test this driver, you will also need this patch: (1 patch) https://marc.info/?l=linux-fpga&m=160379607703940&w=2 Changelog v3 -> v4: - Moved sysfs files for displaying the flash count, the root entry hashes (REH), and the code-signing-key (CSK) cancellation vectors from the FPGA Security Manager class driver to this driver (as they are not generic enough for the class driver). - Added a new ABI documentation file with informtaion about the new sysfs entries: sysfs-driver-intel-m10-bmc-secure - Updated the MAINTAINERS file to add the new ABI documentation file: sysfs-driver-intel-m10-bmc-secure - Removed unnecessary ret variable from m10bmc_secure_probe() - Incorporated new devm_fpga_sec_mgr_register() function into m10bmc_secure_probe() and removed the m10bmc_secure_remove() function. Changelog v2 -> v3: - Changed "MAX10 BMC Security Engine driver" to "MAX10 BMC Secure Update driver" - Changed from "Intel FPGA Security Manager" to FPGA Security Manager" - Changed: iops -> sops, imgr -> smgr, IFPGA_ -> FPGA_, ifpga_ to fpga_ - Removed wrapper functions (m10bmc_raw_*, m10bmc_sys_*). The underlying functions are now called directly. - Changed "_root_entry_hash" to "_reh", with a comment explaining what reh is. - Renamed get_csk_vector() to m10bmc_csk_vector() - Changed calling functions of functions that return "enum fpga_sec_err" to check for (ret != FPGA_SEC_ERR_NONE) instead of (ret) Changelog v1 -> v2: - These patches were previously submitted as part of a larger V1 patch set under the title "Intel FPGA Security Manager Class Driver". - Grouped all changes to include/linux/mfd/intel-m10-bmc.h into a single patch: "mfd: intel-m10-bmc: support for MAX10 BMC Security Engine". - Removed ifpga_sec_mgr_init() and ifpga_sec_mgr_uinit() functions. - Adapted to changes in the Intel FPGA Security Manager by splitting the single call to ifpga_sec_mgr_register() into two function calls: devm_ifpga_sec_mgr_create() and ifpga_sec_mgr_register(). - Replaced small function-creation macros for explicit function declarations. - Bug fix for the get_csk_vector() function to properly apply the stride variable in calls to m10bmc_raw_bulk_read(). - Added m10bmc_ prefix to functions in m10bmc_iops structure - Implemented HW_ERRINFO_POISON for m10bmc_sec_hw_errinfo() to ensure that corresponding bits are set to 1 if we are unable to read the doorbell or auth_result registers. - Added comments and additional code cleanup per V1 review. Russ Weight (6): mfd: intel-m10-bmc: support for MAX10 BMC Secure Updates fpga: m10bmc-sec: create max10 bmc secure update driver fpga: m10bmc-sec: expose max10 flash update count fpga: m10bmc-sec: expose max10 canceled keys in sysfs fpga: m10bmc-sec: add max10 secure update functions fpga: m10bmc-sec: add max10 get_hw_errinfo callback func .../testing/sysfs-driver-intel-m10-bmc-secure | 61 ++ MAINTAINERS | 2 + drivers/fpga/Kconfig | 11 + drivers/fpga/Makefile | 3 + drivers/fpga/intel-m10-bmc-secure.c | 542 ++++++++++++++++++ include/linux/mfd/intel-m10-bmc.h | 85 +++ 6 files changed, 704 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-intel-m10-bmc-secure create mode 100644 drivers/fpga/intel-m10-bmc-secure.c