debuggers.hg

changeset 21165:5fdfbdd6ca41

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@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Apr 08 15:30:52 2010 +0100 (2010-04-08)
parents 28e5409e3fb3
children a33909be109c
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/svm/svm.c xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/mm/shadow/multi.c xen/include/asm-ia64/domain.h xen/include/asm-x86/domain.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Wed Apr 07 16:22:05 2010 +0100
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Thu Apr 08 15:30:52 2010 +0100
     1.3 @@ -1126,7 +1126,7 @@ int hvm_set_cr0(unsigned long value)
     1.4          }
     1.5      }
     1.6  
     1.7 -    if ( has_arch_pdevs(v->domain) )
     1.8 +    if ( has_arch_mmios(v->domain) )
     1.9      {
    1.10          if ( (value & X86_CR0_CD) && !(value & X86_CR0_NW) )
    1.11          {
     2.1 --- a/xen/arch/x86/hvm/svm/svm.c	Wed Apr 07 16:22:05 2010 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu Apr 08 15:30:52 2010 +0100
     2.3 @@ -1228,7 +1228,7 @@ static void wbinvd_ipi(void *info)
     2.4  
     2.5  static void svm_wbinvd_intercept(void)
     2.6  {
     2.7 -    if ( has_arch_pdevs(current->domain) )
     2.8 +    if ( has_arch_mmios(current->domain) )
     2.9          on_each_cpu(wbinvd_ipi, NULL, 1);
    2.10  }
    2.11  
     3.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Apr 07 16:22:05 2010 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Apr 08 15:30:52 2010 +0100
     3.3 @@ -2109,7 +2109,7 @@ static void wbinvd_ipi(void *info)
     3.4  
     3.5  static void vmx_wbinvd_intercept(void)
     3.6  {
     3.7 -    if ( !has_arch_pdevs(current->domain) )
     3.8 +    if ( !has_arch_mmios(current->domain) )
     3.9          return;
    3.10  
    3.11      if ( cpu_has_wbinvd_exiting )
     4.1 --- a/xen/arch/x86/mm/shadow/multi.c	Wed Apr 07 16:22:05 2010 +0100
     4.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Thu Apr 08 15:30:52 2010 +0100
     4.3 @@ -28,6 +28,7 @@
     4.4  #include <xen/sched.h>
     4.5  #include <xen/perfc.h>
     4.6  #include <xen/domain_page.h>
     4.7 +#include <xen/iocap.h>
     4.8  #include <asm/page.h>
     4.9  #include <asm/current.h>
    4.10  #include <asm/shadow.h>
    4.11 @@ -546,7 +547,8 @@ static always_inline void
    4.12       * For HVM domains with direct access to MMIO areas, set the correct
    4.13       * caching attributes in the shadows to match what was asked for.
    4.14       */
    4.15 -    if ( (level == 1) && is_hvm_domain(d) && has_arch_pdevs(d) &&
    4.16 +    if ( (level == 1) && is_hvm_domain(d) &&
    4.17 +         iomem_access_permitted(d, mfn_x(target_mfn), mfn_x(target_mfn) + 1) &&
    4.18           !is_xen_heap_mfn(mfn_x(target_mfn)) )
    4.19      {
    4.20          unsigned int type;
     5.1 --- a/xen/include/asm-ia64/domain.h	Wed Apr 07 16:22:05 2010 +0100
     5.2 +++ b/xen/include/asm-ia64/domain.h	Thu Apr 08 15:30:52 2010 +0100
     5.3 @@ -45,6 +45,7 @@ extern void panic_domain(struct pt_regs 
     5.4       __attribute__ ((noreturn, format (printf, 2, 3)));
     5.5  
     5.6  #define has_arch_pdevs(d)    (!list_empty(&(d)->arch.pdev_list))
     5.7 +#define has_arch_mmios(d)    (!rangeset_is_empty((d)->iomem_caps))
     5.8  
     5.9  struct mm_struct {
    5.10  	volatile pgd_t * pgd;
     6.1 --- a/xen/include/asm-x86/domain.h	Wed Apr 07 16:22:05 2010 +0100
     6.2 +++ b/xen/include/asm-x86/domain.h	Thu Apr 08 15:30:52 2010 +0100
     6.3 @@ -329,6 +329,7 @@ struct arch_domain
     6.4  } __cacheline_aligned;
     6.5  
     6.6  #define has_arch_pdevs(d)    (!list_empty(&(d)->arch.pdev_list))
     6.7 +#define has_arch_mmios(d)    (!rangeset_is_empty((d)->iomem_caps))
     6.8  
     6.9  #ifdef CONFIG_X86_64
    6.10  #define perdomain_pt_pgidx(v) \