fsi: scom: FSI2PIB error recovery
cover fsi: scom: FSI2PIB error recovery
Joel Stanley (2):
fsi: scom: Add dev_dbg in put_scom and get_scom paths
fsi: scom: Handle FSI2PIB timeout
drivers/fsi/fsi-scom.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
Signature · 1 line
2.27.0
PATCH 1/2 fsi: scom: Add dev_dbg in put_scom and get_scom paths
This helps understand scom failures by producing more information about the state of the slave.
Signed-off-by Joel Stanley <[email protected]>
--- drivers/fsi/fsi-scom.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/fsi/fsi-scom.c +10 -0
@@ -240,6 +240,8 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) {uint32_t dummy =-1 ; +dev_dbg (&scom->dev,"handle_fsi2pib_status %08x\n" , status); +if (status &SCOM_STATUS_PROTECTION )return -EPERM ;if (status &SCOM_STATUS_PARITY ) {
@@ -288,8 +290,12 @@ static int put_scom(struct scom_device *scom, uint64_t value,int rc, retries;for (retries =0 ; retries <SCOM_MAX_RETRIES ; retries++) { +dev_dbg (&scom->dev,"put_scom retry %d\n" , retries); + rc =raw_put_scom (scom, value, addr, &status);if (rc) { +dev_dbg (&scom->dev,"raw_put_scom failed rc = %d\n" , rc); +/* Try resetting the bridge if FSI fails */ if (rc != -ENODEV && retries ==0 ) { fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG,
@@ -322,9 +328,13 @@ static int get_scom(struct scom_device *scom, uint64_t *value,int rc, retries;for (retries =0 ; retries <SCOM_MAX_RETRIES ; retries++) { +dev_dbg (&scom->dev,"get_scom retry %d\n" , retries); + rc =raw_get_scom (scom, value, addr, &status);if (rc) {/* Try resetting the bridge if FSI fails */ +dev_dbg (&scom->dev,"raw_get_scom failed rc = %d\n" , rc); +if (rc != -ENODEV && retries ==0 ) {fsi_device_write (scom->fsi_dev,SCOM_FSI2PIB_RESET_REG , &dummy,sizeof (uint32_t ));
Signature · 1 line
2.27.0
PATCH 2/2 fsi: scom: Handle FSI2PIB timeout
In reply to Joel StanleyWhen the scom engine indicates a FSI2PIB timeout we can recover by writing any value to the reset register.
On a machine capable of doing SCOMs, the 0x30000 address will fail and cause subsequent accesses to fail:
$ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib) $ pdbg -p0 -b kernel getscom 0x30000 p0: 0x0000000000030000 failed (/proc0/pib) $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f failed (/proc0/pib)
After this patch, the kernel will detect and clear the error, allowing subsequent accesses to succeed:
$ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib) $ pdbg -p0 -b kernel getscom 0x30000 p0: 0x0000000000030000 failed (/proc0/pib) $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib)
Signed-off-by Joel Stanley <[email protected]>
--- drivers/fsi/fsi-scom.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/fsi/fsi-scom.c +19 -0
@@ -38,6 +38,15 @@#define SCOM_STATUS_PIB_RESP_MASK 0x00007000#define SCOM_STATUS_PIB_RESP_SHIFT 12 +/* Values the SCOM_STATUS_PIB_RESP_MASK can take */ +#define SCOM_PIB_ERR_XSCOM_BLOCKED 0x00004000 +#define SCOM_PIB_ERR_CHIPLET_OFFLINE 0x00002000 +#define SCOM_PIB_ERR_PARTIAL_GOOD 0x00006000 +#define SCOM_PIB_ERR_INVALID_ADDR 0x00001000 +#define SCOM_PIB_ERR_CLOCK 0x00005000 +#define SCOM_PIB_ERR_HANDSHAKE 0x00003000 +#define SCOM_PIB_ERR_TIMEOUT 0x00007000 +#define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ SCOM_STATUS_PARITY | \ SCOM_STATUS_PIB_ABORT | \
@@ -249,9 +258,19 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) sizeof(uint32_t));return -EIO ; } + +if (status &SCOM_PIB_ERR_TIMEOUT ) { +dev_dbg (&scom->dev,"PIB timeout, recovering\n" ); +fsi_device_write (scom->fsi_dev,SCOM_FSI2PIB_RESET_REG , + &dummy,sizeof (uint32_t )); +/* Return -EBUSY to force a retry */ +return -EBUSY ; + } +/* Return -EBUSY on PIB abort to force a retry */ if (status &SCOM_STATUS_PIB_ABORT )return -EBUSY ; +return 0 ; }
Signature · 1 line
2.27.0