diff mbox

hw/xscom: Reset XSCOM engine after querying sleeping core FIR

Message ID 201605311147.u4VBdQ1o009319@mx0a-001b2d01.pphosted.com
State Changes Requested
Headers show

Commit Message

Vipin K Parashar May 31, 2016, 11:46 a.m. UTC
XSCOM engine blocks subsequently after querying FIR of any
sleeping core. This causes subsequent XSCOM opertions to hang
forever due to XSCOM engine being continuously busy. Reset XSCOM
engine after querying FIR of any sleeping core.

Cc: stable
Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
Note: This patch needs below patch:
hw/xscom: Reset XSCOM engine after finite number of
Link: https://patchwork.ozlabs.org/patch/628160/
Please apply above patch first for trying out this one.

 hw/xscom.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Comments

Stewart Smith July 11, 2016, 3:35 a.m. UTC | #1
Vipin K Parashar <vipin@linux.vnet.ibm.com> writes:
> XSCOM engine blocks subsequently after querying FIR of any
> sleeping core. This causes subsequent XSCOM opertions to hang
> forever due to XSCOM engine being continuously busy. Reset XSCOM
> engine after querying FIR of any sleeping core.
>
> Cc: stable
> Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
> ---
> Note: This patch needs below patch:
> hw/xscom: Reset XSCOM engine after finite number of
> Link: https://patchwork.ozlabs.org/patch/628160/
> Please apply above patch first for trying out this one.

hi,

this patch no longer applies to master, are you able to send a rebased patch?
Vipin K Parashar July 11, 2016, 9:04 p.m. UTC | #2
On Monday 11 July 2016 09:05 AM, Stewart Smith wrote:
> Vipin K Parashar <vipin@linux.vnet.ibm.com> writes:
>> XSCOM engine blocks subsequently after querying FIR of any
>> sleeping core. This causes subsequent XSCOM opertions to hang
>> forever due to XSCOM engine being continuously busy. Reset XSCOM
>> engine after querying FIR of any sleeping core.
>>
>> Cc: stable
>> Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
>> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
>> ---
>> Note: This patch needs below patch:
>> hw/xscom: Reset XSCOM engine after finite number of
>> Link: https://patchwork.ozlabs.org/patch/628160/
>> Please apply above patch first for trying out this one.
> hi,
>
> this patch no longer applies to master, are you able to send a rebased patch?
>

Thanks!! Stewart for picking it up.
Sent out a rebased version of this patch against master.
Also sent backported one for stable branch.

Regards,
Vipin
diff mbox

Patch

diff --git a/hw/xscom.c b/hw/xscom.c
index 2649a50..d081c4d 100644
--- a/hw/xscom.c
+++ b/hw/xscom.c
@@ -126,6 +126,7 @@  static void xscom_reset(uint32_t gcid)
 static int64_t xscom_handle_error(uint64_t hmer, uint32_t gcid, uint32_t pcb_addr,
 			      bool is_write, int64_t retries)
 {
+	int64_t ret;
 	struct timespec ts;
 	unsigned int stat = GETFIELD(SPR_HMER_XSCOM_STATUS, hmer);
 
@@ -163,21 +164,23 @@  static int64_t xscom_handle_error(uint64_t hmer, uint32_t gcid, uint32_t pcb_add
 				gcid, pcb_addr, stat);
 		return OPAL_BUSY;
 
-	/* CPU is asleep, don't retry */
+	/* CPU is asleep, reset and return. */
 	case 2:
-		return OPAL_WRONG_STATE;
-	}
+		ret = OPAL_WRONG_STATE;
+		break;
 
-	/* XXX: Create error log entry ? */
-	log_simple_error(&e_info(OPAL_RC_XSCOM_RW),
-		"XSCOM: %s error gcid=0x%x pcb_addr=0x%x stat=0x%x\n",
-		is_write ? "write" : "read", gcid, pcb_addr, stat);
+	/* Log error, reset and return. */
+	default:
+		ret = OPAL_HARDWARE;
+		log_simple_error(&e_info(OPAL_RC_XSCOM_RW),
+			"XSCOM: %s error gcid=0x%x pcb_addr=0x%x stat=0x%x\n",
+			is_write ? "write" : "read", gcid, pcb_addr, stat);
+	}
 
-	/* We need to reset the XSCOM or we'll hang on the next access */
+	/* Reset XSCOM engine before returning else we'll hang on the next access */
 	xscom_reset(gcid);
 
-	/* Non recovered ... just fail */
-	return OPAL_HARDWARE;
+	return ret;
 }
 
 static void xscom_handle_ind_error(uint64_t data, uint32_t gcid,