Skip to contentSkip to conversation

drm/amdgpu: move UVD/VCE and VCN structure out from union

PATCH In review Leo Liu 4 participants 6 messages Nov 21, 2017 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Leo Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: move UVD/VCE and VCN structure out from union

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -12
index 750336dce0e9..86f91789de6d 100644
@@ -1590,18 +1590,14 @@ struct amdgpu_device {
 	/* sdma */
 	struct amdgpu_sdma		sdma;
 
-	union {
-		struct {
-			/* uvd */
-			struct amdgpu_uvd		uvd;
-
-			/* vce */
-			struct amdgpu_vce		vce;
-		};
-
-		/* vcn */
-		struct amdgpu_vcn		vcn;
-	};
+	/* uvd */
+	struct amdgpu_uvd		uvd;
+
+	/* vce */
+	struct amdgpu_vce		vce;
+
+	/* vcn */
+	struct amdgpu_vcn		vcn;
 
 	/* firmwares */
 	struct amdgpu_firmware		firmware;
Signature · 6 lines
2.14.1

_______________________________________________
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): [email protected]

author
#2 lore raw

Wth the current upstream Mesa, kernel will spin error and break when starting display manger at least on my Polaris10 card.

This is because the query info from VCN enc from Mesa, and "adev->vcn.num_enc_rings" is not zero because of the union.

[ 9066.794232] BUG: unable to handle kernel paging request at ffff99b6400001ec
[ 9066.794293] IP: amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794295] PGD 44229067 P4D 44229067 PUD 0
[ 9066.794300] Oops: 0000 [#1] SMP
[ 9066.794302] Modules linked in: fuse amdgpu(OE) mfd_core chash ttm k10temp i2c_piix4
[ 9066.794310] CPU: 3 PID: 24999 Comm: Xorg Tainted: G OE   4.14.0-rc3+ #4
[ 9066.794311] Hardware name: Gigabyte Technology Co., Ltd. GA-880GMA-UD2H/GA-880GMA-UD2H, BIOS F5 09/30/2010
[ 9066.794313] task: ffff99b62a930040 task.stack: ffffadf280c60000
[ 9066.794339] RIP: 0010:amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794340] RSP: 0018:ffffadf280c63b70 EFLAGS: 00010217
[ 9066.794342] RAX: 0000000000000000 RBX: ffffadf280c63db0 RCX: 0000000000063c59
[ 9066.794344] RDX: ffff99b6400001ec RSI: 00000000ffffffff RDI: 00000000ffffffff
[ 9066.794345] RBP: ffffadf280c63d28 R08: 000000000000e200 R09: 0000000000000001
[ 9066.794346] R10: 0000000000000000 R11: 0000000000000000 R12: ffff99b61e7b0000
[ 9066.794348] R13: ffffffffc0127730 R14: 0000000000000020 R15: 00007ffd852f0410
[ 9066.794350] FS:  00007f0265507a00(0000) GS:ffff99b63fcc0000(0000) knlGS:0000000000000000
[ 9066.794351] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9066.794352] CR2: ffff99b6400001ec CR3: 000000013763d000 CR4: 00000000000006e0
[ 9066.794354] Call Trace:
[ 9066.794359]  ? kernel_text_address+0x69/0xc0
[ 9066.794362]  ? rcu_read_lock_sched_held+0x1d/0x60
[ 9066.794365]  ? module_assert_mutex_or_preempt+0x13/0x40
[ 9066.794366]  ? __module_address+0x27/0xf0
[ 9066.794391]  ? amdgpu_drm_ioctl+0x32/0x80 [amdgpu]
[ 9066.794395]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794396]  ? __kernel_text_address+0xd/0x40
[ 9066.794399]  ? unwind_get_return_address+0x1a/0x30
[ 9066.794402]  ? __save_stack_trace+0x61/0xd0
[ 9066.794404]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794430]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794433]  drm_ioctl_kernel+0x64/0xb0
[ 9066.794435]  drm_ioctl+0x30a/0x3d0
[ 9066.794461]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794464]  ? trace_hardirqs_on_caller+0x11f/0x190
[ 9066.794466]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794492]  amdgpu_drm_ioctl+0x47/0x80 [amdgpu]
[ 9066.794495]  do_vfs_ioctl+0x8e/0x640
[ 9066.794497]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794500]  ? security_file_ioctl+0x3e/0x60
Quoted 31 lines · Leo Liu

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++------------
  1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -12
index 750336dce0e9..86f91789de6d 100644
@@ -1590,18 +1590,14 @@ struct amdgpu_device {
  	/* sdma */
  	struct amdgpu_sdma		sdma;
 
-	union {
-		struct {
-			/* uvd */
-			struct amdgpu_uvd		uvd;
-
-			/* vce */
-			struct amdgpu_vce		vce;
-		};
-
-		/* vcn */
-		struct amdgpu_vcn		vcn;
-	};
+	/* uvd */

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_device { · line 1603

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +7 -0
+	struct amdgpu_uvd		uvd;
+
+	/* vce */
+	struct amdgpu_vce		vce;
+
+	/* vcn */
+	struct amdgpu_vcn		vcn;
 
  	/* firmwares */
  	struct amdgpu_firmware		firmware;

_______________________________________________
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): 648f7d30-5f15-b64c-2220-36cac6caed16-5C7GfCeVMHo@public.gmane.org

Acked-by
#4 lore raw
Quoted 5 lines · Leo Liu

Wth the current upstream Mesa, kernel will spin error and break when starting display manger at least on my Polaris10 card.

This is because the query info from VCN enc from Mesa, and "adev->vcn.num_enc_rings" is not zero because of the union.

For some reason the patch doesn't seem to have come through properly on the mailing list.

Quoted 100 lines
[ 9066.794232] BUG: unable to handle kernel paging request at
ffff99b6400001ec
[ 9066.794293] IP: amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794295] PGD 44229067 P4D 44229067 PUD 0
[ 9066.794300] Oops: 0000 [#1] SMP
[ 9066.794302] Modules linked in: fuse amdgpu(OE) mfd_core chash ttm k10temp
i2c_piix4
[ 9066.794310] CPU: 3 PID: 24999 Comm: Xorg Tainted: G           OE
4.14.0-rc3+ #4
[ 9066.794311] Hardware name: Gigabyte Technology Co., Ltd.
GA-880GMA-UD2H/GA-880GMA-UD2H, BIOS F5 09/30/2010
[ 9066.794313] task: ffff99b62a930040 task.stack: ffffadf280c60000
[ 9066.794339] RIP: 0010:amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794340] RSP: 0018:ffffadf280c63b70 EFLAGS: 00010217
[ 9066.794342] RAX: 0000000000000000 RBX: ffffadf280c63db0 RCX:
0000000000063c59
[ 9066.794344] RDX: ffff99b6400001ec RSI: 00000000ffffffff RDI:
00000000ffffffff
[ 9066.794345] RBP: ffffadf280c63d28 R08: 000000000000e200 R09:
0000000000000001
[ 9066.794346] R10: 0000000000000000 R11: 0000000000000000 R12:
ffff99b61e7b0000
[ 9066.794348] R13: ffffffffc0127730 R14: 0000000000000020 R15:
00007ffd852f0410
[ 9066.794350] FS:  00007f0265507a00(0000) GS:ffff99b63fcc0000(0000)
knlGS:0000000000000000
[ 9066.794351] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9066.794352] CR2: ffff99b6400001ec CR3: 000000013763d000 CR4:
00000000000006e0
[ 9066.794354] Call Trace:
[ 9066.794359]  ? kernel_text_address+0x69/0xc0
[ 9066.794362]  ? rcu_read_lock_sched_held+0x1d/0x60
[ 9066.794365]  ? module_assert_mutex_or_preempt+0x13/0x40
[ 9066.794366]  ? __module_address+0x27/0xf0
[ 9066.794391]  ? amdgpu_drm_ioctl+0x32/0x80 [amdgpu]
[ 9066.794395]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794396]  ? __kernel_text_address+0xd/0x40
[ 9066.794399]  ? unwind_get_return_address+0x1a/0x30
[ 9066.794402]  ? __save_stack_trace+0x61/0xd0
[ 9066.794404]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794430]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794433]  drm_ioctl_kernel+0x64/0xb0
[ 9066.794435]  drm_ioctl+0x30a/0x3d0
[ 9066.794461]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794464]  ? trace_hardirqs_on_caller+0x11f/0x190
[ 9066.794466]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794492]  amdgpu_drm_ioctl+0x47/0x80 [amdgpu]
[ 9066.794495]  do_vfs_ioctl+0x8e/0x640
[ 9066.794497]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794500]  ? security_file_ioctl+0x3e/0x60

On 11/21/2017 09:28 AM, Leo Liu wrote:

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -12
index 750336dce0e9..86f91789de6d 100644
@@ -1590,18 +1590,14 @@ struct amdgpu_device {
  /* sdma */
  struct amdgpu_sdma sdma;
 
- union {
- struct {
- /* uvd */
- struct amdgpu_uvd uvd;
-
- /* vce */
- struct amdgpu_vce vce;
- };
-
- /* vcn */
- struct amdgpu_vcn vcn;
- };
+ /* uvd */
+ struct amdgpu_uvd uvd;
+
+ /* vce */
+ struct amdgpu_vce vce;
+
+ /* vcn */
+ struct amdgpu_vcn vcn;
 
  /* firmwares */
  struct amdgpu_firmware firmware;
Quoted 5 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

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

Reviewed-by
#6 lore raw

Am 21.11.2017 um 17:22 schrieb Alex Deucher:

Quoted 8 lines · Leo Liu
Quoted 5 lines

Wth the current upstream Mesa, kernel will spin error and break when starting display manger at least on my Polaris10 card.

This is because the query info from VCN enc from Mesa, and "adev->vcn.num_enc_rings" is not zero because of the union.

For some reason the patch doesn't seem to have come through properly on the mailing list.

Yeah, don't see that either.

Quoted 2 lines

Regards,
Christian.

Quoted 100 lines
Quoted 100 lines
[ 9066.794232] BUG: unable to handle kernel paging request at
ffff99b6400001ec
[ 9066.794293] IP: amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794295] PGD 44229067 P4D 44229067 PUD 0
[ 9066.794300] Oops: 0000 [#1] SMP
[ 9066.794302] Modules linked in: fuse amdgpu(OE) mfd_core chash ttm k10temp
i2c_piix4
[ 9066.794310] CPU: 3 PID: 24999 Comm: Xorg Tainted: G           OE
4.14.0-rc3+ #4
[ 9066.794311] Hardware name: Gigabyte Technology Co., Ltd.
GA-880GMA-UD2H/GA-880GMA-UD2H, BIOS F5 09/30/2010
[ 9066.794313] task: ffff99b62a930040 task.stack: ffffadf280c60000
[ 9066.794339] RIP: 0010:amdgpu_info_ioctl+0xee2/0x1070 [amdgpu]
[ 9066.794340] RSP: 0018:ffffadf280c63b70 EFLAGS: 00010217
[ 9066.794342] RAX: 0000000000000000 RBX: ffffadf280c63db0 RCX:
0000000000063c59
[ 9066.794344] RDX: ffff99b6400001ec RSI: 00000000ffffffff RDI:
00000000ffffffff
[ 9066.794345] RBP: ffffadf280c63d28 R08: 000000000000e200 R09:
0000000000000001
[ 9066.794346] R10: 0000000000000000 R11: 0000000000000000 R12:
ffff99b61e7b0000
[ 9066.794348] R13: ffffffffc0127730 R14: 0000000000000020 R15:
00007ffd852f0410
[ 9066.794350] FS:  00007f0265507a00(0000) GS:ffff99b63fcc0000(0000)
knlGS:0000000000000000
[ 9066.794351] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 9066.794352] CR2: ffff99b6400001ec CR3: 000000013763d000 CR4:
00000000000006e0
[ 9066.794354] Call Trace:
[ 9066.794359]  ? kernel_text_address+0x69/0xc0
[ 9066.794362]  ? rcu_read_lock_sched_held+0x1d/0x60
[ 9066.794365]  ? module_assert_mutex_or_preempt+0x13/0x40
[ 9066.794366]  ? __module_address+0x27/0xf0
[ 9066.794391]  ? amdgpu_drm_ioctl+0x32/0x80 [amdgpu]
[ 9066.794395]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794396]  ? __kernel_text_address+0xd/0x40
[ 9066.794399]  ? unwind_get_return_address+0x1a/0x30
[ 9066.794402]  ? __save_stack_trace+0x61/0xd0
[ 9066.794404]  ? entry_SYSCALL_64_fastpath+0x1f/0xbe
[ 9066.794430]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794433]  drm_ioctl_kernel+0x64/0xb0
[ 9066.794435]  drm_ioctl+0x30a/0x3d0
[ 9066.794461]  ? amdgpu_debugfs_firmware_info+0x290/0x290 [amdgpu]
[ 9066.794464]  ? trace_hardirqs_on_caller+0x11f/0x190
[ 9066.794466]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794492]  amdgpu_drm_ioctl+0x47/0x80 [amdgpu]
[ 9066.794495]  do_vfs_ioctl+0x8e/0x640
[ 9066.794497]  ? trace_hardirqs_on+0xd/0x10
[ 9066.794500]  ? security_file_ioctl+0x3e/0x60

