My desktop machine with Rtx 4090 hangs with new Linux Kernels

I’m running Fedora 36, KDE on a desktop with the following information:

Operating System: Fedora Linux 36
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 5.19.15-201.fc36.x86_64 (64-bit)
Graphics Platform: X11
Processors: 32 × AMD Ryzen 9 7950X 16-Core Processor
Memory: 30.5 GiB of RAM
Graphics Processor: NVIDIA Graphics Device/PCIe/SSE2 (RTX 4090) Gigabyte
Manufacturer: ASUS (ROG STRIX X670E-E GAMING WIFI 6E)

I have installed the driver: NVIDIA-Linux-x86_64-520.56.06.run.

The system uses LUKS to encrypt the hard drive and was working fine until the kernel: 5.19.15-201.fc36
Starting 5.19.16-200.fc36 and now with 6.0.5-200.fc36, the system hangs when it reaches the password entry screen for LUKS (which is right after selecting the kernel version in grub menu).

If I connect the monitor to the onboard AMD driver, the system works fine (But does not load the graphics environment, because it is set to use Nvidia).

One interesting difference is that the password entry page (when connected to AMD) switches to monitor’s native resolution for the failing kernels, but stays in a low resolution for the succeeding kernel), so my guess is that the new kernels are trying to switch to a higher resolution, but the Nividia driver is failing for some reason.

Another weird behavior is that when I run the Nvidia’s proprietary driver installer, it fails to install, saying that the module is loaded, but if I try to uninstall it, it complains that the driver is not installed.

Also, another weird behavior is that when running dkms status, I get"

nvidia/520.61.05, 5.19.15-201.fc36.x86_64, x86_64: installed
nvidia/520.61.05, 5.19.16-200.fc36.x86_64, x86_64: installed
nvidia/520.61.05, 6.0.5-200.fc36.x86_64, x86_64: installed
nvidia/520.61.05, 6.1.0-0.rc2.20221027gitb229b6ca5abb.23.vanilla.1.fc36.x86_64, x86_64: installed

Please note that the installed version is different from the one I have downloaded from Nvidia’s website.

Update: I’m having the same problem in the Fedora 37 live usb: computer boots when monitor is connected to AMD integrated graphics, but not when connected to Nvidia Rtx 4090.