Skip to contentSkip to conversation

Generic WorkQueue Engine (GenWQE) device driver (v4)

PATCH In review Frank Haverkamp 4 participants 21 messages Oct 30, 2013 – Nov 13, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Generic WorkQueue Engine (GenWQE) device driver (v4)

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 (1):
Generic WorkQueue Engine (GenWQE) device driver (v4)

 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
#1 lore raw

PATCH 1/1 Generic WorkQueue Engine (GenWQE) device driver (v4)

From: Frank Haverkamp <[email protected]>

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
new file mode 100644
index 0000000..c3503a4
@@ -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
index 8dacd4c..92142cf 100644
@@ -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
index c235d5b..62a3dfb 100644
@@ -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
new file mode 100644
index 0000000..bbf137d
@@ -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
new file mode 100644
index 0000000..b6af308
@@ -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.

maintainer
#2 lore raw

drivers/misc/genwqe/Kconfig line 21

Quoted 7 lines · Frank Haverkamp
drivers/misc/genwqe/Kconfig new file +7 -0
+if GENWQE
+
+config GENWQE_DEVNAME
+        string "Name for sysfs and device nodes"
+	default "genwqe"
+        help
+          Select alternate name for sysfs and device nodes.

Don't let the user pick this, it's up to the driver to set this once and then live with it.

And, from what I can tell in the driver, this help text is wrong (there are no device nodes with this name in it, right?)

thanks,

greg k-h

#3 lore raw
Quoted 12 lines · Greg KH

drivers/misc/genwqe/Kconfig line 21

Quoted 7 lines · Frank Haverkamp
drivers/misc/genwqe/Kconfig new file +7 -0
+if GENWQE
+
+config GENWQE_DEVNAME
+        string "Name for sysfs and device nodes"
+	default "genwqe"
+        help
+          Select alternate name for sysfs and device nodes.

Don't let the user pick this, it's up to the driver to set this once and then live with it.

Quoted 2 lines

And, from what I can tell in the driver, this help text is wrong (there are no device nodes with this name in it, right?)

The indentation is also messed up here. Kconfig should use hard tabs, with two additional spaces for the help text. This has mixed tabs and spaces between lines.

~Ryan

#4 lore raw

Am Donnerstag, den 31.10.2013, 07:38 +1100 schrieb Ryan Mallon:

Quoted 14 lines · Greg KH
Quoted 13 lines · Frank Haverkamp

drivers/misc/genwqe/Kconfig line 21

Quoted 7 lines
drivers/misc/genwqe/Kconfig new file +7 -0
+if GENWQE
+
+config GENWQE_DEVNAME
+        string "Name for sysfs and device nodes"
+	default "genwqe"
+        help
+          Select alternate name for sysfs and device nodes.

Don't let the user pick this, it's up to the driver to set this once and then live with it.

Quoted 8 lines
Quoted 2 lines

And, from what I can tell in the driver, this help text is wrong (there are no device nodes with this name in it, right?)

The indentation is also messed up here. Kconfig should use hard tabs, with two additional spaces for the help text. This has mixed tabs and spaces between lines.

Ok. Removed it anyways.

Quoted 3 lines

~Ryan

Regards

Frank

#5 lore raw
In reply to Greg KH

Hi Greg,

Am Mittwoch, den 30.10.2013, 10:35 -0700 schrieb Greg KH:

Quoted 3 lines

Don't let the user pick this, it's up to the driver to set this once and
then live with it.

Ok. I will remove it in the next version.

Quoted 4 lines

And, from what I can tell in the driver, this help text is wrong (there
are no device nodes with this name in it, right?)

There is a /dev/genwqe<n>_card character device:

card_dev.c:
cd->dev = device_create(cd->class_genwqe, &cd->pci_dev->dev,

				cd->devnum_genwqe, NULL,
				GENWQE_DEVNAME "%u_card", cd->card_idx);

That is what I meant with "device node".

Regards

Frank

maintainer
#6 lore raw
In reply to Frank Haverkamp
Quoted 7 lines · Frank Haverkamp

+/*
+ * 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.

Quoted 8 lines

+ *
+ * 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.
+ */

Put this documentation somewhere a user has a _chance_ of reading it. Digging it out of code comments is not ok. Why isn't this in the ABI file for the sysfs files?

thanks,

greg k-h

#7 lore raw

Hi Greg,

Am Mittwoch, den 30.10.2013, 10:36 -0700 schrieb Greg KH:

Quoted 17 lines · Frank Haverkamp
Quoted 7 lines

+/*
+ * 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.

Quoted 8 lines

+ *
+ * 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.
+ */

Quoted 8 lines

Put this documentation somewhere a user has a _chance_ of reading it. Digging it out of code comments is not ok. Why isn't this in the ABI file for the sysfs files?

thanks,

greg k-h

True. There was other stuff I moved/deleted now too.

Regards

Frank

maintainer
#8 lore raw
In reply to Frank Haverkamp

drivers/misc/genwqe/card_base.c line 76

Quoted 12 lines · Frank Haverkamp
drivers/misc/genwqe/card_base.c new file +12 -0
+/*
+ * We like to be able to disable the health checking entirely in some
+ * cases e.g. if a card is broken and needs to be analyzed. I
+ * considered using debugfs/sysfs attributes, but I did not see a way
+ * to prevent the thread from being started at driver load time other
+ * than starting it later manually, what I did not like either
+ * in this case (e.g. like the new SRIOV enablement).
+ */
+static int genwqe_health_check_interval = 4;   /* <= 0: disabled */
+module_param(genwqe_health_check_interval, int, 0644);  /* read/writeable */
+MODULE_PARM_DESC(genwqe_health_check_interval,
+		 "check card health every N seconds (0 = disabled)");

Module paramaters are driver wide, not device specific.

If a card is broken, it's broken, send it back. No one will ever know to set this value, and then you just affected all other cards in the system for this same driver.

Just delete this please.

thanks,

greg k-h

#9 lore raw

Hi Greg,

Am Mittwoch, den 30.10.2013, 10:37 -0700 schrieb Greg KH:

Quoted 20 lines · Frank Haverkamp

drivers/misc/genwqe/card_base.c line 76

Quoted 12 lines
drivers/misc/genwqe/card_base.c new file +12 -0
+/*
+ * We like to be able to disable the health checking entirely in some
+ * cases e.g. if a card is broken and needs to be analyzed. I
+ * considered using debugfs/sysfs attributes, but I did not see a way
+ * to prevent the thread from being started at driver load time other
+ * than starting it later manually, what I did not like either
+ * in this case (e.g. like the new SRIOV enablement).
+ */
+static int genwqe_health_check_interval = 4;   /* <= 0: disabled */
+module_param(genwqe_health_check_interval, int, 0644);  /* read/writeable */
+MODULE_PARM_DESC(genwqe_health_check_interval,
+		 "check card health every N seconds (0 = disabled)");

Module paramaters are driver wide, not device specific.

If a card is broken, it's broken, send it back. No one will ever know to set this value, and then you just affected all other cards in the system for this same driver.

Quoted 6 lines

Just delete this please.

thanks,

greg k-h

Finally I removed all my module parameters or replaced them by debugfs or sysfs attributes.

Regards

Frank

maintainer
#10 lore raw
In reply to Frank Haverkamp
Quoted 10 lines · Frank Haverkamp

+/*
+ * GenWQE Driver: Need SLC timeout set to 250ms (temporary setting for
+ * testing of 1000ms due to decompressor testcase failing)
+ *
+ * There is a requirement by the card users that the timeout must not
+ * exceed the 250ms.
+ *
+ * In this case the settings must be done before any interaction to
+ * the device can be done, since we cannot change the settings without
+ * stopping the queues.

Then stop the queue, change the value, and start them up again.

Why would anyone ever want to change these values? Don't make anything "tunable", just get it right and don't rely on someone making tweaks later with module options, especially as, again, these are driver wide, not specific to a device.

If you _really_ need them for a device, make them a sysfs file and fix the code to handle stopping and starting. You have to handle that anyway with dynamic bind/unbind of the driver to specific devices anyway, so this shouldn't be a big deal.

greg k-h

maintainer
#11 lore raw
In reply to Frank Haverkamp

drivers/misc/genwqe/card_sysfs.c line 249

Quoted 8 lines · Frank Haverkamp
drivers/misc/genwqe/card_sysfs.c new file +8 -0
+/*
+ * Create device_attribute structures / params: name, mode, show, store
+ * additional flag if valid in VF
+ */
+struct genwqe_dev_attrib {
+	struct device_attribute att;	/* sysfs entry attributes */
+	int vf;				/* may exist in VF or not */
+};

Why do you need your own structure? Use the is_visible() callback to create or not, the individual attributes for a specific device, don't roll your own logic for something the driver core already supports.

Quoted 21 lines
drivers/misc/genwqe/card_sysfs.c new file +21 -0
+static struct genwqe_dev_attrib dev_attr_tab[] = {
+	{__ATTR(tempsens,       S_IRUGO, show_card_tempsens, NULL), 0},
+	{__ATTR(next_bitstream, (S_IRUGO | S_IWUSR),
+		show_card_next_bitstream, store_card_next_bitstream), 0},
+	{__ATTR(curr_bitstream, S_IRUGO, show_card_curr_bitstream, NULL), 0},
+	{__ATTR(cpld_version,   S_IRUGO, show_cpld_version, NULL), 0},
+	{__ATTR(base_clock,	S_IRUGO, show_card_base_clock, NULL), 0},
+
+	{__ATTR(driver,		S_IRUGO, show_card_driver, NULL), 1},
+	{__ATTR(type,		S_IRUGO, show_card_type, NULL), 1},
+	{__ATTR(version,	S_IRUGO, show_card_version, NULL), 1},
+	{__ATTR(appid,		S_IRUGO, show_card_appid, NULL), 1},
+	{__ATTR(status,		S_IRUGO, show_card_status, NULL), 1},
+};
+
+/**
+ * create_card_sysfs() - Setup sysfs entries of the card device
+ *
+ * VFs have restricted mmio capabilities, so not all sysfs entries
+ * are allowed in VFs.
+ */

drivers/misc/genwqe/card_sysfs.c line 281

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+int create_card_sysfs(struct genwqe_dev *cd)
+{
+	int rc, priv;
+	unsigned int i;
+
+	priv = genwqe_is_privileged(cd);
+	for (i = 0; i < ARRAY_SIZE(dev_attr_tab); i++) {
+		struct genwqe_dev_attrib *dev_attr = &dev_attr_tab[i];
+		if (dev_attr->vf || priv) {
+			rc = device_create_file(cd->dev, &dev_attr->att);

No, you just raced with userspace, creating the sysfs files _after_ it was told to userspace that the driver was bound to the device.

Please use the attribute groups for this driver to have the driver core create the files before it it told to userspace.

Also, instead of using __ATTR(), please use DEVICE_ATTR_RO(), it makes things easier to audit and saves me from having to change it later on (I'm doing a tree-wide change of this type of thing...)

thanks,

greg k-h

#12 lore raw

Hi Greg,

Am Mittwoch, den 30.10.2013, 10:44 -0700 schrieb Greg KH:

Quoted 49 lines · Frank Haverkamp

drivers/misc/genwqe/card_sysfs.c line 249

Quoted 8 lines
drivers/misc/genwqe/card_sysfs.c new file +8 -0
+/*
+ * Create device_attribute structures / params: name, mode, show, store
+ * additional flag if valid in VF
+ */
+struct genwqe_dev_attrib {
+	struct device_attribute att;	/* sysfs entry attributes */
+	int vf;				/* may exist in VF or not */
+};

Why do you need your own structure? Use the is_visible() callback to create or not, the individual attributes for a specific device, don't roll your own logic for something the driver core already supports.

Quoted 21 lines
drivers/misc/genwqe/card_sysfs.c new file +21 -0
+static struct genwqe_dev_attrib dev_attr_tab[] = {
+	{__ATTR(tempsens,       S_IRUGO, show_card_tempsens, NULL), 0},
+	{__ATTR(next_bitstream, (S_IRUGO | S_IWUSR),
+		show_card_next_bitstream, store_card_next_bitstream), 0},
+	{__ATTR(curr_bitstream, S_IRUGO, show_card_curr_bitstream, NULL), 0},
+	{__ATTR(cpld_version,   S_IRUGO, show_cpld_version, NULL), 0},
+	{__ATTR(base_clock,	S_IRUGO, show_card_base_clock, NULL), 0},
+
+	{__ATTR(driver,		S_IRUGO, show_card_driver, NULL), 1},
+	{__ATTR(type,		S_IRUGO, show_card_type, NULL), 1},
+	{__ATTR(version,	S_IRUGO, show_card_version, NULL), 1},
+	{__ATTR(appid,		S_IRUGO, show_card_appid, NULL), 1},
+	{__ATTR(status,		S_IRUGO, show_card_status, NULL), 1},
+};
+
+/**
+ * create_card_sysfs() - Setup sysfs entries of the card device
+ *
+ * VFs have restricted mmio capabilities, so not all sysfs entries
+ * are allowed in VFs.
+ */

drivers/misc/genwqe/card_sysfs.c line 281

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+int create_card_sysfs(struct genwqe_dev *cd)
+{
+	int rc, priv;
+	unsigned int i;
+
+	priv = genwqe_is_privileged(cd);
+	for (i = 0; i < ARRAY_SIZE(dev_attr_tab); i++) {
+		struct genwqe_dev_attrib *dev_attr = &dev_attr_tab[i];
+		if (dev_attr->vf || priv) {
+			rc = device_create_file(cd->dev, &dev_attr->att);

No, you just raced with userspace, creating the sysfs files _after_ it was told to userspace that the driver was bound to the device.

Quoted 2 lines

Please use the attribute groups for this driver to have the driver core create the files before it it told to userspace.

The code got a little smaller now, which is good. I introduced the usage of is_visible(), but wondered if it really makes sense for my driver. Alternatively I thought I could use something like this:

if (genwqe_is_privileged(cd))

        sysfs_create_group(&cd->dev->kobj, &genwqe_attribute_group);
else
        sysfs_create_group(&cd->dev->kobj,
                           &genwqe_normal_attribute_group);
Quoted 3 lines

Also, instead of using __ATTR(), please use DEVICE_ATTR_RO(), it makes things easier to audit and saves me from having to change it later on (I'm doing a tree-wide change of this type of thing...)

Ok.

I stumbled across your article:
http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/

I am using sysfs_create_group() now, but do I understand you correctly that setting the const struct attribute_group **groups; in my device (where in my struct pci_device.dev?) is an even better way to establish my sysfs attributes? Is there a function which I could call rather than trying to find the right pointer?

Quoted 4 lines

thanks,

greg k-h

Regards

Frank

maintainer
#13 lore raw
Quoted 59 lines · Frank Haverkamp

Hi Greg,

Am Mittwoch, den 30.10.2013, 10:44 -0700 schrieb Greg KH:

Quoted 49 lines · Frank Haverkamp

drivers/misc/genwqe/card_sysfs.c line 249

Quoted 8 lines
drivers/misc/genwqe/card_sysfs.c new file +8 -0
+/*
+ * Create device_attribute structures / params: name, mode, show, store
+ * additional flag if valid in VF
+ */
+struct genwqe_dev_attrib {
+	struct device_attribute att;	/* sysfs entry attributes */
+	int vf;				/* may exist in VF or not */
+};

Why do you need your own structure? Use the is_visible() callback to create or not, the individual attributes for a specific device, don't roll your own logic for something the driver core already supports.

Quoted 21 lines
drivers/misc/genwqe/card_sysfs.c new file +21 -0
+static struct genwqe_dev_attrib dev_attr_tab[] = {
+	{__ATTR(tempsens,       S_IRUGO, show_card_tempsens, NULL), 0},
+	{__ATTR(next_bitstream, (S_IRUGO | S_IWUSR),
+		show_card_next_bitstream, store_card_next_bitstream), 0},
+	{__ATTR(curr_bitstream, S_IRUGO, show_card_curr_bitstream, NULL), 0},
+	{__ATTR(cpld_version,   S_IRUGO, show_cpld_version, NULL), 0},
+	{__ATTR(base_clock,	S_IRUGO, show_card_base_clock, NULL), 0},
+
+	{__ATTR(driver,		S_IRUGO, show_card_driver, NULL), 1},
+	{__ATTR(type,		S_IRUGO, show_card_type, NULL), 1},
+	{__ATTR(version,	S_IRUGO, show_card_version, NULL), 1},
+	{__ATTR(appid,		S_IRUGO, show_card_appid, NULL), 1},
+	{__ATTR(status,		S_IRUGO, show_card_status, NULL), 1},
+};
+
+/**
+ * create_card_sysfs() - Setup sysfs entries of the card device
+ *
+ * VFs have restricted mmio capabilities, so not all sysfs entries
+ * are allowed in VFs.
+ */

drivers/misc/genwqe/card_sysfs.c line 281

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+int create_card_sysfs(struct genwqe_dev *cd)
+{
+	int rc, priv;
+	unsigned int i;
+
+	priv = genwqe_is_privileged(cd);
+	for (i = 0; i < ARRAY_SIZE(dev_attr_tab); i++) {
+		struct genwqe_dev_attrib *dev_attr = &dev_attr_tab[i];
+		if (dev_attr->vf || priv) {
+			rc = device_create_file(cd->dev, &dev_attr->att);

No, you just raced with userspace, creating the sysfs files _after_ it was told to userspace that the driver was bound to the device.

Quoted 2 lines

Please use the attribute groups for this driver to have the driver core create the files before it it told to userspace.

The code got a little smaller now, which is good. I introduced the usage of is_visible(), but wondered if it really makes sense for my driver. Alternatively I thought I could use something like this:

Quoted 5 lines

if (genwqe_is_privileged(cd))

        sysfs_create_group(&cd->dev->kobj, &genwqe_attribute_group);
else
        sysfs_create_group(&cd->dev->kobj,
                           &genwqe_normal_attribute_group);

Ideally you would never call that function, so yes, is_visible() should be used.

Quoted 6 lines
Quoted 3 lines

Also, instead of using __ATTR(), please use DEVICE_ATTR_RO(), it makes things easier to audit and saves me from having to change it later on (I'm doing a tree-wide change of this type of thing...)

Ok.

Quoted 8 lines

I stumbled across your article:
http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/

I am using sysfs_create_group() now, but do I understand you correctly that setting the const struct attribute_group **groups; in my device (where in my struct pci_device.dev?) is an even better way to establish my sysfs attributes? Is there a function which I could call rather than trying to find the right pointer?

Ugh, this is still a problem, I'm trying to work through how to have individual drivers implement groups and sysfs files in a non-racy way. The issue is your device was announced to userspace _before_ it was bound to the driver, so there's no way to get the sysfs files to apply before then.

You should just have the attributes on the sysfs device you create yourself, not your pci device, as that's where they make more sense, and there you should be able to use the attribute group easily, right?

thanks,

greg k-h

#14 lore raw

Hi Greg,

Am Montag, den 04.11.2013, 14:15 -0800 schrieb Greg KH:

Quoted 15 lines
Quoted 1 line

I am using sysfs_create_group() now, but do I understand you

correctly

Quoted 2 lines

that setting the const struct attribute_group **groups; in my device (where in my struct pci_device.dev?) is an even better way to

establish

Quoted 1 line

my sysfs attributes? Is there a function which I could call rather

than

Quoted 1 line

trying to find the right pointer?

Ugh, this is still a problem, I'm trying to work through how to have individual drivers implement groups and sysfs files in a non-racy way. The issue is your device was announced to userspace _before_ it was bound to the driver, so there's no way to get the sysfs files to apply before then.

Quoted 5 lines

You should just have the attributes on the sysfs device you create yourself, not your pci device, as that's where they make more sense, and
there you should be able to use the attribute group easily, right?

The current version works well for me and I did not get any complaints about the possible race-condition you mentioned so far. So I am happy.

Quoted 3 lines

thanks,

greg k-h

Greetings

Frank

maintainer
#15 lore raw
Quoted 18 lines · Frank Haverkamp

Hi Greg,

Am Montag, den 04.11.2013, 14:15 -0800 schrieb Greg KH:

Quoted 15 lines
Quoted 1 line

I am using sysfs_create_group() now, but do I understand you

correctly

Quoted 2 lines

that setting the const struct attribute_group **groups; in my device (where in my struct pci_device.dev?) is an even better way to

establish

Quoted 1 line

my sysfs attributes? Is there a function which I could call rather

than

Quoted 1 line

trying to find the right pointer?

Ugh, this is still a problem, I'm trying to work through how to have individual drivers implement groups and sysfs files in a non-racy way. The issue is your device was announced to userspace _before_ it was bound to the driver, so there's no way to get the sysfs files to apply before then.

Quoted 8 lines
Quoted 5 lines

You should just have the attributes on the sysfs device you create yourself, not your pci device, as that's where they make more sense, and
there you should be able to use the attribute group easily, right?

The current version works well for me and I did not get any complaints about the possible race-condition you mentioned so far. So I am happy.

Just because you can't see the race happening, doesn't mean it isn't there and will not show up for someone else.

A trivial way to see this is write a program that uses libudev that gets notified when your device shows up and then read the attribute files. Those files will not be present when your program is notified so the read will usually fail.

greg k-h

#16 lore raw
In reply to Frank Haverkamp
Quoted 16 lines · Frank Haverkamp

From: Frank Haverkamp <[email protected]>

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 +++++++++++++++++++++
Quoted 8 lines
 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(-)

Please consider breaking this into multiple patches. One behemoth patch is harder to review and less likely for people to read all of it. Since this adds a new driver, you can add it in parts, e.g: core, sysfs, documentation, etc, and add the Makefile/Kconfig bits in the final patch. That way it won't break the build at any point.

Couple of comments on the sysfs bits below.

~Ryan

Quoted 50 lines

+++ b/drivers/misc/genwqe/card_sysfs.c

drivers/misc/genwqe/card_sysfs.c new file +48 -0
@@ -0,0 +1,306 @@
+/**
+ * IBM Accelerator Family 'GenWQE'
+ *
+ * (C) Copyright IBM Corp. 2013
+ *
+ * Author: Frank Haverkamp <[email protected]>
+ * Author: Joerg-Stephan Vogt <[email protected]>
+ * Author: Michael Jung <[email protected]>
+ * Author: Michael Ruettger <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (version 2 only)
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * Sysfs interfaces for the GenWQE card. There are attributes to query
+ * the version of the bitstream as well as some for the
+ * driver. Additionally there are some attributes which help to debug
+ * potential problems.
+ */
+
+#include <linux/version.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/string.h>
+#include <linux/fs.h>
+#include <linux/sysfs.h>
+#include <linux/ctype.h>
+
+#include "card_base.h"
+#include "card_ddcb.h"
+
+static const char * const genwqe_types[] = {
+	[GENWQE_TYPE_ALTERA_230] = "GenWQE4-230",
+	[GENWQE_TYPE_ALTERA_530] = "GenWQE4-530",
+	[GENWQE_TYPE_ALTERA_A4]  = "GenWQE5-A4",
+	[GENWQE_TYPE_ALTERA_A7]  = "GenWQE5-A7",
+};
+
+static ssize_t show_card_status(struct device *dev,

drivers/misc/genwqe/card_sysfs.c line 58

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+				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;

This is a bit confusingly written. Why do:

	scnprintf(&buf[len], ...

When len is always zero at that point? Since you are printing from an array of statically sized strings that are guaranteed to be smaller than PAGE_SIZE, you can safely do:

	sprintf(buf, "%s\n", cs[cd->card_state]);

You might want to add some checking for cd->card_state being out of bounds, and printing "unknown" or something in that case.

Same issue exists in other sysfs handlers.

Quoted 157 lines
drivers/misc/genwqe/card_sysfs.c new file +157 -0
+}
+
+static ssize_t show_card_appid(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;
+}
+
+static ssize_t show_card_version(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;
+}
+
+/**
+ * FIXME Implement me!
+ */
+static ssize_t show_cpld_version(struct device *dev,
+				 struct device_attribute *attr,
+				 char *buf)
+{
+	ssize_t len = 0;
+	len += scnprintf(&buf[len], PAGE_SIZE - len,
+			 "unknown (FIXME)\n");
+	return len;
+}
+
+static ssize_t show_card_type(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)) ?
+			 "invalid" : genwqe_types[card_type]);
+	return len;
+}
+
+static ssize_t show_card_driver(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;
+}
+
+static ssize_t show_card_tempsens(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;
+}
+
+static ssize_t show_card_base_clock(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;
+}
+
+/**
+ * show_card_curr_bitstream() - Show the current bitstream id
+ *
+ * There is a bug in some old versions of the CPLD which selects the
+ * bitstream, which causes the IO_SLU_BITSTREAM register to report
+ * unreliable data in very rare cases. This makes this sysfs
+ * unreliable up to the point were a new CPLD version is being used.
+ *
+ * Unfortunately there is no automatic way yet to query the CPLD
+ * version (See show_cpld_version() ;-)), such that you need to
+ * manually ensure via programming tools that you have a recent
+ * version of the CPLD software.
+ *
+ * The proposed circumvention is to use a special recovery bitstream
+ * on the backup partition (0) to identify problems while loading the
+ * image.
+ */
+static ssize_t show_card_curr_bitstream(struct device *dev,
+					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;
+}
+
+/**
+ * show_card_next_bitstream() - Show the next activated bitstream
+ *
+ * IO_SLC_CFGREG_SOFTRESET: This register can only be accessed by the PF.
+ */
+static ssize_t show_card_next_bitstream(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	ssize_t len = 0;
+	int next_bitstream;
+	struct genwqe_dev *cd = dev_get_drvdata(dev);
+
+	switch ((cd->softreset & 0xCull) >> 2) {
+	case 0x2:
+		next_bitstream =  0;
+		break;
+	case 0x3:
+		next_bitstream =  1;
+		break;
+	default:
+		next_bitstream = -1;
+		break;		/* error */
+	}
+	len += scnprintf(&buf[len], PAGE_SIZE - len,
+			 "%d\n", next_bitstream);
+	return len;
+}

drivers/misc/genwqe/card_sysfs.c line 225

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+
+static ssize_t store_card_next_bitstream(struct device *dev,
+					 struct device_attribute *attr,
+					 const char *buf, size_t count)
+{
+	u64 partition;
+	struct genwqe_dev *cd = dev_get_drvdata(dev);
+
+	if (kstrtoull(buf, 0, &partition) < 0)
+		return -EINVAL;

Does this give a type error? partition should be unsigned long long, which is _at least_ 64 bits.

Quoted 37 lines
drivers/misc/genwqe/card_sysfs.c new file +37 -0
+
+	switch (partition) {
+	case 0x0:
+		cd->softreset = 0x78ull;
+		break;
+	case 0x1:
+		cd->softreset = 0x7cull;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	__genwqe_writeq(cd, IO_SLC_CFGREG_SOFTRESET, cd->softreset);
+	return count;
+}
+
+/*
+ * Create device_attribute structures / params: name, mode, show, store
+ * additional flag if valid in VF
+ */
+struct genwqe_dev_attrib {
+	struct device_attribute att;	/* sysfs entry attributes */
+	int vf;				/* may exist in VF or not */
+};
+
+static struct genwqe_dev_attrib dev_attr_tab[] = {
+	{__ATTR(tempsens,       S_IRUGO, show_card_tempsens, NULL), 0},
+	{__ATTR(next_bitstream, (S_IRUGO | S_IWUSR),
+		show_card_next_bitstream, store_card_next_bitstream), 0},
+	{__ATTR(curr_bitstream, S_IRUGO, show_card_curr_bitstream, NULL), 0},
+	{__ATTR(cpld_version,   S_IRUGO, show_cpld_version, NULL), 0},
+	{__ATTR(base_clock,	S_IRUGO, show_card_base_clock, NULL), 0},
+
+	{__ATTR(driver,		S_IRUGO, show_card_driver, NULL), 1},
+	{__ATTR(type,		S_IRUGO, show_card_type, NULL), 1},
+	{__ATTR(version,	S_IRUGO, show_card_version, NULL), 1},
+	{__ATTR(appid,		S_IRUGO, show_card_appid, NULL), 1},

drivers/misc/genwqe/card_sysfs.c line 272

Quoted 10 lines
drivers/misc/genwqe/card_sysfs.c new file +10 -0
+	{__ATTR(status,		S_IRUGO, show_card_status, NULL), 1},
+};
+
+/**
+ * create_card_sysfs() - Setup sysfs entries of the card device
+ *
+ * VFs have restricted mmio capabilities, so not all sysfs entries
+ * are allowed in VFs.
+ */
+int create_card_sysfs(struct genwqe_dev *cd)

This is extern, and has a very generic name. Prefix it with genwqe or something. Same for the function below, and for any other extern symbols you have.

#17 lore raw

Hi Ryan,

Am Donnerstag, den 31.10.2013, 14:49 +1100 schrieb Ryan Mallon:

Quoted 22 lines

drivers/misc/genwqe/card_sysfs.c

Quoted 7 lines
drivers/misc/genwqe/card_sysfs.c new file +7 -0
+static ssize_t show_card_status(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" };

drivers/misc/genwqe/card_sysfs.c line 58

Quoted 4 lines
drivers/misc/genwqe/card_sysfs.c new file +4 -0
+
+     len += scnprintf(&buf[len], PAGE_SIZE - len,
+                      "%s\n", cs[cd->card_state]);
+     return len;

This is a bit confusingly written. Why do:

        scnprintf(&buf[len], ...

When len is always zero at that point? Since you are printing from an array of statically sized strings that are guaranteed to be smaller than
PAGE_SIZE, you can safely do:

Quoted 7 lines
        sprintf(buf, "%s\n", cs[cd->card_state]);

You might want to add some checking for cd->card_state being out of bounds, and printing "unknown" or something in that case.

Same issue exists in other sysfs handlers.

I kept using scnprintf(), but reworked the code around it. ssize_t len is not needed of course and the &buf[len] stuff is obsolete too. I had sysfs entries with multiple lines of output, where it was convenient and safe to code it like that. Now since those interfaces were moved to debugfs, the sysfs code can be simpler, as you pointed it out.

Regards

Frank

#18 lore raw
In reply to Ryan Mallon

Hi Ryan,

Am Donnerstag, den 31.10.2013, 14:49 +1100 schrieb Ryan Mallon:

Quoted 4 lines
Quoted 4 lines

+/**
+ * create_card_sysfs() - Setup sysfs entries of the card device
+ *
+ * VFs have restricted mmio capabilities, so not all sysfs entries

Quoted 8 lines
Quoted 3 lines

+ * are allowed in VFs.
+ */
+int create_card_sysfs(struct genwqe_dev *cd)

This is extern, and has a very generic name. Prefix it with genwqe or something. Same for the function below, and for any other extern symbols
you have.

Good finding. I fixed that in the course of the other sysfs reworks too. Thanks for pointing it out.

Regards

Frank

#19 lore raw
In reply to Frank Haverkamp

Hi!

Quoted 4 lines

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.

Is it similar to the Intel's Xeon Phi? They basically many-core have computer on PCI card...

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#20 lore raw

Hi Pavel,

Am Dienstag, den 12.11.2013, 14:50 +0100 schrieb Pavel Machek:

Quoted 10 lines

Hi!

Quoted 4 lines

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.

Is it similar to the Intel's Xeon Phi? They basically many-core have computer on PCI card...

No, I think it is not the same. The GenWQE PCIe card is not a multi-processor card. One cannot run software on it.

Our GenWQE card can be configured by updating it with different bitstreams to perform different purposes. The service logic to perform such updates stays of course the same and the work-queue too. But the request one can put onto this work-queue can be of different nature. Currently we can do things like compression, decompression, calculate a CRC, copy data ...

Regards

Frank