diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2016-09-13 14:45:26 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-09-13 15:50:41 +1000 |
commit | 459a7e1f012df02393c0bc0a0885024e044cbafd (patch) | |
tree | 18f693f7ffe4147c8964f81f7428c609e773fa8b /hw/centaur.c | |
parent | d6a64f99f3c9c39b00d0821cc04dc9a51fe06490 (diff) | |
download | skiboot-459a7e1f012df02393c0bc0a0885024e044cbafd.zip skiboot-459a7e1f012df02393c0bc0a0885024e044cbafd.tar.gz skiboot-459a7e1f012df02393c0bc0a0885024e044cbafd.tar.bz2 |
centaur: Mark centaur offline after 10 consecutive access errors
This avoids spamming the logs when the centaur is dead and PRD
constantly tries to access it
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/centaur.c')
-rw-r--r-- | hw/centaur.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/hw/centaur.c b/hw/centaur.c index 1f2b9c4..8b7311f 100644 --- a/hw/centaur.c +++ b/hw/centaur.c @@ -39,6 +39,9 @@ /* Is that correct ? */ #define MAX_CENTAURS_PER_CHIP 8 +/* Mark the centaur offline after this many consecutive errors */ +#define CENTAUR_ERR_OFFLINE_THRESHOLD 10 + /* * FSI2PIB register definitions (this could be moved out if we were to * support FSI master to other chips. @@ -319,12 +322,24 @@ int64_t centaur_xscom_read(uint32_t id, uint64_t pcb_addr, uint64_t *val) if (!centaur) return OPAL_PARAMETER; + if (!centaur->online) + return OPAL_XSCOM_CTR_OFFLINED; lock(¢aur->lock); if (pcb_addr & XSCOM_ADDR_IND_FLAG) rc = centaur_xscom_ind_read(centaur, pcb_addr, val); else rc = centaur_fsiscom_read(centaur, pcb_addr, val); + + /* We mark the centaur offline if we get too many errors on + * consecutive accesses + */ + if (rc) { + centaur->error_count++; + if (centaur->error_count > CENTAUR_ERR_OFFLINE_THRESHOLD) + centaur->online = false; + } else + centaur->error_count = 0; unlock(¢aur->lock); return rc; @@ -337,12 +352,24 @@ int64_t centaur_xscom_write(uint32_t id, uint64_t pcb_addr, uint64_t val) if (!centaur) return OPAL_PARAMETER; + if (!centaur->online) + return OPAL_XSCOM_CTR_OFFLINED; lock(¢aur->lock); if (pcb_addr & XSCOM_ADDR_IND_FLAG) rc = centaur_xscom_ind_write(centaur, pcb_addr, val); else rc = centaur_fsiscom_write(centaur, pcb_addr, val); + + /* We mark the centaur offline if we get too many errors on + * consecutive accesses + */ + if (rc) { + centaur->error_count++; + if (centaur->error_count > CENTAUR_ERR_OFFLINE_THRESHOLD) + centaur->online = false; + } else + centaur->error_count = 0; unlock(¢aur->lock); return rc; @@ -425,6 +452,7 @@ static bool centaur_add(uint32_t part_id, uint32_t mchip, uint32_t meng, centaur->fsi_master_chip_id = mchip; centaur->fsi_master_port = mport; centaur->fsi_master_engine = meng ? MFSI_cMFSI1 : MFSI_cMFSI0; + centaur->online = true; init_lock(¢aur->lock); list_head_init(¢aur->i2cms); |