Skip to content

Commit 33e63ac

Browse files
codomaniaKAGA-KOKO
authored andcommitted
Documentation/x86: Add AMD Secure Encrypted Virtualization (SEV) description
Update the AMD memory encryption document describing the Secure Encrypted Virtualization (SEV) feature. Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@suse.de> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: kvm@vger.kernel.org Cc: Jonathan Corbet <corbet@lwn.net> Cc: Borislav Petkov <bp@alien8.de> Link: https://lkml.kernel.org/r/20171020143059.3291-2-brijesh.singh@amd.com
1 parent e846d13 commit 33e63ac

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

Documentation/x86/amd-memory-encryption.txt

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,44 @@
1-
Secure Memory Encryption (SME) is a feature found on AMD processors.
1+
Secure Memory Encryption (SME) and Secure Encrypted Virtualization (SEV) are
2+
features found on AMD processors.
23

34
SME provides the ability to mark individual pages of memory as encrypted using
45
the standard x86 page tables. A page that is marked encrypted will be
56
automatically decrypted when read from DRAM and encrypted when written to
67
DRAM. SME can therefore be used to protect the contents of DRAM from physical
78
attacks on the system.
89

10+
SEV enables running encrypted virtual machines (VMs) in which the code and data
11+
of the guest VM are secured so that a decrypted version is available only
12+
within the VM itself. SEV guest VMs have the concept of private and shared
13+
memory. Private memory is encrypted with the guest-specific key, while shared
14+
memory may be encrypted with hypervisor key. When SME is enabled, the hypervisor
15+
key is the same key which is used in SME.
16+
917
A page is encrypted when a page table entry has the encryption bit set (see
1018
below on how to determine its position). The encryption bit can also be
1119
specified in the cr3 register, allowing the PGD table to be encrypted. Each
1220
successive level of page tables can also be encrypted by setting the encryption
1321
bit in the page table entry that points to the next table. This allows the full
1422
page table hierarchy to be encrypted. Note, this means that just because the
15-
encryption bit is set in cr3, doesn't imply the full hierarchy is encyrpted.
23+
encryption bit is set in cr3, doesn't imply the full hierarchy is encrypted.
1624
Each page table entry in the hierarchy needs to have the encryption bit set to
1725
achieve that. So, theoretically, you could have the encryption bit set in cr3
1826
so that the PGD is encrypted, but not set the encryption bit in the PGD entry
1927
for a PUD which results in the PUD pointed to by that entry to not be
2028
encrypted.
2129

22-
Support for SME can be determined through the CPUID instruction. The CPUID
23-
function 0x8000001f reports information related to SME:
30+
When SEV is enabled, instruction pages and guest page tables are always treated
31+
as private. All the DMA operations inside the guest must be performed on shared
32+
memory. Since the memory encryption bit is controlled by the guest OS when it
33+
is operating in 64-bit or 32-bit PAE mode, in all other modes the SEV hardware
34+
forces the memory encryption bit to 1.
35+
36+
Support for SME and SEV can be determined through the CPUID instruction. The
37+
CPUID function 0x8000001f reports information related to SME:
2438

2539
0x8000001f[eax]:
2640
Bit[0] indicates support for SME
41+
Bit[1] indicates support for SEV
2742
0x8000001f[ebx]:
2843
Bits[5:0] pagetable bit number used to activate memory
2944
encryption
@@ -39,6 +54,13 @@ determine if SME is enabled and/or to enable memory encryption:
3954
Bit[23] 0 = memory encryption features are disabled
4055
1 = memory encryption features are enabled
4156

57+
If SEV is supported, MSR 0xc0010131 (MSR_AMD64_SEV) can be used to determine if
58+
SEV is active:
59+
60+
0xc0010131:
61+
Bit[0] 0 = memory encryption is not active
62+
1 = memory encryption is active
63+
4264
Linux relies on BIOS to set this bit if BIOS has determined that the reduction
4365
in the physical address space as a result of enabling memory encryption (see
4466
CPUID information above) will not conflict with the address space resource

0 commit comments

Comments
 (0)