qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 19/22] exec: set debug attribute in SEV-enabl


From: Brijesh Singh
Subject: [Qemu-devel] [RFC PATCH v1 19/22] exec: set debug attribute in SEV-enabled guest
Date: Tue, 13 Sep 2016 10:49:58 -0400
User-agent: StGit/0.17.1-dirty

When debug version of physical memory read APIs are called on SEV guest
then set the MemTxAttrs.sev_debug attribute to indicate that memory
read/write is requested for debug purposes.

On SEV guest, the memory region read/write callback will check this
attribute and if its set then it will use SEV DEBUG DECRYPT/ENCRYPT commands
to read/write into guest memory.

Signed-off-by: Brijesh Singh <address@hidden>
---
 exec.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 604bd05..b1df25d 100644
--- a/exec.c
+++ b/exec.c
@@ -3773,7 +3773,11 @@ void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t 
*buf,
 {
     MemTxAttrs attrs;
 
-    attrs = MEMTXATTRS_UNSPECIFIED;
+    if (kvm_sev_enabled()) {
+        attrs = MEMTXATTRS_SEV_DEBUG;
+    } else {
+        attrs = MEMTXATTRS_UNSPECIFIED;
+    }
 
     address_space_rw(&address_space_memory, addr, attrs, buf, len, is_write);
 }
@@ -3793,6 +3797,11 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
         page = addr & TARGET_PAGE_MASK;
         phys_addr = cpu_get_phys_page_attrs_debug(cpu, page, &attrs);
         asidx = cpu_asidx_from_attrs(cpu, attrs);
+
+        if (kvm_sev_enabled()) {
+            attrs = MEMTXATTRS_SEV_DEBUG;
+        }
+
         /* if no physical page mapped, return an error */
         if (phys_addr == -1)
             return -1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]