Generic WorkQueue Engine (GenWQE) device driver (v5)
Subsystems (2)
cover Generic WorkQueue Engine (GenWQE) device driver (v5)
The GenWQE device is a PCIe card used to acclerate different tasks. Since it is configurable, it can be adjusted to different purposes. Our initial task for the card is to do zlib style compression/decompression RFC1950, RFC1951, and RFC1952.
I kindly ask for your feedback on the code, such that I can do any change which helps me to get it integrated smoothly.
Frank Haverkamp (9):
Generic WorkQueue Engine (GenWQE) device driver (v4)
GenWQE: Remove option to select name
GenWQE: Remove obsolete constants
GenWQE: Rework comments
GenWQE: Move comments
GenWQE: Remove/rework module parameters
GenWQE: Start using sysfs attribute groups
GenWQE: Simplify sysfs buffer printouts
GenWQE: Increment driver internal version number
Documentation/ABI/testing/debugfs-driver-genwqe | 70 ++ Documentation/ABI/testing/sysfs-driver-genwqe | 55 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/genwqe/Kconfig | 13 + drivers/misc/genwqe/Makefile | 8 + drivers/misc/genwqe/card_base.c | 1203 ++++++++++++++++++ drivers/misc/genwqe/card_base.h | 570 +++++++++ drivers/misc/genwqe/card_ddcb.c | 1380 +++++++++++++++++++++ drivers/misc/genwqe/card_ddcb.h | 188 +++ drivers/misc/genwqe/card_debugfs.c | 579 +++++++++ drivers/misc/genwqe/card_dev.c | 1499 +++++++++++++++++++++++ drivers/misc/genwqe/card_sysfs.c | 290 +++++ drivers/misc/genwqe/card_utils.c | 983 +++++++++++++++ drivers/misc/genwqe/genwqe_driver.h | 75 ++ include/linux/genwqe/genwqe_card.h | 547 +++++++++ 16 files changed, 7462 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/debugfs-driver-genwqe create mode 100644 Documentation/ABI/testing/sysfs-driver-genwqe create mode 100644 drivers/misc/genwqe/Kconfig create mode 100644 drivers/misc/genwqe/Makefile create mode 100644 drivers/misc/genwqe/card_base.c create mode 100644 drivers/misc/genwqe/card_base.h create mode 100644 drivers/misc/genwqe/card_ddcb.c create mode 100644 drivers/misc/genwqe/card_ddcb.h create mode 100644 drivers/misc/genwqe/card_debugfs.c create mode 100644 drivers/misc/genwqe/card_dev.c create mode 100644 drivers/misc/genwqe/card_sysfs.c create mode 100644 drivers/misc/genwqe/card_utils.c create mode 100644 drivers/misc/genwqe/genwqe_driver.h create mode 100644 include/linux/genwqe/genwqe_card.h
PATCH 1/9 Generic WorkQueue Engine (GenWQE) device driver (v4)
The GenWQE card itself provides access to a generic work queue into which the work can be put, which should be executed, e.g. compression or decompression request, or whatever the card was configured to do.
Each request comes with a set of input data (ASV) and will produce some output data (ASIV). The request will also contain a sequence number, some timestamps and a command code/subcode plus some fields for hardware-/ software-interaction.
A request can contain references to blocks of memory. Since the card requires DMA-addresses of that memory, the driver provides two ways to solve that task:
1) The drivers mmap() will allocate some DMAable memory for the user. The driver has a lookup table such that the virtual userspace address can properly be replaced and checked.
2) The user allocates memory and the driver will pin/unpin that memory and setup a scatter gatherlist with matching DMA addresses.
Currently work requests are synchronous.
The genwqe driver has a user-space interface described in linux/include/genwqe/genwqe_card.h. There are several ioctls which can be used to talk to the driver.
In addition there are some sysfs entries where information can be exchanged with user-space. The sysfs interface is described in Documentation/ABI/testing/sysfs-driver-genwqe.
Now the driver has also a debugfs interface. This is described in Documentation/ABI/testing/debugfs-driver-genwqe.
Co-authors: Joerg-Stephan Vogt <[email protected]>,
Michael Jung <[email protected]>, Michael Ruettger <[email protected]>
--- Documentation/ABI/testing/debugfs-driver-genwqe | 57 + Documentation/ABI/testing/sysfs-driver-genwqe | 46 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/genwqe/Kconfig | 23 + drivers/misc/genwqe/Makefile | 8 + drivers/misc/genwqe/card_base.c | 1238 +++++++++++++++++++ drivers/misc/genwqe/card_base.h | 569 +++++++++ drivers/misc/genwqe/card_ddcb.c | 1380 +++++++++++++++++++++ drivers/misc/genwqe/card_ddcb.h | 188 +++ drivers/misc/genwqe/card_debugfs.c | 566 +++++++++ drivers/misc/genwqe/card_dev.c | 1499 +++++++++++++++++++++++ drivers/misc/genwqe/card_sysfs.c | 306 +++++ drivers/misc/genwqe/card_utils.c | 983 +++++++++++++++ drivers/misc/genwqe/genwqe_driver.h | 75 ++ include/linux/genwqe/genwqe_card.h | 559 +++++++++ 16 files changed, 7499 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/debugfs-driver-genwqe create mode 100644 Documentation/ABI/testing/sysfs-driver-genwqe create mode 100644 drivers/misc/genwqe/Kconfig create mode 100644 drivers/misc/genwqe/Makefile create mode 100644 drivers/misc/genwqe/card_base.c create mode 100644 drivers/misc/genwqe/card_base.h create mode 100644 drivers/misc/genwqe/card_ddcb.c create mode 100644 drivers/misc/genwqe/card_ddcb.h create mode 100644 drivers/misc/genwqe/card_debugfs.c create mode 100644 drivers/misc/genwqe/card_dev.c create mode 100644 drivers/misc/genwqe/card_sysfs.c create mode 100644 drivers/misc/genwqe/card_utils.c create mode 100644 drivers/misc/genwqe/genwqe_driver.h create mode 100644 include/linux/genwqe/genwqe_card.h
Documentation/ABI/testing/debugfs-driver-genwqe new file +57 -0
@@ -0,0 +1,57 @@ +What: /sys/kernel/debug/genwqe/genwqe<n>_card/ddcb_info +Date: Oct 2013 +Contact: [email protected] +Description: DDCB queue dump used for debugging queueing problems. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/curr_regs +Date: Oct 2013 +Contact: [email protected] +Description: Dump of the current error registers. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/curr_uid0 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID0 (unit id 0). + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/curr_uid1 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID1. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/curr_uid2 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID2. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/prev_regs +Date: Oct 2013 +Contact: [email protected] +Description: Dump of the error registers before the last reset of + the card occured. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/prev_uid0 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID0 before card was reset. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/prev_uid1 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID1 before card was reset. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/prev_uid2 +Date: Oct 2013 +Contact: [email protected] +Description: Internal chip state of UID2 before card was reset. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/info +Date: Oct 2013 +Contact: [email protected] +Description: Comprehensive summary of bitstream version and software + version. Used bitstream and bitstream clocking information. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/err_inject +Date: Oct 2013 +Contact: [email protected] +Description: Possibility to inject error cases to ensure that the drivers + error handling code works well.
Documentation/ABI/testing/sysfs-driver-genwqe new file +46 -0
46 lines not on this page · raw message
drivers/misc/Kconfig +1 -0
@@ -537,4 +537,5 @@ source "drivers/misc/carma/Kconfig" source "drivers/misc/altera-stapl/Kconfig" source "drivers/misc/mei/Kconfig" source "drivers/misc/vmw_vmci/Kconfig" +source "drivers/misc/genwqe/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -53,3 +53,4 @@ obj-$(CONFIG_INTEL_MEI) += mei/ obj-$(CONFIG_VMWARE_VMCI) += vmw_vmci/ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lattice-ecp3-config.o obj-$(CONFIG_SRAM) += sram.o +obj-$(CONFIG_GENWQE) += genwqe/
drivers/misc/genwqe/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +# +# IBM Accelerator Family 'GenWQE' +# + +menuconfig GENWQE + tristate "GenWQE PCIe Accelerator" + depends on PCI && 64BIT + select CRC_ITU_T + default n + help + Enables PCIe card driver for IBM GenWQE accelerators. + The user-space interface is described in + include/linux/genwqe/genwqe_card.h. + +if GENWQE + +config GENWQE_DEVNAME + string "Name for sysfs and device nodes" + default "genwqe" + help + Select alternate name for sysfs and device nodes. + +endif
drivers/misc/genwqe/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Makefile for GenWQE driver +# + +# card driver +obj-$(CONFIG_GENWQE) := genwqe_card.o +genwqe_card-objs := card_base.o card_dev.o card_ddcb.o card_sysfs.o \ + card_debugfs.o card_utils.o
drivers/misc/genwqe/card_base.c new file +1238 -0
1,238 lines not on this page · raw message
drivers/misc/genwqe/card_base.h new file +569 -0
569 lines not on this page · raw message
drivers/misc/genwqe/card_ddcb.c new file +1380 -0
1,050 lines not on this page · raw message
drivers/misc/genwqe/card_ddcb.h new file +188 -0
188 lines not on this page · raw message
drivers/misc/genwqe/card_debugfs.c new file +566 -0
566 lines not on this page · raw message
drivers/misc/genwqe/card_dev.c new file +1499 -0
1,499 lines not on this page · raw message
drivers/misc/genwqe/card_sysfs.c new file +306 -0
306 lines not on this page · raw message
drivers/misc/genwqe/card_utils.c new file +983 -0
983 lines not on this page · raw message
drivers/misc/genwqe/genwqe_driver.h new file +75 -0
75 lines not on this page · raw message
include/linux/genwqe/genwqe_card.h new file +559 -0
559 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.1
Part of the diff is not shown here. View the raw message.
Greg KH
maintainerRe: [PATCH 1/9] Generic WorkQueue Engine (GenWQE) device driver (v4)
drivers/misc/genwqe/Kconfig line 23
Quoted 9 lines · Frank Haverkamp
drivers/misc/genwqe/Kconfig new file +9
-0+if GENWQE + +config GENWQE_DEVNAME + string "Name for sysfs and device nodes" + default "genwqe" + help + Select alternate name for sysfs and device nodes. + +endif
Why is this still here? I thought you said you had removed this?
Re: [PATCH 1/9] Generic WorkQueue Engine (GenWQE) device driver (v4)
Am Montag, den 04.11.2013, 14:12 -0800 schrieb Greg KH:
Quoted 13 lines · Frank Haverkamp
drivers/misc/genwqe/Kconfig line 23
Quoted 9 lines
drivers/misc/genwqe/Kconfig new file +9
-0+if GENWQE + +config GENWQE_DEVNAME + string "Name for sysfs and device nodes" + default "genwqe" + help + Select alternate name for sysfs and device nodes. + +endifWhy is this still here? I thought you said you had removed this?
I posted my original v4 version of the code plus the requested changes on top of it. But I think, I should rather follow Ryans suggestion how to split the code into multiple patches. See his last mail. So I will need to spend some time today to get the patch into the form he suggested.
Regards
Frank
PATCH 2/9 GenWQE: Remove option to select name
In reply to Frank HaverkampSelecting interface names via configuration option is obsolete.
--- drivers/misc/genwqe/Kconfig | 14 ++------------ include/linux/genwqe/genwqe_card.h | 6 +----- 2 files changed, 3 insertions(+), 17 deletions(-)
drivers/misc/genwqe/Kconfig +2 -12
@@ -9,15 +9,5 @@ menuconfig GENWQE default n help Enables PCIe card driver for IBM GenWQE accelerators. - The user-space interface is described in - include/linux/genwqe/genwqe_card.h. - -if GENWQE - -config GENWQE_DEVNAME - string "Name for sysfs and device nodes" - default "genwqe" - help - Select alternate name for sysfs and device nodes. - -endif + The user-space interface is described in + include/linux/genwqe/genwqe_card.h.
include/linux/genwqe/genwqe_card.h +1 -5
@@ -41,11 +41,7 @@#endif /* Basename of sysfs, debugfs and /dev interfaces */ -#if defined(CONFIG_GENWQE_DEVNAME ) -# define GENWQE_DEVNAME CONFIG_GENWQE_DEVNAME -#else -# define GENWQE_DEVNAME "genwqe" -#endif +#define GENWQE_DEVNAME "genwqe"#define GENWQE_TYPE_ALTERA_230 0x00/* GenWQE4 Stratix-IV-230 */ #define GENWQE_TYPE_ALTERA_530 0x01/* GenWQE4 Stratix-IV-530 */
Signature · 1 line
1.7.1
Re: [PATCH 2/9] GenWQE: Remove option to select name
Quoted 1 line · Frank Haverkamp
Selecting interface names via configuration option is obsolete.
Don't do this. You are adding completely new code, so there is no reason to post a patch full of code that is known to be incorrect, followed by a set of patches fixing things. Just post the correct code to start with. This makes the git history cleaner, and makes the code easier to review.
You can use tools like git interactive rebase to split your work into multiple patches. It should be quite easy for this because you mostly just want to break down things to the file level, so even:
git reset --soft <your-first-commit>
and then manually staging and commiting things from there would probably be enough. You can use git add --interactive to stage individual file hunks if you want to break things down further.
~Ryan
Quoted 47 lines
Signed-off-by Frank Haverkamp <[email protected]>--- drivers/misc/genwqe/Kconfig | 14 ++------------ include/linux/genwqe/genwqe_card.h | 6 +----- 2 files changed, 3 insertions(+), 17 deletions(-)drivers/misc/genwqe/Kconfig +2
-12@@ -9,15 +9,5 @@ menuconfig GENWQE default n help Enables PCIe card driver for IBM GenWQE accelerators. - The user-space interface is described in - include/linux/genwqe/genwqe_card.h. - -if GENWQE - -config GENWQE_DEVNAME - string "Name for sysfs and device nodes" - default "genwqe" - help - Select alternate name for sysfs and device nodes. - -endif + The user-space interface is described in + include/linux/genwqe/genwqe_card.h.include/linux/genwqe/genwqe_card.h +1
-5@@ -41,11 +41,7 @@#endif /* Basename of sysfs, debugfs and /dev interfaces */ -#if defined(CONFIG_GENWQE_DEVNAME ) -# define GENWQE_DEVNAME CONFIG_GENWQE_DEVNAME -#else -# define GENWQE_DEVNAME "genwqe" -#endif +#define GENWQE_DEVNAME "genwqe"#define GENWQE_TYPE_ALTERA_230 0x00/* GenWQE4 Stratix-IV-230 */ #define GENWQE_TYPE_ALTERA_530 0x01/* GenWQE4 Stratix-IV-530 */
Re: [PATCH 2/9] GenWQE: Remove option to select name
Hi Ryan,
Am Dienstag, den 05.11.2013, 08:55 +1100 schrieb Ryan Mallon:
Quoted 8 lines · Frank Haverkamp
Quoted 1 line
Selecting interface names via configuration option is obsolete.
Don't do this. You are adding completely new code, so there is no reason to post a patch full of code that is known to be incorrect, followed by a set of patches fixing things. Just post the correct code to start with. This makes the git history cleaner, and makes the code easier to review.
Agreed.
Quoted 9 lines
You can use tools like git interactive rebase to split your work into multiple patches. It should be quite easy for this because you mostly just want to break down things to the file level, so even:
git reset --soft <your-first-commit>and then manually staging and commiting things from there would probably be enough. You can use git add --interactive to stage individual file hunks if you want to break things down further.
I have sent "Generic WorkQueue Engine (GenWQE) device driver (v6)" now which hopefully is what you wanted.
Regards
Frank
PATCH 3/9 GenWQE: Remove obsolete constants
In reply to Frank HaverkampThe removed constants should not be part of the user-space kernel interface.
--- include/linux/genwqe/genwqe_card.h | 12 ------------ 1 files changed, 0 insertions(+), 12 deletions(-)
include/linux/genwqe/genwqe_card.h +0 -12
@@ -390,18 +390,6 @@ struct chip_bitstream {#define DDCB_ASV_LENGTH 64/* len of the DDCB ASV array */ #define DDCB_FIXUPS 12/* maximum number of fixups */ -/* -* We might have addresses within the ASIV data. Those need to be -* replaced by valid DMA addresses to the buffer, sg-list or -* child-block in the kernel driver handling the request. -*/ -#define GENWQE_DMA_TYPE_MASK 0x18/* mask off type */ -#define GENWQE_DMA_TYPE_RAW 0x00/* no DMA addr */ -#define GENWQE_DMA_TYPE_FLAT 0x08/* contignous DMA block */ -#define GENWQE_DMA_TYPE_SGLIST 0x10/* DMA sg-list */ -#define GENWQE_DMA_TYPE_CHILD 0x18/* DMA child-block */ -#define GENWQE_DMA_WRITEABLE 0x04/* memory writeable? */ -struct genwqe_debug_data {char driver_version[64 ];uint64_t slu_unitcfg;
Signature · 1 line
1.7.1
PATCH 4/9 GenWQE: Rework comments
In reply to Frank HaverkampSome leftovers from the comment cleanup. Fix them up such that they match the requested format.
--- include/linux/genwqe/genwqe_card.h | 40 +++++++++++++++++++---------------- 1 files changed, 22 insertions(+), 18 deletions(-)
include/linux/genwqe/genwqe_card.h +22 -18
@@ -383,7 +383,7 @@ struct chip_bitstream {uint32_t progress;/* progress code from processing */ }; -/* issuing a specific DDCB command */ +/* Issuing a specific DDCB command */ #define DDCB_LENGTH 256/* for debug data */ #define DDCB_ASIV_LENGTH 104/* len of the DDCB ASIV array */ #define DDCB_ASIV_LENGTH_ATS 96/* ASIV in ATS architecture */
@@ -427,10 +427,12 @@ struct genwqe_debug_data {#define ATS_GET_FLAGS (_ats, _byte_offs) \ (((_ats) >> (44 - (4 * ((_byte_offs) / 8)))) & 0xf) -/* -* User parameter for generic DDCB commands. On the way into the -* kernel the driver will read the whole data structure. On the way -* out the driver will not copy the ASIV data back to userland. +/** +* struct genwqe_ddcb_cmd - User parameter for generic DDCB commands +* +* On the way into the kernel the driver will read the whole data +* structure. On the way out the driver will not copy the ASIV data +* back to user-space. */ struct genwqe_ddcb_cmd {/* ------ START of data copied to/from driver ---------------------- */
@@ -495,7 +497,12 @@ static inline void genwqe_ddcb_cmd_init(struct genwqe_ddcb_cmd *cmd)#define GENWQE_GET_CARD_STATE _IOR(GENWQE_IOC_CODE, 36, \ enum genwqe_card_state *) -/* +/** +* struct genwqe_mem - Memory pinning/unpinning information +* @addr: virtual user space address +* @size: size of the area pin/dma-map/unmap +* direction: 0: read/1: read and write +* * Avoid pinning and unpinning of memory pages dynamically. Instead * the idea is to pin the whole buffer space required for DDCB * opertionas in advance. The driver will reuse this pinning and the
@@ -509,26 +516,23 @@ static inline void genwqe_ddcb_cmd_init(struct genwqe_ddcb_cmd *cmd)* memory. */ struct genwqe_mem { -unsigned long addr;/* virtual user space address */ -unsigned long size;/* size of the area pin/dma-map/unmap */ -int direction;/* 0: read/1: read and write */ +unsigned long addr; +unsigned long size; +int direction; };#define GENWQE_PIN_MEM _IOWR(GENWQE_IOC_CODE, 40, struct genwqe_mem *)#define GENWQE_UNPIN_MEM _IOWR(GENWQE_IOC_CODE, 41, struct genwqe_mem *)/* -* @brief Generic synchronous DDCB execution interface. +* Generic synchronous DDCB execution interface. * Synchronously execute a DDCB. * -* @param [in] fd open file descriptor to the genwqe_card device. -* @param [inout] cmd DDCB execution request -* @return 0 on success or negative error code. -* -EINVAL: Invalid parameters (ASIV_LEN, ASV_LEN, illegal fixups -* no mappings found/could not create mappings. -* -EFAULT: illegal addresses in fixups. -* purging failed. -* -EBADMSG: enqueing failed, retc != DDCB_RETC_COMPLETE. +* Return: 0 on success or negative error code. +* -EINVAL: Invalid parameters (ASIV_LEN, ASV_LEN, illegal fixups +* no mappings found/could not create mappings +* -EFAULT: illegal addresses in fixups, purging failed +* -EBADMSG: enqueing failed, retc != DDCB_RETC_COMPLETE */ #define GENWQE_EXECUTE_DDCB \ _IOWR(GENWQE_IOC_CODE, 50, struct genwqe_ddcb_cmd *)
Signature · 1 line
1.7.1
PATCH 5/9 GenWQE: Move comments
In reply to Frank HaverkampMove documentation from driver sources to appropriate place in the sysfs documentation file for this driver
--- Documentation/ABI/testing/sysfs-driver-genwqe | 9 +++++++++ drivers/misc/genwqe/card_base.c | 20 -------------------- 2 files changed, 9 insertions(+), 20 deletions(-)
Documentation/ABI/testing/sysfs-driver-genwqe +9 -0
@@ -44,3 +44,12 @@ What: /sys/class/genwqe/genwqe<n>_card/base_clock Date: Oct 2013 Contact: [email protected] Description: Base clock frequency of the card. + +What: /sys/class/genwqe/genwqe<n>_card/device/sriov_numvfs +Date: Oct 2013 +Contact: [email protected] +Description: Enable VFs (1..15): + sudo sh -c 'echo 15 > \ + /sys/bus/pci/devices/0000\:1b\:00.0/sriov_numvfs' + Disable VFs: + Write a 0 into the same sysfs entry.
drivers/misc/genwqe/card_base.c +0 -20
@@ -22,16 +22,6 @@* Module initialization and PCIe setup. Card health monitoring and * recovery functionality. Character device creation and deletion are * controlled from here. -* -* Please use the new sysfs interfaces to enable the VFs after PF -* driver loading. -* -* Enable VFs: -* sudo sh -c 'echo 15 > /sys/bus/pci/devices/0000\:1b\:00.0/sriov_numvfs' -* or -* sudo sh -c 'echo 15 > /sys/class/genwqe/genwqe0_card/device/sriov_numvfs' -* Disable VFs: -* Write a 0 into the same sysfs entries. */ #include <linux/module.h>
@@ -798,22 +788,12 @@ static u64 genwqe_fir_checking(struct genwqe_dev *cd)* * This thread must only exit if kthread_should_stop() becomes true. * -* Testing bind/unbind with: -* sudo sh -c "echo -n 0000:20:00.0 > /sys/bus/pci/drivers/genwqe/unbind" -* sudo sh -c "echo -n 0000:20:00.0 > /sys/bus/pci/drivers/genwqe/bind" -* * Condition for the health-thread to trigger: * a) when a kthread_stop() request comes in or * b) a critical GFIR occured * * Informational GFIRs are checked and potentially printed in * health_check_interval seconds. -* -* Testcase to trigger this code: -* Fatal GFIR: -* sudo ./tools/genwqe_poke -C0 0x00000008 0x001 -* Info GFIR by writing to VF: -* sudo ./tools/genwqe_poke -C2 0x00020020 0x800 */ static int genwqe_health_thread (void *data) {
Signature · 1 line
1.7.1
PATCH 6/9 GenWQE: Remove/rework module parameters
In reply to Frank HaverkampThe module parameter genwqe_vf_jobtimeout_msec is changed into a debugfs interface:
/sys/kernel/debug/genwqe/genwqe<n>_card/vf<0..14>_jobtimeout_msec
The setting is applied when the virtual functions are enabled. Switching during operation is not allowed.
The following thow former module parameters are now constants:
genwqe_pf_jobtimeout_msec genwqe_health_check_interval
--- Documentation/ABI/testing/debugfs-driver-genwqe | 13 +++ drivers/misc/genwqe/card_base.c | 93 ++++++++++------------- drivers/misc/genwqe/card_base.h | 9 +- drivers/misc/genwqe/card_debugfs.c | 15 ++++- 4 files changed, 71 insertions(+), 59 deletions(-)
Documentation/ABI/testing/debugfs-driver-genwqe +13 -0
@@ -55,3 +55,16 @@ Date: Oct 2013 Contact: [email protected] Description: Possibility to inject error cases to ensure that the drivers error handling code works well. + +What: /sys/kernel/debug/genwqe/genwqe<n>_card/vf<0..14>_jobtimeout_msec +Date: Oct 2013 +Contact: [email protected] +Description: Default VF timeout 250ms. Testing might require 1000ms. + Using 0 will use the cards default value (whatever that is). + + The timeout depends on the max number of available cards + in the system and the maximum allowed queue size. + + The driver ensures that the settings are done just before + the VFs get enabled. Changing the timeouts in flight is not + possible.
drivers/misc/genwqe/card_base.c +39 -54
145 lines not on this page · raw message
drivers/misc/genwqe/card_base.h +5 -4
@@ -43,6 +43,7 @@#define GENWQE_MSI_IRQS 4/* Just one supported, no MSIx */ #define GENWQE_FLAG_MSI_ENABLED (1 << 0) +#define GENWQE_MAX_VFS 15/* maximum 15 VFs are possible */ #define GENWQE_MAX_FUNCS 16/* 1 PF and 15 VFs */ #define GENWQE_CARD_NO_MAX (16 * GENWQE_MAX_FUNCS)
@@ -51,10 +52,9 @@#define genwqe_polling_enabled 0/* in case of irqs not working */ #define genwqe_ddcb_software_timeout 10/* timeout per DDCB in seconds */ #define genwqe_kill_timeout 8/* time until process gets killed */ - -/* Module parameters */ -extern int genwqe_pf_jobtimeout_msec; -extern int genwqe_vf_jobtimeout_msec; +#define genwqe_vf_jobtimeout_msec 250/* 250 msec */ +#define genwqe_pf_jobtimeout_msec 8000/* 8 sec should be ok */ +#define genwqe_health_check_interval 4/* <= 0: disabled */ /* * Config space for Genwqe5 A7:
@@ -318,6 +318,7 @@ struct genwqe_dev {void __iomem *mmio;/* BAR-0 MMIO start */ unsigned long mmio_len;u16 num_vfs; +u32 vf_jobtimeout_msec[GENWQE_MAX_VFS ];int is_privileged;/* access to all regs possible */ /* config regs which we need often */
drivers/misc/genwqe/card_debugfs.c +14 -1
@@ -271,7 +271,7 @@ static int genwqe_jtimer_show(struct seq_file *s, void *unused)for (vf_num =0 ; vf_num < cd->num_vfs; vf_num++) { jtimer =genwqe_read_jtimer (cd, vf_num +1 );seq_printf (s," VF%-2d 0x%016llx %d msec\n" , vf_num, jtimer, - genwqe_vf_jobtimeout_msec); + cd->vf_jobtimeout_msec[vf_num]); }return 0 ; }
@@ -425,6 +425,8 @@ int genwqe_init_debugfs(struct genwqe_dev *cd)struct dentry *file;int ret, priv;char card_name[64 ]; +char name[64 ]; +unsigned int i;sprintf (card_name,"%s%u_card" ,GENWQE_DEVNAME , cd->card_idx);
@@ -538,6 +540,17 @@ int genwqe_init_debugfs(struct genwqe_dev *cd) goto err1; } +for (i =0 ; i <GENWQE_MAX_VFS ; i++) { +sprintf (name,"vf%d_jobtimeout_msec" , i); + + file =debugfs_create_u32 (name,0666 , root, + &cd->vf_jobtimeout_msec[i]); +if (!file) { + ret = -ENOMEM ; + goto err1; + } + } + file =debugfs_create_file ("jobtimer" ,S_IRUGO , root, cd, &genwqe_jtimer_fops);if (!file) {
Signature · 1 line
1.7.1
PATCH 7/9 GenWQE: Start using sysfs attribute groups
In reply to Frank HaverkampUse the existing sysfs infrastructure to create multiple attributes instead of doing things manually. Use the is_visible callback now to determine if an attribute is visible or not.
--- drivers/misc/genwqe/card_base.h | 6 +- drivers/misc/genwqe/card_dev.c | 6 +- drivers/misc/genwqe/card_sysfs.c | 199 ++++++++++++++++++++------------------ 3 files changed, 113 insertions(+), 98 deletions(-)
drivers/misc/genwqe/card_base.h +3 -3
@@ -416,11 +416,11 @@ int genwqe_device_create(struct genwqe_dev *cd);int genwqe_device_remove (struct genwqe_dev *cd);/* sysfs */ -int create_card_sysfs (struct genwqe_dev *cd); -void remove_card_sysfs (struct genwqe_dev *cd); +int genwqe_init_sysfs (struct genwqe_dev *cd); +void genwqe_exit_sysfs (struct genwqe_dev *cd);/* debugfs */ -int genwqe_init_debugfs (struct genwqe_dev *cd); +int genwqe_init_debugfs (struct genwqe_dev *cd);void genqwe_exit_debugfs (struct genwqe_dev *cd);int genwqe_read_softreset (struct genwqe_dev *cd);
drivers/misc/genwqe/card_dev.c +3 -3
@@ -1389,7 +1389,7 @@ int genwqe_device_create(struct genwqe_dev *cd) }dev_set_drvdata (cd->dev, cd); - rc =create_card_sysfs (cd); + rc =genwqe_init_sysfs (cd);if (rc !=0 ) goto err_sysfs;
@@ -1400,7 +1400,7 @@ int genwqe_device_create(struct genwqe_dev *cd)return 0 ; err_debugfs: -remove_card_sysfs (cd); +genwqe_exit_sysfs (cd); err_sysfs:device_destroy (cd->class_genwqe, cd->devnum_genwqe); err_cdev:
@@ -1489,7 +1489,7 @@ int genwqe_device_remove(struct genwqe_dev *cd) }genqwe_exit_debugfs (cd); -remove_card_sysfs (cd); +genwqe_exit_sysfs (cd);device_destroy (cd->class_genwqe, cd->devnum_genwqe);cdev_del (&cd->cdev_genwqe);unregister_chrdev_region (cd->devnum_genwqe,GENWQE_MAX_MINOR );
drivers/misc/genwqe/card_sysfs.c +107 -92
321 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 8/9 GenWQE: Simplify sysfs buffer printouts
In reply to Frank HaverkampRework code which was inteneded to print out multiple lines via sysfs attributes. This is not needed anymore. We just print one item.
--- drivers/misc/genwqe/card_sysfs.c | 59 +++++++++----------------------------- 1 files changed, 14 insertions(+), 45 deletions(-)
drivers/misc/genwqe/card_sysfs.c +14 -45
@@ -48,82 +48,65 @@ static const char * const genwqe_types[] = {static ssize_t status_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ;struct genwqe_dev *cd =dev_get_drvdata (dev);const char *cs[GENWQE_CARD_STATE_MAX ] = {"unused" ,"used" ,"error" }; - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%s\n" , cs[cd->card_state]); -return len; +return scnprintf (buf,PAGE_SIZE ,"%s\n" , cs[cd->card_state]); }static DEVICE_ATTR_RO (status);static ssize_t appid_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ;char app_name[5 ];struct genwqe_dev *cd =dev_get_drvdata (dev);genwqe_read_app_id (cd, app_name,sizeof (app_name)); - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%s\n" , app_name); -return len; +return scnprintf (buf,PAGE_SIZE ,"%s\n" , app_name); }static DEVICE_ATTR_RO (appid);static ssize_t version_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ;u64 slu_id, app_id;struct genwqe_dev *cd =dev_get_drvdata (dev); slu_id =__genwqe_readq (cd,IO_SLU_UNITCFG ); app_id =__genwqe_readq (cd,IO_APP_UNITCFG ); - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%016llx.%016llx\n" , slu_id, app_id); -return len; +return scnprintf (buf,PAGE_SIZE ,"%016llx.%016llx\n" , slu_id, app_id); }static DEVICE_ATTR_RO (version);static ssize_t type_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ;u8 card_type;struct genwqe_dev *cd =dev_get_drvdata (dev); card_type =genwqe_card_type (cd); - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%s\n" , (card_type >=ARRAY_SIZE (genwqe_types)) ? +return scnprintf (buf,PAGE_SIZE ,"%s\n" , + (card_type >=ARRAY_SIZE (genwqe_types)) ?"invalid" : genwqe_types[card_type]); -return len; }static DEVICE_ATTR_RO (type);static ssize_t driver_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ; - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%s\n" ,DRV_VERS_STRING ); -return len; +return scnprintf (buf,PAGE_SIZE ,"%s\n" ,DRV_VERS_STRING ); }static DEVICE_ATTR_RO (driver);static ssize_t tempsens_show (struct device *dev,struct device_attribute *attr,char *buf) { -ssize_t len =0 ;u64 tempsens;struct genwqe_dev *cd =dev_get_drvdata (dev); tempsens =__genwqe_readq (cd,IO_SLU_TEMPERATURE_SENSOR ); - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%016llx\n" , tempsens); -return len; +return scnprintf (buf,PAGE_SIZE ,"%016llx\n" , tempsens); }static DEVICE_ATTR_RO (tempsens);
@@ -131,14 +114,11 @@ static ssize_t base_clock_show(struct device *dev,struct device_attribute *attr, char *buf) { - ssize_t len = 0; u64 base_clock;struct genwqe_dev *cd =dev_get_drvdata (dev); base_clock =genwqe_base_clock_frequency (cd); - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%lld\n" , base_clock); -return len; +return scnprintf (buf,PAGE_SIZE ,"%lld\n" , base_clock); }static DEVICE_ATTR_RO (base_clock);
@@ -160,17 +140,13 @@ static DEVICE_ATTR_RO(base_clock);* image. */ static ssize_t curr_bitstream_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr,char *buf) { -ssize_t len =0 ;int curr_bitstream;struct genwqe_dev *cd =dev_get_drvdata (dev); curr_bitstream =__genwqe_readq (cd,IO_SLU_BITSTREAM ) &0x1 ; - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%d\n" , curr_bitstream); -return len; +return scnprintf (buf,PAGE_SIZE ,"%d\n" , curr_bitstream); }static DEVICE_ATTR_RO (curr_bitstream);
@@ -180,10 +156,8 @@ static DEVICE_ATTR_RO(curr_bitstream);* IO_SLC_CFGREG_SOFTRESET: This register can only be accessed by the PF. */ static ssize_t next_bitstream_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr,char *buf) { -ssize_t len =0 ;int next_bitstream;struct genwqe_dev *cd =dev_get_drvdata (dev);
@@ -198,9 +172,7 @@ static ssize_t next_bitstream_show(struct device *dev, next_bitstream =-1 ;break ;/* error */ } - len +=scnprintf (&buf[len],PAGE_SIZE - len, -"%d\n" , next_bitstream); -return len; +return scnprintf (buf,PAGE_SIZE ,"%d\n" , next_bitstream); } static ssize_t next_bitstream_store(struct device *dev,
@@ -233,12 +205,9 @@ static DEVICE_ATTR_RW(next_bitstream);* FIXME Implement me! */ static ssize_t cpld_version_show (struct device *dev, -struct device_attribute *attr, -char *buf) +struct device_attribute *attr,char *buf) { -ssize_t len =0 ; - len +=scnprintf (&buf[len],PAGE_SIZE - len,"unknown (FIXME)\n" ); -return len; +return scnprintf (buf,PAGE_SIZE ,"unknown (FIXME)\n" ); }static DEVICE_ATTR_RO (cpld_version);
Signature · 1 line
1.7.1
PATCH 9/9 GenWQE: Increment driver internal version number
In reply to Frank HaverkampNew version for this release.
--- drivers/misc/genwqe/genwqe_driver.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/genwqe/genwqe_driver.h +1 -1
@@ -35,7 +35,7 @@#include <linux/genwqe/genwqe_card.h> -#define DRV_VERS_STRING "1.1.35" +#define DRV_VERS_STRING "2.0.0"/* * Static minor number assignement, until we decide/implement
Signature · 1 line
1.7.1