Skip to contentSkip to conversation

drm/amdgpu: Do not program AGP BAR regs under SRIOV

PATCH Superseded Victor Lu 3 participants 6 messages Feb 14, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Victor Lu

author
#0 lore raw

PATCH 1/3 drm/amdgpu: Do not program AGP BAR regs under SRIOV

SRIOV VF does not have write access to AGP BAR regs. Skip the writes to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +5 -5
index 0e3ddea7b8e0..a7bfc9f41d0e 100644
@@ -92,12 +92,12 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
 {
 	uint64_t value;
 
-	/* Program the AGP BAR */
-	WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BASE, 0);
-	WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
-	WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
-
 	if (!amdgpu_sriov_vf(adev) || adev->asic_type <= CHIP_VEGA10) {
+		/* Program the AGP BAR */
+		WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BASE, 0);
+		WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
+		WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
+
 		/* Program the system aperture low logical page number. */
 		WREG32_SOC15_RLC(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
 			min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/3 drm/amdgpu: Do not write to GRBM_CNTL if Aldebaran SRIOV

Aldebaran SRIOV VF does not have write permissions to GRBM_CTNL. This access can be skipped to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index ccdfe7c37517..569a76835918 100644
@@ -2637,7 +2637,9 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
 	u32 tmp;
 	int i;
 
-	WREG32_FIELD15_RLC(GC, 0, GRBM_CNTL, READ_TIMEOUT, 0xff);
+	if (!amdgpu_sriov_vf(adev) || (adev->asic_type != CHIP_ALDEBARAN)) {
+		WREG32_FIELD15_RLC(GC, 0, GRBM_CNTL, READ_TIMEOUT, 0xff);
+	}
 
 	gfx_v9_0_tiling_mode_table_init(adev);
 
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 2/3] drm/amdgpu: Do not write to GRBM_CNTL if Aldebaran SRIOV

Quoted 13 lines · Victor Lu

Aldebaran SRIOV VF does not have write permissions to GRBM_CTNL. This access can be skipped to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index ccdfe7c37517..569a76835918 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_constants_init(struct amdgpu_device *adev) · line 2640

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -2637,7 +2637,9 @@ static void gfx_v9_0_constants_init(struct amdgpu_device *adev)
 	u32 tmp;
 	int i;
 
-	WREG32_FIELD15_RLC(GC, 0, GRBM_CNTL, READ_TIMEOUT, 0xff);
+	if (!amdgpu_sriov_vf(adev) || (adev->asic_type != CHIP_ALDEBARAN)) {

Please switch to IP version checks -

	amdgpu_ip_version(adev, GC_HWIP, 0) != IP_VERSION(9, 4, 2)

Thanks,
Lijo

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+		WREG32_FIELD15_RLC(GC, 0, GRBM_CNTL, READ_TIMEOUT, 0xff);
+	}
 
 	gfx_v9_0_tiling_mode_table_init(adev);
 
author
#3 lore raw

PATCH 3/3 drm/amdgpu: Do not set power brake sequence for Aldebaran SRIOV

In reply to Victor Lu

Aldebaran SRIOV VF cannot access the power brake feature regs. The accesses can be skipped to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
index 569a76835918..31b378eb5318 100644
@@ -4044,7 +4044,8 @@ static int gfx_v9_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
+	if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2) &&
+	    !(amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN)))
 		gfx_v9_4_2_set_power_brake_sequence(adev);
 
 	return r;
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 3/3] drm/amdgpu: Do not set power brake sequence for Aldebaran SRIOV

Quoted 13 lines · Victor Lu

Aldebaran SRIOV VF cannot access the power brake feature regs. The accesses can be skipped to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
index 569a76835918..31b378eb5318 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_hw_init(struct amdgpu_ip_block *ip_block) · line 4048

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -1
@@ -4044,7 +4044,8 @@ static int gfx_v9_0_hw_init(struct amdgpu_ip_block *ip_block)
 	if (r)
 		return r;
 
-	if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2))
+	if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 2) &&
+	    !(amdgpu_sriov_vf(adev) && (adev->asic_type == CHIP_ALDEBARAN)))

Asic type check is not required here -
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c#L2639

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 		gfx_v9_4_2_set_power_brake_sequence(adev);
 
 	return r;
#5 lore raw
In reply to Victor Lu

[Public]

Are there any cases where the asic_type check would cause this register to fail to get programmed?

Alex

________________________________
From: amd-gfx <[email protected]> on behalf of Victor Lu <[email protected]>
Sent: Thursday, February 13, 2025 7:13 PM
To: [email protected] <[email protected]>
Cc: Lu, Victor Cheng Chi (Victor) <[email protected]>; [email protected] <[email protected]>
Subject: [PATCH 1/3] drm/amdgpu: Do not program AGP BAR regs under SRIOV

SRIOV VF does not have write access to AGP BAR regs. Skip the writes to avoid a dmesg warning.

---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +5 -5
index 0e3ddea7b8e0..a7bfc9f41d0e 100644
@@ -92,12 +92,12 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
 {
         uint64_t value;
 
-       /* Program the AGP BAR */
-       WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BASE, 0);
-       WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
-       WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
-
         if (!amdgpu_sriov_vf(adev) || adev->asic_type <= CHIP_VEGA10) {
+               /* Program the AGP BAR */
+               WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BASE, 0);
+               WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_BOT, adev->gmc.agp_start >> 24);
+               WREG32_SOC15_RLC(GC, 0, mmMC_VM_AGP_TOP, adev->gmc.agp_end >> 24);
+
                 /* Program the system aperture low logical page number. */
                 WREG32_SOC15_RLC(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
                         min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);

--
2.34.1