diff mbox

[2/2] cxl: Workaround XSL bug that does not clear the RA bit after a reset

Message ID 1467226286-28547-2-git-send-email-imunsie@au.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Ian Munsie June 29, 2016, 6:51 p.m. UTC
From: Ian Munsie <imunsie@au1.ibm.com>

An issue was noted in our debug logs where the XSL would leave the RA
bit asserted after an AFU reset operation, which would effectively
prevent further AFU reset operations from working.

Workaround the issue by clearing the RA bit with an MMIO write if it is
still asserted after any AFU control operation.

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 drivers/misc/cxl/native.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Frederic Barrat June 30, 2016, 11:05 a.m. UTC | #1
Le 29/06/2016 20:51, Ian Munsie a écrit :
> From: Ian Munsie <imunsie@au1.ibm.com>
>
> An issue was noted in our debug logs where the XSL would leave the RA
> bit asserted after an AFU reset operation, which would effectively
> prevent further AFU reset operations from working.
>
> Workaround the issue by clearing the RA bit with an MMIO write if it is
> still asserted after any AFU control operation.
>
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>


OK, should be safe and valid even on non-xsl hardware.

Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>


   Fred
Michael Ellerman July 11, 2016, 10:19 a.m. UTC | #2
On Wed, 2016-29-06 at 18:51:26 UTC, Ian Munsie wrote:
> From: Ian Munsie <imunsie@au1.ibm.com>
> 
> An issue was noted in our debug logs where the XSL would leave the RA
> bit asserted after an AFU reset operation, which would effectively
> prevent further AFU reset operations from working.
> 
> Workaround the issue by clearing the RA bit with an MMIO write if it is
> still asserted after any AFU control operation.
> 
> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
> Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/2a4f667aadb2d61c289a52a0d6

cheers
diff mbox

Patch

diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index 9479bfc..bc79be8 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -55,6 +55,16 @@  static int afu_control(struct cxl_afu *afu, u64 command, u64 clear,
 		cpu_relax();
 		AFU_Cntl = cxl_p2n_read(afu, CXL_AFU_Cntl_An);
 	};
+
+	if (AFU_Cntl & CXL_AFU_Cntl_An_RA) {
+		/*
+		 * Workaround for a bug in the XSL used in the Mellanox CX4
+		 * that fails to clear the RA bit after an AFU reset,
+		 * preventing subsequent AFU resets from working.
+		 */
+		cxl_p2n_write(afu, CXL_AFU_Cntl_An, AFU_Cntl & ~CXL_AFU_Cntl_An_RA);
+	}
+
 	pr_devel("AFU command complete: %llx\n", command);
 	afu->enabled = enabled;
 out: