Skip to contentSkip to conversation

drm/amdgpu: drm/amdgpu: always consider virualised device for checking post (v2)

PATCH In review Pixel Ding 2 participants 5 messages Oct 19, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Pixel Ding

author
#0 lore raw

PATCH 1/1 drm/amdgpu: drm/amdgpu: always consider virualised device for checking post (v2)

From: pding <[email protected]>

The post checking on scratch registers isn't reliable for virtual function.

v2: only change in IGP reading bios.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 0280ae5..caabc5b 100644
@@ -1840,6 +1840,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
 bool amdgpu_need_backup(struct amdgpu_device *adev);
+bool amdgpu_vpost_needed(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_need_post(struct amdgpu_device *adev);
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index c21adf6..25f43eb 100644
@@ -99,7 +99,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
 	resource_size_t size = 256 * 1024; /* ??? */
 
 	if (!(adev->flags & AMD_IS_APU))
-		if (amdgpu_need_post(adev))
+		if (amdgpu_vpost_needed(adev))
 			return false;
 
 	adev->bios = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a601d87..098cd44 100644
@@ -764,7 +764,7 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 
 }
 
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
+bool amdgpu_vpost_needed(struct amdgpu_device *adev)
 {
 	if (amdgpu_sriov_vf(adev))
 		return false;
Signature · 6 lines
2.9.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1508377448-4671-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Hi Alex,

This is the v2 patch as you suggested. Only fix the issue found in amdgpu_bios.c.

Please review, thanks.

—
Sincerely Yours,
Pixel

Quoted 58 lines · amd-gfx on behalf of Pixel Ding

From: pding <[email protected]>

The post checking on scratch registers isn't reliable for virtual function.

v2: only change in IGP reading bios.

---

drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c   | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 0280ae5..caabc5b 100644
@@ -1840,6 +1840,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
 bool amdgpu_need_backup(struct amdgpu_device *adev);
+bool amdgpu_vpost_needed(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_need_post(struct amdgpu_device *adev);
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index c21adf6..25f43eb 100644
@@ -99,7 +99,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
 	resource_size_t size = 256 * 1024; /* ??? */
 
 	if (!(adev->flags & AMD_IS_APU))
-		if (amdgpu_need_post(adev))
+		if (amdgpu_vpost_needed(adev))
 			return false;
 
 	adev->bios = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index a601d87..098cd44 100644
@@ -764,7 +764,7 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 
 }
 
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
+bool amdgpu_vpost_needed(struct amdgpu_device *adev)
 {
 	if (amdgpu_sriov_vf(adev))
 		return false;
Signature · 6 lines
2.9.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive
Quoted 5 lines · Pixel Ding

From: pding <[email protected]>

The post checking on scratch registers isn't reliable for virtual function.

v2: only change in IGP reading bios.

Subject has "drm/amdgpu: drm/amdgpu: " drop one of them.

Quoted 13 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 0280ae5..caabc5b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h amdgpu_get_sdma_instance(struct amdgpu_ring *ring) · line 1845

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1840,6 +1840,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
 bool amdgpu_need_backup(struct amdgpu_device *adev);
+bool amdgpu_vpost_needed(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_need_post(struct amdgpu_device *adev);

amdgpu_need_post can be dropped now.

Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index c21adf6..25f43eb 100644
@@ -99,7 +99,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
        resource_size_t size = 256 * 1024; /* ??? */
 
        if (!(adev->flags & AMD_IS_APU))
-               if (amdgpu_need_post(adev))
+               if (amdgpu_vpost_needed(adev))
                        return false;
 
        adev->bios = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index a601d87..098cd44 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c bool amdgpu_need_post(struct amdgpu_device *adev) · line 767

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -764,7 +764,7 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 
 }
 
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
+bool amdgpu_vpost_needed(struct amdgpu_device *adev)

Please also make amdgpu_need_post() static now.

Is there a way we can just merge amdgpu_need_post() into amdgpu_vpost_needed()? For bare metal it should be fine. Might need some logic adjustments for sr-iov amdgpu_device_resume(). That can be a follow on patch if you want.

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
 {
        if (amdgpu_sriov_vf(adev))
                return false;
--

2.9.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_Pm6bS1JZ_GcLE=RNnCDDHmip99PK6KmogMoArUXk7pxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw

Thanks Alex. Some comments inline.
—
Sincerely Yours,
Pixel

Quoted 20 lines · Alex Deucher
Quoted 5 lines · Pixel Ding

From: pding <[email protected]>

The post checking on scratch registers isn't reliable for virtual function.

v2: only change in IGP reading bios.

Subject has "drm/amdgpu: drm/amdgpu: " drop one of them. [Pixel] get it.

Quoted 8 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h amdgpu_get_sdma_instance(struct amdgpu_ring *ring) · line 1845

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 0280ae5..caabc5b 100644
@@ -1840,6 +1840,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
 bool amdgpu_need_backup(struct amdgpu_device *adev);
+bool amdgpu_vpost_needed(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_need_post(struct amdgpu_device *adev);

amdgpu_need_post can be dropped now.

[Pixel] some other functions still invoke the amdgpu_need_post(). Only if we change all to use amdgpu_vpost_needed(). that’s what the v1 patch did, however it’s confused. the only difference is that original patch uses amdgpu_need_post() function name instead of amdgpu_vpost_needed(), I thought it’s more generic.

Quoted 28 lines
Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index c21adf6..25f43eb 100644
@@ -99,7 +99,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
        resource_size_t size = 256 * 1024; /* ??? */
 
        if (!(adev->flags & AMD_IS_APU))
-               if (amdgpu_need_post(adev))
+               if (amdgpu_vpost_needed(adev))
                        return false;
 
        adev->bios = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index a601d87..098cd44 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c bool amdgpu_need_post(struct amdgpu_device *adev) · line 767

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -764,7 +764,7 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 
 }
 
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
+bool amdgpu_vpost_needed(struct amdgpu_device *adev)

Please also make amdgpu_need_post() static now.

Quoted 4 lines

Is there a way we can just merge amdgpu_need_post() into amdgpu_vpost_needed()? For bare metal it should be fine. Might need some logic adjustments for sr-iov amdgpu_device_resume(). That can be a follow on patch if you want.

[Pixel] the original patch replaces all amdgpu_need_post() with amdgpu_vpost_needed(), then rename the amdgpu_vpost_needed() to amdgpu_need_post(), and amdgpu_need_post() to static amdgpu_check_post(). After these transform it looks unclear. By now I think we can go back to that one.

Quoted 14 lines

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
 {
        if (amdgpu_sriov_vf(adev))
                return false;
--

2.9.5

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): FC26870B-8173-40E3-94A1-5FC0A5227C5B-5C7GfCeVMHo@public.gmane.org

#7 lore raw
Quoted 76 lines · Pixel

Thanks Alex. Some comments inline.
—
Sincerely Yours,
Pixel

Quoted 20 lines · Alex Deucher
Quoted 5 lines · Pixel Ding

From: pding <[email protected]>

The post checking on scratch registers isn't reliable for virtual function.

v2: only change in IGP reading bios.

Subject has "drm/amdgpu: drm/amdgpu: " drop one of them. [Pixel] get it.

Quoted 8 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c   | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/gpu/drm/amd/amdgpu/amdgpu.h amdgpu_get_sdma_instance(struct amdgpu_ring *ring) · line 1845

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 0280ae5..caabc5b 100644
@@ -1840,6 +1840,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
 /* Common functions */
 int amdgpu_gpu_reset(struct amdgpu_device *adev);
 bool amdgpu_need_backup(struct amdgpu_device *adev);
+bool amdgpu_vpost_needed(struct amdgpu_device *adev);
 void amdgpu_pci_config_reset(struct amdgpu_device *adev);
 bool amdgpu_need_post(struct amdgpu_device *adev);

amdgpu_need_post can be dropped now.

[Pixel] some other functions still invoke the amdgpu_need_post(). Only if we change all to use amdgpu_vpost_needed(). that’s what the v1 patch did, however it’s confused. the only difference is that original patch uses amdgpu_need_post() function name instead of amdgpu_vpost_needed(), I thought it’s more generic.

Quoted 28 lines
Quoted 20 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
 void amdgpu_update_display_priority(struct amdgpu_device *adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index c21adf6..25f43eb 100644
@@ -99,7 +99,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
        resource_size_t size = 256 * 1024; /* ??? */
 
        if (!(adev->flags & AMD_IS_APU))
-               if (amdgpu_need_post(adev))
+               if (amdgpu_vpost_needed(adev))
                        return false;
 
        adev->bios = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index a601d87..098cd44 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c bool amdgpu_need_post(struct amdgpu_device *adev) · line 767

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -764,7 +764,7 @@ bool amdgpu_need_post(struct amdgpu_device *adev)
 
 }
 
-static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
+bool amdgpu_vpost_needed(struct amdgpu_device *adev)

Please also make amdgpu_need_post() static now.

Quoted 5 lines
Quoted 4 lines

Is there a way we can just merge amdgpu_need_post() into amdgpu_vpost_needed()? For bare metal it should be fine. Might need some logic adjustments for sr-iov amdgpu_device_resume(). That can be a follow on patch if you want.

[Pixel] the original patch replaces all amdgpu_need_post() with amdgpu_vpost_needed(), then rename the amdgpu_vpost_needed() to amdgpu_need_post(), and amdgpu_need_post() to static amdgpu_check_post(). After these transform it looks unclear. By now I think we can go back to that one.

I'm fine with that as long as it doesn't break anything. The only difference between the two functions is for virtualization. I'm not sure why we use one in some places and other in other places. I'd prefer to just merge them to avoid any confusion about when to use which one.

Alex

Quoted 11 lines
Quoted 11 lines

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
 {
        if (amdgpu_sriov_vf(adev))
                return false;
--

2.9.5

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx