fpga: dfl: fme: adding reserved bits for revision of FME/Port error
Subsystems (2)
PATCH v2 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. The new production like Intel PAC N6000 plans to deploy the new register format which it is more reasonable.
To distinguish the register layouts,we provide another sysfs node for revision info, but it is a bad method that using one sysfs node's value to determine the usage of other sysfs node.
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 attribution on the readout value.
---
v2:
- add documentation for this change.
- fix the reverse xmas tree declaration.
--- .../ABI/testing/sysfs-platform-dfl-fme | 37 ++++++++++++------- drivers/fpga/dfl-fme-error.c | 36 +++++++++++++++--- 2 files changed, 54 insertions(+), 19 deletions(-)
Documentation/ABI/testing/sysfs-platform-dfl-fme +24 -13
@@ -50,46 +50,57 @@ Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie0 link. - Write this file to clear errors logged in pcie0_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie0_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing + fails or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/pcie1_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie1 link. - Write this file to clear errors logged in pcie1_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie1_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing fails + or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/nonfatal_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-only. It returns non-fatal errors detected. +Description: Read-only. It returns non-fatal errors detected. The readout + value has embedded 4 bits revision attribution in Bit[59:56] + which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/catfatal_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-only. It returns catastrophic and fatal errors detected. + The readout value has embedded 4 bits revision attribution in + Bit[59:56] which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/inject_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to check errors injected. Write this - file to inject errors for testing purpose. Write fails with - -EINVAL if input parsing fails or input inject error code isn't - supported. +Description: Read-Write. Read this file to check errors injected. The readout + value has embedded 4 bits revision attribution which reserved by + hardware. Write this file to inject errors for testing purpose. + Clean Bit[59:56] before write this file. Write fails with -EINVAL + if input parsing fails or input inject error code isn't supported. What: /sys/bus/platform/devices/dfl-fme.0/errors/fme_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to get errors detected on FME. - Write this file to clear errors logged in fme_errors. Write +Description: Read-Write. Read this file to get errors detected on FME. The + readout value has embedded 4 bits revision attribution which + reserved by hardware. Write this file to clear errors logged + in fme_errors. Clean Bit[59:56] before write this file. Write fials with -EINVAL if input parsing fails or input error code doesn't match.
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 revision; +u64 dfh; + + 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 9 lines
-----Original Message-----
From: Zhang, Tianfei <[email protected]>
Sent: Tuesday, April 19, 2022 11:04 AM
To: Wu, Hao <[email protected]>; [email protected]; [email protected]; Xu, Yilun <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>
Subject: [PATCH v2] fpga: dfl: fme: adding reserved bits for revision of FME/Port error
Quoted 6 lines
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. The new production like Intel PAC N6000 plans to deploy the new register format which it is more reasonable.
Can you explain a little more why there would be different register layouts? There will only be two layouts or more?
Intel PAC N6000 "plans" to have new register format? Not finalized yet? So anyone could define its own error register layout, is my understanding correct?
Quoted 8 lines
To distinguish the register layouts,we provide another sysfs node for revision info, but it is a bad method that using one sysfs node's value to determine the usage of other sysfs node.
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 attribution on the readout value.
Will UUID be more reasonable than just 4bits value? If we consider this is a FPGA, anyone could implement its own error register layout, then just reserve 4bits will not be enough? I hope we don't need to modify the code and design again...
Quoted 193 lines
Signed-off-by Tianfei zhang <[email protected]>---
v2:
- add documentation for this change.
- fix the reverse xmas tree declaration.--- .../ABI/testing/sysfs-platform-dfl-fme | 37 ++++++++++++------- drivers/fpga/dfl-fme-error.c | 36 +++++++++++++++--- 2 files changed, 54 insertions(+), 19 deletions(-)Documentation/ABI/testing/sysfs-platform-dfl-fme +17
-11@@ -50,46 +50,57 @@ Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie0 link. - Write this file to clear errors logged in pcie0_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie0_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing + fails or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/pcie1_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie1 link. - Write this file to clear errors logged in pcie1_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie1_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing fails + or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/nonfatal_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-only. It returns non-fatal errors detected. +Description: Read-only. It returns non-fatal errors detected. The readout + value has embedded 4 bits revision attribution in Bit[59:56] + which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/catfatal_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-only. It returns catastrophic and fatal errors detected. + The readout value has embedded 4 bits revision attribution in + Bit[59:56] which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/inject_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to check errors injected. Write this - file to inject errors for testing purpose. Write fails with - -EINVAL if input parsing fails or input inject error code isn't - supported. +Description: Read-Write. Read this file to check errors injected. The readout + value has embedded 4 bits revision attribution which reservedby
Documentation/ABI/testing/sysfs-platform-dfl-fme +7
-2+ hardware. Write this file to inject errors for testing purpose. + Clean Bit[59:56] before write this file. Write fails with -EINVAL + if input parsing fails or input inject error code isn't supported. What: /sys/bus/platform/devices/dfl-fme.0/errors/fme_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to get errors detected on FME. - Write this file to clear errors logged in fme_errors. Write +Description: Read-Write. Read this file to get errors detected on FME. The + readout value has embedded 4 bits revision attribution which + reserved by hardware. Write this file to clear errors logged + in fme_errors. Clean Bit[59:56] before write this file. Write fials with -EINVAL if input parsing fails or input error code doesn't match.drivers/fpga/dfl-fme-error.c +16
-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) + +static u64 set_error_revision (struct device *dev,u64 value) +{ +void __iomem *base; +u64 revision; +u64 dfh; + + 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){
drivers/fpga/dfl-fme-error.c +7
-3@@ -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);drivers/fpga/dfl-fme-error.c +7
-4@@ -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, --2.26.2
Quoted 19 lines
-----Original Message-----
From: Wu, Hao <[email protected]>
Sent: Thursday, May 5, 2022 2:47 PM
To: Zhang, Tianfei <[email protected]>; [email protected]; [email protected]; Xu, Yilun <[email protected]>; [email protected]
Subject: RE: [PATCH v2] fpga: dfl: fme: adding reserved bits for revision of FME/Port errorQuoted 9 lines
-----Original Message-----
From: Zhang, Tianfei <[email protected]>
Sent: Tuesday, April 19, 2022 11:04 AM
To: Wu, Hao <[email protected]>; [email protected]; [email protected]; Xu, Yilun <[email protected]>; [email protected]
Cc: Zhang, Tianfei <[email protected]>
Subject: [PATCH v2] fpga: dfl: fme: adding reserved bits for revision of FME/Port error
Quoted 8 lines
Quoted 6 lines
From: Tianfei zhang <[email protected]>
There are 2 different register layouts for FME/Port error registers. The new production like Intel PAC N6000 plans to deploy the new register format which it is more reasonable.
Can you explain a little more why there would be different register layouts?
There is a historical problem for it, the older PAC card using the older register layout, but for now, we will use the newer register layout for OFS PAC card.
Quoted 1 line
There will only be two layouts or more?
Yes, we have two layouts now.
Quoted 1 line
Intel PAC N6000 "plans" to have new register format? Not finalized yet?
N6000 and all of PAC card in the future will use the new register layout for FME/Port error register.
Quoted 2 lines
So anyone could define its own error register layout, is my understanding correct?
Yes, we suggested that they are follow our OFS spec.
Quoted 5 lines
Quoted 5 lines
To distinguish the register layouts,we provide another sysfs node for revision info, but it is a bad method that using one sysfs node's value to determine the usage of other sysfs node.
Quoted 8 lines
Quoted 3 lines
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 attribution on the readout value.
Will UUID be more reasonable than just 4bits value? If we consider this is a FPGA, anyone could implement its own error register layout, then just reserve 4bits will not be enough? I hope we don't need to modify the code and design again...
The revision was came from DFH_REVISION field in DFH register which is 4-bits, I think is enough now. We suggested that the customers follow our register layout design.
In the DFH v1 spec, we will consider use the UUID but this spec has not finalized now.
Quoted 195 lines
Quoted 21 lines
Signed-off-by Tianfei zhang <[email protected]>---
v2:
- add documentation for this change.
- fix the reverse xmas tree declaration.--- .../ABI/testing/sysfs-platform-dfl-fme | 37 ++++++++++++------- drivers/fpga/dfl-fme-error.c | 36 +++++++++++++++--- 2 files changed, 54 insertions(+), 19 deletions(-)Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-0@@ -50,46 +50,57 @@ Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie0 link.Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019 · line 59
Quoted 10 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +5
-3- Write this file to clear errors logged in pcie0_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie0_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing + fails or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/pcie1_errors
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-0Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie1 link.Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 10 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +5
-3- Write this file to clear errors logged in pcie1_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie1_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing fails + or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/nonfatal_errors
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 9 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +3
-1Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-only. It returns non-fatal errors detected. +Description: Read-only. It returns non-fatal errors detected. The readout + value has embedded 4 bits revision attribution in Bit[59:56] + which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/catfatal_errors
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 8 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +2
-0Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-only. It returns catastrophic and fatal errors detected. + The readout value has embedded 4 bits revision attribution in + Bit[59:56] which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/inject_errors
Quoted 42 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +2
-4Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to check errors injected. Write this - file to inject errors for testing purpose. Write fails with - -EINVAL if input parsing fails or input inject error code isn't - supported. +Description: Read-Write. Read this file to check errors injected. The readout + value has embedded 4 bits revision attribution which reservedby
Documentation/ABI/testing/sysfs-platform-dfl-fme +7
-2+ hardware. Write this file to inject errors for testing purpose. + Clean Bit[59:56] before write this file. Write fails with -EINVAL + if input parsing fails or input inject error code isn't supported. What: /sys/bus/platform/devices/dfl-fme.0/errors/fme_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to get errors detected on FME. - Write this file to clear errors logged in fme_errors. Write +Description: Read-Write. Read this file to get errors detected on FME. The + readout value has embedded 4 bits revision attribution which + reserved by hardware. Write this file to clear errors logged + in fme_errors. Clean Bit[59:56] before write this file. Write fials with -EINVAL if input parsing fails or input error code doesn't match.(quoted diff) +0
-0
b/drivers/fpga/dfl-fme-error.cindex51c2892ec06d..a440bc09938d100644drivers/fpga/dfl-fme-error.c +7
-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) + +static u64 set_error_revision (struct device *dev,u64 value) { +void __iomem *base; +u64 revision; +u64 dfh;drivers/fpga/dfl-fme-error.c line 58
Quoted 10 lines
drivers/fpga/dfl-fme-error.c +7
-0+ + 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 @@
drivers/fpga/dfl-fme-error.c static ssize_t catfatal_errors_show(struct device
Quoted 36 lines
static
ssize_tpcie0_errors_show(struct device *dev,drivers/fpga/dfl-fme-error.c +2
-1value =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 +4
-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" , + (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 +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,
Quoted 39 lines
drivers/fpga/dfl-fme-error.c +7
-4struct 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, --2.26.2
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Subject: [PATCH v2] 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. The new production like Intel PAC N6000 plans to deploy the new register format which it is more reasonable.
Quoted 4 lines
Quoted 1 line
Can you explain a little more why there would be different register layouts?
There is a historical problem for it, the older PAC card using the older register layout, but for now, we will use the newer register layout for OFS PAC card.
So OFS is using the same way to distinguish different register layout?
Quoted 4 lines
Quoted 2 lines
There will only be two layouts or more?
Yes, we have two layouts now.
So it could be more in the future.
Quoted 10 lines
Quoted 2 lines
Intel PAC N6000 "plans" to have new register format? Not finalized yet?
N6000 and all of PAC card in the future will use the new register layout for FME/Port error register.
Quoted 2 lines
So anyone could define its own error register layout, is my understanding correct?
Yes, we suggested that they are follow our OFS spec.
So it's still possible customers have their own register definitions.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
To distinguish the register layouts,we provide another sysfs node for revision info, but it is a bad method that using one sysfs node's value to determine the usage of other sysfs node.
Quoted 8 lines
Quoted 3 lines
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 attribution on the readout value.
Will UUID be more reasonable than just 4bits value? If we consider this is a FPGA, anyone could implement its own error register layout, then just reserve 4bits will not be enough? I hope we don't need to modify the code and design again...
Quoted 5 lines
The revision was came from
DFH_REVISIONfield in DFH register which is 4-bits, I think is enough now.
We suggested that the customers follow our register layout design. In the DFH v1 spec, we will consider use the UUID but this spec has not finalized now.
So OFS is still using DFHv0 not DFHv1?
I didn't get your point, why you think 4-bits field is enough? It's possible in the future there could be more different register layouts, and customers could have different register layouts, and even for OFS is still using the same way...
Quoted 201 lines
Quoted 46 lines
Quoted 22 lines
Signed-off-by Tianfei zhang <[email protected]>---
v2:
- add documentation for this change.
- fix the reverse xmas tree declaration.--- .../ABI/testing/sysfs-platform-dfl-fme | 37 ++++++++++++------- drivers/fpga/dfl-fme-error.c | 36 +++++++++++++++--- 2 files changed, 54 insertions(+), 19 deletions(-)Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-0@@ -50,46 +50,57 @@ Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie0 link.Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019 · line 59
Quoted 10 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +5
-3- Write this file to clear errors logged in pcie0_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie0_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing + fails or input error code doesn't match. What: /sys/bus/platform/devices/dfl-fme.0/errors/pcie1_errors
Quoted 13 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +5
-3Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-Write. Read this file for errors detected on pcie1 link. - Write this file to clear errors logged in pcie1_errors. Write - fails with -EINVAL if input parsing fails or input error code - doesn't match. + The readout value has embedded 4 bits revision attribution + in Bit[59:56] which reserved by hardware. Write this file to + clear errors logged in pcie1_errors. Clean Bit[59:56] before + write this file. Write fails with -EINVAL if input parsing fails + or input error code doesn't match.Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019 · line 70
Quoted 1 line
Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-0What: /sys/bus/platform/devices/dfl-fme.0/errors/nonfatal_errors
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 5 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +1
-1Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-only. It returns non-fatal errors detected. +Description: Read-only. It returns non-fatal errors detected. Thereadout
Quoted 12 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +2
-0+ value has embedded 4 bits revision attribution in Bit[59:56] + which reserved by hardware. What: /sys/bus/platform/devices/dfl-fme.0/errors/catfatal_errors
Quoted 7 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +2
-0Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> Description: Read-only. It returns catastrophic and fatal errors detected. + The readout value has embedded 4 bits revision attribution in + Bit[59:56] which reserved by hardware.Quoted 6 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019 · line 86
Quoted 1 line
Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-0What: /sys/bus/platform/devices/dfl-fme.0/errors/inject_errors
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +0
-1Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to check errors injected.Write this
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +1
-3- file to inject errors for testing purpose. Write fails with - -EINVAL if input parsing fails or input inject error code isn't - supported. +Description: Read-Write. Read this file to check errors injected. Thereadout
Quoted 11 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme Date: August 2019
Quoted 11 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +1
-0+ value has embedded 4 bits revision attribution which reservedby
Documentation/ABI/testing/sysfs-platform-dfl-fme +3
-1+ hardware. Write this file to inject errors for testing purpose. + Clean Bit[59:56] before write this file. Write fails with -EINVAL + if input parsing fails or input inject error code isn't supported. What: /sys/bus/platform/devices/dfl-fme.0/errors/fme_errors Date: August 2019 KernelVersion: 5.4 Contact: Wu Hao <[email protected]> -Description: Read-Write. Read this file to get errors detected onFME.
Quoted 2 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme
Quoted 2 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +1
-1- Write this file to clear errors logged in fme_errors. Write +Description: Read-Write. Read this file to get errors detected onFME. The
Quoted 108 lines
Quoted 21 lines
Documentation/ABI/testing/sysfs-platform-dfl-fme +3
-0+ readout value has embedded 4 bits revision attribution which + reserved by hardware. Write this file to clear errors logged + in fme_errors. Clean Bit[59:56] before write this file. Write fials with -EINVAL if input parsing fails or input error code doesn't match.(quoted diff) +0
-0
b/drivers/fpga/dfl-fme-error.cindex51c2892ec06d..a440bc09938d100644drivers/fpga/dfl-fme-error.c +7
-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) + +static u64 set_error_revision (struct device *dev,u64 value) { +void __iomem *base; +u64 revision; +u64 dfh;drivers/fpga/dfl-fme-error.c line 58
Quoted 10 lines
drivers/fpga/dfl-fme-error.c +7
-0+ + 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 @@
drivers/fpga/dfl-fme-error.c static ssize_t catfatal_errors_show(struct device
Quoted 36 lines
static
ssize_tpcie0_errors_show(struct device *dev,drivers/fpga/dfl-fme-error.c +2
-1value =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 +4
-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" , + (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 +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,
Quoted 39 lines
drivers/fpga/dfl-fme-error.c +7
-4struct 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, --2.26.2