linux icon indicating copy to clipboard operation
linux copied to clipboard

Obtaining register states from Windows

Open mkopec opened this issue 9 months ago • 24 comments

I don't have access to many DCN generations on hand. To make developing for other DCN generations simpler, I created a script to dump register states: https://github.com/mkopec/dcn_regdump

We need to collect DCN register states from a Windows VM with the GPU passed through and with the HDMI cable connected, working in FRL mode. This way we can check what the Windows driver does and try to replicate the behavior in Linux.

Any help is greatly appreciated! Instructions are outlined in the README :)

So far I have collected logs from:

  • [x] DCN 4.0.1 (RX 9000 series)
  • [x] DCN 3.2.1 (RX 7600)
  • [x] DCN 3.1.5 (Granite Ridge)

mkopec avatar Feb 23 '26 04:02 mkopec

Just to confirm, I have a 9070XT, you DONT need me to get my register values since you already have 4.0.1?

Leon-Swains avatar Feb 23 '26 06:02 Leon-Swains

Correct, no need :) I'm looking to have a complete set of register states from all DCN gens, to get a complete picture of what we need to do

mkopec avatar Feb 23 '26 06:02 mkopec

Alright, I still have friends with AMD cards. I’ll try to see if they can dump their DCNs. I feel like it would be useful for you to make a public spreadsheet of all the generations you have/don’t have.

Leon-Swains avatar Feb 23 '26 06:02 Leon-Swains

And to reiterate, I'm basically looking for Windows register dumps. I don't really need ones from Linux with FRL not working. I'll update the OP

mkopec avatar Feb 23 '26 06:02 mkopec

I understand, I read the readme. I have a 7600x3d with an iGPU, I’ll definitely try to get the DCNs from that.

Leon-Swains avatar Feb 23 '26 06:02 Leon-Swains

I still have a 7800xt laying around which I could put back into my pc.( I recently upgraded it for a 9070xt before prices got crazy.) I will try to give you a dump of it in the coming week. Probably Wednesday.

gladiac avatar Feb 23 '26 06:02 gladiac

Your script is written for single GPU pass-through i assume. Because it picks up the iGPU i am using for the Linux desktop instead of my 6900XT.

Aviana avatar Feb 23 '26 08:02 Aviana

@Aviana You're right, I forgot multi-gpu setups exist, apparently. Pushed a change that should detect multiple GPUs

mkopec avatar Feb 23 '26 08:02 mkopec

The 6900XT announces itself as DCN 3.0 which gets not picked up by your script. I hardcoded it to 3.0.0 which should be the correct one and got the following output:

`Multiple AMD GPUs found: [0] 0000:03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] (rev c0) [1] 0000:11:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Granite Ridge [Radeon Graphics] (rev cb) Select GPU [0-1]: 0 Using AMD GPU at 0000:03:00.0 Found resource file at /sys/bus/pci/devices/0000:03:00.0/resource Using BAR5 at 0x00000000df900000 Detected DCN version: 3.0.0 Offset file: /home/avi/dcn_regdump-master/dcn_reg/dcn_3_0_0_offset.h SH mask file: /home/avi/dcn_regdump-master/dcn_reg/dcn_3_0_0_sh_mask.h Register prefix: reg Loading registers from: /home/avi/dcn_regdump-master/dcn_reg/dcn_3_0_0_offset.h

====HDMICHARCLOCK==== regHDMICHARCLK0_CLOCK_CNTL: 0x00000000 HDMICHARCLK0_EN: 0 HDMICHARCLK0_SRC_SEL: 0

====HDMI==== regHDMICHARCLK0_CLOCK_CNTL: 0x00000000 HDMICHARCLK0_EN: 0 HDMICHARCLK0_SRC_SEL: 0 `

Aviana avatar Feb 23 '26 09:02 Aviana

ehh, the DCN 3.0.x register definition files are stripped of almost anything related to HDMI 2.1. I haven't added all the definitions back yet, because I haven't figured out the correct VPG and AFMT indexes and if anything else is missing. You might have more success dumping regs from the integrated granite ridge iGPU

mkopec avatar Feb 23 '26 09:02 mkopec

I don't know if its the fact that i am binding the GPU early to the vfio driver but i am just getting zero values / permission denied with the iGPU.

dcn_regdump.20260223-114036.log

Aviana avatar Feb 23 '26 11:02 Aviana

maybe it's picking the wrong BAR? Could you run sudo lspci -vvvs 11:00.0?

mkopec avatar Feb 23 '26 11:02 mkopec

Looks good to me:

11:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Granite Ridge [Radeon Graphics] (rev cb) (prog-if 00 [VGA controller]) Subsystem: ASRock Incorporation Device 364e 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 69 IOMMU group: 28 Region 0: Memory at fcf0000000 (64-bit, prefetchable) [size=256M] Region 2: Memory at dec00000 (64-bit, prefetchable) [size=2M] Region 4: I/O ports at e000 [size=256] Region 5: Memory at df100000 (32-bit, non-prefetchable) [size=512K] Capabilities: <access denied> Kernel driver in use: amdgpu Kernel modules: amdgpu

Aviana avatar Feb 23 '26 11:02 Aviana

hmm... maybe you need to boot with iomem=relaxed in the kernel commandline

mkopec avatar Feb 23 '26 11:02 mkopec

Well that was it. Here are your logs. The first one is with a plugged LG Oled CX48 on 4K 120Hz HDR. Then i pulled the cable and took the second log.

plugged.log

unplugged.log

Aviana avatar Feb 23 '26 11:02 Aviana

Awesome, thanks! Will try to get something out of these

mkopec avatar Feb 23 '26 11:02 mkopec

Does it needed for a RX 7900 XTX ? I understand that dump register state of Windows VM must be done only with the HDMI-FRL kernel.

However, I get black screen when boot HDMI-FRL kernel with HDMI connected to igpu port of a Ryzen 9800X3D. And no black screen on boot if connected to igpu with default cachyOS kernel.

MetotoSakamoto avatar Feb 23 '26 13:02 MetotoSakamoto

7900XTX is already working, because i had the logs for DCN3.2.1. I also already have logs for 9800X3D

mkopec avatar Feb 23 '26 23:02 mkopec

@mkopec Here are the dumps for DCN 3.2.0 from an RX 7800XT running 4K at 120Hz:

plugged-rgb444-8b-hdr10.txt plugged-rgb444-8b-sdr.txt plugged-rgb444-10b-hdr10.txt plugged-rgb444-10b-sdr.txt plugged-rgb444-12b-hdr10.txt plugged-rgb444-12b-sdr.txt plugged-ycbcr444-8b-hdr10.txt plugged-ycbcr444-8b-sdr.txt plugged-ycbcr444-10b-hdr10.txt plugged-ycbcr444-10b-sdr.txt plugged-ycbcr444-12b-hdr10.txt plugged-ycbcr444-12b-sdr.txt unplugged.txt

I had to hardcode DCN 3.2.0 because dmesg outputs the DCN version as 3.2 (without leading .0) but the script expects x.y.z pattern. As a result it cannot find the version. Furthermore, I had to blacklist amdgpu to make the windows vm boot and have it eventually work so there is no amdgpu output to parse for the script.

I collected the setup steps for installing proxmox on an external drive, configuring the environment and installing the windows 11 vm. I can write up a little guide to make life easier for others because I had invested many hours to make this work.

gladiac avatar Feb 26 '26 12:02 gladiac

I had a similar experience. When i bound the card to the vfio stub to prevent the amdgpu driver from loading there is no DCN version output in dmesg. Also some hints for successful pass-through with AMD are:

  • Turn off re-sizable bar
  • Make sure to pass both audio and graphics device
  • The HDMI audio might be hidden behind the bios onboard audio option, make sure it is on
  • Both graphics and audio device need a romfile
  • As mentioned above i needed to set the iomem=relaxed kernel parameter on the host
  • Keeping in mind the AMD reset bug where only the first boot of the VM works on certain cards

Even though i didn't use proxmox myself i took some of this info and files from this guide: https://github.com/isc30/ryzen-gpu-passthrough-proxmox

Aviana avatar Feb 28 '26 06:02 Aviana