All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH PV_OPS] IOMMU interaction fixes.
@ 2009-09-24 22:43 Konrad Rzeszutek Wilk
  2009-09-24 22:43 ` [PATCH 1/2] Revert "xen/swiotlb: make sure GART iommu doesn't initialize if we want Xen swiotlb" Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-09-24 22:43 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge

Two fixes to make Xen boot on AMD machines with GART. Also (but not tested)
with other IOMMUs, such as Calgary (IBM 3950,3850), AMD IOMMU, and Intel's IOMMUs.

 [PATCH 1/2] Revert "xen/swiotlb: make sure GART iommu doesn't initialize if we want Xen swiotlb"
 [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.

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

* [PATCH 1/2] Revert "xen/swiotlb: make sure GART iommu doesn't initialize if we want Xen swiotlb"
  2009-09-24 22:43 [PATCH PV_OPS] IOMMU interaction fixes Konrad Rzeszutek Wilk
@ 2009-09-24 22:43 ` Konrad Rzeszutek Wilk
  2009-09-24 22:43   ` [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-09-24 22:43 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge, Konrad Rzeszutek Wilk

This reverts commit d26d4ca29d2a13c8ccb94a1fe2d154b2c46de9e0.
---
 arch/x86/kernel/pci-dma.c  |    4 ++--
 arch/x86/xen/pci-swiotlb.c |    8 --------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 1101a9f..6b76948 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -122,8 +122,6 @@ void __init pci_iommu_alloc(void)
 	 * The order of these functions is important for
 	 * fall-back/fail-over reasons
 	 */
-	xen_swiotlb_init();
-
 	gart_iommu_hole_init();
 
 	detect_calgary();
@@ -132,6 +130,8 @@ void __init pci_iommu_alloc(void)
 
 	amd_iommu_detect();
 
+	xen_swiotlb_init();
+
 	pci_swiotlb_init();
 }
 
diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
index 00f2260..5e2c856 100644
--- a/arch/x86/xen/pci-swiotlb.c
+++ b/arch/x86/xen/pci-swiotlb.c
@@ -43,10 +43,6 @@
 #include <xen/page.h>
 #include <xen/xen-ops.h>
 
-
-#include <linux/pci.h>
-#include <asm/gart.h>
-
 #define OFFSET(val,align) ((unsigned long)	\
 	                   ( (val) & ( (align) - 1)))
 
@@ -989,9 +985,5 @@ void __init xen_swiotlb_init(void)
 		xen_swiotlb_init_with_default_size(64 * (1<<20));	/* default to 64MB */
 		dma_ops = &xen_swiotlb_dma_ops;
 		iommu_detected = 1;
-#ifdef CONFIG_GART_IOMMU
-		gart_iommu_aperture_disabled = 1;
-#endif
-
 	}
 }
-- 
1.6.2.5

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

* [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.
  2009-09-24 22:43 ` [PATCH 1/2] Revert "xen/swiotlb: make sure GART iommu doesn't initialize if we want Xen swiotlb" Konrad Rzeszutek Wilk
