Add Intel Stratix10 FPGA manager and service layer
Subsystems (5)
v6 cover Add Intel Stratix10 FPGA manager and service layer
From: Richard Gong <[email protected]>
This is the 6th submission of Intel stratix10 service layer patches. Intel Stratix10 FPGA manager, which is 1st Stratix10 service layer client, is included in this submission.
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. 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 an in kernel API 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/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
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
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
driver, misc: add Intel Stratix10 service layer driver
defconfig: enable fpga and service layer
Documentation: driver-api: add stratix10 service layer
.../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 | 48 + arch/arm64/configs/defconfig | 6 + drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 553 +++++++++++ drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/stratix10-smc.h | 205 ++++ drivers/misc/stratix10-svc.c | 1000 ++++++++++++++++++++ include/linux/stratix10-svc-client.h | 201 ++++ 14 files changed, 2140 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-smc.h create mode 100644 drivers/misc/stratix10-svc.c create mode 100644 include/linux/stratix10-svc-client.h
Signature · 1 line
2.7.4
PATCH v6 1/8 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
v4: Add Rob's Reviewed-by
v5: No change
v6: Add Moritz's Acked-by
--- .../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@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
PATCH v6 2/8 arm64: dts: stratix10: add stratix10 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
v4: s/service driver/stratix10 service driver/ in subject line
v5: No change
v6: Add Moritz's Acked-by
--- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +36 -0
@@ -24,6 +24,19 @@ #address-cells = <2>; #size-cells = <2>; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + service_reserved: svcbuffer@0 { + compatible = "shared-dma-pool"; + reg = <0x0 0x0 0x0 0x1000000>; + alignment = <0x1000>; + no-map; + }; + }; + cpus { #address-cells = <1>; #size-cells = <0>;
@@ -466,5 +479,28 @@ interrupts = <16 4>, <48 4>; }; }; + + qspi: spi@ff8d2000 { + compatible = "cdns,qspi-nor"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xff8d2000 0x100>, + <0xff900000 0x100000>; + interrupts = <0 3 4>; + cdns,fifo-depth = <128>; + cdns,fifo-width = <4>; + cdns,trigger-address = <0x00000000>; + clocks = <&qspi_clk>; + + status = "disabled"; + }; + + firmware { + svc { + compatible = "intel,stratix10-svc"; + method = "smc"; + memory-region = <&service_reserved>; + }; + }; }; };
Signature · 1 line
2.7.4
PATCH v6 3/8 driver, misc: add Intel Stratix10 service layer driver
In reply to [email protected]From: Richard Gong <[email protected]>
Some features of the Intel Stratix10 SoC require a level of privilege higher than the kernel is granted. Such secure features include FPGA programming. 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 SoC service layer provides an in kernel API 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).
The header file stratix10-sve-client.h defines the interface between service providers (FPGA manager is one of them) and service layer.
The header file stratix10-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).
---
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
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 formattingv5: 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.
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
fix several Klocwork errors
--- drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/stratix10-smc.h | 205 +++++++ drivers/misc/stratix10-svc.c | 1000 ++++++++++++++++++++++++++++++++++ include/linux/stratix10-svc-client.h | 201 +++++++ 5 files changed, 1419 insertions(+) create mode 100644 drivers/misc/stratix10-smc.h create mode 100644 drivers/misc/stratix10-svc.c create mode 100644 include/linux/stratix10-svc-client.h
drivers/misc/Kconfig +12 -0
@@ -152,6 +152,18 @@ config INTEL_MID_PTI an Intel Atom (non-netbook) mobile device containing a MIPI P1149.7 standard implementation. +config STRATIX10_SERVICE + tristate "Stratix10 Service Layer" + depends on HAVE_ARM_SMCCC + default n + help + Stratix10 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 Stratix10 service layer support. + config SGI_IOC4 tristate "SGI IOC4 Base IO support" depends on PCI
drivers/misc/Makefile +1 -0
@@ -9,6 +9,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_STRATIX10_SERVICE) += stratix10-svc.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o
drivers/misc/stratix10-smc.h new file +205 -0
205 lines not on this page · raw message
drivers/misc/stratix10-svc.c new file +1000 -0
1,000 lines not on this page · raw message
include/linux/stratix10-svc-client.h new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v6 4/8 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
v4: s/fpga-mgr@0/fpga-mgr/ to remove unit_address
add Richard's signed-off-by
v5: add Reviewed-by Rob Herring
v6: no change
--- .../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 { + compatible = "intel,stratix10-soc-fpga-mgr"; + }; + }; + };
Signature · 1 line
2.7.4
PATCH v6 5/8 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
v4: s/fpga-mgr@0/fpga-mgr/ to remove unit_address
add Richard's signed-off-by
v5: no change
v6: no change
--- arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi +12 -0
@@ -106,6 +106,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@ffd10000 { compatible = "intel,stratix10-clkmgr"; reg = <0xffd10000 0x1000>;
@@ -500,6 +508,10 @@ compatible = "intel,stratix10-svc"; method = "smc"; memory-region = <&service_reserved>; + + fpga_mgr: fpga-mgr { + compatible = "intel,stratix10-soc-fpga-mgr"; + }; }; }; };
Signature · 1 line
2.7.4
PATCH v6 6/8 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
v4: changes to align with stratix10-svc-client API updates
add Richard's signed-off-by
v5: update to align changes at service layer to minimize service
layer thread usages
v6: add S10_RECONFIG_TIMEOUT
rename s/S10_BUF_TIMEOUT/S10_BUFFER_TIMEOUT/
fix klocwork errors
--- drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 553 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 560 insertions(+) create mode 100644 drivers/fpga/stratix10-soc.c
drivers/fpga/Kconfig +6 -0
@@ -56,6 +56,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 && STRATIX10_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
@@ -13,6 +13,7 @@ obj-$(CONFIG_FPGA_MGR_ICE40_SPI) += ice40-spi.o obj-$(CONFIG_FPGA_MGR_MACHXO2_SPI) += machxo2-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 +553 -0
553 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCHv6 6/8] fpga: add intel stratix10 soc fpga manager driver
Hi Richard + Alan,
couple of small stuff inline. Sorry for the super late reply.
Quoted 106 lines · On Tue, Jul 3, 2018 at 7:46 AM, <[email protected]> wrote:
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.
Signed-off-by Alan Tull <[email protected]>Signed-off-by Richard Gong <[email protected]>---
v2: this patch is added in patch set version 2
v3: change to align to the update of service client APIs, and the
update offpga_mgrdevice node
v4: changes to align with stratix10-svc-client API updates
add Richard's signed-off-by
v5: update to align changes at service layer to minimize service
layer thread usages
v6: addS10_RECONFIG_TIMEOUT
rename s/S10_BUF_TIMEOUT/S10_BUFFER_TIMEOUT/
fix klocwork errors--- drivers/fpga/Kconfig | 6 + drivers/fpga/Makefile | 1 + drivers/fpga/stratix10-soc.c | 553 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 560 insertions(+) create mode 100644 drivers/fpga/stratix10-soc.cdrivers/fpga/Kconfig +6
-0@@ -56,6 +56,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 && STRATIX10_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 SPIdrivers/fpga/Makefile +1
-0@@ -13,6 +13,7 @@ obj-$(CONFIG_FPGA_MGR_ICE40_SPI) += ice40-spi.o obj-$(CONFIG_FPGA_MGR_MACHXO2_SPI) += machxo2-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.odrivers/fpga/stratix10-soc.c new file +44
-0@@ -0,0 +1,553 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* FPGA Manager Driver for Intel Stratix10 SoC +* +* Copyright (C) 2018 Intel Corporation +*/ +#include <linux/completion.h> +#include <linux/fpga/fpga-mgr.h> +#include <linux/stratix10-svc-client.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_platform.h> + +/* +* FPGA programming requires a higher level of privilege (EL3), per the SoC +* design. +*/ +#define NUM_SVC_BUFS 4 +#define SVC_BUF_SIZE SZ_512K + +/* Indicates buffer is in use if set */ +#define SVC_BUF_LOCK 0 + +#define S10_BUFFER_TIMEOUT (msecs_to_jiffies(SVC_RECONFIG_BUFFER_TIMEOUT_MS)) +#define S10_RECONFIG_TIMEOUT (msecs_to_jiffies(SVC_RECONFIG_REQUEST_TIMEOUT_MS)) + +/** +* struct s10_svc_buf +* @buf: virtual address of buf provided by service layer +* @lock: locked if buffer is in use +*/ +struct s10_svc_buf { +char *buf; +unsigned long lock; +}; + +struct s10_priv { +struct stratix10_svc_chan *chan; +struct stratix10_svc_client client; +struct completion status_return_completion; +struct s10_svc_buf svc_bufs[NUM_SVC_BUFS ]; +unsigned long status; +}; +
drivers/fpga/stratix10-soc.c line 54
Quoted 10 lines
drivers/fpga/stratix10-soc.c new file +10
-0+static int s10_svc_send_msg (struct s10_priv *priv, +enum stratix10_svc_command_code command, +void *payload,u32 payload_length) +{ +struct stratix10_svc_chan *chan = priv->chan; +struct stratix10_svc_client_msg msg; +int ret; + +pr_debug ("%s cmd=%d payload=%p legnth=%d\n" , + __func__, command, payload, payload_length);
Can we make those dev_dbg() ? Or do we not have a device available?
Quoted 134 lines
drivers/fpga/stratix10-soc.c new file +134
-0+ + msg.command = command; + msg.payload = payload; + msg.payload_length = payload_length; + + ret =stratix10_svc_send (chan, &msg); +pr_debug ("stratix10_svc_send returned status %d\n" , ret); + +return ret; +} + +/** +* s10_free_buffers +* Free buffers allocated from the service layer's pool that are not in use. +* @mgr: fpga manager struct +* Free all buffers that are not in use. +* Return true when all buffers are freed. +*/ +static bool s10_free_buffers (struct fpga_manager *mgr) +{ +struct s10_priv *priv = mgr->priv; +uint num_free =0 ; +uint i; + +for (i =0 ; i <NUM_SVC_BUFS ; i++) { +if (!priv->svc_bufs[i].buf) { + num_free++; +continue ; + } + +if (!test_and_set_bit_lock (SVC_BUF_LOCK , + &priv->svc_bufs[i].lock)) { +stratix10_svc_free_memory (priv->chan, + priv->svc_bufs[i].buf); + priv->svc_bufs[i].buf =NULL ; + num_free++; + } + } + +return num_free ==NUM_SVC_BUFS ; +} + +/** +* s10_free_buffer_count +* Count how many buffers are not in use. +* @mgr: fpga manager struct +* Return # of buffers that are not in use. +*/ +static uint s10_free_buffer_count (struct fpga_manager *mgr) +{ +struct s10_priv *priv = mgr->priv; +uint num_free =0 ; +uint i; + +for (i =0 ; i <NUM_SVC_BUFS ; i++) +if (!priv->svc_bufs[i].buf) + num_free++; + +return num_free; +} + +/** +* s10_unlock_bufs +* Given the returned buffer address, match that address to our buffer struct +* and unlock that buffer. This marks it as available to be refilled and sent +* (or freed). +* @priv: private data +* @kaddr: kernel address of buffer that was returned from service layer +*/ +static void s10_unlock_bufs (struct s10_priv *priv,void *kaddr) +{ +uint i; + +if (!kaddr) +return ; + +for (i =0 ; i <NUM_SVC_BUFS ; i++) +if (priv->svc_bufs[i].buf == kaddr) { +clear_bit_unlock (SVC_BUF_LOCK , + &priv->svc_bufs[i].lock); +return ; + } + +WARN (1 ,"Unknown buffer returned from service layer %p\n" , kaddr); +} + +/** +* s10_receive_callback +* Callback for service layer to use to provide client (this driver) messages +* received through the mailbox. +* @client: service layer client struct +* @data: message +*/ +static void s10_receive_callback (struct stratix10_svc_client *client, +struct stratix10_svc_cb_data *data) +{ +struct s10_priv *priv = client->priv; +u32 status; +int i; + +WARN_ONCE (!data,"%s: stratix10_svc_rc_data = NULL" , __func__); + + status = data->status; + +/* +* Here we set status bits as we receive them. Elsewhere, we always use +* test_and_clear_bit() to check status in priv->status +*/ +for (i =0 ; i <=SVC_STATUS_RECONFIG_ERROR ; i++) +if (status & (1 << i)) +set_bit (i, &priv->status); + +if (status &BIT (SVC_STATUS_RECONFIG_BUFFER_DONE )) { +s10_unlock_bufs (priv, data->kaddr1); +s10_unlock_bufs (priv, data->kaddr2); +s10_unlock_bufs (priv, data->kaddr3); + } + +complete (&priv->status_return_completion); +} + +/** +* s10_ops_write_init +* Prepare for FPGA reconfiguration by requesting partial reconfig and +* allocating buffers from the service layer. +* @mgr: fpga manager +* @info: fpga image info +* @buf: fpga image buffer +* @count: size of buf in bytes +*/ +static int s10_ops_write_init (struct fpga_manager *mgr, +struct fpga_image_info *info, +const char *buf,size_t count) +{
drivers/fpga/stratix10-soc.c line 198
Quoted 10 lines
drivers/fpga/stratix10-soc.c new file +10
-0+struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +struct stratix10_svc_command_reconfig_payload payload; +char *kbuf; +uint i; +int ret; + + payload.flags =0 ; +if (info->flags &FPGA_MGR_PARTIAL_RECONFIG ) { +dev_info (dev,"Requesting partial reconfiguration.\n" );
Do we need these to be _info() or can the by _dbg()? The Framework already prints ("Writing blah.foo to ...")
drivers/fpga/stratix10-soc.c line 201
Quoted 3 lines
drivers/fpga/stratix10-soc.c new file +3
-0+ payload.flags |=BIT (COMMAND_RECONFIG_FLAG_PARTIAL ); + }else { +dev_info (dev,"Requesting full reconfiguration.\n" );
Same here.
Quoted 73 lines
drivers/fpga/stratix10-soc.c new file +73
-0+ } + +reinit_completion (&priv->status_return_completion); + ret =s10_svc_send_msg (priv,COMMAND_RECONFIG , + &payload,sizeof (payload)); +if (ret <0 ) + goto init_done; + + ret =wait_for_completion_interruptible_timeout ( + &priv->status_return_completion,S10_RECONFIG_TIMEOUT ); +if (!ret) { +dev_err (dev,"timeout waiting for RECONFIG_REQUEST\n" ); + ret = -ETIMEDOUT ; + goto init_done; + } +if (ret <0 ) { +dev_err (dev,"error (%d) waiting for RECONFIG_REQUEST\n" , ret); + goto init_done; + } + + ret =0 ; +if (!test_and_clear_bit (SVC_STATUS_RECONFIG_REQUEST_OK , + &priv->status)) { + ret = -ETIMEDOUT ; + goto init_done; + } + +/* Allocate buffers from the service layer's pool. */ +for (i =0 ; i <NUM_SVC_BUFS ; i++) { + kbuf =stratix10_svc_allocate_memory (priv->chan,SVC_BUF_SIZE ); +if (!kbuf) { +s10_free_buffers (mgr); + ret = -ENOMEM ; + goto init_done; + } + + priv->svc_bufs[i].buf = kbuf; + priv->svc_bufs[i].lock =0 ; + } + +init_done: +stratix10_svc_done (priv->chan); +return ret; +} + +/** +* s10_send_buf +* Send a buffer to the service layer queue +* @mgr: fpga manager struct +* @buf: fpga image buffer +* @count: size of buf in bytes +* Returns # of bytes transferred or -ENOBUFS if the all the buffers are in use +* or if the service queue is full. Never returns 0. +*/ +static int s10_send_buf (struct fpga_manager *mgr,const char *buf,size_t count) +{ +struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +void *svc_buf; +size_t xfer_sz; +int ret; +uint i; + +/* get/lock a buffer that that's not being used */ +for (i =0 ; i <NUM_SVC_BUFS ; i++) +if (!test_and_set_bit_lock (SVC_BUF_LOCK , + &priv->svc_bufs[i].lock)) +break ; + +if (i ==NUM_SVC_BUFS ) +return -ENOBUFS ; + + xfer_sz = count <SVC_BUF_SIZE ? count :SVC_BUF_SIZE ;
drivers/fpga/stratix10-soc.c line 284
Quoted 10 lines
drivers/fpga/stratix10-soc.c new file +10
-0+ + svc_buf = priv->svc_bufs[i].buf; +memcpy (svc_buf, buf, xfer_sz); + ret =s10_svc_send_msg (priv,COMMAND_RECONFIG_DATA_SUBMIT , + svc_buf, xfer_sz); +if (ret <0 ) { +dev_err (dev, +"Error while sending data to service layer (%d)" , ret); +return ret; + }
Do we need to clean up anything here, or is the buffer unlocked if we fail?
Quoted 182 lines
drivers/fpga/stratix10-soc.c new file +182
-0+ +return xfer_sz; +} + +/** +* s10_ops_write +* Send a FPGA image to privileged layers to write to the FPGA. When done +* sending, free all service layer buffers we allocated in write_init. +* @mgr: fpga manager +* @buf: fpga image buffer +* @count: size of buf in bytes +* Returns 0 for success or negative errno. +*/ +static int s10_ops_write (struct fpga_manager *mgr,const char *buf, +size_t count) +{ +struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +long wait_status; +int sent =0 ; +int ret =0 ; + +/* +* Loop waiting for buffers to be returned. When a buffer is returned, +* reuse it to send more data or free if if all data has been sent. +*/ +while (count >0 ||s10_free_buffer_count (mgr) !=NUM_SVC_BUFS ) { +reinit_completion (&priv->status_return_completion); + +if (count >0 ) { + sent =s10_send_buf (mgr, buf, count); +if (sent <0 ) +continue ; + + count -= sent; + buf += sent; + }else { +if (s10_free_buffers (mgr)) +return 0 ; + + ret =s10_svc_send_msg ( + priv,COMMAND_RECONFIG_DATA_CLAIM , +NULL ,0 ); +if (ret <0 ) +break ; + } + +/* +* If callback hasn't already happened, wait for buffers to be +* returned from service layer +*/ + wait_status =1 ;/* not timed out */ +if (!priv->status) + wait_status =wait_for_completion_interruptible_timeout ( + &priv->status_return_completion, +S10_BUFFER_TIMEOUT ); + +if (test_and_clear_bit (SVC_STATUS_RECONFIG_BUFFER_DONE , + &priv->status) || +test_and_clear_bit (SVC_STATUS_RECONFIG_BUFFER_SUBMITTED , + &priv->status)) { + ret =0 ; +continue ; + } + +if (test_and_clear_bit (SVC_STATUS_RECONFIG_ERROR , + &priv->status)) { +dev_err (dev,"ERROR - giving up - SVC_STATUS_RECONFIG_ERROR\n" ); + ret = -EFAULT ; +break ; + } + +if (!wait_status) { +dev_err (dev,"timeout waiting for svc layer buffers\n" ); + ret = -ETIMEDOUT ; +break ; + } +if (wait_status <0 ) { + ret = wait_status; +dev_err (dev, +"error (%d) waiting for svc layer buffers\n" , + ret); +break ; + } + } + +if (!s10_free_buffers (mgr)) +dev_err (dev,"%s not all buffers were freed\n" , __func__); + +return ret; +} + +/** +* s10_ops_write_complete +* Wait for FPGA configuration to be done +* @mgr: fpga manager +* @info: fpga image info +* Returns 0 for success negative errno. +*/ +static int s10_ops_write_complete (struct fpga_manager *mgr, +struct fpga_image_info *info) +{ +struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +unsigned long timeout; +int ret; + + timeout =usecs_to_jiffies (info->config_complete_timeout_us); + +do { +reinit_completion (&priv->status_return_completion); + + ret =s10_svc_send_msg (priv,COMMAND_RECONFIG_STATUS ,NULL ,0 ); +if (ret <0 ) +break ; + + ret =wait_for_completion_interruptible_timeout ( + &priv->status_return_completion, timeout); +if (!ret) { +dev_err (dev, +"timeout waiting for RECONFIG_COMPLETED\n" ); + ret = -ETIMEDOUT ; +break ; + } +if (ret <0 ) { +dev_err (dev, +"error (%d) waiting for RECONFIG_COMPLETED\n" , + ret); +break ; + } +/* Not error or timeout, so ret is # of jiffies until timeout */ + timeout = ret; + ret =0 ; + +if (test_and_clear_bit (SVC_STATUS_RECONFIG_COMPLETED , + &priv->status)) +break ; + +if (test_and_clear_bit (SVC_STATUS_RECONFIG_ERROR , + &priv->status)) { +dev_err (dev,"ERROR - giving up - SVC_STATUS_RECONFIG_ERROR\n" ); + ret = -EFAULT ; +break ; + } + }while (1 ); + +stratix10_svc_done (priv->chan); + +return ret; +} + +static enum fpga_mgr_states s10_ops_state (struct fpga_manager *mgr) +{ +return FPGA_MGR_STATE_UNKNOWN ; +} + +static const struct fpga_manager_ops s10_ops = { + .state = s10_ops_state, + .write_init = s10_ops_write_init, + .write = s10_ops_write, + .write_complete = s10_ops_write_complete, +}; + +static int s10_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct s10_priv *priv; +struct fpga_manager *mgr; +int ret; + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->client.dev = dev; + priv->client.receive_cb = s10_receive_callback; + priv->client.priv = priv; + + priv->chan =stratix10_svc_request_channel_byname (&priv->client, +SVC_CLIENT_FPGA ); +if (IS_ERR (priv->chan)) { + dev_err(dev, "couldn't get service channel (%s)\n",
drivers/fpga/stratix10-soc.c line 476
Quoted 10 lines
drivers/fpga/stratix10-soc.c new file +10
-0+ SVC_CLIENT_FPGA); +return PTR_ERR (priv->chan); + } + +init_completion (&priv->status_return_completion); + + mgr =fpga_mgr_create (dev,"Stratix10 SOC FPGA Manager" , + &s10_ops, priv); +if (!mgr) +return -ENOMEM ;
Does this release the channel above?
Quoted 78 lines
drivers/fpga/stratix10-soc.c new file +77
-1+ + ret =fpga_mgr_register (mgr); +if (ret) { +dev_err (dev,"unable to register FPGA manager\n" ); +stratix10_svc_free_channel (priv->chan); +fpga_mgr_free (mgr); +return ret; + } + +platform_set_drvdata (pdev, mgr); + +return ret; +} + +static int s10_remove (struct platform_device *pdev) +{ +struct fpga_manager *mgr =platform_get_drvdata (pdev); +struct s10_priv *priv = mgr->priv; + +fpga_mgr_unregister (mgr); +stratix10_svc_free_channel (priv->chan); + +return 0 ; +} + +static const struct of_device_id s10_of_match[] = { + { .compatible ="intel,stratix10-soc-fpga-mgr" , }, + {}, +}; + +MODULE_DEVICE_TABLE (of, s10_of_match); + +static struct platform_driver s10_driver = { + .probe = s10_probe, + .remove = s10_remove, + .driver = { + .name ="Stratix10 SoC FPGA manager" , + .of_match_table =of_match_ptr (s10_of_match), + }, +}; + +static int __init s10_init (void ) +{ +struct device_node *fw_np; +struct device_node *np; +int ret; + + fw_np =of_find_node_by_name (NULL ,"svc" ); +if (!fw_np) +return -ENODEV ; + + np =of_find_matching_node (fw_np, s10_of_match); +if (!np) { +of_node_put (fw_np); +return -ENODEV ; + } + +of_node_put (np); + ret =of_platform_populate (fw_np, s10_of_match,NULL ,NULL ); +of_node_put (fw_np); +if (ret) +return ret; + +return platform_driver_register (&s10_driver); +} + +static void __exit s10_exit(void) +{ +return platform_driver_unregister (&s10_driver); +} + +module_init (s10_init); +module_exit (s10_exit); + +MODULE_AUTHOR ("Alan Tull <[email protected]>" ); +MODULE_DESCRIPTION ("Intel Stratix 10 SOC FPGA Manager" ); +MODULE_LICENSE ("GPL v2" ); --
Quoted 2 lines
2.7.4
Cheers,
Moritz
Re: [PATCHv6 6/8] fpga: add intel stratix10 soc fpga manager driver
Quoted 4 lines · Moritz Fischer
Hi Richard + Alan,
couple of small stuff inline. Sorry for the super late reply.
Hi Moritz,
Thanks for the review comments!
Quoted 10 lines · On Tue, Jul 3, 2018 at 7:46 AM, <[email protected]> wrote:
Quoted 9 lines
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.
Signed-off-by Alan Tull <[email protected]>Signed-off-by Richard Gong <[email protected]>
...
Quoted 4 lines
Quoted 4 lines
drivers/fpga/stratix10-soc.c new file +4
-0+static int s10_svc_send_msg (struct s10_priv *priv, +enum stratix10_svc_command_code command, +void *payload,u32 payload_length) +{
Quoted 8 lines
drivers/fpga/stratix10-soc.c line 54
Quoted 6 lines
drivers/fpga/stratix10-soc.c new file +6
-0+struct stratix10_svc_chan *chan = priv->chan; +struct stratix10_svc_client_msg msg; +int ret; + +pr_debug ("%s cmd=%d payload=%p legnth=%d\n" , + __func__, command, payload, payload_length);Can we make those
dev_dbg()? Or do we not have a device available?
It's easy to get client dev:and it's worth doing by adding:
struct device *dev = priv->client.dev;
Quoted 11 lines
Quoted 11 lines
drivers/fpga/stratix10-soc.c new file +11
-0+ + msg.command = command; + msg.payload = payload; + msg.payload_length = payload_length; + + ret =stratix10_svc_send (chan, &msg); +pr_debug ("stratix10_svc_send returned status %d\n" , ret); + +return ret; +} +
...
Quoted 25 lines
Quoted 13 lines
drivers/fpga/stratix10-soc.c new file +13
-0+/** +* s10_ops_write_init +* Prepare for FPGA reconfiguration by requesting partial reconfig and +* allocating buffers from the service layer. +* @mgr: fpga manager +* @info: fpga image info +* @buf: fpga image buffer +* @count: size of buf in bytes +*/ +static int s10_ops_write_init (struct fpga_manager *mgr, +struct fpga_image_info *info, +const char *buf,size_t count) +{drivers/fpga/stratix10-soc.c line 198
Quoted 10 lines
drivers/fpga/stratix10-soc.c new file +10
-0+struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +struct stratix10_svc_command_reconfig_payload payload; +char *kbuf; +uint i; +int ret; + + payload.flags =0 ; +if (info->flags &FPGA_MGR_PARTIAL_RECONFIG ) { +dev_info (dev,"Requesting partial reconfiguration.\n" );Do we need these to be
_info()or can the by_dbg()? The Framework already prints ("Writing blah.foo to ...")
Quoted 4 lines
drivers/fpga/stratix10-soc.c line 201
Quoted 3 lines
drivers/fpga/stratix10-soc.c new file +3
-0+ payload.flags |=BIT (COMMAND_RECONFIG_FLAG_PARTIAL ); + }else { +dev_info (dev,"Requesting full reconfiguration.\n" );Same here.
These can go away or be dgb. fpga-mgr.c has dev_info(dev, "writing %s to %s\n", image_name, mgr->name); in fpga_mgr_firmware_load().
Maybe at some point it would be better to have the "Reauesting full/partial reconfiguration" messages as dbg messages in fpga-mgr.c. Some of the fpga manager drivers have one message or the other only because they only handle full or partial, so it's an error message in their case.such as "Partial reconfiguration not supported."
Quoted 76 lines
Quoted 76 lines
drivers/fpga/stratix10-soc.c new file +76
-0+ } + +reinit_completion (&priv->status_return_completion); + ret =s10_svc_send_msg (priv,COMMAND_RECONFIG , + &payload,sizeof (payload)); +if (ret <0 ) + goto init_done; + + ret =wait_for_completion_interruptible_timeout ( + &priv->status_return_completion,S10_RECONFIG_TIMEOUT ); +if (!ret) { +dev_err (dev,"timeout waiting for RECONFIG_REQUEST\n" ); + ret = -ETIMEDOUT ; + goto init_done; + } +if (ret <0 ) { +dev_err (dev,"error (%d) waiting for RECONFIG_REQUEST\n" , ret); + goto init_done; + } + + ret =0 ; +if (!test_and_clear_bit (SVC_STATUS_RECONFIG_REQUEST_OK , + &priv->status)) { + ret = -ETIMEDOUT ; + goto init_done; + } + +/* Allocate buffers from the service layer's pool. */ +for (i =0 ; i <NUM_SVC_BUFS ; i++) { + kbuf =stratix10_svc_allocate_memory (priv->chan,SVC_BUF_SIZE ); +if (!kbuf) { +s10_free_buffers (mgr); + ret = -ENOMEM ; + goto init_done; + } + + priv->svc_bufs[i].buf = kbuf; + priv->svc_bufs[i].lock =0 ; + } + +init_done: +stratix10_svc_done (priv->chan); +return ret; +} + +/** +* s10_send_buf +* Send a buffer to the service layer queue +* @mgr: fpga manager struct +* @buf: fpga image buffer +* @count: size of buf in bytes +* Returns # of bytes transferred or -ENOBUFS if the all the buffers are in use +* or if the service queue is full. Never returns 0. +*/ +static int s10_send_buf (struct fpga_manager *mgr,const char *buf,size_t count) +{ +struct s10_priv *priv = mgr->priv; +struct device *dev = priv->client.dev; +void *svc_buf; +size_t xfer_sz; +int ret; +uint i; + +/* get/lock a buffer that that's not being used */ +for (i =0 ; i <NUM_SVC_BUFS ; i++) +if (!test_and_set_bit_lock (SVC_BUF_LOCK , + &priv->svc_bufs[i].lock)) +break ; + +if (i ==NUM_SVC_BUFS ) +return -ENOBUFS ; + + xfer_sz = count <SVC_BUF_SIZE ? count :SVC_BUF_SIZE ; + + svc_buf = priv->svc_bufs[i].buf; +memcpy (svc_buf, buf, xfer_sz);
Quoted 8 lines
drivers/fpga/stratix10-soc.c line 284
Quoted 7 lines
drivers/fpga/stratix10-soc.c new file +7
-0+ ret =s10_svc_send_msg (priv,COMMAND_RECONFIG_DATA_SUBMIT , + svc_buf, xfer_sz); +if (ret <0 ) { +dev_err (dev, +"Error while sending data to service layer (%d)" , ret); +return ret; + }Do we need to clean up anything here, or is the buffer unlocked if we fail?
Yes, need to unlock buff if s10_svc_send_msg() fails.
clear_bit_unlock(SVC_BUF_LOCK,
&priv->svc_bufs[i].lock);Quoted 3 lines
Quoted 3 lines
drivers/fpga/stratix10-soc.c new file +3
-0+ +return xfer_sz; +}
...
Quoted 22 lines
Quoted 22 lines
drivers/fpga/stratix10-soc.c new file +22
-0+static int s10_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct s10_priv *priv; +struct fpga_manager *mgr; +int ret; + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->client.dev = dev; + priv->client.receive_cb = s10_receive_callback; + priv->client.priv = priv; + + priv->chan =stratix10_svc_request_channel_byname (&priv->client, +SVC_CLIENT_FPGA ); +if (IS_ERR (priv->chan)) { +dev_err (dev,"couldn't get service channel (%s)\n" , +SVC_CLIENT_FPGA ); +return PTR_ERR (priv->chan); + }
Quoted 8 lines
drivers/fpga/stratix10-soc.c line 476
Quoted 7 lines
drivers/fpga/stratix10-soc.c new file +7
-0+ +init_completion (&priv->status_return_completion); + + mgr =fpga_mgr_create (dev,"Stratix10 SOC FPGA Manager" , + &s10_ops, priv); +if (!mgr) +return -ENOMEM ;Does this release the channel above?
We need to call "stratix10_svc_free_channel(priv->chan);" here if fpga_mgr_create() fails.
Quoted 13 lines
Quoted 13 lines
drivers/fpga/stratix10-soc.c new file +13
-0+ + ret =fpga_mgr_register (mgr); +if (ret) { +dev_err (dev,"unable to register FPGA manager\n" ); +stratix10_svc_free_channel (priv->chan); +fpga_mgr_free (mgr); +return ret; + } + +platform_set_drvdata (pdev, mgr); + +return ret; +}
PATCH v6 7/8 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 Stratix10 Service Layer
---
v2: this patch is added in patch set version 2
v3: no change
v4: s/CONFIG_INTEL_SERVICE/CONFIG_STRATIX10_SERVICE/
add CONFIG_OF_FPGA_REGION=y s/Intel/Stratix10/ in subject line
v5: no change
v6: no change
--- arch/arm64/configs/defconfig | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/configs/defconfig +6 -0
@@ -188,6 +188,7 @@ CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_NBD=m CONFIG_VIRTIO_BLK=y CONFIG_BLK_DEV_NVME=m +CONFIG_STRATIX10_SERVICE=y CONFIG_SRAM=y CONFIG_EEPROM_AT25=m # CONFIG_SCSI_PROC_FS is not set
@@ -636,6 +637,11 @@ CONFIG_PHY_TEGRA_XUSB=y CONFIG_QCOM_L2_PMU=y CONFIG_QCOM_L3_PMU=y CONFIG_MESON_EFUSE=m +CONFIG_FPGA=y +CONFIG_FPGA_MGR_STRATIX10_SOC=y +CONFIG_FPGA_REGION=y +CONFIG_FPGA_BRIDGE=y +CONFIG_OF_FPGA_REGION=y CONFIG_QCOM_QFPROM=y CONFIG_ROCKCHIP_EFUSE=y CONFIG_UNIPHIER_EFUSE=y
Signature · 1 line
2.7.4
PATCH v6 8/8 Documentation: driver-api: add stratix10 service layer
In reply to [email protected]From: Richard Gong <[email protected]>
Add new file stratix10-svc.rst
Add stratix10-svc.rst to driver-api/index.rst
---
v5: this patch is added in patch set version 5
v6: no change
--- Documentation/driver-api/index.rst | 1 + Documentation/driver-api/stratix10-svc.rst | 32 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Documentation/driver-api/stratix10-svc.rst
Documentation/driver-api/index.rst +1 -0
@@ -53,6 +53,7 @@ available subsections can be seen below. slimbus soundwire/index fpga/index + stratix10-svc .. only:: subproject and html
Documentation/driver-api/stratix10-svc.rst new file +32 -0
@@ -0,0 +1,32 @@ + +Intel Stratix10 SoC Service Layer +================================= + +Some features of the Intel Stratix10 SoC require a level of privilege +higher than the kernel is granted. Such secure features include +FPGA programming. 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 SoC service layer provides an in kernel API 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). + +.. kernel-doc:: include/linux/stratix10-svc-client.h + :functions: stratix10_svc_command_code + +.. kernel-doc:: include/linux/stratix10-svc-client.h + :functions: stratix10_svc_client_msg + +.. kernel-doc:: include/linux/stratix10-svc-client.h + :functions: stratix10_svc_command_reconfig_payload + +.. kernel-doc:: include/linux/stratix10-svc-client.h + :functions: stratix10_svc_cb_data + +.. kernel-doc:: include/linux/stratix10-svc-client.h + :functions: stratix10_svc_client + +.. kernel-doc:: drivers/misc/stratix10-svc.c + :export:
Signature · 1 line
2.7.4