Skip to contentSkip to conversation

drm/amdgpu: fix incorrect VCN revision in SRIOV

PATCH Superseded Leslie Shi 4 participants 6 messages Dec 8, 2021 – Dec 9, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Leslie Shi

author
#0 lore raw

PATCH 1/1 drm/amdgpu: fix incorrect VCN revision in SRIOV

Guest OS will setup VCN instance 1 which is disabled as an enabled instance. This will cause VCN ib ring test failure during modprobe.

Fixes 36b7d5646476 ("drm/amdgpu: handle SRIOV VCN revision parsing")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
index 2658414c503d..2323815ac32d 100644
@@ -293,6 +293,9 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type t
 	if (amdgpu_discovery_get_vcn_version(adev, vcn_instance, &major, &minor, &revision) != 0)
 		return true;
 
+	if (amdgpu_sriov_vf(adev))
+		revision |= adev->vcn.sriov_config[vcn_instance] << 6;
+
 	if ((type == VCN_ENCODE_RING) && (revision & VCN_BLOCK_ENCODE_DISABLE_MASK)) {
 		ret = true;
 	} else if ((type == VCN_DECODE_RING) && (revision & VCN_BLOCK_DECODE_DISABLE_MASK)) {
Signature · 1 line
2.25.1
#1 lore raw

[Public]

Hi Leslie,

Can we move revision handling in this patch into amdgpu_discovery_get_vcn_version? Then we will maintain all revision handlings only in amdgpu_discovery.c.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Leslie Shi
Sent: Wednesday, December 8, 2021 4:46 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix incorrect VCN revision in SRIOV

Guest OS will setup VCN instance 1 which is disabled as an enabled instance. This will cause VCN ib ring test failure during modprobe.

Fixes 36b7d5646476 ("drm/amdgpu: handle SRIOV VCN revision parsing")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
index 2658414c503d..2323815ac32d 100644
@@ -293,6 +293,9 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type t
 	if (amdgpu_discovery_get_vcn_version(adev, vcn_instance, &major, &minor, &revision) != 0)
 		return true;
 
+	if (amdgpu_sriov_vf(adev))
+		revision |= adev->vcn.sriov_config[vcn_instance] << 6;
+
 	if ((type == VCN_ENCODE_RING) && (revision & VCN_BLOCK_ENCODE_DISABLE_MASK)) {
 		ret = true;
 	} else if ((type == VCN_DECODE_RING) && (revision & VCN_BLOCK_DECODE_DISABLE_MASK)) {
Signature · 1 line
2.25.1
#2 lore raw
Quoted 6 lines · Guchun

[Public]

Hi Leslie,

Can we move revision handling in this patch into amdgpu_discovery_get_vcn_version? Then we will maintain all revision handlings only in amdgpu_discovery.c.

This seems to be more about VCN config than revision. A better thing to do will be to rename sriov_config as vcn_config and use that here (regardless of SRIOV or not).

Change discovery code to -

	adev->vcn.vcn_config[adev->vcn.num_vcn_inst] = (ip->revision & 0xc0);

And check here as:
vcn_config & VCN_BLOCK_ENCODE_DISABLE_MASK

Looks like baremetal enables all and VF enables only encode or decode on particular VCN instance.

Thanks,
Lijo

Quoted 33 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Leslie Shi
Sent: Wednesday, December 8, 2021 4:46 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix incorrect VCN revision in SRIOV

Guest OS will setup VCN instance 1 which is disabled as an enabled instance. This will cause VCN ib ring test failure during modprobe.

Fixes 36b7d5646476 ("drm/amdgpu: handle SRIOV VCN revision parsing")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
index 2658414c503d..2323815ac32d 100644
@@ -293,6 +293,9 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type t
  	if (amdgpu_discovery_get_vcn_version(adev, vcn_instance, &major, &minor, &revision) != 0)
  		return true;
 
+	if (amdgpu_sriov_vf(adev))
+		revision |= adev->vcn.sriov_config[vcn_instance] << 6;
+
  	if ((type == VCN_ENCODE_RING) && (revision & VCN_BLOCK_ENCODE_DISABLE_MASK)) {
  		ret = true;
  	} else if ((type == VCN_DECODE_RING) && (revision & VCN_BLOCK_DECODE_DISABLE_MASK)) {
#3 lore raw
Quoted 15 lines · Lijo
Quoted 6 lines · Guchun

[Public]

Hi Leslie,

Can we move revision handling in this patch into amdgpu_discovery_get_vcn_version? Then we will maintain all revision handlings only in amdgpu_discovery.c.

This seems to be more about VCN config than revision. A better thing to do will be to rename sriov_config as vcn_config and use that here (regardless of SRIOV or not).

Quoted 9 lines

Change discovery code to -

        adev->vcn.vcn_config[adev->vcn.num_vcn_inst] = (ip->revision & 0xc0);

And check here as:
vcn_config & VCN_BLOCK_ENCODE_DISABLE_MASK

Looks like baremetal enables all and VF enables only encode or decode on particular VCN instance.

That seems cleaner. We can also drop amdgpu_discovery_get_vcn_version() and just use vcn_config.

Alex

Quoted 36 lines

Thanks,
Lijo

Quoted 33 lines

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Leslie Shi
Sent: Wednesday, December 8, 2021 4:46 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: fix incorrect VCN revision in SRIOV

Guest OS will setup VCN instance 1 which is disabled as an enabled instance. This will cause VCN ib ring test failure during modprobe.

Fixes 36b7d5646476 ("drm/amdgpu: handle SRIOV VCN revision parsing")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -0
index 2658414c503d..2323815ac32d 100644
@@ -293,6 +293,9 @@ bool amdgpu_vcn_is_disabled_vcn(struct amdgpu_device *adev, enum vcn_ring_type t
      if (amdgpu_discovery_get_vcn_version(adev, vcn_instance, &major, &minor, &revision) != 0)
              return true;
 
+     if (amdgpu_sriov_vf(adev))
+             revision |= adev->vcn.sriov_config[vcn_instance] << 6;
+
      if ((type == VCN_ENCODE_RING) && (revision & VCN_BLOCK_ENCODE_DISABLE_MASK)) {
              ret = true;
      } else if ((type == VCN_DECODE_RING) && (revision & VCN_BLOCK_DECODE_DISABLE_MASK)) {
author
#4 lore raw

PATCH 1/1 drm/amdgpu: add modifiers in amdgpu_vkms_plane_init()

In reply to Leslie Shi

Fix following warning in SRIOV during modprobe:

amdgpu 0000:00:08.0: GFX9+ requires FB check based on format modifier

WARNING: CPU: 0 PID: 1023 at drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1150 amdgpu_display_framebuffer_init+0x8e7/0xb40 [amdgpu]
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +2 -1
index af3a2f8c12b4..03a13771a9f7 100644
@@ -390,6 +390,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
 						int index)
 {
 	struct drm_plane *plane;
+	uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID};
 	int ret;
 
 	plane = kzalloc(sizeof(*plane), GFP_KERNEL);
@@ -400,7 +401,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
 				       &amdgpu_vkms_plane_funcs,
 				       amdgpu_vkms_formats,
 				       ARRAY_SIZE(amdgpu_vkms_formats),
-				       NULL, type, NULL);
+				       modifiers, type, NULL);
 	if (ret) {
 		kfree(plane);
 		return ERR_PTR(ret);
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#5 lore raw

RE: [PATCH] drm/amdgpu: add modifiers in amdgpu_vkms_plane_init()

[Public]

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Leslie Shi
Sent: Wednesday, December 8, 2021 4:46 PM
To: [email protected]
Subject: [PATCH] drm/amdgpu: add modifiers in amdgpu_vkms_plane_init()

Fix following warning in SRIOV during modprobe:

amdgpu 0000:00:08.0: GFX9+ requires FB check based on format modifier

WARNING: CPU: 0 PID: 1023 at drivers/gpu/drm/amd/amdgpu/amdgpu_display.c:1150 amdgpu_display_framebuffer_init+0x8e7/0xb40 [amdgpu]
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +2 -0
index af3a2f8c12b4..03a13771a9f7 100644
@@ -390,6 +390,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
 						int index)
 {
 	struct drm_plane *plane;
+	uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR, 
+DRM_FORMAT_MOD_INVALID};
 	int ret;
 

plane = kzalloc(sizeof(*plane), GFP_KERNEL); @@ -400,7 +401,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
&amdgpu_vkms_plane_funcs,
amdgpu_vkms_formats,
ARRAY_SIZE(amdgpu_vkms_formats),
- NULL, type, NULL);
+ modifiers, type, NULL);
if (ret) {
kfree(plane);
return ERR_PTR(ret);
--
2.25.1