Skip to content

Commit 4c8874c

Browse files
committed
accel/qaic: Implement quirk for SOC_HW_VERSION
The SOC_HW_VERSION register in the BHI space is not correctly initialized by the device and in many cases contains uninitialized data. The register could contain 0xFFFFFFFF which is a special value to indicate a link error in PCIe, therefore if observed, we could incorrectly think the device is down. Intercept reads for this register, and provide the correct value - every production instance would read 0x60110200 if the device was operating as intended. Fixes: a36bf7a ("accel/qaic: Add MHI controller") Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231208163101.1295769-3-quic_jhugo@quicinc.com
1 parent c8b6f4a commit 4c8874c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/accel/qaic/mhi_controller.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,21 @@ static struct mhi_controller_config aic100_config = {
404404

405405
static int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 *out)
406406
{
407-
u32 tmp = readl_relaxed(addr);
407+
u32 tmp;
408408

409+
/*
410+
* SOC_HW_VERSION quirk
411+
* The SOC_HW_VERSION register (offset 0x224) is not reliable and
412+
* may contain uninitialized values, including 0xFFFFFFFF. This could
413+
* cause a false positive link down error. Instead, intercept any
414+
* reads and provide the correct value of the register.
415+
*/
416+
if (addr - mhi_cntrl->regs == 0x224) {
417+
*out = 0x60110200;
418+
return 0;
419+
}
420+
421+
tmp = readl_relaxed(addr);
409422
if (tmp == U32_MAX)
410423
return -EIO;
411424

0 commit comments

Comments
 (0)