fpga: dfl: fme: adding reserved bits for revision of FME/Port error
Subsystems (2)
PATCH 1/1 fpga: dfl: fme: adding reserved bits for revision of FME/Port error
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) to indicate the revision of register layout for userland application.
--- drivers/fpga/dfl-fme-error.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/fpga/dfl-fme-error.c +30 -6
@@ -39,6 +39,22 @@#define ERROR_MASK GENMASK_ULL(63, 0) +/* Bit[59:56] was reserved by software for error revision */ +#define ERROR_SW_REVISION_MASK GENMASK_ULL(59, 56) + +static u64 set_error_revision (struct device *dev,u64 value) +{ +void __iomem *base; +u64 dfh; +u64 revision; + + base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + dfh =readq (base); + revision =FIELD_GET (DFH_REVISION , dfh); + +return value |FIELD_PREP (ERROR_SW_REVISION_MASK , revision); +} +static ssize_t pcie0_errors_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -52,7 +68,8 @@ static ssize_t pcie0_errors_show(struct device *dev, value =readq (base +PCIE0_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie0_errors_store(struct device *dev,
@@ -97,7 +114,8 @@ static ssize_t pcie1_errors_show(struct device *dev, value =readq (base +PCIE1_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie1_errors_store(struct device *dev,
@@ -133,11 +151,13 @@ static ssize_t nonfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + value =readq (base +RAS_NONFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_NONFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (nonfatal_errors);
@@ -145,11 +165,13 @@ static ssize_t catfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + value =readq (base +RAS_CATFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_CATFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (catfatal_errors);
@@ -165,9 +187,10 @@ static ssize_t inject_errors_show(struct device *dev,mutex_lock (&pdata->lock); v =readq (base +RAS_ERROR_INJECT );mutex_unlock (&pdata->lock); + v =FIELD_GET (INJECT_ERROR_MASK , v);return sprintf (buf,"0x%llx\n" , - (unsigned long long )FIELD_GET (INJECT_ERROR_MASK , v)); + (unsigned long long )set_error_revision (dev, v)); } static ssize_t inject_errors_store(struct device *dev,
@@ -211,7 +234,8 @@ static ssize_t fme_errors_show(struct device *dev, value =readq (base +FME_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t fme_errors_store(struct device *dev,
Signature · 1 line
2.26.2
Xu Yilun
maintainerQuoted 6 lines · Tianfei Zhang
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) to indicate the revision of register layout for userland application.
Please specify that the 4 bits are reserved by HW so that SW appends revision info on these bits for the attr readout value.
Quoted 11 lines
Signed-off-by Tianfei zhang <[email protected]>--- drivers/fpga/dfl-fme-error.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)drivers/fpga/dfl-fme-error.c +0
-0
drivers/fpga/dfl-fme-error.c line 43
Quoted 5 lines
drivers/fpga/dfl-fme-error.c +2
-0@@ -39,6 +39,22 @@#define ERROR_MASK GENMASK_ULL(63, 0) +/* Bit[59:56] was reserved by software for error revision */ +#define ERROR_SW_REVISION_MASK GENMASK_ULL(59, 56)
This will change the user behavior for the error interfaces. Now they need to recognize the revision bits and discard them before clearing the errors, is it?
How users know the revision fields in output values? Maybe it still involves change in Documentation/ABI/testing/sysfs-platform-dfl-fme, which should be reconsidered carefully.
drivers/fpga/dfl-fme-error.c line 49
Quoted 6 lines
drivers/fpga/dfl-fme-error.c +6
-0+ +static u64 set_error_revision (struct device *dev,u64 value) +{ +void __iomem *base; +u64 dfh; +u64 revision;
Better we follow the reverse xmas tree declaration, so reverse the 2 lines please.
Thanks,
Yilun
Quoted 85 lines
drivers/fpga/dfl-fme-error.c +22
-6+ + base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + dfh =readq (base); + revision =FIELD_GET (DFH_REVISION , dfh); + +return value |FIELD_PREP (ERROR_SW_REVISION_MASK , revision); +} +static ssize_t pcie0_errors_show (struct device *dev,struct device_attribute *attr,char *buf) {@@ -52,7 +68,8 @@ static ssize_t pcie0_errors_show(struct device *dev, value =readq (base +PCIE0_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie0_errors_store(struct device *dev,@@ -97,7 +114,8 @@ static ssize_t pcie1_errors_show(struct device *dev, value =readq (base +PCIE1_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie1_errors_store(struct device *dev,@@ -133,11 +151,13 @@ static ssize_t nonfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + value =readq (base +RAS_NONFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_NONFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (nonfatal_errors);@@ -145,11 +165,13 @@ static ssize_t catfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base =dfl_get_feature_ioaddr_by_id (dev,FME_FEATURE_ID_GLOBAL_ERR ); + value =readq (base +RAS_CATFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_CATFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (catfatal_errors);@@ -165,9 +187,10 @@ static ssize_t inject_errors_show(struct device *dev,mutex_lock (&pdata->lock); v =readq (base +RAS_ERROR_INJECT );mutex_unlock (&pdata->lock); + v =FIELD_GET (INJECT_ERROR_MASK , v);return sprintf (buf,"0x%llx\n" , - (unsigned long long )FIELD_GET (INJECT_ERROR_MASK , v)); + (unsigned long long )set_error_revision (dev, v)); } static ssize_t inject_errors_store(struct device *dev,@@ -211,7 +234,8 @@ static ssize_t fme_errors_show(struct device *dev, value =readq (base +FME_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t fme_errors_store(struct device *dev,Signature · 1 line
2.26.2
Quoted 12 lines
-----Original Message-----
From: Xu, Yilun <[email protected]>
Sent: Saturday, April 16, 2022 11:53 PM
To: Zhang, Tianfei <[email protected]>
Cc: Wu, Hao <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] fpga: dfl: fme: adding reserved bits for revision of FME/Port errorOn Tue, Apr 12, 2022 at 02:35:23AM -0400, Tianfei Zhang wrote:
Quoted 8 lines
Quoted 5 lines
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) to indicate the revision of register layout for userland application.
Please specify that the 4 bits are reserved by HW so that SW appends revision info on these bits for the attr readout value.
Yes, correct, I will make the git log message clear. How about this git commit message:
There are 2 different register layouts for FME/Port error registers.
This patch introduces 4 reserved bits (Bit[59:56]) which are reserved by HW, dfl driver appends the FME/Port error revision info on those bits for attribute on the readout value.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Tianfei zhang <[email protected]>--- drivers/fpga/dfl-fme-error.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/fpga/dfl-fme-error.cindex51c2892ec06d..3b54470f56ca100644drivers/fpga/dfl-fme-error.c +0
-0@@ -39,6 +39,22 @@
Quoted 7 lines
drivers/fpga/dfl-fme-error.c
Quoted 4 lines
drivers/fpga/dfl-fme-error.c +2
-0#define ERROR_MASK GENMASK_ULL(63, 0) +/* Bit[59:56] was reserved by software for error revision */ #define +ERROR_SW_REVISION_MASK GENMASK_ULL(59, 56)This will change the user behavior for the error interfaces. Now they need to recognize the revision bits and discard them before clearing the errors, is it?
Yes, the end-user write to those error register without this revision info.
Quoted 4 lines
How users know the revision fields in output values? Maybe it still involves change in
Documentation/ABI/testing/sysfs-platform-dfl-fme, which should be reconsidered carefully.
I will add those info in sysfs node documentation.
Quoted 9 lines
drivers/fpga/dfl-fme-error.c line 49
Quoted 6 lines
drivers/fpga/dfl-fme-error.c +5
-0+ +static u64 set_error_revision (struct device *dev,u64 value) { +void __iomem *base; +u64 dfh; +u64 revision;Better we follow the reverse xmas tree declaration, so reverse the 2 lines please.
Yes, I will fix it on next version.
Quoted 90 lines
Thanks,
Yilundrivers/fpga/dfl-fme-error.c line 50
Quoted 2 lines
drivers/fpga/dfl-fme-error.c +2
-0+ + base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);drivers/fpga/dfl-fme-error.c
Quoted 7 lines
drivers/fpga/dfl-fme-error.c +5
-0+ dfh =readq (base); + revision =FIELD_GET (DFH_REVISION , dfh); + +return value |FIELD_PREP (ERROR_SW_REVISION_MASK , revision); } +static ssize_t pcie0_errors_show (struct device *dev, struct device_attribute *attr, char *buf) { @@-52,7 +68,8 @@
Quoted 16 lines
drivers/fpga/dfl-fme-error.c +2
-1static ssize_t pcie0_errors_show (struct device *dev, value = readq(base + PCIE0_ERROR);mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie0_errors_store(struct device *dev, @@ -97,7 +114,8@@ static
ssize_tpcie1_errors_show(struct device *dev,drivers/fpga/dfl-fme-error.c +1
-1value =readq (base +PCIE1_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n",drivers/fpga/dfl-fme-error.c static ssize_t pcie1_errors_show(struct device *dev,
Quoted 10 lines
drivers/fpga/dfl-fme-error.c +3
-0+ (unsigned long long)set_error_revision(dev, value)); } static ssize_t pcie1_errors_store(struct device *dev, @@ -133,11 +151,13 @@ static ssize_t nonfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) {void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);drivers/fpga/dfl-fme-error.c static ssize_t catfatal_errors_show(struct device
Quoted 9 lines
drivers/fpga/dfl-fme-error.c +2
-1+ value =readq (base +RAS_NONFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_NONFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (nonfatal_errors);@@ -145,11 +165,13 @@ static ssize_t catfatal_errors_show(struct device*dev,
drivers/fpga/dfl-fme-error.c static ssize_t nonfatal_errors_show(struct device *dev,
Quoted 5 lines
drivers/fpga/dfl-fme-error.c +1
-0struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);Quoted 32 lines
drivers/fpga/dfl-fme-error.c +7
-4+ value =readq (base +RAS_CATFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_CATFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (catfatal_errors);@@ -165,9 +187,10 @@ static ssize_t inject_errors_show(struct device *dev,mutex_lock (&pdata->lock); v =readq (base +RAS_ERROR_INJECT );mutex_unlock (&pdata->lock); + v =FIELD_GET (INJECT_ERROR_MASK , v);return sprintf (buf,"0x%llx\n" , - (unsigned long long )FIELD_GET (INJECT_ERROR_MASK , v)); + (unsigned long long )set_error_revision (dev, v)); } static ssize_t inject_errors_store(struct device *dev, @@ -211,7 +234,8 @@ static ssize_t fme_errors_show(struct device *dev, value = readq(base + FME_ERROR); mutex_unlock(&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n", + (unsigned long long)set_error_revision(dev, value)); } static ssize_t fme_errors_store(struct device *dev, --2.26.2
Quoted 10 lines
Quoted 10 lines
-----Original Message-----
From: Xu, Yilun <[email protected]>
Sent: Saturday, April 16, 2022 11:53 PM
To: Zhang, Tianfei <[email protected]>
Cc: Wu, Hao <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] fpga: dfl: fme: adding reserved bits for revision of FME/Port error
Quoted 6 lines
Quoted 6 lines · Tianfei Zhang
Quoted 5 lines
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) to indicate the revision of register layout for userland application.
Please provide more detailed background information to explain why we need this.
Quoted 11 lines
Quoted 3 lines
Please specify that the 4 bits are reserved by HW so that SW appends revision info on these bits for the attr readout value.
Yes, correct, I will make the git log message clear. How about this git commit message:
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) which are reserved by HW, dfl driver appends the
FME/Port error revision info on those bits for attribute on the readout value.
We need more clear information, why we have 2 different register layouts, and why 2 different register layouts requires 4 bits in HW, or even 4 bits will that be enough?
Quoted 132 lines
Quoted 15 lines
Quoted 15 lines
Signed-off-by Tianfei zhang <[email protected]>--- drivers/fpga/dfl-fme-error.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/fpga/dfl-fme-error.cindex51c2892ec06d..3b54470f56ca100644drivers/fpga/dfl-fme-error.c +0
-0@@ -39,6 +39,22 @@Quoted 7 lines
drivers/fpga/dfl-fme-error.c
Quoted 4 lines
drivers/fpga/dfl-fme-error.c +2
-0#define ERROR_MASK GENMASK_ULL(63, 0) +/* Bit[59:56] was reserved by software for error revision */ #define +ERROR_SW_REVISION_MASK GENMASK_ULL(59, 56)This will change the user behavior for the error interfaces. Now they need to recognize the revision bits and discard them before clearing the errors, is it?
Yes, the end-user write to those error register without this revision info.
Quoted 4 lines
How users know the revision fields in output values? Maybe it still involves change in
Documentation/ABI/testing/sysfs-platform-dfl-fme, which should be reconsidered carefully.I will add those info in sysfs node documentation.
Quoted 9 lines
drivers/fpga/dfl-fme-error.c line 49
Quoted 6 lines
drivers/fpga/dfl-fme-error.c +5
-0+ +static u64 set_error_revision (struct device *dev,u64 value) { +void __iomem *base; +u64 dfh; +u64 revision;Better we follow the reverse xmas tree declaration, so reverse the 2 lines please.
Yes, I will fix it on next version.
Quoted 90 lines
Thanks,
Yilundrivers/fpga/dfl-fme-error.c line 50
Quoted 2 lines
drivers/fpga/dfl-fme-error.c +2
-0+ + base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);drivers/fpga/dfl-fme-error.c
Quoted 7 lines
drivers/fpga/dfl-fme-error.c +5
-0+ dfh =readq (base); + revision =FIELD_GET (DFH_REVISION , dfh); + +return value |FIELD_PREP (ERROR_SW_REVISION_MASK , revision); } +static ssize_t pcie0_errors_show (struct device *dev, struct device_attribute *attr, char *buf) { @@-52,7 +68,8 @@
Quoted 16 lines
drivers/fpga/dfl-fme-error.c +2
-1static ssize_t pcie0_errors_show (struct device *dev, value = readq(base + PCIE0_ERROR);mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie0_errors_store(struct device *dev, @@ -97,7 +114,8@@ static
ssize_tpcie1_errors_show(struct device *dev,drivers/fpga/dfl-fme-error.c +1
-1value =readq (base +PCIE1_ERROR );mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n",drivers/fpga/dfl-fme-error.c static ssize_t pcie1_errors_show(struct device *dev,
Quoted 10 lines
drivers/fpga/dfl-fme-error.c +3
-0+ (unsigned long long)set_error_revision(dev, value)); } static ssize_t pcie1_errors_store(struct device *dev, @@ -133,11 +151,13 @@ static ssize_t nonfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) {void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);drivers/fpga/dfl-fme-error.c static ssize_t catfatal_errors_show(struct device
Quoted 9 lines
drivers/fpga/dfl-fme-error.c +2
-1+ value =readq (base +RAS_NONFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_NONFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (nonfatal_errors);@@ -145,11 +165,13 @@ static ssize_t catfatal_errors_show(struct device*dev,
drivers/fpga/dfl-fme-error.c static ssize_t nonfatal_errors_show(struct device *dev,
Quoted 5 lines
drivers/fpga/dfl-fme-error.c +1
-0struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);Quoted 32 lines
drivers/fpga/dfl-fme-error.c +7
-4+ value =readq (base +RAS_CATFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_CATFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (catfatal_errors);@@ -165,9 +187,10 @@ static ssize_t inject_errors_show(struct device *dev,mutex_lock (&pdata->lock); v =readq (base +RAS_ERROR_INJECT );mutex_unlock (&pdata->lock); + v =FIELD_GET (INJECT_ERROR_MASK , v);return sprintf (buf,"0x%llx\n" , - (unsigned long long )FIELD_GET (INJECT_ERROR_MASK , v)); + (unsigned long long )set_error_revision (dev, v)); } static ssize_t inject_errors_store(struct device *dev, @@ -211,7 +234,8 @@ static ssize_t fme_errors_show(struct device *dev, value = readq(base + FME_ERROR); mutex_unlock(&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n", + (unsigned long long)set_error_revision(dev, value)); } static ssize_t fme_errors_store(struct device *dev, --2.26.2
Quoted 21 lines
-----Original Message-----
From: Wu, Hao <[email protected]>
Sent: Monday, April 18, 2022 9:52 AM
To: Zhang, Tianfei <[email protected]>; Xu, Yilun <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v1] fpga: dfl: fme: adding reserved bits for revision of FME/Port errorQuoted 10 lines
Quoted 10 lines
-----Original Message-----
From: Xu, Yilun <[email protected]>
Sent: Saturday, April 16, 2022 11:53 PM
To: Zhang, Tianfei <[email protected]>
Cc: Wu, Hao <[email protected]>; [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH v1] fpga: dfl: fme: adding reserved bits for revision of FME/Port errorOn Tue, Apr 12, 2022 at 02:35:23AM -0400, Tianfei Zhang wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) to indicate the revision of register layout for userland application.
Please provide more detailed background information to explain why we need this.
The background is that it is not a good method that it use one sysfs node' value to determine the usage of other sysfs node.
The sysfs node should be has a persistent value or usage.
In our previous patch, we provide a "revision" sysfs node for user application to get the register layout information while paring the FME/Port error registers.
Quoted 9 lines
Quoted 9 lines
Quoted 4 lines
Please specify that the 4 bits are reserved by HW so that SW appends revision info on these bits for the attr readout value.
Yes, correct, I will make the git log message clear. How about this git commit
message:
Quoted 8 lines
Quoted 4 lines
There are 2 different register layouts for FME/Port error registers. This patch introduces 4 reserved bits (Bit[59:56]) which are reserved by HW, dfl driver appends the FME/Port error revision info on those bits for attribute on the readout value.
We need more clear information, why we have 2 different register layouts, and why 2 different register layouts requires 4 bits in HW, or even 4 bits will that be enough?
The old production like PAC N3000 was used the old format, and the new production like PAC N6000 was used the new register format. The new register format will be more reasonable.
The revision in DFH register was 4 bits width, so we reserved 4 bits is enough.
Quoted 137 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Signed-off-by Tianfei zhang <[email protected]>--- drivers/fpga/dfl-fme-error.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/fpga/dfl-fme-error.cindex51c2892ec06d..3b54470f56ca100644drivers/fpga/dfl-fme-error.c +0
-0@@ -39,6 +39,22 @@Quoted 7 lines
Quoted 7 lines
drivers/fpga/dfl-fme-error.c line 43
Quoted 4 lines
drivers/fpga/dfl-fme-error.c +2
-0#define ERROR_MASK GENMASK_ULL(63, 0) +/* Bit[59:56] was reserved by software for error revision */ +#define ERROR_SW_REVISION_MASK GENMASK_ULL(59, 56)This will change the user behavior for the error interfaces. Now they need to recognize the revision bits and discard them before clearing the
errors, is it?
Quoted 81 lines
Yes, the end-user write to those error register without this revision info.
Quoted 4 lines
How users know the revision fields in output values? Maybe it still involves change in
Documentation/ABI/testing/sysfs-platform-dfl-fme, which should be reconsidered carefully.I will add those info in sysfs node documentation.
Quoted 9 lines
drivers/fpga/dfl-fme-error.c line 49
Quoted 6 lines
drivers/fpga/dfl-fme-error.c +5
-0+ +static u64 set_error_revision (struct device *dev,u64 value) { +void __iomem *base; +u64 dfh; +u64 revision;Better we follow the reverse xmas tree declaration, so reverse the 2 lines please.
Yes, I will fix it on next version.
Quoted 61 lines
Thanks,
Yilundrivers/fpga/dfl-fme-error.c line 50
Quoted 2 lines
drivers/fpga/dfl-fme-error.c +2
-0+ + base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);drivers/fpga/dfl-fme-error.c
Quoted 7 lines
drivers/fpga/dfl-fme-error.c +5
-0+ dfh =readq (base); + revision =FIELD_GET (DFH_REVISION , dfh); + +return value |FIELD_PREP (ERROR_SW_REVISION_MASK , revision); } +static ssize_t pcie0_errors_show (struct device *dev, struct device_attribute *attr, char *buf) { @@-52,7 +68,8 @@
Quoted 16 lines
drivers/fpga/dfl-fme-error.c +4
-2static ssize_t pcie0_errors_show (struct device *dev, value = readq(base + PCIE0_ERROR);mutex_unlock (&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); +return sprintf (buf,"0x%llx\n" , + (unsigned long long )set_error_revision (dev, value)); } static ssize_t pcie0_errors_store(struct device *dev, @@ -97,7 +114,8 @@ static ssize_t pcie1_errors_show(struct device *dev, value = readq(base + PCIE1_ERROR); mutex_unlock(&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n",drivers/fpga/dfl-fme-error.c
Quoted 10 lines
drivers/fpga/dfl-fme-error.c +3
-0+ (unsigned long long)set_error_revision(dev, value)); } static ssize_t pcie1_errors_store(struct device *dev, @@ -133,11 +151,13 @@ static ssize_t nonfatal_errors_show(struct device *dev, struct device_attribute *attr, char *buf) {void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);Quoted 10 lines
drivers/fpga/dfl-fme-error.c +2
-1+ value =readq (base +RAS_NONFAT_ERROR );return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_NONFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (nonfatal_errors);@@ -145,11 +165,13 @@ static ssize_t catfatal_errors_show(structdevice
*dev,
drivers/fpga/dfl-fme-error.c static ssize_t nonfatal_errors_show(struct device *dev,
Quoted 5 lines
drivers/fpga/dfl-fme-error.c +1
-0struct device_attribute *attr, char *buf) { void __iomem *base; +u64 value; base = dfl_get_feature_ioaddr_by_id(dev,
FME_FEATURE_ID_GLOBAL_ERR);Quoted 2 lines
drivers/fpga/dfl-fme-error.c +1
-0+ value =readq (base +RAS_CATFAT_ERROR );Quoted 7 lines
Quoted 7 lines
drivers/fpga/dfl-fme-error.c static ssize_t inject_errors_show(struct device
Quoted 7 lines
drivers/fpga/dfl-fme-error.c +1
-1return sprintf (buf,"0x%llx\n" , - (unsigned long long )readq (base +RAS_CATFAT_ERROR )); + (unsigned long long )set_error_revision (dev, value)); }static DEVICE_ATTR_RO (catfatal_errors);@@ -165,9 +187,10 @@ static ssize_t inject_errors_show(struct device*dev,
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
drivers/fpga/dfl-fme-error.c +5
-3mutex_lock (&pdata->lock); v =readq (base +RAS_ERROR_INJECT );mutex_unlock (&pdata->lock); + v =FIELD_GET (INJECT_ERROR_MASK , v);return sprintf (buf,"0x%llx\n" , - (unsigned long long )FIELD_GET (INJECT_ERROR_MASK , v)); + (unsigned long long )set_error_revision (dev, v)); } static ssize_t inject_errors_store(struct device *dev, @@ -211,7 +234,8 @@ static ssize_t fme_errors_show(struct device *dev, value = readq(base + FME_ERROR); mutex_unlock(&pdata->lock); -return sprintf (buf,"0x%llx\n" , (unsigned long long )value); + return sprintf(buf, "0x%llx\n", + (unsigned long long)set_error_revision(dev, value)); } static ssize_t fme_errors_store(struct device *dev, --2.26.2