executable_gpu_reset.sh 841 B

12345678910111213141516171819202122
  1. #!/run/current-system/profile/bin/bash
  2. if [[ -e /sys/kernel/debug/dri/0/amdgpu_gpu_recover ]]
  3. then
  4. if [[ -e /sys/bus/pci/devices/0000:12:00.1/remove ]]
  5. then
  6. echo 1 > /sys/bus/pci/devices/0000:12:00.1/remove
  7. /run/current-system/profile/bin/cat /sys/kernel/debug/dri/0/amdgpu_gpu_recover
  8. echo 1 > /sys/bus/pci/rescan
  9. fi
  10. /run/current-system/profile/bin/cat /sys/kernel/debug/dri/0/amdgpu_gpu_recover
  11. elif [[ -e /sys/kernel/debug/dri/2/amdgpu_gpu_recover ]]
  12. then
  13. if [[ -e /sys/bus/pci/devices/0000:12:00.1/remove ]]
  14. then
  15. echo 1 > /sys/bus/pci/devices/0000:12:00.1/remove
  16. /run/current-system/profile/bin/cat /sys/kernel/debug/dri/2/amdgpu_gpu_recover
  17. echo 1 > /sys/bus/pci/rescan
  18. fi
  19. /run/current-system/profile/bin/cat /sys/kernel/debug/dri/2/amdgpu_gpu_recover
  20. fi