Skip to contentSkip to conversation

DFL Module support

PATCH In review Moritz Fischer 3 participants 13 messages Nov 3, 2020 – Nov 4, 2020

Subsystems (3)
lore
Share & tools
lore

Moritz Fischer

author maintainer
#0 lore raw

cover DFL Module support

Hi Greg,

as requested resend of pull request as patches.

Note: I put this on a separate branch so Maintainers can pull the stable tag to allow them to apply DFL based drivers through their trees (krzk@ had asked for this when Xu intially posted his patchset, since there was a driver for drivers/memory that uses this series).

Thanks,

Moritz

Xu Yilun (4):
fpga: dfl: fix the definitions of type & feature_id for dfl devices
fpga: dfl: move dfl_device_id to mod_devicetable.h
fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()
fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

 MAINTAINERS                       |  1 +
 drivers/fpga/dfl.c                |  4 +-
 drivers/fpga/dfl.h                | 85 +-----------------------------
 include/linux/dfl.h               | 86 +++++++++++++++++++++++++++++++
 include/linux/mod_devicetable.h   | 24 +++++++++
 scripts/mod/devicetable-offsets.c |  4 ++
 scripts/mod/file2alias.c          | 13 +++++
 7 files changed, 131 insertions(+), 86 deletions(-)
 create mode 100644 include/linux/dfl.h
Signature · 1 line
2.29.2
author maintainer
#1 lore raw

PATCH 1/4 fpga: dfl: fix the definitions of type & feature_id for dfl devices

From: Xu Yilun <[email protected]>

The value of the field dfl_device.type comes from the 12 bits register field DFH_ID according to DFL spec. So this patch changes the definition of the type field to u16.

Also it is not necessary to illustrate the valid bits of the type field in comments. Instead we should explicitly define the possible values in the enumeration type for it, because they are shared by hardware spec. We should not let the compiler decide these values.

Similar changes are also applied to dfl_device.feature_id.

This patch also fixed the MODALIAS format according to the changes above.

---
 drivers/fpga/dfl.c |  3 +--
 drivers/fpga/dfl.h | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/fpga/dfl.c +1 -2
index b450870b75ed..5a6ba3b2fa05 100644
@@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	struct dfl_device *ddev = to_dfl_dev(dev);
 
-	/* The type has 4 valid bits and feature_id has 12 valid bits */
-	return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X",
+	return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X",
 			      ddev->type, ddev->feature_id);
 }
 
drivers/fpga/dfl.h +7 -7
index 5dc758f655b7..ac373b1fcff9 100644
@@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
  * enum dfl_id_type - define the DFL FIU types
  */
 enum dfl_id_type {
-	FME_ID,
-	PORT_ID,
+	FME_ID = 0,
+	PORT_ID = 1,
 	DFL_ID_MAX,
 };
 
 /**
  * struct dfl_device_id -  dfl device identifier
- * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: contains 12 bits feature identifier local to its DFL FIU type.
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @driver_data: driver specific data.
  */
 struct dfl_device_id {
-	u8 type;
+	u16 type;
 	u16 feature_id;
 	unsigned long driver_data;
 };
@@ -543,7 +543,7 @@ struct dfl_device_id {
  * @dev: generic device interface.
  * @id: id of the dfl device.
  * @type: type of DFL FIU of the device. See enum dfl_id_type.
- * @feature_id: 16 bits feature identifier local to its DFL FIU type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @mmio_res: mmio resource of this dfl device.
  * @irqs: list of Linux IRQ numbers of this dfl device.
  * @num_irqs: number of IRQs supported by this dfl device.
@@ -553,7 +553,7 @@ struct dfl_device_id {
 struct dfl_device {
 	struct device dev;
 	int id;
-	u8 type;
+	u16 type;
 	u16 feature_id;
 	struct resource mmio_res;
 	int *irqs;
Signature · 1 line
2.29.2
author maintainer
#4 lore raw

PATCH 2/4 fpga: dfl: move dfl_device_id to mod_devicetable.h

In reply to Moritz Fischer

From: Xu Yilun <[email protected]>

In order to support MODULE_DEVICE_TABLE() for dfl device driver, this patch moves struct dfl_device_id to mod_devicetable.h

Some brief description for DFL (Device Feature List) is added to make the DFL known to the whole kernel.

---
 drivers/fpga/dfl.h              | 13 +------------
 include/linux/mod_devicetable.h | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/fpga/dfl.h +1 -12
index ac373b1fcff9..549c7900dcfd 100644
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/uuid.h>
@@ -525,18 +526,6 @@ enum dfl_id_type {
 	DFL_ID_MAX,
 };
 
-/**
- * struct dfl_device_id -  dfl device identifier
- * @type: DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: feature identifier local to its DFL FIU type.
- * @driver_data: driver specific data.
- */
-struct dfl_device_id {
-	u16 type;
-	u16 feature_id;
-	unsigned long driver_data;
-};
-
 /**
  * struct dfl_device - represent an dfl device on dfl bus
  *
include/linux/mod_devicetable.h +24 -0
index 5b08a473cdba..e4870e5d3ea8 100644
@@ -838,4 +838,28 @@ struct mhi_device_id {
 	kernel_ulong_t driver_data;
 };
 
+/*
+ * DFL (Device Feature List)
+ *
+ * DFL defines a linked list of feature headers within the device MMIO space to
+ * provide an extensible way of adding features. Software can walk through these
+ * predefined data structures to enumerate features. It is now used in the FPGA.
+ * See Documentation/fpga/dfl.rst for more information.
+ *
+ * The dfl bus type is introduced to match the individual feature devices (dfl
+ * devices) for specific dfl drivers.
+ */
+
+/**
+ * struct dfl_device_id -  dfl device identifier
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
+ * @driver_data: driver specific data.
+ */
+struct dfl_device_id {
+	__u16 type;
+	__u16 feature_id;
+	unsigned long driver_data;
+};
+
 #endif /* LINUX_MOD_DEVICETABLE_H */
Signature · 1 line
2.29.2
author maintainer
#7 lore raw

PATCH 3/4 fpga: dfl: add dfl bus support to MODULE_DEVICE_TABLE()

In reply to Moritz Fischer

From: Xu Yilun <[email protected]>

Device Feature List (DFL) is a linked list of feature headers within the device MMIO space. It is used by FPGA to enumerate multiple sub features within it. Each feature can be uniquely identified by DFL type and feature id, which can be read out from feature headers.

A dfl bus helps DFL framework modularize DFL device drivers for different sub features. The dfl bus matches its devices and drivers by DFL type and feature id.

This patch adds dfl bus support to MODULE_DEVICE_TABLE() by adding info about struct dfl_device_id in devicetable-offsets.c and add a dfl entry point in file2alias.c.

---
 scripts/mod/devicetable-offsets.c |  4 ++++
 scripts/mod/file2alias.c          | 13 +++++++++++++
 2 files changed, 17 insertions(+)
scripts/mod/devicetable-offsets.c +4 -0
index 27007c18e754..d8350eea6d1a 100644
@@ -243,5 +243,9 @@ int main(void)
 	DEVID(mhi_device_id);
 	DEVID_FIELD(mhi_device_id, chan);
 
+	DEVID(dfl_device_id);
+	DEVID_FIELD(dfl_device_id, type);
+	DEVID_FIELD(dfl_device_id, feature_id);
+
 	return 0;
 }
scripts/mod/file2alias.c +13 -0
index 2417dd1dee33..8a438c94dcd9 100644
@@ -1368,6 +1368,18 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)
 	return 1;
 }
 
