Configuring the Guest
The Virtual Machine Administrator receives a CVM with GPUs attached by the hypervisor and configures the NVIDIA driver in the guest. This persona might not know the BIOS or host OS configuration. Most users start here.
The examples on this page continue from an Ubuntu 24.04 guest that you created by following Creating a Confidential VM. If your system administrators provided the CVM, the output can differ slightly, but the steps are the same.
Log in to the CVM and run the commands on this page in the guest.
Enabling LKCA
The NVIDIA driver requires the Linux Kernel Crypto API (LKCA) in every Confidential Computing mode.
-
Create the
/etc/modprobe.d/nvidia-lkca.conffile with the following line: -
Update the initramfs and reboot:
Installing the NVIDIA Driver and CUDA Toolkit
NVIDIA recommends that you install the driver by using the package manager. The open GPU kernel modules are the open-source version of the NVIDIA kernel driver. The source code is available in the NVIDIA Linux Open GPU Kernel Module repository.
-
Install the CUDA repository keyring:
-
Install the CUDA Toolkit:
-
Install the driver:
Starting Fabric Manager for Hopper PPCIe Mode
If the GPUs use multi-GPU PPCIe mode, start Fabric Manager in the guest and confirm that Fabric Manager is running:
Enabling Persistence Mode
When the NVIDIA driver loads, the driver establishes a secure SPDM session with the GPU and exchanges ephemeral encryption keys with the GPU.
When no process uses the GPU, the NVIDIA kernel driver normally tears down the device state. In the Confidential Computing modes, the teardown destroys the shared secret and the keys from the SPDM session. For security, the GPU doesn’t allow a new SPDM session until a function-level reset (FLR) resets and scrubs the GPU.
Persistence mode prevents the NVIDIA kernel driver from tearing down the device state.
The nvidia-persistenced daemon provides persistence mode.
The daemon doesn’t use device resources and only holds a reference to the NVIDIA device state.
-
Determine whether
nvidia-persistencedruns in persistence mode:-
If the output includes
--uvm-persistence-mode,nvidia-persistencedruns in persistence mode, and you can skip to Validating the GPU State: -
If the output includes
--no-persistence-mode,nvidia-persistencedruns without persistence mode: -
If the output shows only the
grepcommand,nvidia-persistencedisn’t running:
-
-
Edit
/usr/lib/systemd/system/nvidia-persistenced.serviceand change--no-persistence-modeto--uvm-persistence-modein theExecStartline: -
Reload the systemd configuration, enable the
nvidia-persistencedservice, and reboot the guest:
Validating the GPU State
With the driver in persistence mode, confirm that the GPU runs in the Confidential Computing mode that you expect.
The nvidia-smi command reports CC mode and PPCIe mode differently.
The following example shows a GPU in PPCIe mode on an Intel TDX system:
For multi-GPU modes, also confirm that Fabric Manager runs, that NVIDIA NVLink is up, and that NVLink peer-to-peer access is enabled:
The guest CVM is now configured for CC mode or PPCIe mode. After you install the driver, maintain the following requirements:
- Keep persistence mode enabled for the NVIDIA driver.
- After the driver unloads, the driver doesn’t load again until the GPU is reset. Reset the GPU with a physical function-level reset (PF-FLR) or reboot the system before you load the driver again.
Continue with Attesting the GPU.