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

[Xen-changelog] [xen-4.0-testing] xen: allow guests to set caching attributes for MMIOs



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1273481021 -3600
# Node ID 454f610e94dd8fe5f37402e783206a54fbdb7243
# Parent  0031e33d028f426f331cf3ae6f18d2b115856045
xen: allow guests to set caching attributes for MMIOs

This patch allows guests that have directly mapped MMIO regions to set
the caching attributes for them, and only for them.
Currently we have just an on/off check for a directly assigned device
instead of looking for directly mapped MMIO regions.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
xen-unstable changeset:   21119:5fdfbdd6ca41
xen-unstable date:        Thu Apr 08 15:30:52 2010 +0100
---
 xen/arch/x86/hvm/hvm.c         |    2 +-
 xen/arch/x86/hvm/svm/svm.c     |    2 +-
 xen/arch/x86/hvm/vmx/vmx.c     |    2 +-
 xen/arch/x86/mm/shadow/multi.c |    4 +++-
 xen/include/asm-ia64/domain.h  |    1 +
 xen/include/asm-x86/domain.h   |    1 +
 6 files changed, 8 insertions(+), 4 deletions(-)

diff -r 0031e33d028f -r 454f610e94dd xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon May 10 09:38:22 2010 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Mon May 10 09:43:41 2010 +0100
@@ -1120,7 +1120,7 @@ int hvm_set_cr0(unsigned long value)
         }
     }
 
-    if ( has_arch_pdevs(v->domain) )
+    if ( has_arch_mmios(v->domain) )
     {
         if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
         {
diff -r 0031e33d028f -r 454f610e94dd xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Mon May 10 09:38:22 2010 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon May 10 09:43:41 2010 +0100
@@ -1225,7 +1225,7 @@ static void wbinvd_ipi(void *info)
 
 static void svm_wbinvd_intercept(void)
 {
-    if ( has_arch_pdevs(current->domain) )
+    if ( has_arch_mmios(current->domain) )
         on_each_cpu(wbinvd_ipi, NULL, 1);
 }
 
diff -r 0031e33d028f -r 454f610e94dd xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon May 10 09:38:22 2010 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon May 10 09:43:41 2010 +0100
@@ -2087,7 +2087,7 @@ static void wbinvd_ipi(void *info)
 
 static void vmx_wbinvd_intercept(void)
 {
-    if ( !has_arch_pdevs(current->domain) )
+    if ( !has_arch_mmios(current->domain) )
         return;
 
     if ( cpu_has_wbinvd_exiting )
diff -r 0031e33d028f -r 454f610e94dd xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Mon May 10 09:38:22 2010 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c    Mon May 10 09:43:41 2010 +0100
@@ -28,6 +28,7 @@
 #include <xen/sched.h>
 #include <xen/perfc.h>
 #include <xen/domain_page.h>
+#include <xen/iocap.h>
 #include <asm/page.h>
 #include <asm/current.h>
 #include <asm/shadow.h>
@@ -563,7 +564,8 @@ _sh_propagate(struct vcpu *v,
      * For HVM domains with direct access to MMIO areas, set the correct
      * caching attributes in the shadows to match what was asked for.
      */
-    if ( (level == 1) && is_hvm_domain(d) && has_arch_pdevs(d) &&
+    if ( (level == 1) && is_hvm_domain(d) &&
+         iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn) + 1) &&
          !is_xen_heap_mfn(mfn_x(target_mfn)) )
     {
         unsigned int type;
diff -r 0031e33d028f -r 454f610e94dd xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h     Mon May 10 09:38:22 2010 +0100
+++ b/xen/include/asm-ia64/domain.h     Mon May 10 09:43:41 2010 +0100
@@ -45,6 +45,7 @@ extern void panic_domain(struct pt_regs 
      __attribute__ ((noreturn, format (printf, 2, 3)));
 
 #define has_arch_pdevs(d)    (!list_empty(&(d)->arch.pdev_list))
+#define has_arch_mmios(d)    (!rangeset_is_empty((d)->iomem_caps))
 
 struct mm_struct {
        volatile pgd_t * pgd;
diff -r 0031e33d028f -r 454f610e94dd xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h      Mon May 10 09:38:22 2010 +0100
+++ b/xen/include/asm-x86/domain.h      Mon May 10 09:43:41 2010 +0100
@@ -329,6 +329,7 @@ struct arch_domain
 } __cacheline_aligned;
 
 #define has_arch_pdevs(d)    (!list_empty(&(d)->arch.pdev_list))
+#define has_arch_mmios(d)    (!rangeset_is_empty((d)->iomem_caps))
 
 #ifdef CONFIG_X86_64
 #define perdomain_pt_pgidx(v) \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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