AMD Polaris, Vega & Navi Reset Project - vendor-reset

I think that could be helpful, so of course :eyes:

Please check the pastebin link as dmesg has too much output to post it here: https://pastebin.com/G6bkhDQu

The last few lines are coming from a disconnected Thrustmaster joystick that I use to hook up to my monitor which itself goes to the USB port which gets passed through to the VM.

Hmm, it doesn’t look like the module is loaded when the VM tries to reboot. Can you try loading the module at boot (putting it in /etc/modules or /etc/modules-load.d depending on your system), or at least modprobeing it before booting your VM?

1 Like

Hey there, thanks for the tip! :eyes:

I have created a vendor-reset.conf in /etc/modules-load.d/ with vendor-reset as its only content.

Resetting Navi works great now :grinning::tada:

Buuut now since that works, libvirt claims it couldn’t find further added USB devices that worked fine previously, such as my monitor’s USB hub or the XBOX360 wireless controller adapter :eyes:

Adding those devices works fine but starting the VM will return that said devices couldn’t be found.

And I’m pretty certain I didn’t switch ports or anything, it’s odd.

EDIT: Also once restarted the VM wouldn’t detect the RX5700 anymore and start in 800x600 with a basic Microsoft Display Driver running :slightly_frowning_face:

I would be interested in seeing the dmesg output in that case. It’s possible you’re running into the same issue as @mathew2214. I’m looking into what may be causing it currently.

Here’s the dmesg that I get when resetting the VM actually works but ends up with the Basic Microsoft adapter in 800x600.

I restarted the VM a couple of times - like three or four times - thus entries are similar, otherwise I didn’t change anything this time.

The vendor-reset.conf is still in its place also.

unRAID setup with OSX and WIN10 VM using AMD Vega64 both VMs have the reset bug found this tonight and would like to try it out. But can anyone point me in the right direction? I’ve no clue how to install this. Checked out the Readme but I’ve never done something like this. Thanks!

This module can be installed either using the standard make , make install pattern, or through dkms (recommended).

Literally, as the readme states, just be sure your kernel headers are installed first.

make
make install

or use DKMS which you may need to install first

dkms install .

After which you need to sort out loading the module at boot, which is distro dependent and you will need to read their documentation. Or you can load it manually via

modprobe vendor-reset

In all instances it must be loaded (modprobed) before you try to use the GPU for VFIO.

1 Like

This works for proxmox: https://www.nicksherlock.com/2020/11/working-around-the-amd-gpu-reset-bug-on-proxmox/

# Get latest Proxmox kernel headers:
apt install pve-headers

# Did that fail? If so make sure you have Proxmox repository set up properly! https://pve.proxmox.com/wiki/Package_Repositories

# Get required build tools:
apt install git dkms build-essential

# Perform the build:
git clone https://github.com/gnif/vendor-reset.git
cd vendor-reset
dkms install .

# Enable vendor-reset to be loaded automatically on startup:
echo "vendor-reset" >> /etc/modules
update-initramfs -u

# Reboot to load the module:
shutdown -r now

Appreciate the fast response, wow! is this done from root command? How do I check if kernel headers are installed first. my first bike ride

Yes, as root, the other details are dependent on your distro and you will need to discover this for yourself.

1 Like

That is exactly the type of instructions a noob needs but 2 q’s is that done from root command and would this work on unRAID I’m not using Proxmox.

Please don’t double post like that in the future. Again, do the research, loading kernel modules is a Linux basic you should learn how to do and is specific to each distribution.

1 Like

It will not work directly as is, just shows you the steps needed. You’ll have to figure out how unraid does those things (i’ve never used it). And yes, it’s all root.

Sorry was replying to 2 different posts… enjoy the coffee’s :wink:

I’d like to confirm that both my Powercolor Vega 64, and my XFX 460 both appear to be resetting just fine.

Thanks to this, extron usb extenders, and a fiber displayport cable, my ā€œDesktop computerā€ is now being hosted by my NAS/Homelab in a completely different room.

2 Likes
  • does somebody know what to expect from a WX9100? likely to be comparable?

  • and regarding the reset:
    is it true that the reset is applied BEFORE vm start, meaning after shutdown it will remain in a failed state until reused?
    asking because i suspect my mainboard to have a watchdog thats responsible for the painful alarm sound that follows a failed gpu after a few seconds.

Thank you so much for working on this project. However I’m still having issues with passing a Radeon VII to a Windows guest VM.

After I shut down the Windows VM I can start it up again (which is already an improvement as normally it would throw and error and refuse to boot at all without a whole system reset), however the reset seems to fail and the Windows guest eventually starts with the GPU disabled. If I look at Device Manager inside the Windows VM the Radeon VII does actually show up but the status says:

Windows has stopped this device because it has reported problems. (Code 43)

And if I check dmesg on the Linux host I see:

[86087.649781] vfio-pci 0000:0b:00.0: enabling device (0400 -> 0403)
[86087.649862] vfio-pci 0000:0b:00.0: AMD_VEGA20: version 1.0
[86087.649863] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing pre-reset
[86087.649910] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing reset
[86087.885954] vfio-pci 0000:0b:00.0: AMD_VEGA20: psp not working for mode1 reset
[86087.885955] vfio-pci 0000:0b:00.0: AMD_VEGA20: falling back to BACO reset
[86088.106507] vfio-pci 0000:0b:00.0: SMU error 0x0
[86088.106508] vfio-pci 0000:0b:00.0: AMD_VEGA20: enter BACO failed
[86088.106509] vfio-pci 0000:0b:00.0: AMD_VEGA20: failed to reset device
[86088.106509] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing post-reset
[86088.106570] vfio-pci 0000:0b:00.0: AMD_VEGA20: reset result = 0
[86088.126666] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86088.146663] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86088.198670] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86088.242807] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86088.266789] vfio-pci 0000:0b:00.0: AMD_VEGA20: version 1.0
[86088.266791] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing pre-reset
[86088.266843] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing reset
[86088.507173] vfio-pci 0000:0b:00.0: AMD_VEGA20: psp not working for mode1 reset
[86088.507175] vfio-pci 0000:0b:00.0: AMD_VEGA20: falling back to BACO reset
[86088.726684] vfio-pci 0000:0b:00.0: SMU error 0x0
[86088.726685] vfio-pci 0000:0b:00.0: AMD_VEGA20: enter BACO failed
[86088.726686] vfio-pci 0000:0b:00.0: AMD_VEGA20: failed to reset device
[86088.726686] vfio-pci 0000:0b:00.0: AMD_VEGA20: performing post-reset
[86088.726719] vfio-pci 0000:0b:00.0: AMD_VEGA20: reset result = 0
[86089.662524] virbr0: port 2(vnet0) entered forwarding state
[86089.662538] virbr0: topology change detected, propagating
[86091.802652] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86092.030577] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0
[86121.397868] vfio-pci 0000:0b:00.1: refused to change power state from D3hot to D0

Any help would be appreciated, thank you. Actually this looks like the exact same problem Lunaa was having earlier but I didn’t see a reply to them.

1 Like

It needs work still sorry, I should be spending some time on it in the coming weeks.

Tested on a 10.15.7 MacOS VM with a 5700 and I get the following:

[   50.259828] vfio-pci 0000:06:00.0: AMD_NAVI10: version 1.1
[   50.259830] vfio-pci 0000:06:00.0: AMD_NAVI10: performing pre-reset
[   50.259899] vfio-pci 0000:06:00.0: AMD_NAVI10: performing reset
[   50.260407] vendor-reset-drm: invalid ip discovery binary signature
[   50.260443] vendor-reset-drm: amdgpu_discovery_init failed
[   50.260464] vfio-pci 0000:06:00.0: AMD_NAVI10: amdgpu_discovery_reg_base_init failed, using legacy method
[   50.359814] ATOM BIOS: 113-D1820201-101
[   50.359815] vendor-reset-drm: atomfirmware: bios_scratch_reg_offset initialized to 4c
[   50.517819] vfio-pci 0000:06:00.0: AMD_NAVI10: bus reset disabled? yes
[   50.517823] vfio-pci 0000:06:00.0: AMD_NAVI10: SMU response reg: 0, sol reg: 0, mp1 intr enabled? no, bl ready? yes
[   50.517825] vfio-pci 0000:06:00.0: AMD_NAVI10: performing post-reset
[   50.534546] vfio-pci 0000:06:00.0: AMD_NAVI10: reset result = 0
[   72.163011] vfio-pci 0000:00:1a.0: enabling device (0000 -> 0002)
[   72.268032] vfio-pci 0000:00:1a.0: vfio_cap_init: hiding cap 0xa@0x58
[   72.368076] vfio-pci 0000:06:00.0: enabling device (0400 -> 0403)
[   72.368170] vfio-pci 0000:06:00.0: AMD_NAVI10: version 1.1
[   72.368172] vfio-pci 0000:06:00.0: AMD_NAVI10: performing pre-reset
[   72.368235] vfio-pci 0000:06:00.0: AMD_NAVI10: performing reset
[   72.368731] vendor-reset-drm: invalid ip discovery binary signature
[   72.368768] vendor-reset-drm: amdgpu_discovery_init failed
[   72.368789] vfio-pci 0000:06:00.0: AMD_NAVI10: amdgpu_discovery_reg_base_init failed, using legacy method
[   72.465046] ATOM BIOS: 113-D1820201-101
[   72.465048] vendor-reset-drm: atomfirmware: bios_scratch_reg_offset initialized to 4c
[   72.622660] vfio-pci 0000:06:00.0: AMD_NAVI10: bus reset disabled? yes
[   72.622670] vfio-pci 0000:06:00.0: AMD_NAVI10: SMU response reg: 0, sol reg: 0, mp1 intr enabled? no, bl ready? yes
[   72.622680] vfio-pci 0000:06:00.0: AMD_NAVI10: performing post-reset
[   72.640422] vfio-pci 0000:06:00.0: AMD_NAVI10: reset result = 0
[   72.640528] vfio-pci 0000:06:00.0: vfio_ecap_init: hiding ecap 0x19@0x270
[   72.640536] vfio-pci 0000:06:00.0: vfio_ecap_init: hiding ecap 0x1b@0x2d0
[   72.640539] vfio-pci 0000:06:00.0: vfio_ecap_init: hiding ecap 0x25@0x400
[   72.640541] vfio-pci 0000:06:00.0: vfio_ecap_init: hiding ecap 0x26@0x410
[   72.640543] vfio-pci 0000:06:00.0: vfio_ecap_init: hiding ecap 0x27@0x440
[   72.804716] vfio-pci 0000:06:00.0: AMD_NAVI10: version 1.1
[   72.804718] vfio-pci 0000:06:00.0: AMD_NAVI10: performing pre-reset
[   72.804793] vfio-pci 0000:06:00.0: AMD_NAVI10: performing reset
[   72.805305] vendor-reset-drm: invalid ip discovery binary signature
[   72.805363] vendor-reset-drm: amdgpu_discovery_init failed
[   72.805384] vfio-pci 0000:06:00.0: AMD_NAVI10: amdgpu_discovery_reg_base_init failed, using legacy method
[   72.900822] ATOM BIOS: 113-D1820201-101
[   72.900825] vendor-reset-drm: atomfirmware: bios_scratch_reg_offset initialized to 4c
[   73.059124] vfio-pci 0000:06:00.0: AMD_NAVI10: bus reset disabled? yes
[   73.059134] vfio-pci 0000:06:00.0: AMD_NAVI10: SMU response reg: 0, sol reg: 0, mp1 intr enabled? no, bl ready? yes
[   73.059136] vfio-pci 0000:06:00.0: AMD_NAVI10: performing post-reset
[   73.076993] vfio-pci 0000:06:00.0: AMD_NAVI10: reset result = 0

Here’s the info of my card:

06:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 (rev c4) (prog-if 00 [VGA controller])
        Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 118
        NUMA node: 0
        Region 0: Memory at a0000000 (64-bit, prefetchable) [size=256M]
        Region 2: Memory at b0000000 (64-bit, prefetchable) [size=2M]
        Region 4: I/O ports at 7000 [size=256]
        Region 5: Memory at bf600000 (32-bit, non-prefetchable) [size=512K]
        Expansion ROM at bf680000 [disabled] [size=128K]
        Capabilities: [48] Vendor Specific Information: Len=08 <?>
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [64] Express (v2) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 256 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
                LnkCap: Port #0, Speed unknown, Width x16, ASPM L0s L1, Exit Latency L0s <64ns, L1 <1us
                        ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed unknown, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkCtl2: Target Link Speed: Unknown, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
                         EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
                Address: 00000000fee00cd8  Data: 0000
        Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150 v2] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
        Capabilities: [200 v1] #15
        Capabilities: [240 v1] Power Budgeting <?>
        Capabilities: [270 v1] #19
        Capabilities: [2a0 v1] Access Control Services
                ACSCap: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
                ACSCtl: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
        Capabilities: [2b0 v1] Address Translation Service (ATS)
                ATSCap: Invalidate Queue Depth: 00
                ATSCtl: Enable+, Smallest Translation Unit: 00
        Capabilities: [2c0 v1] Page Request Interface (PRI)
                PRICtl: Enable- Reset-
                PRISta: RF- UPRGI- Stopped+
                Page Request Capacity: 00000100, Page Request Allocation: 00000000
        Capabilities: [2d0 v1] Process Address Space ID (PASID)
                PASIDCap: Exec+ Priv+, Max PASID Width: 10
                PASIDCtl: Enable- Exec- Priv-
        Capabilities: [320 v1] Latency Tolerance Reporting
                Max snoop latency: 0ns
                Max no snoop latency: 0ns
        Capabilities: [400 v1] #25
        Capabilities: [410 v1] #26
        Capabilities: [440 v1] #27
        Kernel driver in use: vfio-pci
        Kernel modules: amdgpu

06:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio
        Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Navi 10 HDMI Audio
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin B routed to IRQ 117
        NUMA node: 0
        Region 0: Memory at bf6a0000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: [48] Vendor Specific Information: Len=08 <?>
        Capabilities: [50] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME+
        Capabilities: [64] Express (v2) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
                        ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd- ExtTag+ PhantFunc- AuxPwr- NoSnoop+
                        MaxPayload 256 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr- TransPend-
                LnkCap: Port #0, Speed unknown, Width x16, ASPM L0s L1, Exit Latency L0s <64ns, L1 <1us
                        ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed unknown, Width x16, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Not Supported
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
                         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
        Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
                Address: 00000000fee00cb8  Data: 0000
        Capabilities: [100 v1] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [150 v2] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
                AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
        Capabilities: [2a0 v1] Access Control Services
                ACSCap: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
                ACSCtl: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
        Kernel driver in use: vfio-pci
        Kernel modules: snd_hda_intel

Got the same issue with my 5700 xt. after a longer gaming session (Wasteland 3) i get the same error code and cannot use the video output of my 5700. host restart → it works again.

just for the record.

1 Like