+/* Looks like: dfl:tNfN */
+static int do_dfl_entry(const char *filename, void *symval, char *alias)
+{
+	DEF_FIELD(symval, dfl_device_id, type);
+	DEF_FIELD(symval, dfl_device_id, feature_id);
+
+	sprintf(alias, "dfl:t%04Xf%04X", type, feature_id);
+
+	add_wildcard(alias);
+	return 1;
+}
+
 /* Does namelen bytes of name exactly match the symbol? */
 static bool sym_is(const char *name, unsigned namelen, const char *symbol)
 {
@@ -1442,6 +1454,7 @@ static const struct devtable devtable[] = {
 	{"tee", SIZE_tee_client_device_id, do_tee_entry},
 	{"wmi", SIZE_wmi_device_id, do_wmi_entry},
 	{"mhi", SIZE_mhi_device_id, do_mhi_entry},
+	{"dfl", SIZE_dfl_device_id, do_dfl_entry},
 };
 
 /* Create MODULE_ALIAS() statements.
Signature · 1 line
2.29.2
author maintainer
#8 lore raw

PATCH 4/4 fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

In reply to Moritz Fischer

From: Xu Yilun <[email protected]>

Now the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.

[[email protected]: Fixed up header guards to match filename]
---
 MAINTAINERS         |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 -------------------------------------
 include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h
MAINTAINERS +1 -0
index e73636b75f29..9bbb378308a8 100644
@@ -6886,6 +6886,7 @@ S:	Maintained
 F:	Documentation/ABI/testing/sysfs-bus-dfl
 F:	Documentation/fpga/dfl.rst
 F:	drivers/fpga/dfl*
+F:	include/linux/dfl.h
 F:	include/uapi/linux/fpga-dfl.h
 
 FPGA MANAGER FRAMEWORK
drivers/fpga/dfl.c +1 -0
index 5a6ba3b2fa05..511b20ff35a3 100644
@@ -10,6 +10,7 @@
  *   Wu Hao <[email protected]>
  *   Xiao Guangrong <[email protected]>
  */
+#include <linux/dfl.h>
 #include <linux/fpga-dfl.h>
 #include <linux/module.h>
 #include <linux/uaccess.h>
drivers/fpga/dfl.h +0 -72

76 lines not on this page · raw message

include/linux/dfl.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
2.29.2
#5 lore raw

Re: [PATCH 2/4] fpga: dfl: move dfl_device_id to mod_devicetable.h

In reply to Moritz Fischer
Quoted 71 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

In order to support MODULE_DEVICE_TABLE() for dfl device driver, this patch moves struct dfl_device_id to mod_devicetable.h

Some brief description for DFL (Device Feature List) is added to make the DFL known to the whole kernel.

---
 drivers/fpga/dfl.h              | 13 +------------
 include/linux/mod_devicetable.h | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/fpga/dfl.h +1 -12
index ac373b1fcff9..549c7900dcfd 100644
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/uuid.h>
@@ -525,18 +526,6 @@ enum dfl_id_type {
 	DFL_ID_MAX,
 };
 
-/**
- * struct dfl_device_id -  dfl device identifier
- * @type: DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: feature identifier local to its DFL FIU type.
- * @driver_data: driver specific data.
- */
-struct dfl_device_id {
-	u16 type;
-	u16 feature_id;
-	unsigned long driver_data;
-};
-
 /**
  * struct dfl_device - represent an dfl device on dfl bus
  *
include/linux/mod_devicetable.h +12 -0
index 5b08a473cdba..e4870e5d3ea8 100644
@@ -838,4 +838,28 @@ struct mhi_device_id {
 	kernel_ulong_t driver_data;
 };
 
+/*
+ * DFL (Device Feature List)
+ *
+ * DFL defines a linked list of feature headers within the device MMIO space to
+ * provide an extensible way of adding features. Software can walk through these
+ * predefined data structures to enumerate features. It is now used in the FPGA.
+ * See Documentation/fpga/dfl.rst for more information.
+ *
+ * The dfl bus type is introduced to match the individual feature devices (dfl
+ * devices) for specific dfl drivers.
+ */
+

include/linux/mod_devicetable.h struct mhi_device_id { · line 862

Quoted 10 lines
include/linux/mod_devicetable.h +10 -0
+/**
+ * struct dfl_device_id -  dfl device identifier
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
+ * @driver_data: driver specific data.
+ */
+struct dfl_device_id {
+	__u16 type;
+	__u16 feature_id;
+	unsigned long driver_data;

This is the wrong type for driver_data now that it goes to userspace :(

{sigh}

#9 lore raw

Re: [PATCH 4/4] fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

In reply to Moritz Fischer
Quoted 12 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

Now the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.

[[email protected]: Fixed up header guards to match filename]
Quoted 7 lines
---
 MAINTAINERS         |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 -------------------------------------
 include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h

Why move this if there is no in-kernel users?

greg k-h

#2 lore raw

Re: [PATCH 1/4] fpga: dfl: fix the definitions of type & feature_id for dfl devices

In reply to Moritz Fischer
Quoted 29 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

The value of the field dfl_device.type comes from the 12 bits register field DFH_ID according to DFL spec. So this patch changes the definition of the type field to u16.

Also it is not necessary to illustrate the valid bits of the type field in comments. Instead we should explicitly define the possible values in the enumeration type for it, because they are shared by hardware spec. We should not let the compiler decide these values.

Similar changes are also applied to dfl_device.feature_id.

This patch also fixed the MODALIAS format according to the changes above.

---
 drivers/fpga/dfl.c |  3 +--
 drivers/fpga/dfl.h | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/fpga/dfl.c +0 -0
index b450870b75ed..5a6ba3b2fa05 100644

drivers/fpga/dfl.c static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) · line 301

Quoted 6 lines
drivers/fpga/dfl.c +1 -2
@@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	struct dfl_device *ddev = to_dfl_dev(dev);
 
-	/* The type has 4 valid bits and feature_id has 12 valid bits */
-	return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X",
+	return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X",

Why drop the comment and not just fix it up instead?

Quoted 19 lines
drivers/fpga/dfl.c +0 -0
 			      ddev->type, ddev->feature_id);
 }
 
drivers/fpga/dfl.h +2 -2
index 5dc758f655b7..ac373b1fcff9 100644
@@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
  * enum dfl_id_type - define the DFL FIU types
  */
 enum dfl_id_type {
-	FME_ID,
-	PORT_ID,
+	FME_ID = 0,
+	PORT_ID = 1,
 	DFL_ID_MAX,
 };
 
 /**

drivers/fpga/dfl.h long dfl_feature_ioctl_set_irq(struct platform_device *pdev, · line 535

Quoted 10 lines
drivers/fpga/dfl.h +3 -3
  * struct dfl_device_id -  dfl device identifier
- * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: contains 12 bits feature identifier local to its DFL FIU type.
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @driver_data: driver specific data.
  */
 struct dfl_device_id {
-	u8 type;
+	u16 type;

Why isn't this enum dfl_id_type?

drivers/fpga/dfl.h struct dfl_device_id { · line 546

Quoted 9 lines
drivers/fpga/dfl.h +1 -1
 	u16 feature_id;
 	unsigned long driver_data;
 };
@@ -543,7 +543,7 @@ struct dfl_device_id {
  * @dev: generic device interface.
  * @id: id of the dfl device.
  * @type: type of DFL FIU of the device. See enum dfl_id_type.
- * @feature_id: 16 bits feature identifier local to its DFL FIU type.
+ * @feature_id: feature identifier local to its DFL FIU type.

But feature_id is still 16 bits, why change this?

drivers/fpga/dfl.h struct dfl_device_id { · line 556

Quoted 9 lines
drivers/fpga/dfl.h +1 -1
  * @mmio_res: mmio resource of this dfl device.
  * @irqs: list of Linux IRQ numbers of this dfl device.
  * @num_irqs: number of IRQs supported by this dfl device.
@@ -553,7 +553,7 @@ struct dfl_device_id {
 struct dfl_device {
 	struct device dev;
 	int id;
-	u8 type;
+	u16 type;

why isn't this an enum as well?

greg k-h

maintainer
#3 lore raw

Re: [PATCH 1/4] fpga: dfl: fix the definitions of type & feature_id for dfl devices

Hi Greg:

Quoted 33 lines · Greg KH
Quoted 32 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

The value of the field dfl_device.type comes from the 12 bits register field DFH_ID according to DFL spec. So this patch changes the definition of the type field to u16.

Also it is not necessary to illustrate the valid bits of the type field in comments. Instead we should explicitly define the possible values in the enumeration type for it, because they are shared by hardware spec. We should not let the compiler decide these values.

Similar changes are also applied to dfl_device.feature_id.

This patch also fixed the MODALIAS format according to the changes above.

---
 drivers/fpga/dfl.c |  3 +--
 drivers/fpga/dfl.h | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/fpga/dfl.c +0 -0
index b450870b75ed..5a6ba3b2fa05 100644
@@ -298,8 +298,7 @@ static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	struct dfl_device *ddev = to_dfl_dev(dev);
 
Quoted 5 lines

drivers/fpga/dfl.c static int dfl_bus_uevent(struct device *dev, struct kobj_uevent_env *env) · line 301

Quoted 3 lines
drivers/fpga/dfl.c +1 -2
-	/* The type has 4 valid bits and feature_id has 12 valid bits */
-	return add_uevent_var(env, "MODALIAS=dfl:t%01Xf%03X",
+	return add_uevent_var(env, "MODALIAS=dfl:t%04Xf%04X",

Why drop the comment and not just fix it up instead?

Previously in Pull request for 5.10, you suggested that don't care too much about the exact data width.

"Who cares it's only 4 bits, we have room in the kernel to have it be a full 8
bits or 32 or whatever"

So I changed the type of 'type' & 'feature_id' all to u16 and deleted all the comments about the width of them.

Quoted 19 lines
Quoted 19 lines
drivers/fpga/dfl.c +0 -0
 			      ddev->type, ddev->feature_id);
 }
 
drivers/fpga/dfl.h +2 -2
index 5dc758f655b7..ac373b1fcff9 100644
@@ -520,19 +520,19 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,
  * enum dfl_id_type - define the DFL FIU types
  */
 enum dfl_id_type {
-	FME_ID,
-	PORT_ID,
+	FME_ID = 0,
+	PORT_ID = 1,
 	DFL_ID_MAX,
 };
 
Quoted 13 lines

drivers/fpga/dfl.h long dfl_feature_ioctl_set_irq(struct platform_device *pdev, · line 535

Quoted 11 lines
drivers/fpga/dfl.h +3 -3
 /**
  * struct dfl_device_id -  dfl device identifier
- * @type: contains 4 bits DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: contains 12 bits feature identifier local to its DFL FIU type.
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
  * @driver_data: driver specific data.
  */
 struct dfl_device_id {
-	u8 type;
+	u16 type;

Why isn't this enum dfl_id_type?

We are going to move the two fields to mod_devicetable.h, they will be eventually changed to __u16, so I use u16 here.

Quoted 12 lines

drivers/fpga/dfl.h struct dfl_device_id { · line 546

Quoted 10 lines
drivers/fpga/dfl.h +1 -1
 	u16 feature_id;
 	unsigned long driver_data;
 };
@@ -543,7 +543,7 @@ struct dfl_device_id {
  * @dev: generic device interface.
  * @id: id of the dfl device.
  * @type: type of DFL FIU of the device. See enum dfl_id_type.
- * @feature_id: 16 bits feature identifier local to its DFL FIU type.
+ * @feature_id: feature identifier local to its DFL FIU type.

But feature_id is still 16 bits, why change this?

As I mentioned before, I mean not to emphasize on the bitfield width.

Quoted 13 lines

drivers/fpga/dfl.h struct dfl_device_id { · line 556

Quoted 11 lines
drivers/fpga/dfl.h +1 -1
  * @mmio_res: mmio resource of this dfl device.
  * @irqs: list of Linux IRQ numbers of this dfl device.
  * @num_irqs: number of IRQs supported by this dfl device.
@@ -553,7 +553,7 @@ struct dfl_device_id {
 struct dfl_device {
 	struct device dev;
 	int id;
-	u8 type;
+	u16 type;

why isn't this an enum as well?

Same as before, the 'type' should be sync with dfl_device_id.type.

Thanks,
Yilun

Quoted 2 lines

greg k-h

maintainer
#6 lore raw

Re: [PATCH 2/4] fpga: dfl: move dfl_device_id to mod_devicetable.h

In reply to Greg KH
Quoted 85 lines · Greg KH
Quoted 71 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

In order to support MODULE_DEVICE_TABLE() for dfl device driver, this patch moves struct dfl_device_id to mod_devicetable.h

Some brief description for DFL (Device Feature List) is added to make the DFL known to the whole kernel.

---
 drivers/fpga/dfl.h              | 13 +------------
 include/linux/mod_devicetable.h | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 12 deletions(-)
drivers/fpga/dfl.h +1 -12
index ac373b1fcff9..549c7900dcfd 100644
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/iopoll.h>
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/uuid.h>
@@ -525,18 +526,6 @@ enum dfl_id_type {
 	DFL_ID_MAX,
 };
 
-/**
- * struct dfl_device_id -  dfl device identifier
- * @type: DFL FIU type of the device. See enum dfl_id_type.
- * @feature_id: feature identifier local to its DFL FIU type.
- * @driver_data: driver specific data.
- */
-struct dfl_device_id {
-	u16 type;
-	u16 feature_id;
-	unsigned long driver_data;
-};
-
 /**
  * struct dfl_device - represent an dfl device on dfl bus
  *
include/linux/mod_devicetable.h +12 -0
index 5b08a473cdba..e4870e5d3ea8 100644
@@ -838,4 +838,28 @@ struct mhi_device_id {
 	kernel_ulong_t driver_data;
 };
 
+/*
+ * DFL (Device Feature List)
+ *
+ * DFL defines a linked list of feature headers within the device MMIO space to
+ * provide an extensible way of adding features. Software can walk through these
+ * predefined data structures to enumerate features. It is now used in the FPGA.
+ * See Documentation/fpga/dfl.rst for more information.
+ *
+ * The dfl bus type is introduced to match the individual feature devices (dfl
+ * devices) for specific dfl drivers.
+ */
+

include/linux/mod_devicetable.h struct mhi_device_id { · line 862

Quoted 10 lines
include/linux/mod_devicetable.h +10 -0
+/**
+ * struct dfl_device_id -  dfl device identifier
+ * @type: DFL FIU type of the device. See enum dfl_id_type.
+ * @feature_id: feature identifier local to its DFL FIU type.
+ * @driver_data: driver specific data.
+ */
+struct dfl_device_id {
+	__u16 type;
+	__u16 feature_id;
+	unsigned long driver_data;

This is the wrong type for driver_data now that it goes to userspace :(

Quoted 1 line

{sigh}

Thanks for the catching, I should change it to kernel_ulong_t.

Thanks,
Yilun

maintainer
#10 lore raw

Re: [PATCH 4/4] fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

In reply to Greg KH
Quoted 21 lines · Greg KH
Quoted 12 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

Now the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.

[[email protected]: Fixed up header guards to match filename]
Quoted 7 lines
---
 MAINTAINERS         |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 -------------------------------------
 include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h
Quoted 1 line

Why move this if there is no in-kernel users?

The DFL emif driver in driver/memory is the first user, see:

https://lore.kernel.org/linux-fpga/20201027105545.GB20676@kozik-lap/T/#m6b72f043ecf266c6305bf43db88cddcaf3f9f73d

It is not in this patchset, but the memory controller maintainer is already acked this patch.

Thanks,
Yilun

Quoted 2 lines

greg k-h

#11 lore raw

Re: [PATCH 4/4] fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

Quoted 22 lines · Xu Yilun
Quoted 21 lines · Greg KH
Quoted 19 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

Now the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.

[[email protected]: Fixed up header guards to match filename]
---
 MAINTAINERS         |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 -------------------------------------
 include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h
Quoted 8 lines
Quoted 1 line

Why move this if there is no in-kernel users?

The DFL emif driver in driver/memory is the first user, see:

https://lore.kernel.org/linux-fpga/20201027105545.GB20676@kozik-lap/T/#m6b72f043ecf266c6305bf43db88cddcaf3f9f73d

It is not in this patchset, but the memory controller maintainer is already acked this patch.

How am I, or anyone else, supposed to know this?

Again, don't include patches that are not actually used, that's a huge red flag to any reviewer and it just makes them grumpy and sad and less-likely to ever want to review code from the submitter again...

{sigh}

greg k-h

maintainer
#12 lore raw

Re: [PATCH 4/4] fpga: dfl: move dfl bus related APIs to include/linux/dfl.h

Quoted 29 lines · Greg KH
Quoted 28 lines · Xu Yilun
Quoted 21 lines · Greg KH
Quoted 12 lines · Moritz Fischer

From: Xu Yilun <[email protected]>

Now the dfl drivers could be made as independent modules and put in different folders according to their functionalities. In order for scattered dfl device drivers to include dfl bus APIs, move the dfl bus APIs to a new header file in the public folder.

[[email protected]: Fixed up header guards to match filename]
Quoted 7 lines
---
 MAINTAINERS         |  1 +
 drivers/fpga/dfl.c  |  1 +
 drivers/fpga/dfl.h  | 72 -------------------------------------
 include/linux/dfl.h | 86 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 72 deletions(-)
 create mode 100644 include/linux/dfl.h
Quoted 1 line

Why move this if there is no in-kernel users?

The DFL emif driver in driver/memory is the first user, see:

https://lore.kernel.org/linux-fpga/20201027105545.GB20676@kozik-lap/T/#m6b72f043ecf266c6305bf43db88cddcaf3f9f73d

Quoted 8 lines
Quoted 2 lines

It is not in this patchset, but the memory controller maintainer is already acked this patch.

How am I, or anyone else, supposed to know this?

Again, don't include patches that are not actually used, that's a huge red flag to any reviewer and it just makes them grumpy and sad and less-likely to ever want to review code from the submitter again...

Sorry, I didn't explain it clearly.

The DFL emif driver was in this patchset before v11. All the maintainers are on the maillist, see the v10:
https://lore.kernel.org/linux-fpga/[email protected]/T/#m64f61e205ed0ea1fd65e30e24bea55da40f8881d

In v10, the first 4 patches are DFL bus related, the same as you can see in this pull request. The 5th is the dfl-n3000-nios driver and the 6th is the dfl-emif, they are the in-kernel users of dfl bus.

In v11, I didn't include the first 4 patches because Moritz has already queued them to his branch, I just send the remaining ones in order to save time for the reviewers.

Thanks,
Yilun

Quoted 4 lines

{sigh}

greg k-h