Add Intel Stratix10 FPGA manager and service layer
Subsystems (4)
v3 cover Add Intel Stratix10 FPGA manager and service layer
From: Richard Gong <[email protected]>
This is the 3rd submission of Intel service layer patches. Intel Stratix10 FPGA manager, which is 1st service layer client, is included in this submission.
Service layer patches have been reviewed internally by Alan Tull and other colleagues at Intel.
Intel Stratix10 SoC is composed of a 64 bit quad-core ARM Cortex A53 hard processor system (HPS) and Secure Device Manager (SDM). SDM is the hardware which does the FPGA configuration, QSPI, Crypto and warm reset.
In order to configure the FPGA from HPS, there needs to be a way for HPS to notify SDM the location and size of the configuration data. Then SDM will get the configuration data from that location and perform the FPGA configuration.
To meet the whole system security needs and support virtual machine requesting communication with SDM, only the secure world of software (EL3, Exception Level 3) can interface with SDM. All software entities running on other exception levels must channel through the EL3 software whenever it needs service from SDM.
Intel Stratix10 service layer driver is added to provide the service for FPGA configuration. Running at privileged exception level (EL1, Exception Level 1), Intel Stratix10 service layer driver interfaces with the service provider at EL1 (Intel Stratix10 FPGA Manager) and manages secure monitor call (SMC) to communicate with secure monitor software at secure monitor exception level (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/kfifo_out with kfifo_in_spinlocked/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
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 (4):
dt-bindings, firmware: add Intel Stratix10 service layer binding
arm64: dts: stratix10: add service driver binding to base dtsi driver, misc: add Intel Stratix10 service layer driver
defconfig: enable fpga and service layer
.../bindings/firmware/intel,stratix10-svc.txt | 57 ++ .../bindings/fpga/intel-stratix10-soc-fpga-mgr.txt | 17 + arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 34 + arch/arm64/configs/defconfig | 5 + drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 534 ++++++++++++ drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/intel-service.c | 962 +++++++++++++++++++++ drivers/misc/intel-smc.h | 205 +++++ include/linux/intel-service-client.h | 188 ++++ 12 files changed, 2022 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 drivers/fpga/stratix10-soc.c create mode 100644 drivers/misc/intel-service.c create mode 100644 drivers/misc/intel-smc.h create mode 100644 include/linux/intel-service-client.h
Signature · 1 line
2.7.4
PATCH v3 1/7 dt-bindings, firmware: add Intel Stratix10 service layer binding
From: Richard Gong <[email protected]>
Add a device tree binding for the Intel Stratix10 service layer driver
---
v2: Change to put service layer driver node under the firmware node
Change compatible to "intel, stratix10-svc"
v3: No change
--- .../bindings/firmware/intel,stratix10-svc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/intel,stratix10-svc.txt
Documentation/devicetree/bindings/firmware/intel,stratix10-svc.txt new file +57 -0
@@ -0,0 +1,57 @@ +Intel Service Layer Driver for Stratix10 SoC +============================================ +Intel Stratix10 SoC is composed of a 64 bit quad-core ARM Cortex A53 hard +processor system (HPS) and Secure Device Manager (SDM). When the FPGA is +configured from HPS, there needs to be a way for HPS to notify SDM the +location and size of the configuration data. Then SDM will get the +configuration data from that location and perform the FPGA configuration. + +To meet the whole system security needs and support virtual machine requesting +communication with SDM, only the secure world of software (EL3, Exception +Layer 3) can interface with SDM. All software entities running on other +exception layers must channel through the EL3 software whenever it needs +service from SDM. + +Intel Stratix10 service layer driver, running at privileged exception level +(EL1, Exception Layer 1), interfaces with the service providers and provides +the services for FPGA configuration, QSPI, Crypto and warm reset. Service layer +driver also manages secure monitor call (SMC) to communicate with secure monitor +code running in EL3. + +Required properties: +------------------- +The svc node has the following mandatory properties, must be located under +the firmware node. + +- compatible: "intel,stratix10-svc" +- method: smc or hvc + smc - Secure Monitor Call + hvc - Hypervisor Call +- memory-region: + phandle to the reserved memory node. See + Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt + for details + +Example: +------- + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + service_reserved: svcbuffer at 0 { + compatible = "shared-dma-pool"; + reg = <0x0 0x0 0x0 0x1000000>; + alignment = <0x1000>; + no-map; + }; + }; + + firmware { + svc { + compatible = "intel,stratix10-svc"; + method = "smc"; + memory-region = <&service_reserved>; + }; + };
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCHv3 1/7] dt-bindings, firmware: add Intel Stratix10 service layer binding
Quoted 6 lines · richard.gong at linux.intel.com
From: Richard Gong <[email protected]>
Add a device tree binding for the Intel Stratix10 service layer driver
Signed-off-by Richard Gong <[email protected]>Signed-off-by Alan Tull <[email protected]>
Quoted 8 lines
---
v2: Change to put service layer driver node under the firmware node
Change compatible to "intel, stratix10-svc"
v3: No change--- .../bindings/firmware/intel,stratix10-svc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/firmware/intel,stratix10-svc.txt
Please add acks/reviewed-by's when posting new versions.
Rob
PATCH v3 2/7 arm64: dts: stratix10: add service driver binding to base dtsi
In reply to [email protected]From: Richard Gong <[email protected]>
Add Intel Stratix10 service layer to the device tree
---
v2: Change to put service layer driver node under the firmware node
Change compatible to "intel, stratix10-svc"
v3: No change
--- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +22 -0
@@ -24,6 +24,20 @@ #address-cells = <2>; #size-cells = <2>; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + service_reserved: svcbuffer at 0 { + compatible = "shared-dma-pool"; + reg = <0x0 0x0 0x0 0x1000000>; + alignment = <0x1000>; + no-map; + }; + }; + + cpus { #address-cells = <1>; #size-cells = <0>;
@@ -433,5 +447,13 @@ resets = <&rst WATCHDOG3_RESET>; status = "disabled"; }; + + firmware { + svc { + compatible = "intel,stratix10-svc"; + method = "smc"; + memory-region = <&service_reserved>; + }; + }; }; };
Signature · 1 line
2.7.4
PATCH v3 3/7 driver, misc: add Intel Stratix10 service layer driver
In reply to [email protected]From: Richard Gong <[email protected]>
Intel Stratix10 SoC is composed of a 64 bit quad-core ARM Cortex A53 hard processor system (HPS) and Secure Device Manager (SDM). SDM is the hardware which does the FPGA configuration, QSPI, Crypto and warm reset.
In order to configure the FPGA from HPS, there needs to be a way for HPS to notify SDM the location and size of the configuration data. Then SDM will get the configuration data from that location and perform the FPGA configuration.
To meet the whole system security needs and support virtual machine requesting communication with SDM, only the secure world of software (EL3, Exception Level 3) can interface with SDM. All software entities running on other exception levels must channel through the EL3 software whenever it needs service from SDM.
Intel Stratix10 service layer driver is added to provide the service for FPGA configuration. Running at privileged exception level (EL1, Exception Level 1), Intel Stratix10 service layer driver interfaces with the service provider at EL1 (Intel Stratix10 FPGA Manager) and manages secure monitor call (SMC) to communicate with secure monitor software at secure monitor exception level (EL3).
Header file intel-service-client.h defines the interface between service providers (FPGA manager is one of them) and service layer.
Header file intel-smc.h defines the secure monitor call (SMC) message protocols used for service layer driver in normal world (EL1) to communicate with secure monitor SW in secure monitor exception level 3 (EL3). This file is shared with secure firmware (FW) which is out of kernel tree.
---
v2: Remove intel-service subdirectory and intel-service.h, move
intel-smc.h and intel-service.c to driver/misc subdirectory Correct SPDX markers
Change service layer driver be 'default n'
Remove global variables
Add timeout for do..while() loop
Add kernel-doc for the functions and structs, correct multiline comments Replace kfifo_in/kfifo_out with kfifo_in_spinlocked/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
Other corrections/changes
--- drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/intel-service.c | 962 +++++++++++++++++++++++++++++++++++ drivers/misc/intel-smc.h | 205 ++++++++ include/linux/intel-service-client.h | 188 +++++++ 5 files changed, 1368 insertions(+) create mode 100644 drivers/misc/intel-service.c create mode 100644 drivers/misc/intel-smc.h create mode 100644 include/linux/intel-service-client.h
drivers/misc/Kconfig +12 -0
@@ -139,6 +139,18 @@ config INTEL_MID_PTI an Intel Atom (non-netbook) mobile device containing a MIPI P1149.7 standard implementation. +config INTEL_SERVICE + tristate "Intel Service Layer" + depends on HAVE_ARM_SMCCC + default n + help + Intel service layer runs at privileged exception level, interfaces with + the service providers (FPGA manager is one of them) and manages secure + monitor call to communicate with secure monitor software at secure monitor + exception level. + + Say Y here if you want Intel service layer support. + config SGI_IOC4 tristate "SGI IOC4 Base IO support" depends on PCI
drivers/misc/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o obj-$(CONFIG_INTEL_MID_PTI) += pti.o +obj-$(CONFIG_INTEL_SERVICE) += intel-service.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o
drivers/misc/intel-service.c new file +962 -0
962 lines not on this page · raw message
drivers/misc/intel-smc.h new file +205 -0
205 lines not on this page · raw message
include/linux/intel-service-client.h new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
2.7.4
Greg KH
maintainerRe: [PATCHv3 3/7] driver, misc: add Intel Stratix10 service layer driver
Quoted 1 line · richard.gong at linux.intel.com
+config
INTEL_SERVICE
Naming is hard, but this is a _very_ generic name, don't you agree?
drivers/misc/Kconfig config INTEL_MID_PTI · line 143
Quoted 1 line
drivers/misc/Kconfig +1
-0+ tristate "Intel Service Layer"
As is this. Can you make this a bit more specific to what hardware is being controlled here?
Quoted 1 line
+++
b/drivers/misc/intel-service.c
Same for the file name, why not stratix10.c?
or intel_svc.c? That makes it a _bit_ more generic. Well, not really, but it does hide the "genericness" a bit more, right?
Quoted 34 lines
include/linux/intel-service-client.h new file +31
-0@@ -0,0 +1,188 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2017-2018, Intel Corporation +*/ + +#ifndef __INTEL_SERVICE_CLIENT_H +#define __INTEL_SERVICE_CLIENT_H + +/* +* Service layer driver supports client names +* +* fpga: for FPGA configuration +* dummy: for integration/debug/trouble-shooting +*/ +#define SVC_CLIENT_FPGA "fpga" +#define SVC_CLIENT_DUMMY "dummy" + +/* +* Status of the sent command, in bit number +* +* SVC_COMMAND_STATUS_RECONFIG_REQUEST_OK: +* Secure firmware accepts the request of FPGA reconfiguration. +* +* SVC_STATUS_RECONFIG_BUFFER_SUBMITTED: +* Service client successfully submits FPGA configuration +* data buffer to secure firmware. +* +* SVC_COMMAND_STATUS_RECONFIG_BUFFER_DONE: +* Secure firmware completes data process, ready to accept the +* next WRITE transaction. +*
include/linux/intel-service-client.h line 41
Quoted 10 lines
include/linux/intel-service-client.h new file +10
-0+* SVC_COMMAND_STATUS_RECONFIG_COMPLETED: +* Secure firmware completes FPGA configuration successfully, FPGA should +* be in user mode. +* +* SVC_COMMAND_STATUS_RECONFIG_BUSY: +* FPGA configuration is still in process. +* +* SVC_COMMAND_STATUS_RECONFIG_ERROR: +* Error encountered during FPGA configuration. +*/
You have an odd mix of kernel-doc formatting and non-kernel-doc formatting in this file. Pick one and stick with it :)
Also, if you use kernel-doc (as you should), please hook it up to the kernel documentation build process to take advantage of it.
thanks,
greg k-h
RE: [PATCHv3 3/7] driver, misc: add Intel Stratix10 service layer driver
From: Greg KH
Quoted 11 lines
Sent: 23 April 2018 13:03
Quoted 1 line · richard.gong at linux.intel.com
+config
INTEL_SERVICENaming is hard, but this is a _very_ generic name, don't you agree?
drivers/misc/Kconfig config INTEL_MID_PTI · line 143
Quoted 1 line
drivers/misc/Kconfig +1
-0+ tristate "Intel Service Layer"As is this. Can you make this a bit more specific to what hardware is being controlled here?
Quoted 6 lines
Quoted 1 line
+++
b/drivers/misc/intel-service.cSame for the file name, why not
stratix10.c?or
intel_svc.c? That makes it a _bit_ more generic. Well, not really, but it does hide the "genericness" a bit more, right?
It'll all be even worse if (when) Intel decide to sell Altera to someone else.
David
PATCH v3 4/7 dt-bindings: fpga: add Stratix10 SoC FPGA manager binding
In reply to [email protected]From: Alan Tull <[email protected]>
Add a Device Tree binding for the Intel Stratix10 SoC FPGA manager.
---
v2: this patch is added in patch set version 2
v3: change to put fpga_mgr node under firmware/svc node
--- .../bindings/fpga/intel-stratix10-soc-fpga-mgr.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt
Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt new file +17 -0
@@ -0,0 +1,17 @@ +Intel Stratix10 SoC FPGA Manager + +Required properties: +The fpga_mgr node has the following mandatory property, must be located under +firmware/svc node. + +- compatible : should contain "intel,stratix10-soc-fpga-mgr" + +Example: + + firmware { + svc { + fpga_mgr: fpga-mgr at 0 { + compatible = "intel,stratix10-soc-fpga-mgr"; + }; + }; + };
Signature · 1 line
2.7.4
Re: [PATCHv3 4/7] dt-bindings: fpga: add Stratix10 SoC FPGA manager binding
Quoted 22 lines · On Tue, Mar 27, 2018 at 3:20 PM, <[email protected]> wrote:
From: Alan Tull <[email protected]>
Add a Device Tree binding for the Intel Stratix10 SoC FPGA manager.
Signed-off-by Alan Tull <[email protected]>---
v2: this patch is added in patch set version 2
v3: change to putfpga_mgrnode underfirmware/svcnode--- .../bindings/fpga/intel-stratix10-soc-fpga-mgr.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txtDocumentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt new file +3
-0@@ -0,0 +1,17 @@ +Intel Stratix10 SoC FPGA Manager + +Required properties:
Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt new file +10
-0+The fpga_mgr node has the following mandatory property, must be located under +firmware/svc node. + +- compatible : should contain "intel,stratix10-soc-fpga-mgr" + +Example: + + firmware { + svc { + fpga_mgr: fpga-mgr at 0 {
Shouldn't have the index. Should be:
fpga_mgr: fpga-mgr {Alan
Quoted 7 lines
Documentation/devicetree/bindings/fpga/intel-stratix10-soc-fpga-mgr.txt new file +4
-1+ compatible = "intel,stratix10-soc-fpga-mgr"; + }; + }; + }; --2.7.4
PATCH v3 5/7 arm64: dts: stratix10: add fpga manager and region
In reply to [email protected]From: Alan Tull <[email protected]>
Add the Stratix10 FPGA manager and a FPGA region to the device tree.
---
v2: this patch is added in patch set version 2
v3: change to put fpga_mgr node under firmware/svc node
--- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +12 -0
@@ -107,6 +107,14 @@ interrupt-parent = <&intc>; ranges = <0 0 0 0xffffffff>; + base_fpga_region { + #address-cells = <0x1>; + #size-cells = <0x1>; + + compatible = "fpga-region"; + fpga-mgr = <&fpga_mgr>; + }; + clkmgr: clock-controller at ffd10000 { compatible = "intel,stratix10-clkmgr"; reg = <0xffd10000 0x1000>;
@@ -453,6 +461,10 @@ compatible = "intel,stratix10-svc"; method = "smc"; memory-region = <&service_reserved>; + + fpga_mgr: fpga-mgr at 0 { + compatible = "intel,stratix10-soc-fpga-mgr"; + }; }; }; };
Signature · 1 line
2.7.4
PATCH v3 6/7 fpga: add intel stratix10 soc fpga manager driver
In reply to [email protected]From: Alan Tull <[email protected]>
Add driver for reconfiguring Intel Stratix10 SoC FPGA devices. This driver communicates through the Intel Service Driver which does communication with privileged hardware (that does the FPGA programming) through a secure mailbox.
---
v2: this patch is added in patch set version 2
v3: change to align to the update of service client APIs, and the
update of fpga_mgr device node
--- drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 534 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 541 insertions(+) create mode 100644 drivers/fpga/stratix10-soc.c
drivers/fpga/Kconfig +6 -0
@@ -57,6 +57,12 @@ config FPGA_MGR_ZYNQ_FPGA help FPGA manager driver support for Xilinx Zynq FPGAs. +config FPGA_MGR_STRATIX10_SOC + tristate "Intel Stratix10 SoC FPGA Manager" + depends on (ARCH_STRATIX10 && INTEL_SERVICE) + help + FPGA manager driver support for the Intel Stratix10 SoC. + config FPGA_MGR_XILINX_SPI tristate "Xilinx Configuration over Slave Serial (SPI)" depends on SPI
drivers/fpga/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_FPGA_MGR_ALTERA_PS_SPI) += altera-ps-spi.o obj-$(CONFIG_FPGA_MGR_ICE40_SPI) += ice40-spi.o obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10) += socfpga-a10.o +obj-$(CONFIG_FPGA_MGR_STRATIX10_SOC) += stratix10-soc.o obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o obj-$(CONFIG_FPGA_MGR_XILINX_SPI) += xilinx-spi.o obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o
drivers/fpga/stratix10-soc.c new file +534 -0
534 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 7/7 defconfig: enable fpga and service layer
In reply to [email protected]From: Richard Gong <[email protected]>
Enable fpga framework, Stratix 10 SoC FPGA manager, and Intel Service Layer
---
v2: this patch is added in patch set version 2
v3: no change
--- arch/arm64/configs/defconfig | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/configs/defconfig +5 -0
@@ -169,6 +169,7 @@ CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_NBD=m CONFIG_VIRTIO_BLK=y CONFIG_BLK_DEV_NVME=m +CONFIG_INTEL_SERVICE=y CONFIG_SRAM=y CONFIG_EEPROM_AT25=m # CONFIG_SCSI_PROC_FS is not set
@@ -559,6 +560,10 @@ CONFIG_PHY_ROCKCHIP_INNO_USB2=y CONFIG_PHY_ROCKCHIP_EMMC=y CONFIG_PHY_ROCKCHIP_PCIE=m CONFIG_PHY_XGENE=y +CONFIG_FPGA=y +CONFIG_FPGA_REGION=y +CONFIG_FPGA_MGR_STRATIX10_SOC=y +CONFIG_FPGA_BRIDGE=y CONFIG_PHY_TEGRA_XUSB=y CONFIG_QCOM_L2_PMU=y CONFIG_QCOM_L3_PMU=y
Signature · 1 line
2.7.4