veracrypt / VeraCrypt-DCS

VeraCrypt EFI Bootloader for EFI Windows system encryption (LGPL)
GNU Lesser General Public License v3.0
134 stars 59 forks source link

Interferes with nVidia Optimus when CSM is disabled #17

Open kevinoid opened 5 years ago

kevinoid commented 5 years ago

On a ThinkPad T430 (2342-CTO) with Nvidia Optimus (an NVIDIA NVS 5400M paired with an Intel HD4000) running Windows 10, booting in UEFI mode with Compatibility Support Module disabled using the VeraCrypt boot loader causes the NVIDIA NVS 5400M to stop working with device status "Windows has stopped this device because it has reported problems. (Code 43)" in Device Manager. Switching back to the Windows boot loader (by disabling "Encrypt System Partition/Drive") resolves the error and restores functionality.

After some experimentation, I can confirm that this only occurs when configured to boot in UEFI mode with CSM disabled. If CSM is enabled, or when booting in Legacy/BIOS mode, the error does not occur. It also does not occur when the pre-boot configuration is set to "Discrete Graphics" (which only exposes the NVIDIA NVS 5400M to the OS). I can also confirm that the error occurs with both VeraCrypt Boot Loader 1.23 (from 1.23-Hotfix-2) and 1.18 (from 1.18a).

Let me know if there is anything I can do to help isolate or fix the issue.

Thanks, Kevin

P.S. It appears this issue was also reported on the forums on a W530 by vondatuh.

idrassi commented 5 years ago

Thank you for this report and sorry for the late feedback.

It’s difficult to investigate such issues since the problem occurs in a component that belongs to others (here nVidia). It would help if someone with knowledge of nVidia driver tell us what this error means.

One possible explanation is that there is a conflict between the memory address used by VeraCrypt boot loader to communicate with the VeraCrypt driver and the memory space used by nVidia graphic card during boot to initialize itself.

This hypothesis is reinforced by the fact that if the card is disabled in UEFI mode then the issue goes away.

I don’t know what memory range the nVidia card is reserving to its self and in VeraCrypt boot loader we use standard functions to check memory availability so I don’t know what can we do more to fix this conflict.

You have done a good job in identifying the issue and finding different workarounds. I think we will have to keep it like this until we have more information.

I know it has been long time since your post but if you can still do tests on this machine, I can share some test versions to help find the memory range that the nVidia device is using.

kevinoid commented 5 years ago

No worries. Thanks for the information and follow-up @idrassi!

I'm not familiar with the hardware or driver implementation details, so I don't have any useful advice for how to proceed. You may want to reach out to the Bumblebee Project and/or Dave Airlie and Matthew Garrett, who implemented vga_switcheroo in the Linux kernel (or find some useful information in Dave's blog posts discussing vga_switcheroo).

I'm still ready and willing to help test. I also don't mind continuing to use my current workarounds, so feel free to prioritize the issue however you see fit.

dennis1f commented 3 years ago

Same here, I'm using a T430 (2349-G7G), same NVS 5400M, HD4000 and Windows 10. The Problem occurred after installing Windows 10 and switching from Legacy BIOS to UEFI with CSM disabled. Thanks @kevinoid for the workaround. After only a few hours switching Nvidia and Intel driver versions, I was able to narrow it down to Veracrypt. Never install to much stuff a the same time without reboots, I guess ... But then the "solution" was simple.

Dennis