accel-config: Replicate driver error codes in idxd.h in library
ramesh.thomas at intel.com
PATCH 1/1 accel-config: Replicate driver error codes in idxd.h in library
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Duplicate the driver error code related constants defined in idxd.h in library to avoid dependency on kernel versions.
--- accfg/lib/libaccfg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
accfg/lib/libaccfg.c +23 -1
@@ -27,7 +27,6 @@#include <accfg/libaccel_config.h> #include <fnmatch.h> #include "private.h" -#include <linux/idxd.h> #define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"
@@ -74,6 +73,29 @@ enum { ACCFG_CMD_STATUS_ERROR = 0x80010000, }; +/* driver error codes from kernel idxd.h */ +enum idxd_scmd_stat { +IDXD_SCMD_DEV_ENABLED =0x80000010 , +IDXD_SCMD_DEV_NOT_ENABLED =0x80000020 , +IDXD_SCMD_WQ_ENABLED =0x80000021 , +IDXD_SCMD_DEV_DMA_ERR =0x80020000 , +IDXD_SCMD_WQ_NO_GRP =0x80030000 , +IDXD_SCMD_WQ_NO_NAME =0x80040000 , +IDXD_SCMD_WQ_NO_SVM =0x80050000 , +IDXD_SCMD_WQ_NO_THRESH =0x80060000 , +IDXD_SCMD_WQ_PORTAL_ERR =0x80070000 , +IDXD_SCMD_WQ_RES_ALLOC_ERR =0x80080000 , +IDXD_SCMD_PERCPU_ERR =0x80090000 , +IDXD_SCMD_DMA_CHAN_ERR =0x800a0000 , +IDXD_SCMD_CDEV_ERR =0x800b0000 , +IDXD_SCMD_WQ_NO_SWQ_SUPPORT =0x800c0000 , +IDXD_SCMD_WQ_NONE_CONFIGURED =0x800d0000 , +IDXD_SCMD_WQ_NO_SIZE =0x800e0000 , +}; + +#define IDXD_SCMD_SOFTERR_MASK 0x80000000 +#define IDXD_SCMD_SOFTERR_SHIFT 16 +#define SCMD_STAT (x) (((x) & ~IDXD_SCMD_SOFTERR_MASK) >> \ IDXD_SCMD_SOFTERR_SHIFT)
Signature · 1 line
2.26.3
Dave Jiang
Quoted 4 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Duplicate the driver error code related constants defined in
idxd.hin library to avoid dependency on kernel versions.
I think instead of replicating certain defines, the suggestion by Vishal was to make a copy of the latest kernel uapi idxd.h in accel-config. This is probably the best. Otherwise you'll have conflicts if this is build with the latest idxd.h having those defines as well.
Quoted 48 lines
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>--- accfg/lib/libaccfg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)accfg/lib/libaccfg.c +23
-1@@ -27,7 +27,6 @@#include <accfg/libaccel_config.h> #include <fnmatch.h> #include "private.h" -#include <linux/idxd.h> #define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"@@ -74,6 +73,29 @@ enum { ACCFG_CMD_STATUS_ERROR = 0x80010000, }; +/* driver error codes from kernel idxd.h */ +enum idxd_scmd_stat { +IDXD_SCMD_DEV_ENABLED =0x80000010 , +IDXD_SCMD_DEV_NOT_ENABLED =0x80000020 , +IDXD_SCMD_WQ_ENABLED =0x80000021 , +IDXD_SCMD_DEV_DMA_ERR =0x80020000 , +IDXD_SCMD_WQ_NO_GRP =0x80030000 , +IDXD_SCMD_WQ_NO_NAME =0x80040000 , +IDXD_SCMD_WQ_NO_SVM =0x80050000 , +IDXD_SCMD_WQ_NO_THRESH =0x80060000 , +IDXD_SCMD_WQ_PORTAL_ERR =0x80070000 , +IDXD_SCMD_WQ_RES_ALLOC_ERR =0x80080000 , +IDXD_SCMD_PERCPU_ERR =0x80090000 , +IDXD_SCMD_DMA_CHAN_ERR =0x800a0000 , +IDXD_SCMD_CDEV_ERR =0x800b0000 , +IDXD_SCMD_WQ_NO_SWQ_SUPPORT =0x800c0000 , +IDXD_SCMD_WQ_NONE_CONFIGURED =0x800d0000 , +IDXD_SCMD_WQ_NO_SIZE =0x800e0000 , +}; + +#define IDXD_SCMD_SOFTERR_MASK 0x80000000 +#define IDXD_SCMD_SOFTERR_SHIFT 16 +#define SCMD_STAT (x) (((x) & ~IDXD_SCMD_SOFTERR_MASK) >> \ IDXD_SCMD_SOFTERR_SHIFT)
Thomas
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in /usr/include. Do you think defining new constants would be safer?
Quoted 61 lines · Dave Jiang
Quoted 4 lines · ramesh.thomas(a)intel.com
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Duplicate the driver error code related constants defined in
idxd.hin library to avoid dependency on kernel versions.I think instead of replicating certain defines, the suggestion by Vishal was to make a copy of the latest kernel uapi
idxd.hin accel-config. This is probably the best. Otherwise you'll have conflicts if this is build with the latestidxd.hhaving those defines as well.Quoted 48 lines
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>--- accfg/lib/libaccfg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)accfg/lib/libaccfg.c +23
-1@@ -27,7 +27,6 @@#include <accfg/libaccel_config.h> #include <fnmatch.h> #include "private.h" -#include <linux/idxd.h> #define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"@@ -74,6 +73,29 @@ enum { ACCFG_CMD_STATUS_ERROR = 0x80010000, }; +/* driver error codes from kernel idxd.h */ +enum idxd_scmd_stat { +IDXD_SCMD_DEV_ENABLED =0x80000010 , +IDXD_SCMD_DEV_NOT_ENABLED =0x80000020 , +IDXD_SCMD_WQ_ENABLED =0x80000021 , +IDXD_SCMD_DEV_DMA_ERR =0x80020000 , +IDXD_SCMD_WQ_NO_GRP =0x80030000 , +IDXD_SCMD_WQ_NO_NAME =0x80040000 , +IDXD_SCMD_WQ_NO_SVM =0x80050000 , +IDXD_SCMD_WQ_NO_THRESH =0x80060000 , +IDXD_SCMD_WQ_PORTAL_ERR =0x80070000 , +IDXD_SCMD_WQ_RES_ALLOC_ERR =0x80080000 , +IDXD_SCMD_PERCPU_ERR =0x80090000 , +IDXD_SCMD_DMA_CHAN_ERR =0x800a0000 , +IDXD_SCMD_CDEV_ERR =0x800b0000 , +IDXD_SCMD_WQ_NO_SWQ_SUPPORT =0x800c0000 , +IDXD_SCMD_WQ_NONE_CONFIGURED =0x800d0000 , +IDXD_SCMD_WQ_NO_SIZE =0x800e0000 , +}; + +#define IDXD_SCMD_SOFTERR_MASK 0x80000000 +#define IDXD_SCMD_SOFTERR_SHIFT 16 +#define SCMD_STAT (x) (((x) & ~IDXD_SCMD_SOFTERR_MASK) >> \ IDXD_SCMD_SOFTERR_SHIFT)
Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?
I think instead of pulling the /usr/include version we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.
Quoted 60 lines · Dave Jiang
Quoted 58 lines · ramesh.thomas(a)intel.com
Quoted 4 lines
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Duplicate the driver error code related constants defined in
idxd.hin library to avoid dependency on kernel versions.I think instead of replicating certain defines, the suggestion by Vishal was to make a copy of the latest kernel uapi
idxd.hin accel-config. This is probably the best. Otherwise you'll have conflicts if this is build with the latestidxd.hhaving those defines as well.Quoted 47 lines
Signed-off-by Ramesh Thomas <ramesh.thomas(a)intel.com>--- accfg/lib/libaccfg.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)accfg/lib/libaccfg.c +23
-1@@ -27,7 +27,6 @@#include <accfg/libaccel_config.h> #include <fnmatch.h> #include "private.h" -#include <linux/idxd.h> #define MDEV_POSTFIX "mdev_supported_types"#define IDXD_DRIVER_BIND_PATH "/sys/bus/dsa/drivers/idxd"@@ -74,6 +73,29 @@ enum { ACCFG_CMD_STATUS_ERROR = 0x80010000, }; +/* driver error codes from kernel idxd.h */ +enum idxd_scmd_stat { +IDXD_SCMD_DEV_ENABLED =0x80000010 , +IDXD_SCMD_DEV_NOT_ENABLED =0x80000020 , +IDXD_SCMD_WQ_ENABLED =0x80000021 , +IDXD_SCMD_DEV_DMA_ERR =0x80020000 , +IDXD_SCMD_WQ_NO_GRP =0x80030000 , +IDXD_SCMD_WQ_NO_NAME =0x80040000 , +IDXD_SCMD_WQ_NO_SVM =0x80050000 , +IDXD_SCMD_WQ_NO_THRESH =0x80060000 , +IDXD_SCMD_WQ_PORTAL_ERR =0x80070000 , +IDXD_SCMD_WQ_RES_ALLOC_ERR =0x80080000 , +IDXD_SCMD_PERCPU_ERR =0x80090000 , +IDXD_SCMD_DMA_CHAN_ERR =0x800a0000 , +IDXD_SCMD_CDEV_ERR =0x800b0000 , +IDXD_SCMD_WQ_NO_SWQ_SUPPORT =0x800c0000 , +IDXD_SCMD_WQ_NONE_CONFIGURED =0x800d0000 , +IDXD_SCMD_WQ_NO_SIZE =0x800e0000 , +}; + +#define IDXD_SCMD_SOFTERR_MASK 0x80000000 +#define IDXD_SCMD_SOFTERR_SHIFT 16 +#define SCMD_STAT (x) (((x) & ~IDXD_SCMD_SOFTERR_MASK) >> \ IDXD_SCMD_SOFTERR_SHIFT)
Thomas
Quoted 9 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.
I was also concerned about user apps including the /user/include idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the sw cmd_status which is not available in older idxd.h, I think it is better to define them separately and privately for the library.
Dave Jiang
Quoted 8 lines · Ramesh
Quoted 7 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.
Quoted 7 lines
I was also concerned about user apps including the /user/include
idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the swcmd_statuswhich is not available in olderidxd.h, I think it is better to define them separately and privately for the library.
User ABI is considered constant for Linux and if we are changing it, there would be ways to provide backward compatibility. I think making copy of header should be safe. That is why ndctl does that.
Quoted 1 line
Thomas
Noticed driver idxd.h has GPL license. Library is LGPL and I remember LGPL cannot use GPL code. Even if that is changed in newer drivers I am not sure if there is any issue with older drivers.
Quoted 21 lines · Dave Jiang
Quoted 8 lines · Ramesh
Quoted 7 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.Quoted 7 lines
I was also concerned about user apps including the /user/include
idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the swcmd_statuswhich is not available in olderidxd.h, I think it is better to define them separately and privately for the library.User ABI is considered constant for Linux and if we are changing it, there would be ways to provide backward compatibility. I think making copy of header should be safe. That is why ndctl does that.
Quoted 1 line
Dave Jiang
I just noticed that include/uapi/linux/ndctl.h is distributed as LGPL. I wonder if it's possible to change that given only we (Intel) has touched this file.
Quoted 24 lines · Ramesh
Noticed driver
idxd.hhas GPL license. Library is LGPL and I remember LGPL cannot use GPL code. Even if that is changed in newer drivers I am not sure if there is any issue with older drivers.Quoted 19 lines · Dave Jiang
Quoted 8 lines · Ramesh
Quoted 7 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.Quoted 7 lines
I was also concerned about user apps including the /user/include
idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the swcmd_statuswhich is not available in olderidxd.h, I think it is better to define them separately and privately for the library.User ABI is considered constant for Linux and if we are changing it, there would be ways to provide backward compatibility. I think making copy of header should be safe. That is why ndctl does that.
Thomas
What should we do while this is resolved to fix the compile issue? Should I create an idxd.h with LGPL license?
Quoted 29 lines · Dave Jiang
I just noticed that
include/uapi/linux/ndctl.his distributed as LGPL. I wonder if it's possible to change that given only we (Intel) has touched this file.Quoted 24 lines · Ramesh
Noticed driver
idxd.hhas GPL license. Library is LGPL and I remember LGPL cannot use GPL code. Even if that is changed in newer drivers I am not sure if there is any issue with older drivers.Quoted 19 lines · Dave Jiang
Quoted 8 lines · Ramesh
Quoted 7 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.Quoted 7 lines
I was also concerned about user apps including the /user/include
idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the swcmd_statuswhich is not available in olderidxd.h, I think it is better to define them separately and privately for the library.User ABI is considered constant for Linux and if we are changing it, there would be ways to provide backward compatibility. I think making copy of header should be safe. That is why ndctl does that.
Dave Jiang
Quoted 2 lines · Ramesh
What should we do while this is resolved to fix the compile issue? Should I create an
idxd.hwith LGPL license?
I'm ok with that.
Quoted 31 lines · Dave Jiang
Quoted 29 lines
I just noticed that
include/uapi/linux/ndctl.his distributed as LGPL. I wonder if it's possible to change that given only we (Intel) has touched this file.Quoted 24 lines · Ramesh
Noticed driver
idxd.hhas GPL license. Library is LGPL and I remember LGPL cannot use GPL code. Even if that is changed in newer drivers I am not sure if there is any issue with older drivers.Quoted 19 lines · Dave Jiang
Quoted 8 lines · Ramesh
Quoted 7 lines · Dave Jiang
Quoted 3 lines · Ramesh
I think copying will have the problem of compiler picking different ones. Library may use the copied version while the app may get the one in
/usr/include. Do you think defining new constants would be safer?I think instead of pulling the
/usr/includeversion we just depend on the copied version exclusively. Then we will have 1 less dependency and compile correctly always.Quoted 7 lines
I was also concerned about user apps including the /user/include
idxd.h. Even in libaccel we would need to make assumptions that the constants used will not diverge from the one driver is using. Since the issue is only about some constants like the swcmd_statuswhich is not available in olderidxd.h, I think it is better to define them separately and privately for the library.User ABI is considered constant for Linux and if we are changing it, there would be ways to provide backward compatibility. I think making copy of header should be safe. That is why ndctl does that.