Skip to contentSkip to conversation

drm/amd: Fix initialization mistake for NBIO 7.3.0

PATCH In review Mario Limonciello 3 participants 4 messages Mar 2, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Fix initialization mistake for NBIO 7.3.0

The same strapping initialization issue that happened on NBIO 7.5.1 appears to be happening on NBIO 7.3.0.
Apply the same fix to 7.3.0 as well.

Note: This workaround relies upon the integrated GPU being enabled in BIOS. If the integrated GPU is disabled in BIOS a different workaround will be required.

---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +9 -5
index 4b0d563c6522c..4ef1fa4603c8e 100644
@@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
 		if (def != data)
 			WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3), data);
 		break;
-	case IP_VERSION(7, 5, 1):
-		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
-		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
-		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
-		fallthrough;
 	default:
 		def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL));
 		data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,
@@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
 		break;
 	}
 
+	switch (adev->ip_versions[NBIO_HWIP][0]) {
+	case IP_VERSION(7, 3, 0):
+	case IP_VERSION(7, 5, 1):
+		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
+		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
+		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
+		break;
+	}
+
 	if (amdgpu_sriov_vf(adev))
 		adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
 			regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Mario Limonciello

The same strapping initialization issue that happened on NBIO 7.5.1 appears to be happening on NBIO 7.3.0.
Apply the same fix to 7.3.0 as well.

Quoted 8 lines

Note: This workaround relies upon the integrated GPU being enabled in BIOS. If the integrated GPU is disabled in BIOS a different workaround will be required.

Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +9 -6
index 4b0d563c6522c..4ef1fa4603c8e 100644
@@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
                if (def != data)
                        WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3), data);
                break;
-       case IP_VERSION(7, 5, 1):
-               data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
-               data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
-               WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
-               fallthrough;
        default:
                def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL));
                data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,
@@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
                break;
        }
 
+       switch (adev->ip_versions[NBIO_HWIP][0]) {
+       case IP_VERSION(7, 3, 0):
+       case IP_VERSION(7, 5, 1):
+               data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
+               data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
+               WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
+               break;
+       }
+
        if (amdgpu_sriov_vf(adev))
                adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
                        regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
--

2.25.1

Tested-by on v1 1/1
#2 lore raw
In reply to Mario Limonciello

Hello Mario,

Quoted 4 lines · Mario Limonciello

The same strapping initialization issue that happened on NBIO 7.5.1 appears to be happening on NBIO 7.3.0.
Apply the same fix to 7.3.0 as well.

Quoted 8 lines

Note: This workaround relies upon the integrated GPU being enabled in BIOS. If the integrated GPU is disabled in BIOS a different workaround will be required.

Quoted 21 lines
---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -5
index 4b0d563c6522c..4ef1fa4603c8e 100644
@@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
 		if (def != data)
 			WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regBIF1_PCIE_MST_CTRL_3), data);
 		break;
-	case IP_VERSION(7, 5, 1):
-		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
-		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
-		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
-		fallthrough;
 	default:
 		def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0, regPCIE_CONFIG_CNTL));
 		data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev) · line 395

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -0
@@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)
 		break;
 	}

My tree did not have the above hunk, so I only applied the second hunk.

I replugged by mouse keyboard several times and I have no longer any issues.

Find output of dmesg; lsusb; lspci; dmidecode; lscpu here:

https://tg.st/u/498cb495b307353870e4dbba901a9c7aa58b89d918f54fc73f014f9a4778cc2a.txt

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev) · line 408

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +9 -0
+	switch (adev->ip_versions[NBIO_HWIP][0]) {
+	case IP_VERSION(7, 3, 0):
+	case IP_VERSION(7, 5, 1):
+		data = RREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2);
+		data &= ~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;
+		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2, data);
+		break;
+	}
+
 	if (amdgpu_sriov_vf(adev))
 		adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
 			regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;

Thank you for the workaround.

Cheers,
Thomas

#3 lore raw

[Public]

Quoted 53 lines

-----Original Message-----
From: Thomas Glanzmann <[email protected]>
Sent: Thursday, March 2, 2023 14:17
To: Limonciello, Mario <[email protected]>
Cc: [email protected]; Natikar, Basavaraj <[email protected]>
Subject: Re: [PATCH] drm/amd: Fix initialization mistake for NBIO 7.3.0

Hello Mario,

Quoted 11 lines · Mario Limonciello

The same strapping initialization issue that happened on NBIO 7.5.1 appears to be happening on NBIO 7.3.0.
Apply the same fix to 7.3.0 as well.

Note: This workaround relies upon the integrated GPU being enabled in BIOS. If the integrated GPU is disabled in BIOS a different workaround will be required.

usb/Y%[email protected]/T/#u

Quoted 1 line

Review

Quoted 5 lines
---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct

Quoted 4 lines

index 4b0d563c6522c..4ef1fa4603c8e 100644

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -0
@@ -382,11 +382,6 @@ static void nbio_v7_2_init_registers(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 383

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -0
 		if (def != data)
 			WREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO, 0,

regBIF1_PCIE_MST_CTRL_3), data);

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -2
 		break;
-	case IP_VERSION(7, 5, 1):
-		data = RREG32_SOC15(NBIO, 0,

regRCC_DEV2_EPF0_STRAP2);

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 387

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -1
-		data &=

~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 388

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -1
-		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2,

data);

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -1
-		fallthrough;
 	default:
 		def = data = RREG32_PCIE_PORT(SOC15_REG_OFFSET(NBIO,

0, regPCIE_CONFIG_CNTL));

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -0
 		data = REG_SET_FIELD(data, PCIE_CONFIG_CNTL,
@@ -399,6 +394,15 @@ static void nbio_v7_2_init_registers(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 395

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +0 -0
 		break;
 	}

My tree did not have the above hunk, so I only applied the second hunk.

Yeah this hunk it changes is on it's way to 6.3 right now. I think with the good test results we probably want to take this back to stable as well when they both land.

Quoted 25 lines

I replugged by mouse keyboard several times and I have no longer any issues.

Find output of dmesg; lsusb; lspci; dmidecode; lscpu here:

https://tg.st/u/498cb495b307353870e4dbba901a9c7aa58b89d918f54fc73f014f
9a4778cc2a.txt

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +4 -0
+	switch (adev->ip_versions[NBIO_HWIP][0]) {
+	case IP_VERSION(7, 3, 0):
+	case IP_VERSION(7, 5, 1):
+		data = RREG32_SOC15(NBIO, 0,

regRCC_DEV2_EPF0_STRAP2);

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 400

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +1 -0
+		data &=

~RCC_DEV2_EPF0_STRAP2__STRAP_NO_SOFT_RESET_DEV2_F0_MASK;

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct · line 401

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +1 -0
+		WREG32_SOC15(NBIO, 0, regRCC_DEV2_EPF0_STRAP2,

data);

drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c static void nbio_v7_2_init_registers(struct amdgpu_device *adev)

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +3 -0
+		break;
+	}
+
 	if (amdgpu_sriov_vf(adev))
 		adev->rmmio_remap.reg_offset =

SOC15_REG_OFFSET(NBIO, 0,

Quoted 1 line
Quoted 3 lines
	regBIF_BX_PF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;

Thank you for the workaround.

Sure, thanks for reporting it.