On 11/21/2017 09:28 AM, Leo Liu wrote:

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 ++++++++------------
  1 file changed, 8 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +8 -12
index 750336dce0e9..86f91789de6d 100644
@@ -1590,18 +1590,14 @@ struct amdgpu_device {
   /* sdma */
   struct amdgpu_sdma sdma;
 
- union {
- struct {
- /* uvd */
- struct amdgpu_uvd uvd;
-
- /* vce */
- struct amdgpu_vce vce;
- };
-
- /* vcn */
- struct amdgpu_vcn vcn;
- };
+ /* uvd */
+ struct amdgpu_uvd uvd;
+
+ /* vce */
+ struct amdgpu_vce vce;
+
+ /* vcn */
+ struct amdgpu_vcn vcn;
 
   /* firmwares */
   struct amdgpu_firmware firmware;
Quoted 9 lines
Quoted 5 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

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

#7 lore raw
In reply to a message not in the archive
Quoted 6 lines · Leo Liu

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

Please add:

Fixes 95d0906f8506 ("drm/amdgpu: add initial vcn support and decode
                      tests")
Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
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): 8e1d3d87-c2f6-9892-4646-810ce9e9acfa-otUistvHUpPR7s880joybQ@public.gmane.org

author
#9 lore raw
Quoted 6 lines · Michel Dänzer
Quoted 5 lines · Leo Liu

With the enablement of VCN Dec and Enc from user space, User space queries kernel for the IP information, if HW has UVD/VCE, the info comes from these IP blocks, but this could end up mis-interpret for VCN when they are in the union, ther other way same when HW with VCN block.

Quoted 7 lines
Quoted 1 line

Please add:

Fixes 95d0906f8506 ("drm/amdgpu: add initial vcn support and decode
                       tests")

Thanks for the comment.
Sorry that I have already pushed it to internally branch, since my Polaris10 fails to light up with newer Mesa.

Leo

Quoted 2 lines

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