Skip to contentSkip to conversation

add the FPGA Device Feature List (DFL) EMIF support

PATCH Superseded Xu Yilun 3 participants 7 messages Sep 16, 2020 – Sep 21, 2020

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Xu Yilun

author maintainer
#0 lore raw

PATCH v2 1/1 add the FPGA Device Feature List (DFL) EMIF support

The patchsets "Modularization of DFL private feature drivers" & "add dfl bus support to MODULE_DEVICE_TABLE()" are all queued to linux-next. So there is no dependency now.

The driver supports the EMIF controller on Intel Programmable Acceleration Card (PAC). The controller manages the on-board memory of the PCIe card.

Xu Yilun (1):
memory: dfl-emif: add the DFL EMIF private feature driver

 .../ABI/testing/sysfs-bus-dfl-devices-emif         |  25 +++
 drivers/memory/Kconfig                             |   9 +
 drivers/memory/Makefile                            |   2 +
 drivers/memory/dfl-emif.c                          | 207 +++++++++++++++++++++
 4 files changed, 243 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 drivers/memory/dfl-emif.c
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v2 1/1 memory: dfl-emif: add the DFL EMIF private feature driver

This driver is for the EMIF private feature implemented under FPGA Device Feature List (DFL) framework. It is used to expose memory interface status information as well as memory clearing control.

The purpose of memory clearing block is to zero out all private memory when FPGA is to be reprogrammed. This gives users a reliable method to prevent potential data leakage.

---
v2: Adjust the position of this driver in Kconfig.
Improves the name of the Kconfig option.
Change the include dfl-bus.h to dfl.h, cause the previous patchset
renames the file.
Some minor fixes and comment improvement.

---
 .../ABI/testing/sysfs-bus-dfl-devices-emif         |  25 +++
 drivers/memory/Kconfig                             |   9 +
 drivers/memory/Makefile                            |   2 +
 drivers/memory/dfl-emif.c                          | 207 +++++++++++++++++++++
 4 files changed, 243 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 drivers/memory/dfl-emif.c
Documentation/ABI/testing/sysfs-bus-dfl-devices-emif new file +25 -0
new file mode 100644
index 0000000..56f97dc
@@ -0,0 +1,25 @@
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_cal_fail
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the calibration failed on this
+		memory interface. "1" for calibration failure, "0" for OK.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_init_done
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the initialization completed on
+		this memory interface. "1" for initialization complete, "0"
+		for not yet.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_clear
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Write-only. Writing "1" to this file will zero out all memory
+		data in this memory interface. Writing of other values is
+		invalid.
+		Format: %u
drivers/memory/Kconfig +9 -0
index 8072204..8dc819f 100644
@@ -136,6 +136,15 @@ config TI_EMIF_SRAM
 	  sequence so this driver provides several relocatable PM functions
 	  for the SoC PM code to use.
 
+config FPGA_DFL_EMIF
+	tristate "FPGA DFL EMIF Driver"
+	depends on FPGA_DFL && HAS_IOMEM
+	help
+	  This driver is for the EMIF private feature implemented under
+	  FPGA Device Feature List (DFL) framework. It is used to expose
+	  memory interface status information as well as memory clearing
+	  control.
+
 config MVEBU_DEVBUS
 	bool "Marvell EBU Device Bus Controller"
 	default y if PLAT_ORION
drivers/memory/Makefile +2 -0
index e71cf7b..0afbf39 100644
@@ -39,3 +39,5 @@ $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE
 
 targets += emif-asm-offsets.s
 clean-files += ti-emif-asm-offsets.h
+
+obj-$(CONFIG_FPGA_DFL_EMIF)	+= dfl-emif.o
drivers/memory/dfl-emif.c new file +207 -0

207 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v2] memory: dfl-emif: add the DFL EMIF private feature driver

Thank you for the patch! Yet something to improve:

Hi Xu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20200915]
[also build test ERROR on v5.9-rc5]
[cannot apply to linux/master linus/master v5.9-rc5 v5.9-rc4 v5.9-rc3] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xu-Yilun/memory-dfl-emif-add-the-DFL-EMIF-private-feature-driver/20200916-134300
base:    6b02addb1d1748d21dd1261e46029b264be4e5a0
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

>> drivers/memory/dfl-emif.c:10:10: fatal error: linux/fpga/dfl.h: No such file or directory
      10 | #include <linux/fpga/dfl.h>
         |          ^~~~~~~~~~~~~~~~~~

compilation terminated.

# https://github.com/0day-ci/linux/commit/3d9bcf23589d9e5a2409f2d939d3303eea7852c3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Xu-Yilun/memory-dfl-emif-add-the-DFL-EMIF-private-feature-driver/20200916-134300 git checkout 3d9bcf23589d9e5a2409f2d939d3303eea7852c3
vim +10 drivers/memory/dfl-emif.c

  > 10	#include <linux/fpga/dfl.h>
    11	#include <linux/io.h>
    12	#include <linux/iopoll.h>
    13	#include <linux/io-64-nonatomic-lo-hi.h>
    14	#include <linux/kernel.h>
    15	#include <linux/module.h>
    16	#include <linux/spinlock.h>
    17	#include <linux/types.h>
    18	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw

Re: [PATCH v2] memory: dfl-emif: add the DFL EMIF private feature driver

In reply to Xu Yilun
Quoted 81 lines · Xu Yilun

This driver is for the EMIF private feature implemented under FPGA Device Feature List (DFL) framework. It is used to expose memory interface status information as well as memory clearing control.

The purpose of memory clearing block is to zero out all private memory when FPGA is to be reprogrammed. This gives users a reliable method to prevent potential data leakage.

---
v2: Adjust the position of this driver in Kconfig.
Improves the name of the Kconfig option.
Change the include dfl-bus.h to dfl.h, cause the previous patchset
renames the file.
Some minor fixes and comment improvement.

---
 .../ABI/testing/sysfs-bus-dfl-devices-emif         |  25 +++
 drivers/memory/Kconfig                             |   9 +
 drivers/memory/Makefile                            |   2 +
 drivers/memory/dfl-emif.c                          | 207 +++++++++++++++++++++
 4 files changed, 243 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 drivers/memory/dfl-emif.c
Documentation/ABI/testing/sysfs-bus-dfl-devices-emif new file +25 -0
new file mode 100644
index 0000000..56f97dc
@@ -0,0 +1,25 @@
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_cal_fail
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the calibration failed on this
+		memory interface. "1" for calibration failure, "0" for OK.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_init_done
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the initialization completed on
+		this memory interface. "1" for initialization complete, "0"
+		for not yet.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_clear
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Write-only. Writing "1" to this file will zero out all memory
+		data in this memory interface. Writing of other values is
+		invalid.
+		Format: %u
drivers/memory/Kconfig +9 -0
index 8072204..8dc819f 100644
@@ -136,6 +136,15 @@ config TI_EMIF_SRAM
 	  sequence so this driver provides several relocatable PM functions
 	  for the SoC PM code to use.
 
+config FPGA_DFL_EMIF
+	tristate "FPGA DFL EMIF Driver"
+	depends on FPGA_DFL && HAS_IOMEM
+	help
+	  This driver is for the EMIF private feature implemented under
+	  FPGA Device Feature List (DFL) framework. It is used to expose
+	  memory interface status information as well as memory clearing
+	  control.
+
 config MVEBU_DEVBUS
 	bool "Marvell EBU Device Bus Controller"
 	default y if PLAT_ORION
drivers/memory/Makefile +0 -0
index e71cf7b..0afbf39 100644

drivers/memory/Makefile $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE · line 43

Quoted 5 lines
drivers/memory/Makefile +2 -0
@@ -39,3 +39,5 @@ $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE
 
 targets += emif-asm-offsets.s
 clean-files += ti-emif-asm-offsets.h
+
+obj-$(CONFIG_FPGA_DFL_EMIF)	+= dfl-emif.o

It there is going to be a resend: this as well has to go next to CONFIG_TI_EMIF_SRAM.

Otherwise I will fix it up while applying.

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH v2] memory: dfl-emif: add the DFL EMIF private feature driver

Quoted 83 lines · Krzysztof Kozlowski
Quoted 82 lines · Xu Yilun

This driver is for the EMIF private feature implemented under FPGA Device Feature List (DFL) framework. It is used to expose memory interface status information as well as memory clearing control.

The purpose of memory clearing block is to zero out all private memory when FPGA is to be reprogrammed. This gives users a reliable method to prevent potential data leakage.

---
v2: Adjust the position of this driver in Kconfig.
Improves the name of the Kconfig option.
Change the include dfl-bus.h to dfl.h, cause the previous patchset
renames the file.
Some minor fixes and comment improvement.

---
 .../ABI/testing/sysfs-bus-dfl-devices-emif         |  25 +++
 drivers/memory/Kconfig                             |   9 +
 drivers/memory/Makefile                            |   2 +
 drivers/memory/dfl-emif.c                          | 207 +++++++++++++++++++++
 4 files changed, 243 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-dfl-devices-emif
 create mode 100644 drivers/memory/dfl-emif.c
