drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips
Subsystems (2)
PATCH 1/1 drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips
Totally untested but as long as read_sensor() has been recently implemented for dpm based boards, amdgpu_sensors can now be exposed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -4
@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) - r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); -else -return -EINVAL ; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);if (size > valuesize)return -EINVAL ;
Signature · 6 lines
2.11.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): 20170214002301.6686-1-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Tom St Denis
NAKQuoted 17 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3208
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-4valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) - r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); -else -return -EINVAL ; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);if (size > valuesize)return -EINVAL ;
NAK, this will oops the kernel if amdgpu.dpm=0 and on powerplay systems if powerplay=0.
Otherwise, it seems to work though the GPU_TEMP reads as "5000" on my Kaveri (meaning temp of 5C which isn't true).
I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
Tom
_______________________________________________
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): cc9720c0-653d-f56d-e68e-032454baf324-5C7GfCeVMHo@public.gmane.org
Samuel Pitoiset
Reviewed-by Alex DeucherQuoted 30 lines · Tom St Denis
Quoted 29 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-4@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); -else -return -EINVAL ; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
Quoted 7 lines
Quoted 3 lines
if (size > valuesize)
return-EINVAL;NAK, this will oops the kernel if amdgpu.dpm=0 and on powerplay systems if powerplay=0.
The powerplay parameter has been removed recently.
commit a48203f576e7f708093f7a9d9dcc9ff7b067e559
Author: Rex Zhu <[email protected]> Date: Tue Dec 27 15:51:45 2016 +0800
drm/amdgpu: delete dead module parameter:amdgpu_powerplay.
But I do agree for pre-powerplay chips.
Quoted 5 lines
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" on my Kaveri (meaning temp of 5C which isn't true).I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
Quoted 2 lines
Tom
_______________________________________________
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): 34e0230b-2ccb-b2bd-63d9-c2477dd33bfe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 64 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Samuel Pitoiset
Sent: Tuesday, February 14, 2017 9:45 AM
To: StDenis, Tom; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 20 lines · Tom St Denis
Quoted 19 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ;Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t · line 3207
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-2valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle,idx,
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-2&values[0], &valuesize); - else - return -EINVAL; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);Quoted 7 lines
Quoted 3 lines
if (size > valuesize)
return-EINVAL;NAK, this will oops the kernel if amdgpu.dpm=0 and on powerplay systems if powerplay=0.
The powerplay parameter has been removed recently.
commit
a48203f576e7f708093f7a9d9dcc9ff7b067e559Author: Rex Zhu <[email protected]> Date: Tue Dec 27 15:51:45 2016 +0800drm/amdgpu: delete dead module parameter:amdgpu_powerplay.
Reviewed-by Alex Deucher <[email protected]>Signed-off-by Rex Zhu <[email protected]>Signed-off-by Alex Deucher <[email protected]>But I do agree for pre-powerplay chips.
Quoted 7 lines
Quoted 5 lines
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" on my Kaveri (meaning temp of 5C which isn't true).I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
I don’t know that the GPU temp sensor on CI based APUs actually works properly. I think the package temperature is exposed via the CPU thermals.
Alex
Quoted 7 lines
Quoted 3 lines
Tom
_______________________________________________
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): BN6PR12MB1652DD1BE92DB032AEC64C76F7580-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 6 lines · Alexander
Quoted 6 lines
From: amd-gfx [mailto:[email protected]] On Behalf Of Samuel Pitoiset
Quoted 3 lines
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" on my Kaveri (meaning temp of 5C which isn't true).
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
I don’t know that the GPU temp sensor on CI based APUs actually works properly. I think the package temperature is exposed via the CPU thermals.
Seems to work fine with radeon on my two Kaveri laptops, FWIW.
On my desktop Kaveri, unplausibly low values (around 9-10C) are reported at idle for both GPU and CPU. With load, both go up to around 30C, so it seems like the values make sense in a relative sense but not in an absolute one.
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): 35369b6f-b008-543a-fc0d-aa51fd0abe85-otUistvHUpPR7s880joybQ@public.gmane.org
Quoted 26 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, February 14, 2017 9:52 PM
To: Deucher, Alexander; 'Samuel Pitoiset'; StDenis, Tom
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 1 line · Alexander
Quoted 1 line
From: amd-gfx [mailto:[email protected]] On
Behalf
Quoted 3 lines
Quoted 3 lines
Of Samuel Pitoiset
Quoted 1 line
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" onmy
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
Kaveri (meaning temp of 5C which isn't true).
I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
I don’t know that the GPU temp sensor on CI based APUs actually works properly. I think the package temperature is exposed via the CPU thermals.
Quoted 6 lines
Seems to work fine with radeon on my two Kaveri laptops, FWIW.
On my desktop Kaveri, unplausibly low values (around 9-10C) are reported at idle for both GPU and CPU. With load, both go up to around 30C, so it seems like the values make sense in a relative sense but not in an absolute one.
I think I vaguely recall that it might actually be power rather than temperature. Need to check with the SMU guys.
Alex
Quoted 5 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): BN6PR12MB1652DB3969E0524B6CFB01EEF75B0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 26 lines · Alexander
Quoted 26 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, February 14, 2017 9:52 PM
To: Deucher, Alexander; 'Samuel Pitoiset'; StDenis, Tom
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 1 line · Alexander
Quoted 1 line
From: amd-gfx [mailto:[email protected]] On
Behalf
Quoted 3 lines
Quoted 3 lines
Of Samuel Pitoiset
Quoted 1 line
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" onmy
Quoted 10 lines
Quoted 6 lines
Quoted 4 lines
Kaveri (meaning temp of 5C which isn't true).
I suspect the dpm code is reading the wrong register to get the temp but we can fix that in another change later on.
No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
I don’t know that the GPU temp sensor on CI based APUs actually works properly. I think the package temperature is exposed via the CPU thermals.
Quoted 8 lines
Quoted 6 lines
Seems to work fine with radeon on my two Kaveri laptops, FWIW.
On my desktop Kaveri, unplausibly low values (around 9-10C) are reported at idle for both GPU and CPU. With load, both go up to around 30C, so it seems like the values make sense in a relative sense but not in an absolute one.
I think I vaguely recall that it might actually be power rather than temperature. Need to check with the SMU guys.
On my retail kaveri (with latest bios...) it seems to track with load but isn't really accurate (it'll jump double digits back and forth)
Eitherway though if Samuel updates the patches to include a check for amdgpu_drm we should be able to commit them.
I've already created a patch for umr to read them, just waiting on the kernel side to land.
Tom
_______________________________________________
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): 1ef8a2b2-9591-64dc-b924-e4b274ab0745-5C7GfCeVMHo@public.gmane.org
Quoted 39 lines · Tom St Denis
Quoted 29 lines · Alexander
Quoted 29 lines
-----Original Message-----
From: Michel Dänzer [mailto:[email protected]]
Sent: Tuesday, February 14, 2017 9:52 PM
To: Deucher, Alexander; 'Samuel Pitoiset'; StDenis, Tom
Cc: [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 1 line · Alexander
Quoted 1 line
From: amd-gfx [mailto:[email protected]] On
Behalf
Quoted 3 lines
Quoted 3 lines
Of Samuel Pitoiset
Quoted 1 line
Otherwise, it seems to work though the
GPU_TEMPreads as "5000" onmy
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
Kaveri (meaning temp of 5C which isn't true).
I suspect the dpm code is reading the wrong register to get the temp but
we can fix that in another change later on.No idea. It was just a copy-n-paste. Maybe the initial code is buggy?
I don’t know that the GPU temp sensor on CI based APUs actually works properly. I think the package temperature is exposed via the CPU thermals.
Seems to work fine with radeon on my two Kaveri laptops, FWIW.
Quoted 7 lines
Quoted 4 lines
On my desktop Kaveri, unplausibly low values (around 9-10C) are reported at idle for both GPU and CPU. With load, both go up to around 30C, so it seems like the values make sense in a relative sense but not in an absolute one.
I think I vaguely recall that it might actually be power rather than temperature. Need to check with the SMU guys.
Quoted 5 lines
On my retail kaveri (with latest bios...) it seems to track with load but isn't really accurate (it'll jump double digits back and forth)
Eitherway though if Samuel updates the patches to include a check for
amdgpu_drmwe should be able to commit them.
Sure, I will send a v3.
Quoted 5 lines
I've already created a patch for umr to read them, just waiting on the kernel side to land.
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v2 1/1 drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips
In reply to a message not in the archiveTotally untested but as long as read_sensor() has been recently implemented for dpm based boards, amdgpu_sensors can now be exposed.
v2: - make sure read_sensor is not NULL on dpm chips
- keep sanity check for powerplay chips
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); +else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);else return -EINVAL ;
Signature · 6 lines
2.11.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): 20170214150828.32314-1-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 19 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.v2: - make sure
read_sensoris not NULL on dpm chips
- keep sanity check for powerplay chipsCc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3212
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); +else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);else return -EINVAL ;
Sorry NAK again, even with dpm=0 those function pointers are set and you end up inside the dpm code trying to parse data structures that aren't initialized.
For instance, this oops on my Kaveri when trying to read SCLK.
[ 729.616382] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c4 [ 729.616467] IP: [<ffffffffc0e62d40>] kv_dpm_read_sensor+0xa0/0xd0 [amdgpu] [ 729.616619] PGD 232c58067 [ 729.616644] PUD 232c4f067 [ 729.616670] PMD 0
[ 729.616697] Oops: 0000 [#1] SMP [ 729.616726] Modules linked in: fuse amdkfd amd_iommu_v2 amdgpu i2c_algo_bit ttm drm_kms_helper drm xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack tun bridge ebtable_filter ebtables ip6table_filter ip6_tables rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache bnep vfat fat edac_mce_amd arc4 edac_core kvm_amd iwlmvm snd_hda_codec_realtek mac80211 kvm snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hda_core btusb btrtl btbcm btintel iwlwifi bluetooth snd_hwdep cfg80211 snd_seq snd_seq_device snd_pcm irqbypass joydev snd_timer snd crct10dif_pclmul crc32_pclmul pcspkr ghash_clmulni_intel rfkill fam15h_power sp5100_tco k10temp soundcore acpi_cpufreq tpm_tis i2c_piix4 tpm_tis_core [ 729.617499] shpchp video tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc ata_generic pata_acpi 8021q crc32c_intel garp stp llc serio_raw mrp pata_atiixp r8169 mii fjes [ 729.617672] CPU: 0 PID: 1417 Comm: umr Not tainted 4.9.0+ #4 [ 729.617720] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./F2A88XN-WIFI, BIOS F5 04/22/2015 [ 729.617802] task: ffff8e43ef37d880 task.stack: ffff9d7501594000 [ 729.617852] RIP: 0010:[<ffffffffc0e62d40>] [<ffffffffc0e62d40>] kv_dpm_read_sensor+0xa0/0xd0 [amdgpu] [ 729.618000] RSP: 0018:ffff9d7501597d60 EFLAGS: 00010246 [ 729.618046] RAX: 0000000000000000 RBX: ffff9d7501597d98 RCX: 0000000000000000 [ 729.618104] RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000286 [ 729.618162] RBP: ffff9d7501597d80 R08: 0000000000000000 R09: 0000000000000000 [ 729.618221] R10: 0000000000000000 R11: ffff8e43ef37d880 R12: ffff9d7501597d98 [ 729.618285] R13: 0000000000000000 R14: ffff9d7501597d94 R15: 0000000000000000 [ 729.618344] FS: 00007f6525bfd700(0000) GS:ffff8e43fec00000(0000) knlGS:0000000000000000 [ 729.618411] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 729.618458] CR2: 00000000000000c4 CR3: 00000002261f6000 CR4: 00000000000406f0 [ 729.618515] Stack: [ 729.618535] 0000000000000004 00007ffe1e85ca00 ffff8e43f3162100 0000000000000004 [ 729.618607] ffff9d7501597df8 ffffffffc0e2c637 000000401e85ca00 ffff9d7501597f18 [ 729.618676] ffff9d7501597df8 ffffffffc0e2dc7d 0000000000005403 0000000000000000 [ 729.618747] Call Trace: [ 729.618826] [<ffffffffc0e2c637>] amdgpu_debugfs_sensor_read+0xf7/0x120 [amdgpu] [ 729.618938] [<ffffffffc0e2dc7d>] ? amdgpu_debugfs_regs_read+0x17d/0x220 [amdgpu] [ 729.619002] [<ffffffff8f3433e4>] full_proxy_read+0x54/0x90 [ 729.619049] [<ffffffff8f24be67>] __vfs_read+0x37/0x150 [ 729.619095] [<ffffffff8f35e67b>] ? security_file_permission+0x9b/0xc0 [ 729.621382] [<ffffffff8f24cfe6>] vfs_read+0x96/0x130 [ 729.622997] [<ffffffff8f24e4d5>] SyS_read+0x55/0xc0 [ 729.624540] [<ffffffff8f8010b7>] entry_SYSCALL_64_fastpath+0x1a/0xa9 [ 729.626139] Code: 24 31 c0 41 c7 06 04 00 00 00 41 5c 41 5d 41 5e 41 5f 5d c3 c1 e8 10 83 e0 1f 83 f8 07 77 ad 48 8d 14 c5 00 00 00 00 5b 48 29 c2 <41> 8b 84 95 c4 00 00 00 0f c8 41 89 04 24 41 c7 06 04 00 00 00
_______________________________________________
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): b97cf47b-1f0f-a9dc-4aeb-fa11a9a0f4d6-5C7GfCeVMHo@public.gmane.org
Quoted 30 lines · Tom St Denis
Quoted 29 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.v2: - make sure
read_sensoris not NULL on dpm chips
- keep sanity check for powerplay chipsCc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char__user *buf, valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx,&values[0], &valuesize);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0+else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);
Quoted 8 lines
Quoted 4 lines
else return -EINVAL;Sorry NAK again, even with dpm=0 those function pointers are set and you end up inside the dpm code trying to parse data structures that aren't initialized.
No worries. I thought that check was enough. Anyway, writing code without the hardware should be avoided. :)
Can you try the thing suggested by Alex? Because I will need to fix up the DRM ioctl codepath as well.
Quoted 68 lines
For instance, this oops on my Kaveri when trying to read SCLK.
[ 729.616382] BUG: unable to handle kernel NULL pointer dereference at 00000000000000c4 [ 729.616467] IP: [<ffffffffc0e62d40>] kv_dpm_read_sensor+0xa0/0xd0 [amdgpu] [ 729.616619] PGD 232c58067 [ 729.616644] PUD 232c4f067 [ 729.616670] PMD 0[ 729.616697] Oops: 0000 [#1] SMP [ 729.616726] Modules linked in: fuse amdkfd amd_iommu_v2 amdgpu
i2c_algo_bitttmdrm_kms_helperdrmxt_CHECKSUMiptable_mangleipt_MASQUERADEnf_nat_masquerade_ipv4iptable_natnf_nat_ipv4nf_natnf_conntrack_ipv4nf_defrag_ipv4xt_conntracknf_conntracktun bridgeebtable_filterebtablesip6table_filterip6_tablesrpcsec_gss_krb5nfsv4dns_resolvernfs fscache bnep vfat fatedac_mce_amdarc4edac_corekvm_amdiwlmvmsnd_hda_codec_realtekmac80211 kvmsnd_hda_codec_genericsnd_hda_codec_hdmisnd_hda_intelsnd_hda_codecsnd_hda_corebtusb btrtl btbcm btintel iwlwifi bluetoothsnd_hwdepcfg80211snd_seqsnd_seq_devicesnd_pcmirqbypass joydevsnd_timersndcrct10dif_pclmulcrc32_pclmulpcspkrghash_clmulni_intelrfkillfam15h_powersp5100_tcok10temp soundcoreacpi_cpufreqtpm_tisi2c_piix4tpm_tis_core[ 729.617499] shpchp video tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc ata_generic pata_acpi 8021q crc32c_intel garp stp llc serio_raw mrp pata_atiixp r8169 mii fjes [ 729.617672] CPU: 0 PID: 1417 Comm: umr Not tainted 4.9.0+ #4 [ 729.617720] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./F2A88XN-WIFI, BIOS F5 04/22/2015 [ 729.617802] task: ffff8e43ef37d880 task.stack: ffff9d7501594000 [ 729.617852] RIP: 0010:[<ffffffffc0e62d40>] [<ffffffffc0e62d40>] kv_dpm_read_sensor+0xa0/0xd0 [amdgpu] [ 729.618000] RSP: 0018:ffff9d7501597d60 EFLAGS: 00010246 [ 729.618046] RAX: 0000000000000000 RBX: ffff9d7501597d98 RCX: 0000000000000000 [ 729.618104] RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000286 [ 729.618162] RBP: ffff9d7501597d80 R08: 0000000000000000 R09: 0000000000000000 [ 729.618221] R10: 0000000000000000 R11: ffff8e43ef37d880 R12: ffff9d7501597d98 [ 729.618285] R13: 0000000000000000 R14: ffff9d7501597d94 R15: 0000000000000000 [ 729.618344] FS: 00007f6525bfd700(0000) GS:ffff8e43fec00000(0000) knlGS:0000000000000000 [ 729.618411] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 729.618458] CR2: 00000000000000c4 CR3: 00000002261f6000 CR4: 00000000000406f0 [ 729.618515] Stack: [ 729.618535] 0000000000000004 00007ffe1e85ca00 ffff8e43f3162100 0000000000000004 [ 729.618607] ffff9d7501597df8 ffffffffc0e2c637 000000401e85ca00 ffff9d7501597f18 [ 729.618676] ffff9d7501597df8 ffffffffc0e2dc7d 0000000000005403 0000000000000000 [ 729.618747] Call Trace: [ 729.618826] [<ffffffffc0e2c637>] amdgpu_debugfs_sensor_read+0xf7/0x120 [amdgpu] [ 729.618938] [<ffffffffc0e2dc7d>] ? amdgpu_debugfs_regs_read+0x17d/0x220 [amdgpu] [ 729.619002] [<ffffffff8f3433e4>] full_proxy_read+0x54/0x90 [ 729.619049] [<ffffffff8f24be67>] __vfs_read+0x37/0x150 [ 729.619095] [<ffffffff8f35e67b>] ? security_file_permission+0x9b/0xc0 [ 729.621382] [<ffffffff8f24cfe6>] vfs_read+0x96/0x130 [ 729.622997] [<ffffffff8f24e4d5>] SyS_read+0x55/0xc0 [ 729.624540] [<ffffffff8f8010b7>] entry_SYSCALL_64_fastpath+0x1a/0xa9 [ 729.626139] Code: 24 31 c0 41 c7 06 04 00 00 00 41 5c 41 5d 41 5e 41
Quoted 3 lines
5f 5d c3 c1 e8 10 83 e0 1f 83 f8 07 77 ad 48 8d 14 c5 00 00 00 00 5b 48 29 c2 <41> 8b 84 95 c4 00 00 00 0f c8 41 89 04 24 41 c7 06 04 00 00 00
_______________________________________________
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): 638559e3-6dab-107c-f483-562f6a298ab3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 42 lines · Samuel Pitoiset
Quoted 30 lines · Tom St Denis
Quoted 29 lines · Samuel Pitoiset
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.v2: - make sure
read_sensoris not NULL on dpm chips
- keep sanity check for powerplay chipsCc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3204,6 +3204,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char__user *buf, valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx,&values[0], &valuesize);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0+else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);Quoted 8 lines
Quoted 4 lines
else return -EINVAL;Sorry NAK again, even with dpm=0 those function pointers are set and you end up inside the dpm code trying to parse data structures that aren't initialized.
Quoted 5 lines
No worries. I thought that check was enough. Anyway, writing code without the hardware should be avoided. :)
Can you try the thing suggested by Alex? Because I will need to fix up the DRM ioctl codepath as well.
Sure, I'm building a module with a amdgpu_dpm check near the top of the debugfs read function.
Tom
_______________________________________________
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): 468a8aea-645c-037f-f78e-0d24a5b84a14-5C7GfCeVMHo@public.gmane.org
Quoted 9 lines · Tom St Denis
Quoted 5 lines · Samuel Pitoiset
No worries. I thought that check was enough. Anyway, writing code without the hardware should be avoided. :)
Can you try the thing suggested by Alex? Because I will need to fix up the DRM ioctl codepath as well.
Sure, I'm building a module with a
amdgpu_dpmcheck near the top of the debugfs read function.
It seems returning an error code causes it to do "bad things" on read
[root@kaveri linux]# git diff
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -3198,6 +3198,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,if (size &3 || *pos &0x3 )return -EINVAL ; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ;
That's what I applied on top of Samuel's three patches.
With DPM enabled it works fine obviously, with it disabled the entire system hangs. I think probably because the VFS spins trying to read but never finishes...
Any ideas?
Tom
_______________________________________________
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): 2338bf9c-ab65-36c6-53ae-a15321189817-5C7GfCeVMHo@public.gmane.org
Quoted 30 lines · Tom St Denis
Quoted 9 lines · Tom St Denis
Quoted 5 lines · Samuel Pitoiset
No worries. I thought that check was enough. Anyway, writing code without the hardware should be avoided. :)
Can you try the thing suggested by Alex? Because I will need to fix up the DRM ioctl codepath as well.
Sure, I'm building a module with a
amdgpu_dpmcheck near the top of the debugfs read function.It seems returning an error code causes it to do "bad things" on read
[root@kaveri linux]# git diff
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -3198,6 +3198,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char__user *buf, if (size & 3 || *pos & 0x3) return -EINVAL; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ;
Quoted 5 lines
That's what I applied on top of Samuel's three patches.
With DPM enabled it works fine obviously, with it disabled the entire system hangs. I think probably because the VFS spins trying to read but never finishes...
Nevermind, the issue is umr reading UVD registers when dpm=0 on KV. Without sampling UVD the error works properly.
So add those three lines to your patch (and similar in the ioctl) you should be fine.
Cheers,
To
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 30 lines · Tom St Denis
Quoted 9 lines · Tom St Denis
Quoted 5 lines · Samuel Pitoiset
No worries. I thought that check was enough. Anyway, writing code without the hardware should be avoided. :)
Can you try the thing suggested by Alex? Because I will need to fix up the DRM ioctl codepath as well.
Sure, I'm building a module with a
amdgpu_dpmcheck near the top of the debugfs read function.It seems returning an error code causes it to do "bad things" on read
[root@kaveri linux]# git diff
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -3198,6 +3198,9 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char__user *buf, if (size & 3 || *pos & 0x3) return -EINVAL; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ;
Quoted 5 lines
That's what I applied on top of Samuel's three patches.
With DPM enabled it works fine obviously, with it disabled the entire system hangs. I think probably because the VFS spins trying to read but never finishes...
Nevermind, the issue is umr reading UVD registers when dpm=0 on KV. Without sampling UVD the error works properly.
So add those three lines to your patch (and similar in the ioctl) you should be fine.
Cheers,
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 26 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay chipsTotally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t · line 3208
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-4idx = *pos >>2 ; valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs- >read_sensor) - r = adev->powerplay.pp_funcs->read_sensor (adev- >powerplay.pp_handle, idx, &values[0], &valuesize); -else -return -EINVAL ; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpm is handled by both powerplay and non-powerplay so I think if we check for that here, we should be fine. E.g., if (amdgpu_dpm != 0)
r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
Alex
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1if (size > valuesize)return -EINVAL ; --2.11.1
_______________________________________________
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): BN6PR12MB16525D9E10BE446048A8FD5FF7580-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 32 lines · Alexander
Quoted 32 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay chipsTotally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-2@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs- > read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev-
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3205
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-2> powerplay.pp_handle, idx, &values[0], &valuesize); - else - return -EINVAL; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpmis handled by both powerplay and non-powerplay so I think if we check for that here, we should be fine. E.g., if (amdgpu_dpm!= 0)r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);
And a similar fix in the DRM ioctl too I suppose.
Tom
_______________________________________________
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): b24985ed-1030-deb1-2c80-a5435c383ae4-5C7GfCeVMHo@public.gmane.org
Quoted 48 lines
-----Original Message-----
From: StDenis, Tom
Sent: Tuesday, February 14, 2017 11:58 AM
To: Deucher, Alexander; 'Samuel Pitoiset'; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 2 lines · Alexander
Quoted 2 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] OnBehalf
Quoted 5 lines
Quoted 5 lines
Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay
Quoted 23 lines
Quoted 23 lines
chips
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); - if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3205
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-3> read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev- > powerplay.pp_handle, idx, &values[0], &valuesize); - else - return -EINVAL; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpmis handled by both powerplay and non-powerplay so I think
Quoted 5 lines
if we check for that here, we should be fine. E.g.,
Quoted 2 lines
if (
amdgpu_dpm!= 0)r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);And a similar fix in the DRM ioctl too I suppose.
Yes.
Alex
Quoted 2 lines
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 48 lines
-----Original Message-----
From: StDenis, Tom
Sent: Tuesday, February 14, 2017 11:58 AM
To: Deucher, Alexander; 'Samuel Pitoiset'; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 2 lines · Alexander
Quoted 2 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] OnBehalf
Quoted 5 lines
Quoted 5 lines
Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay
Quoted 23 lines
Quoted 23 lines
chips
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); - if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3205
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-3> read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev- > powerplay.pp_handle, idx, &values[0], &valuesize); - else - return -EINVAL; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpmis handled by both powerplay and non-powerplay so I think
Quoted 5 lines
if we check for that here, we should be fine. E.g.,
Quoted 2 lines
if (
amdgpu_dpm!= 0)r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);And a similar fix in the DRM ioctl too I suppose.
We can just return an error if amdgpu_dpm ==0 in the ioctl.
Alex
Quoted 2 lines
Tom
_______________________________________________
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): BN6PR12MB16522B9BBE1A9048F35EFCF7F7580-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 48 lines · Alexander
Quoted 48 lines
-----Original Message-----
From: StDenis, Tom
Sent: Tuesday, February 14, 2017 11:58 AM
To: Deucher, Alexander; 'Samuel Pitoiset'; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 2 lines · Alexander
Quoted 2 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] OnBehalf
Quoted 5 lines
Quoted 5 lines
Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay
Quoted 31 lines
Quoted 19 lines
chips
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t · line 3208
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-4idx = *pos >>2 ; valuesize =sizeof (values); -if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs- > read_sensor) - r = adev->powerplay.pp_funcs->read_sensor (adev- > powerplay.pp_handle, idx, &values[0], &valuesize); -else -return -EINVAL ; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpmis handled by both powerplay and non-powerplay so I think
Quoted 7 lines
Quoted 5 lines
if we check for that here, we should be fine. E.g.,
Quoted 2 lines
if (
amdgpu_dpm!= 0)r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);And a similar fix in the DRM ioctl too I suppose.
We can just return an error if
amdgpu_dpm==0 in the ioctl.
-EINVAL?
Quoted 5 lines
Alex
Quoted 2 lines
Tom
_______________________________________________
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): ff5516f0-f675-9874-ca2f-e5c26981568b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 60 lines
-----Original Message-----
From: Samuel Pitoiset [mailto:[email protected]]
Sent: Tuesday, February 14, 2017 12:04 PM
To: Deucher, Alexander; StDenis, Tom; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 40 lines · Alexander
Quoted 40 lines
-----Original Message-----
From: StDenis, Tom
Sent: Tuesday, February 14, 2017 11:58 AM
To: Deucher, Alexander; 'Samuel Pitoiset'; [email protected]
Subject: Re: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre- powerplay chipsQuoted 2 lines · Alexander
Quoted 2 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] OnBehalf
Quoted 5 lines
Quoted 5 lines
Of Samuel Pitoiset
Sent: Monday, February 13, 2017 7:23 PM
To: [email protected]
Cc: StDenis, Tom; Samuel Pitoiset
Subject: [PATCH] drm/amdgpu: exposeamdgpu_sensorson pre-powerplay
Quoted 23 lines
Quoted 23 lines
chips
Totally untested but as long as
read_sensor()has been recently implemented for dpm based boards,amdgpu_sensorscan now be exposed.Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1@@ -3202,10 +3202,7 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, idx = *pos >>2 ; valuesize =sizeof (values); - if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t · line 3208
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-3> read_sensor) - r = adev->powerplay.pp_funcs->read_sensor(adev- > powerplay.pp_handle, idx, &values[0], &valuesize); - else - return -EINVAL; + r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
amdgpu_dpmis handled by both powerplay and non-powerplay so Ithink
Quoted 1 line
Quoted 1 line
if we check for that here, we should be fine. E.g.,
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
if (
amdgpu_dpm!= 0)r = amdgpu_dpm_read_sensor(adev, idx, &values[0], &valuesize);And a similar fix in the DRM ioctl too I suppose.
We can just return an error if
amdgpu_dpm==0 in the ioctl.
-EINVAL?
Maybe -ENOENT?
Alex
Quoted 6 lines
Quoted 6 lines
Alex
Quoted 2 lines
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v3 1/1 drm/amdgpu: expose amdgpu_sensors on pre-powerplay chips
In reply to a message not in the archiveread_sensor() has been recently implemented for dpm based boards which means amdgpu_sensors can now be exposed.
v2: - make sure read_sensor is not NULL on dpm chips
- keep sanity check for powerplay chips
v3: - make sure amdgpu_dpm != 0
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
@@ -3198,12 +3198,18 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,if (size &3 || *pos &0x3 )return -EINVAL ; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ; valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); +else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);else return -EINVAL ;
Signature · 6 lines
2.11.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): 20170215183229.32590-1-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Tom St Denis
Reviewed-byQuoted 9 lines · Samuel Pitoiset
read_sensor()has been recently implemented for dpm based boards which meansamdgpu_sensorscan now be exposed.v2: - make sure
read_sensoris not NULL on dpm chips
- keep sanity check for powerplay chips
v3: - make sureamdgpu_dpm!= 0Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>
Cool, you can throw my R-b on this and the first patch (which adds the sensors). Christian/Alex/etc can RB the DRM part.
Thanks,
Tom
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -3198,12 +3198,18 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf,if (size &3 || *pos &0x3 )return -EINVAL ; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3215
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor (adev->powerplay.pp_handle, idx, &values[0 ], &valuesize); +else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);else return -EINVAL ;
_______________________________________________
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): fa40c67e-2507-20d1-3c6a-77d253b72865-5C7GfCeVMHo@public.gmane.org
Quoted 8 lines · Tom St Denis
Quoted 7 lines · Samuel Pitoiset
read_sensor()has been recently implemented for dpm based boards which meansamdgpu_sensorscan now be exposed.v2: - make sure
read_sensoris not NULL on dpm chips
- keep sanity check for powerplay chips
v3: - make sureamdgpu_dpm!= 0
Quoted 7 lines
Quoted 2 lines
Cc Tom St Denis <[email protected]>Signed-off-by Samuel Pitoiset <[email protected]>Cool, you can throw my R-b on this and the first patch (which adds the sensors). Christian/Alex/etc can RB the DRM part.
Reviewed-by Tom St Denis <[email protected]>
Thanks.
I'm improving the DRM part to expose more stuff (not only the clocks/temp).
Quoted 25 lines
Thanks,
TomQuoted 20 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -3198,12 +3198,18 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, if (size & 3 || *pos & 0x3) return -EINVAL; +if (amdgpu_dpm ==0 ) +return -EINVAL ; +/* convert offset to sensor number */ idx = *pos >>2 ;
Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, · line 3214
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0valuesize =sizeof (values);if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->read_sensor) r = adev->powerplay.pp_funcs->read_sensor(adev->powerplay.pp_handle, idx,&values[0], &valuesize);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0+else if (adev->pm.funcs && adev->pm.funcs->read_sensor) + r = adev->pm.funcs->read_sensor (adev, idx, &values[0 ], + &valuesize);else return -EINVAL ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx