xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: eliminate has_arch_mmios()
@ 2013-11-12 13:18 Jan Beulich
  2013-11-12 13:37 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2013-11-12 13:18 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]

... as being generally insufficient: Either has_arch_pdevs() or
cache_flush_permitted() should be used (in particular, it is
insufficient to consider MMIO ranges alone - I/O port ranges have the
same requirements if available to a guest).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -40,6 +40,7 @@
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/i387.h>
+#include <asm/iocap.h>
 #include <asm/spinlock.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
@@ -1973,7 +1974,7 @@ static void wbinvd_ipi(void *info)
 
 static void svm_wbinvd_intercept(void)
 {
-    if ( has_arch_mmios(current->domain) )
+    if ( cache_flush_permitted(current->domain) )
         on_each_cpu(wbinvd_ipi, NULL, 1);
 }
 
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -28,6 +28,7 @@
 #include <xen/perfc.h>
 #include <asm/current.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/regs.h>
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
@@ -2236,10 +2237,7 @@ static void wbinvd_ipi(void *info)
 
 static void vmx_wbinvd_intercept(void)
 {
-    if ( !has_arch_mmios(current->domain) )
-        return;
-
-    if ( iommu_snoop )
+    if ( !cache_flush_permitted(current->domain) || iommu_snoop )
         return;
 
     if ( cpu_has_wbinvd_exiting )
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -316,7 +316,6 @@ 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))
 
 #define gdt_ldt_pt_idx(v) \
       ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))




[-- Attachment #2: x86-drop-has_arch_mmios.patch --]
[-- Type: text/plain, Size: 1824 bytes --]

x86: eliminate has_arch_mmios()

... as being generally insufficient: Either has_arch_pdevs() or
cache_flush_permitted() should be used (in particular, it is
insufficient to consider MMIO ranges alone - I/O port ranges have the
same requirements if available to a guest).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -40,6 +40,7 @@
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/i387.h>
+#include <asm/iocap.h>
 #include <asm/spinlock.h>
 #include <asm/hvm/emulate.h>
 #include <asm/hvm/hvm.h>
@@ -1973,7 +1974,7 @@ static void wbinvd_ipi(void *info)
 
 static void svm_wbinvd_intercept(void)
 {
-    if ( has_arch_mmios(current->domain) )
+    if ( cache_flush_permitted(current->domain) )
         on_each_cpu(wbinvd_ipi, NULL, 1);
 }
 
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -28,6 +28,7 @@
 #include <xen/perfc.h>
 #include <asm/current.h>
 #include <asm/io.h>
+#include <asm/iocap.h>
 #include <asm/regs.h>
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
@@ -2236,10 +2237,7 @@ static void wbinvd_ipi(void *info)
 
 static void vmx_wbinvd_intercept(void)
 {
-    if ( !has_arch_mmios(current->domain) )
-        return;
-
-    if ( iommu_snoop )
+    if ( !cache_flush_permitted(current->domain) || iommu_snoop )
         return;
 
     if ( cpu_has_wbinvd_exiting )
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -316,7 +316,6 @@ 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))
 
 #define gdt_ldt_pt_idx(v) \
       ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86: eliminate has_arch_mmios()
  2013-11-12 13:18 [PATCH] x86: eliminate has_arch_mmios() Jan Beulich
@ 2013-11-12 13:37 ` Keir Fraser
  0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2013-11-12 13:37 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 12/11/2013 13:18, "Jan Beulich" <JBeulich@suse.com> wrote:

> ... as being generally insufficient: Either has_arch_pdevs() or
> cache_flush_permitted() should be used (in particular, it is
> insufficient to consider MMIO ranges alone - I/O port ranges have the
> same requirements if available to a guest).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Keir Fraser <keir@xen.org>

> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -40,6 +40,7 @@
>  #include <asm/debugreg.h>
>  #include <asm/msr.h>
>  #include <asm/i387.h>
> +#include <asm/iocap.h>
>  #include <asm/spinlock.h>
>  #include <asm/hvm/emulate.h>
>  #include <asm/hvm/hvm.h>
> @@ -1973,7 +1974,7 @@ static void wbinvd_ipi(void *info)
>  
>  static void svm_wbinvd_intercept(void)
>  {
> -    if ( has_arch_mmios(current->domain) )
> +    if ( cache_flush_permitted(current->domain) )
>          on_each_cpu(wbinvd_ipi, NULL, 1);
>  }
>  
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -28,6 +28,7 @@
>  #include <xen/perfc.h>
>  #include <asm/current.h>
>  #include <asm/io.h>
> +#include <asm/iocap.h>
>  #include <asm/regs.h>
>  #include <asm/cpufeature.h>
>  #include <asm/processor.h>
> @@ -2236,10 +2237,7 @@ static void wbinvd_ipi(void *info)
>  
>  static void vmx_wbinvd_intercept(void)
>  {
> -    if ( !has_arch_mmios(current->domain) )
> -        return;
> -
> -    if ( iommu_snoop )
> +    if ( !cache_flush_permitted(current->domain) || iommu_snoop )
>          return;
>  
>      if ( cpu_has_wbinvd_exiting )
> --- a/xen/include/asm-x86/domain.h
> +++ b/xen/include/asm-x86/domain.h
> @@ -316,7 +316,6 @@ 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))
>  
>  #define gdt_ldt_pt_idx(v) \
>        ((v)->vcpu_id >> (PAGETABLE_ORDER - GDT_LDT_VCPU_SHIFT))
> 
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-12 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 13:18 [PATCH] x86: eliminate has_arch_mmios() Jan Beulich
2013-11-12 13:37 ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).