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

[Xen-devel] [V2 PATCH 9/9] x86/hvm: pkeys, add pkeys support for gva2gfn funcitons



 This patch adds pkeys support for gva2gfn funcitons.

Signed-off-by: Huaitong Han <huaitong.han@xxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 0103bcb..b28d104 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4304,7 +4304,8 @@ static enum hvm_copy_result __hvm_clear(paddr_t addr, int 
size)
     p2m_type_t p2mt;
     char *p;
     int count, todo = size;
-    uint32_t pfec = PFEC_page_present | PFEC_write_access;
+    uint32_t pfec = PFEC_page_present | PFEC_write_access |
+        hvm_pku_enabled(curr) ? PFEC_prot_key : 0;
 
     /*
      * XXX Disable for 4.1.0: PV-on-HVM drivers will do grant-table ops
@@ -4405,7 +4406,8 @@ enum hvm_copy_result hvm_copy_to_guest_virt(
 {
     return __hvm_copy(buf, vaddr, size,
                       HVMCOPY_to_guest | HVMCOPY_fault | HVMCOPY_virt,
-                      PFEC_page_present | PFEC_write_access | pfec);
+                      PFEC_page_present | PFEC_write_access | pfec |
+                      hvm_pku_enabled(current) ? PFEC_prot_key : 0);
 }
 
 enum hvm_copy_result hvm_copy_from_guest_virt(
@@ -4413,7 +4415,8 @@ enum hvm_copy_result hvm_copy_from_guest_virt(
 {
     return __hvm_copy(buf, vaddr, size,
                       HVMCOPY_from_guest | HVMCOPY_fault | HVMCOPY_virt,
-                      PFEC_page_present | pfec);
+                      PFEC_page_present | pfec |
+                      hvm_pku_enabled(current) ? PFEC_prot_key : 0);
 }
 
 enum hvm_copy_result hvm_fetch_from_guest_virt(
@@ -4431,7 +4434,8 @@ enum hvm_copy_result hvm_copy_to_guest_virt_nofault(
 {
     return __hvm_copy(buf, vaddr, size,
                       HVMCOPY_to_guest | HVMCOPY_no_fault | HVMCOPY_virt,
-                      PFEC_page_present | PFEC_write_access | pfec);
+                      PFEC_page_present | PFEC_write_access | pfec |
+                      hvm_pku_enabled(current) ? PFEC_prot_key : 0);
 }
 
 enum hvm_copy_result hvm_copy_from_guest_virt_nofault(
@@ -4439,7 +4443,8 @@ enum hvm_copy_result hvm_copy_from_guest_virt_nofault(
 {
     return __hvm_copy(buf, vaddr, size,
                       HVMCOPY_from_guest | HVMCOPY_no_fault | HVMCOPY_virt,
-                      PFEC_page_present | pfec);
+                      PFEC_page_present | pfec |
+                      hvm_pku_enabled(current) ? PFEC_prot_key : 0);
 }
 
 enum hvm_copy_result hvm_fetch_from_guest_virt_nofault(
-- 
2.4.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.