@ 2009-09-24 22:43   ` Konrad Rzeszutek Wilk
  2009-09-24 23:37     ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-09-24 22:43 UTC (permalink / raw)
  To: xen-devel; +Cc: Jeremy Fitzhardinge, Konrad Rzeszutek Wilk

Having the 'xen_swiotlb' variable enabled causes all of the
IOMMU's to be disabled (except the Xen-SWIOTLB). It is in
essence a copy of what swiotlb variable does. However the swiotlb variable
cannot be used because it would turn on the non-Xen SWIOTLB.
---
 arch/x86/include/asm/dma-mapping.h |    1 +
 arch/x86/include/asm/xen/swiotlb.h |    4 +++-
 arch/x86/kernel/amd_iommu_init.c   |    2 +-
 arch/x86/kernel/aperture_64.c      |    2 +-
 arch/x86/kernel/pci-calgary_64.c   |    2 +-
 arch/x86/kernel/pci-dma.c          |    4 ++--
 arch/x86/kernel/pci-gart_64.c      |    2 +-
 arch/x86/kernel/pci-swiotlb.c      |    4 ++--
 arch/x86/xen/pci-swiotlb.c         |    3 +++
 9 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index 1c3f943..01ef814 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -12,6 +12,7 @@
 #include <linux/dma-attrs.h>
 #include <asm/io.h>
 #include <asm/swiotlb.h>
+#include <asm/xen/swiotlb.h>
 #include <asm-generic/dma-coherent.h>
 
 extern dma_addr_t bad_dma_address;
diff --git a/arch/x86/include/asm/xen/swiotlb.h b/arch/x86/include/asm/xen/swiotlb.h
index d094f89..fd7e48a 100644
--- a/arch/x86/include/asm/xen/swiotlb.h
+++ b/arch/x86/include/asm/xen/swiotlb.h
@@ -2,9 +2,11 @@
 #define _ASM_X86_XEN_SWIOTLB_H
 
 #ifdef CONFIG_PCI_XEN
+extern int xen_swiotlb;
 extern void xen_swiotlb_init(void);
 #else
-static void xen_swiotlb_init(void) { }
+#define xen_swiotlb 0
+static inline void xen_swiotlb_init(void) { }
 #endif
 
 #endif
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index c1b17e9..78ec74b 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -1304,7 +1304,7 @@ static int __init early_amd_iommu_detect(struct acpi_table_header *table)
 
 void __init amd_iommu_detect(void)
 {
-	if (swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
+	if (swiotlb || xen_swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
 		return;
 
 	if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 676debf..6a50006 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -369,7 +369,7 @@ void __init gart_iommu_hole_init(void)
 	int fix, slot, valid_agp = 0;
 	int i, node;
 
-	if (gart_iommu_aperture_disabled || !fix_aperture ||
+	if (gart_iommu_aperture_disabled || !fix_aperture || xen_swiotlb ||
 	    !early_pci_allowed())
 		return;
 
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 971a3be..f7b8e1c 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -1357,7 +1357,7 @@ void __init detect_calgary(void)
 	 * if the user specified iommu=off or iommu=soft or we found
 	 * another HW IOMMU already, bail out.
 	 */
-	if (swiotlb || no_iommu || iommu_detected)
+	if (swiotlb || xen_swiotlb || no_iommu || iommu_detected)
 		return;
 
 	if (!use_calgary)
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 6b76948..1101a9f 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -122,6 +122,8 @@ void __init pci_iommu_alloc(void)
 	 * The order of these functions is important for
 	 * fall-back/fail-over reasons
 	 */
+	xen_swiotlb_init();
+
 	gart_iommu_hole_init();
 
 	detect_calgary();
@@ -130,8 +132,6 @@ void __init pci_iommu_alloc(void)
 
 	amd_iommu_detect();
 
-	xen_swiotlb_init();
-
 	pci_swiotlb_init();
 }
 
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index d2e56b8..f2c9f19 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -730,7 +730,7 @@ void __init gart_iommu_init(void)
 		(agp_copy_info(agp_bridge, &info) < 0);
 #endif
 
-	if (swiotlb)
+	if (swiotlb || xen_swiotlb)
 		return;
 
 	/* Did we detect a different HW IOMMU? */
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index e8a3501..54a0fa9 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -47,10 +47,10 @@ void __init pci_swiotlb_init(void)
 	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
 #ifdef CONFIG_X86_64
 	if ((!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) ||
-		iommu_pass_through)
+		iommu_pass_through || !xen_swiotlb)
 	       swiotlb = 1;
 #endif
-	if (swiotlb_force)
+	if (swiotlb_force || !xen_swiotlb)
 		swiotlb = 1;
 	if (swiotlb) {
 		printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
index 5e2c856..de2dd39 100644
--- a/arch/x86/xen/pci-swiotlb.c
+++ b/arch/x86/xen/pci-swiotlb.c
@@ -978,6 +978,8 @@ static struct dma_map_ops xen_swiotlb_dma_ops = {
 	.dma_supported = NULL,
 };
 
+int xen_swiotlb __read_mostly;
+
 void __init xen_swiotlb_init(void)
 {
 	if (xen_initial_domain()) {
@@ -985,5 +987,6 @@ void __init xen_swiotlb_init(void)
 		xen_swiotlb_init_with_default_size(64 * (1<<20));	/* default to 64MB */
 		dma_ops = &xen_swiotlb_dma_ops;
 		iommu_detected = 1;
+		xen_swiotlb = 1;
 	}
 }
-- 
1.6.2.5

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

* Re: [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.
  2009-09-24 22:43   ` [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running Konrad Rzeszutek Wilk
@ 2009-09-24 23:37     ` Jeremy Fitzhardinge
  2009-09-24 23:46       ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-24 23:37 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel

On 09/24/09 15:43, Konrad Rzeszutek Wilk wrote:
> Having the 'xen_swiotlb' variable enabled causes all of the
> IOMMU's to be disabled (except the Xen-SWIOTLB). It is in
> essence a copy of what swiotlb variable does. However the swiotlb variable
> cannot be used because it would turn on the non-Xen SWIOTLB.
> ---
>  arch/x86/include/asm/dma-mapping.h |    1 +
>  arch/x86/include/asm/xen/swiotlb.h |    4 +++-
>  arch/x86/kernel/amd_iommu_init.c   |    2 +-
>  arch/x86/kernel/aperture_64.c      |    2 +-
>  arch/x86/kernel/pci-calgary_64.c   |    2 +-
>  arch/x86/kernel/pci-dma.c          |    4 ++--
>  arch/x86/kernel/pci-gart_64.c      |    2 +-
>  arch/x86/kernel/pci-swiotlb.c      |    4 ++--
>  arch/x86/xen/pci-swiotlb.c         |    3 +++
>  9 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
> index 1c3f943..01ef814 100644
> --- a/arch/x86/include/asm/dma-mapping.h
> +++ b/arch/x86/include/asm/dma-mapping.h
> @@ -12,6 +12,7 @@
>  #include <linux/dma-attrs.h>
>  #include <asm/io.h>
>  #include <asm/swiotlb.h>
> +#include <asm/xen/swiotlb.h>
>  #include <asm-generic/dma-coherent.h>
>  
>  extern dma_addr_t bad_dma_address;
> diff --git a/arch/x86/include/asm/xen/swiotlb.h b/arch/x86/include/asm/xen/swiotlb.h
> index d094f89..fd7e48a 100644
> --- a/arch/x86/include/asm/xen/swiotlb.h
> +++ b/arch/x86/include/asm/xen/swiotlb.h
> @@ -2,9 +2,11 @@
>  #define _ASM_X86_XEN_SWIOTLB_H
>  
>  #ifdef CONFIG_PCI_XEN
> +extern int xen_swiotlb;
>  extern void xen_swiotlb_init(void);
>  #else
> -static void xen_swiotlb_init(void) { }
> +#define xen_swiotlb 0
> +static inline void xen_swiotlb_init(void) { }
>  #endif
>  
>  #endif
> diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
> index c1b17e9..78ec74b 100644
> --- a/arch/x86/kernel/amd_iommu_init.c
> +++ b/arch/x86/kernel/amd_iommu_init.c
> @@ -1304,7 +1304,7 @@ static int __init early_amd_iommu_detect(struct acpi_table_header *table)
>  
>  void __init amd_iommu_detect(void)
>  {
> -	if (swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
> +	if (swiotlb || xen_swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
>  		return;
>  
>  	if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
> index 676debf..6a50006 100644
> --- a/arch/x86/kernel/aperture_64.c
> +++ b/arch/x86/kernel/aperture_64.c
> @@ -369,7 +369,7 @@ void __init gart_iommu_hole_init(void)
>  	int fix, slot, valid_agp = 0;
>  	int i, node;
>  
> -	if (gart_iommu_aperture_disabled || !fix_aperture ||
> +	if (gart_iommu_aperture_disabled || !fix_aperture || xen_swiotlb ||
>  	    !early_pci_allowed())
>  		return;
>  
> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
> index 971a3be..f7b8e1c 100644
> --- a/arch/x86/kernel/pci-calgary_64.c
> +++ b/arch/x86/kernel/pci-calgary_64.c
> @@ -1357,7 +1357,7 @@ void __init detect_calgary(void)
>  	 * if the user specified iommu=off or iommu=soft or we found
>  	 * another HW IOMMU already, bail out.
>  	 */
> -	if (swiotlb || no_iommu || iommu_detected)
> +	if (swiotlb || xen_swiotlb || no_iommu || iommu_detected)
>  		return;
>  
>  	if (!use_calgary)
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index 6b76948..1101a9f 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -122,6 +122,8 @@ void __init pci_iommu_alloc(void)
>  	 * The order of these functions is important for
>  	 * fall-back/fail-over reasons
>  	 */
> +	xen_swiotlb_init();
> +
>  	gart_iommu_hole_init();
>  
>  	detect_calgary();
> @@ -130,8 +132,6 @@ void __init pci_iommu_alloc(void)
>  
>  	amd_iommu_detect();
>  
> -	xen_swiotlb_init();
> -
>  	pci_swiotlb_init();
>  }
>  
> diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
> index d2e56b8..f2c9f19 100644
> --- a/arch/x86/kernel/pci-gart_64.c
> +++ b/arch/x86/kernel/pci-gart_64.c
> @@ -730,7 +730,7 @@ void __init gart_iommu_init(void)
>  		(agp_copy_info(agp_bridge, &info) < 0);
>  #endif
>  
> -	if (swiotlb)
> +	if (swiotlb || xen_swiotlb)
>  		return;
>  
>  	/* Did we detect a different HW IOMMU? */
> diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
> index e8a3501..54a0fa9 100644
> --- a/arch/x86/kernel/pci-swiotlb.c
> +++ b/arch/x86/kernel/pci-swiotlb.c
> @@ -47,10 +47,10 @@ void __init pci_swiotlb_init(void)
>  	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
>  #ifdef CONFIG_X86_64
>  	if ((!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) ||
> -		iommu_pass_through)
> +		iommu_pass_through || !xen_swiotlb)
>   

This doesn't apply to the xen/dom0/swiotlb-new branch.

>  	       swiotlb = 1;
>  #endif
> -	if (swiotlb_force)
> +	if (swiotlb_force || !xen_swiotlb)
>   

Are you sure this is right?  This will always enable swiotlb if
!xen_swiotlb.

    J

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

* Re: Re: [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.
  2009-09-24 23:37     ` Jeremy Fitzhardinge
@ 2009-09-24 23:46       ` Jeremy Fitzhardinge
  2009-09-24 23:53         ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-24 23:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel

On 09/24/09 16:37, Jeremy Fitzhardinge wrote:
> On 09/24/09 15:43, Konrad Rzeszutek Wilk wrote:
>   
>> Having the 'xen_swiotlb' variable enabled causes all of the
>> IOMMU's to be disabled (except the Xen-SWIOTLB). It is in
>> essence a copy of what swiotlb variable does. However the swiotlb variable
>> cannot be used because it would turn on the non-Xen SWIOTLB.
>> ---
>>  arch/x86/include/asm/dma-mapping.h |    1 +
>>  arch/x86/include/asm/xen/swiotlb.h |    4 +++-
>>  arch/x86/kernel/amd_iommu_init.c   |    2 +-
>>  arch/x86/kernel/aperture_64.c      |    2 +-
>>  arch/x86/kernel/pci-calgary_64.c   |    2 +-
>>  arch/x86/kernel/pci-dma.c          |    4 ++--
>>  arch/x86/kernel/pci-gart_64.c      |    2 +-
>>  arch/x86/kernel/pci-swiotlb.c      |    4 ++--
>>  arch/x86/xen/pci-swiotlb.c         |    3 +++
>>  9 files changed, 15 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
>> index 1c3f943..01ef814 100644
>> --- a/arch/x86/include/asm/dma-mapping.h
>> +++ b/arch/x86/include/asm/dma-mapping.h
>> @@ -12,6 +12,7 @@
>>  #include <linux/dma-attrs.h>
>>  #include <asm/io.h>
>>  #include <asm/swiotlb.h>
>> +#include <asm/xen/swiotlb.h>
>>  #include <asm-generic/dma-coherent.h>
>>  
>>  extern dma_addr_t bad_dma_address;
>> diff --git a/arch/x86/include/asm/xen/swiotlb.h b/arch/x86/include/asm/xen/swiotlb.h
>> index d094f89..fd7e48a 100644
>> --- a/arch/x86/include/asm/xen/swiotlb.h
>> +++ b/arch/x86/include/asm/xen/swiotlb.h
>> @@ -2,9 +2,11 @@
>>  #define _ASM_X86_XEN_SWIOTLB_H
>>  
>>  #ifdef CONFIG_PCI_XEN
>> +extern int xen_swiotlb;
>>  extern void xen_swiotlb_init(void);
>>  #else
>> -static void xen_swiotlb_init(void) { }
>> +#define xen_swiotlb 0
>> +static inline void xen_swiotlb_init(void) { }
>>  #endif
>>  
>>  #endif
>> diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
>> index c1b17e9..78ec74b 100644
>> --- a/arch/x86/kernel/amd_iommu_init.c
>> +++ b/arch/x86/kernel/amd_iommu_init.c
>> @@ -1304,7 +1304,7 @@ static int __init early_amd_iommu_detect(struct acpi_table_header *table)
>>  
>>  void __init amd_iommu_detect(void)
>>  {
>> -	if (swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
>> +	if (swiotlb || xen_swiotlb || no_iommu || (iommu_detected && !gart_iommu_aperture))
>>  		return;
>>  
>>  	if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
>> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
>> index 676debf..6a50006 100644
>> --- a/arch/x86/kernel/aperture_64.c
>> +++ b/arch/x86/kernel/aperture_64.c
>> @@ -369,7 +369,7 @@ void __init gart_iommu_hole_init(void)
>>  	int fix, slot, valid_agp = 0;
>>  	int i, node;
>>  
>> -	if (gart_iommu_aperture_disabled || !fix_aperture ||
>> +	if (gart_iommu_aperture_disabled || !fix_aperture || xen_swiotlb ||
>>  	    !early_pci_allowed())
>>  		return;
>>  
>> diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
>> index 971a3be..f7b8e1c 100644
>> --- a/arch/x86/kernel/pci-calgary_64.c
>> +++ b/arch/x86/kernel/pci-calgary_64.c
>> @@ -1357,7 +1357,7 @@ void __init detect_calgary(void)
>>  	 * if the user specified iommu=off or iommu=soft or we found
>>  	 * another HW IOMMU already, bail out.
>>  	 */
>> -	if (swiotlb || no_iommu || iommu_detected)
>> +	if (swiotlb || xen_swiotlb || no_iommu || iommu_detected)
>>  		return;
>>  
>>  	if (!use_calgary)
>> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
>> index 6b76948..1101a9f 100644
>> --- a/arch/x86/kernel/pci-dma.c
>> +++ b/arch/x86/kernel/pci-dma.c
>> @@ -122,6 +122,8 @@ void __init pci_iommu_alloc(void)
>>  	 * The order of these functions is important for
>>  	 * fall-back/fail-over reasons
>>  	 */
>> +	xen_swiotlb_init();
>> +
>>  	gart_iommu_hole_init();
>>  
>>  	detect_calgary();
>> @@ -130,8 +132,6 @@ void __init pci_iommu_alloc(void)
>>  
>>  	amd_iommu_detect();
>>  
>> -	xen_swiotlb_init();
>> -
>>  	pci_swiotlb_init();
>>  }
>>  
>> diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
>> index d2e56b8..f2c9f19 100644
>> --- a/arch/x86/kernel/pci-gart_64.c
>> +++ b/arch/x86/kernel/pci-gart_64.c
>> @@ -730,7 +730,7 @@ void __init gart_iommu_init(void)
>>  		(agp_copy_info(agp_bridge, &info) < 0);
>>  #endif
>>  
>> -	if (swiotlb)
>> +	if (swiotlb || xen_swiotlb)
>>  		return;
>>  
>>  	/* Did we detect a different HW IOMMU? */
>> diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
>> index e8a3501..54a0fa9 100644
>> --- a/arch/x86/kernel/pci-swiotlb.c
>> +++ b/arch/x86/kernel/pci-swiotlb.c
>> @@ -47,10 +47,10 @@ void __init pci_swiotlb_init(void)
>>  	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
>>  #ifdef CONFIG_X86_64
>>  	if ((!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN) ||
>> -		iommu_pass_through)
>> +		iommu_pass_through || !xen_swiotlb)
>>   
>>     
> This doesn't apply to the xen/dom0/swiotlb-new branch.
>   

OK, its against xen/master.

>>  	       swiotlb = 1;
>>  #endif
>> -	if (swiotlb_force)
>> +	if (swiotlb_force || !xen_swiotlb)
>>   
>>     
> Are you sure this is right?  This will always enable swiotlb if
> !xen_swiotlb.
>   

I went with this instead:

diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index 9640e17..e2d739e 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -45,6 +45,9 @@ static struct dma_map_ops swiotlb_dma_ops = {
 void __init pci_swiotlb_init(void)
 {
 	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
+	if (xen_swiotlb)
+		return;
+
 #ifdef CONFIG_X86_64
 	if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
 	       swiotlb = 1;

Does that work?

    J

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

* Re: Re: [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.
  2009-09-24 23:46       ` Jeremy Fitzhardinge
@ 2009-09-24 23:53         ` Konrad Rzeszutek Wilk
  2009-09-25  0:11           ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2009-09-24 23:53 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: xen-devel

> > This doesn't apply to the xen/dom0/swiotlb-new branch.
> >   
> 
> OK, its against xen/master.

Do you want me to send patches against the swiotlb-new branch instead in the future?

> 
> >>  	       swiotlb = 1;
> >>  #endif
> >> -	if (swiotlb_force)
> >> +	if (swiotlb_force || !xen_swiotlb)
> >>   
> >>     
> > Are you sure this is right?  This will always enable swiotlb if
> > !xen_swiotlb.

That is wrong. Thanks for spotting that.
> >   
> 
> I went with this instead:
> 
> diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
> index 9640e17..e2d739e 100644
> --- a/arch/x86/kernel/pci-swiotlb.c
> +++ b/arch/x86/kernel/pci-swiotlb.c
> @@ -45,6 +45,9 @@ static struct dma_map_ops swiotlb_dma_ops = {
>  void __init pci_swiotlb_init(void)
>  {
>  	/* don't initialize swiotlb if iommu=off (no_iommu=1) */
> +	if (xen_swiotlb)
> +		return;
> +
>  #ifdef CONFIG_X86_64
>  	if (!iommu_detected && !no_iommu && max_pfn > MAX_DMA32_PFN)
>  	       swiotlb = 1;
> 
> Does that work?

Yes. That will do it.

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

* Re: Re: [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running.
  2009-09-24 23:53         ` Konrad Rzeszutek Wilk
@ 2009-09-25  0:11           ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 7+ messages in thread
From: Jeremy Fitzhardinge @ 2009-09-25  0:11 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel

On 09/24/09 16:53, Konrad Rzeszutek Wilk wrote:
> Do you want me to send patches against the swiotlb-new branch instead in the future?
>   

Yeah.  I never apply patches to xen/master if I can possibly help it;
its just the result of merging.  All the real work should be happening
on the appropriate topic branches.  The only time I'd apply something to
xen/master is to fix up some kind of merge-related problem.

    J

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

end of thread, other threads:[~2009-09-25  0:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24 22:43 [PATCH PV_OPS] IOMMU interaction fixes Konrad Rzeszutek Wilk
2009-09-24 22:43 ` [PATCH 1/2] Revert "xen/swiotlb: make sure GART iommu doesn't initialize if we want Xen swiotlb" Konrad Rzeszutek Wilk
2009-09-24 22:43   ` [PATCH 2/2] Introduce xen_swiotlb variable that is set when Xen is running Konrad Rzeszutek Wilk
2009-09-24 23:37     ` Jeremy Fitzhardinge
2009-09-24 23:46       ` Jeremy Fitzhardinge
2009-09-24 23:53         ` Konrad Rzeszutek Wilk
2009-09-25  0:11           ` Jeremy Fitzhardinge

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.