Documentation/ABI/testing/sysfs-bus-dfl-devices-emif new file +25 -0
new file mode 100644
index 0000000..56f97dc
@@ -0,0 +1,25 @@
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_cal_fail
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the calibration failed on this
+		memory interface. "1" for calibration failure, "0" for OK.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_init_done
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Read-only. It indicates if the initialization completed on
+		this memory interface. "1" for initialization complete, "0"
+		for not yet.
+		Format: %u
+
+What:		/sys/bus/dfl/devices/dfl_dev.X/infX_clear
+Date:		Sep 2020
+KernelVersion:	5.10
+Contact:	Xu Yilun <[email protected]>
+Description:	Write-only. Writing "1" to this file will zero out all memory
+		data in this memory interface. Writing of other values is
+		invalid.
+		Format: %u
drivers/memory/Kconfig +9 -0
index 8072204..8dc819f 100644
@@ -136,6 +136,15 @@ config TI_EMIF_SRAM
 	  sequence so this driver provides several relocatable PM functions
 	  for the SoC PM code to use.
 
+config FPGA_DFL_EMIF
+	tristate "FPGA DFL EMIF Driver"
+	depends on FPGA_DFL && HAS_IOMEM
+	help
+	  This driver is for the EMIF private feature implemented under
+	  FPGA Device Feature List (DFL) framework. It is used to expose
+	  memory interface status information as well as memory clearing
+	  control.
+
 config MVEBU_DEVBUS
 	bool "Marvell EBU Device Bus Controller"
 	default y if PLAT_ORION
drivers/memory/Makefile +0 -0
index e71cf7b..0afbf39 100644
@@ -39,3 +39,5 @@ $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE
 
Quoted 8 lines

drivers/memory/Makefile $(obj)/ti-emif-asm-offsets.h: $(obj)/emif-asm-offsets.s FORCE · line 43

Quoted 4 lines
drivers/memory/Makefile +2 -0
 targets += emif-asm-offsets.s
 clean-files += ti-emif-asm-offsets.h
+
+obj-$(CONFIG_FPGA_DFL_EMIF)	+= dfl-emif.o

It there is going to be a resend: this as well has to go next to CONFIG_TI_EMIF_SRAM.

Otherwise I will fix it up while applying.

This patch depends on latest fpga/dfl changes which I see are mixed with other changes on FPGA drivers tree so they cannot be provided independently from others as a stable tag. Unless Moritz can rebase his tree and put them on separate branch.

Your "Modularization of DFL private feature drivers" should be sent along with this here, so all the maintainers see the dependencies and they can apply things for cross-merging at the beginning of the process.

Therefore please send a v3 of this patch with the fix above and let's apply it via Moritz's tree.

Best regards,
Krzysztof

#5 lore raw
In reply to Xu Yilun
Quoted 3 lines · Xu Yilun

The patchsets "Modularization of DFL private feature drivers" & "add dfl bus support to MODULE_DEVICE_TABLE()" are all queued to linux-next. So there is no dependency now.

What do you mean there is no dependency? The DFL is required here and it won't compile without these patches:

CC drivers/memory/dfl-emif.o
../drivers/memory/dfl-emif.c:10:10: fatal error: linux/fpga/dfl.h: No such file or directory

 #include <linux/fpga/dfl.h>
          ^~~~~~~~~~~~~~~~~~

compilation terminated.

This simply cannot go in without dependency.

I described in your v1 submission what is needed here:
"Anyway I will need a stable tag with mentioned dependencies or this will wait for the next cycle."

Best regards,
Krzysztof

author maintainer
#6 lore raw
Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Xu Yilun

The patchsets "Modularization of DFL private feature drivers" & "add dfl bus support to MODULE_DEVICE_TABLE()" are all queued to linux-next. So there is no dependency now.

What do you mean there is no dependency? The DFL is required here and it won't compile without these patches:

Sorry, actually I mean the dependencies have been queued to linux-next. I didn't realize patch dependency problems across maintainer's trees.

I'll try to contact Moritz if this patch could be applied via his tree.

Thanks,
Yilun

Quoted 15 lines

CC drivers/memory/dfl-emif.o
../drivers/memory/dfl-emif.c:10:10: fatal error: linux/fpga/dfl.h: No such file or directory

 #include <linux/fpga/dfl.h>
          ^~~~~~~~~~~~~~~~~~

compilation terminated.

This simply cannot go in without dependency.

I described in your v1 submission what is needed here:
"Anyway I will need a stable tag with mentioned dependencies or this will wait for the next cycle."

Best regards,
Krzysztof