On Thu, Dec 9, 2021 at 1:18 PM Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> wrote: > > Thanks again Alex! Some comments inlined below: > > On 09/12/2021 15:06, Alex Deucher wrote: > > Not really in a generic way. It's asic and platform specific. In > > addition most modern displays require link training to bring up the > > display, so you can't just save and restore registers. > > Oh sure, I understand that. My question is more like: is there a way, > inside amdgpu driver, to save this state before taking > over/overwriting/reprogramming the device? So we could (again, from > inside the amdgpu driver) dump this pre-saved state in the shutdown > handler, for example, having the device in a "pre-OS" state when the new > kexec'ed kernel starts. Sure, it could be done, it's just a fair amount of work. Things like legacy vga text mode is a bit more of a challenge, but that tends to be less relevant as non-legacy UEFI becomes more pervasive. > > > > > The drivers are asic and platform specific. E.g., the driver for > > vangogh is different from renoir is different from skylake, etc. The > > display programming interfaces are asic specific. > > Cool, that makes sense! But if you (or anybody here) know some of these > GOP drivers, e.g. for the qemu/qxl device, I'm just curious to > see/understand how complex is the FW driver to just put the > device/screen in a usable state. Most of the asic init and display setup on AMD GPUs is handled via atombios command tables (basically little scripted stored in the vbios) which are shared by the driver and the GOP driver for most programming sequences. In our case, the GOP driver is pretty simple. Take a look at the pre-DC display code in amdgpu to see what a basic display driver would look like (e.g., dce_v11_0.c). The GOP driver would call the atombios asic_init table to make sure the chip itself is initialized (e.g., memory controller, etc.), then walk the display data tables in the vbios to determine the display configuration specific to this board, then probe the displays and use the atombios display command tables to light them up. Alex