# Use Models

In this section, we explore two different models that demonstrate how software can utilize the SME (Secure Memory Encryption) feature.

### Full Memory Encryption

Full memory encryption is a straightforward and compelling approach for many computing systems, particularly in situations where physical attacks on the system are a concern, such as government data centers or smaller/remote enterprise data centers with limited physical security. With full memory encryption, all contents in DRAM are encrypted using a random key, providing robust protection against cold boot attacks, DRAM interface snooping, and similar threats. This approach also safeguards systems with NVDIMM (Non-Volatile Dual In-line Memory Module), preventing attackers from extracting data by removing a memory module.

To enable full memory encryption with SME, the operating system (OS) or hypervisor (HV) sets the C-bit (Confidentiality-bit) in all DRAM physical addresses within the page tables. This includes both instruction and data pages, as well as the pages corresponding to the page tables themselves. Effectively, the OS or HV software treats the system as having DRAM starting at address 0x8000\_0000\_0000. If the HV sets the C-bit to encrypt all physical memory, all virtual machines (VMs) controlled by the HV are encrypted using the same encryption key.

Importantly, DMA (Direct Memory Access) to memory encrypted via SME is supported. From the perspective of a device, an encrypted memory access appears as a normal memory access with bit 47 set.

### Partial Memory Encryption

<img src="/files/H5ux4Zj9pj3WajVzg4xp" alt="Encrypted VMs" class="gitbook-drawing">

The utilization of the C-bit in the page tables offers flexibility for the OS or HV to selectively encrypt only a subset of memory, if desired. This approach still provides physical protection of the encrypted memory, while potentially improving performance for non-sensitive data. Additionally, the choice between encrypted and unencrypted memory can be used to create isolation for critical workloads. One example of this isolation is a system that marks only the memory used by guest VMs as encrypted. This can be achieved without modifying the guest VMs themselves. By setting the C-bit in all the nested page table entries corresponding to DRAM for those VMs (as depicted in figure above), the hypervisor enables encryption for the VM memory exclusively.

This configuration can be employed to protect VMs from a rogue machine administrator. Even if the administrator has access to the hardware and host system, they would not be able to inspect guest VM data, even with memory scanning utilities.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enclaive.cloud/confidential-cloud/technology-in-depth/amd-sev/technology/sme-concepts/use-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
