Fix calling order wherein iommu_detected would be set after software IO TLB was initialized causing double IO TLB allocation.
Subsystems (2)
PATCH 2/2 Fix calling order wherein iommu_detected would be set after software IO TLB was initialized causing double IO TLB allocation.
The iommu_detected flag was set _after_ the Software IO TLB was initialized. This caused the Xen software IO TLB to be init and right after that the software IO TLB. Merging xen_swiotlb_init and xen_swiotlb_init_alloc in one function that sets this argument fixes the issue.
Signed-off-by Konrad Rzeszutek Wilk <[email protected]>
--- arch/x86/include/asm/xen/swiotlb.h | 6 ++---- arch/x86/kernel/pci-dma.c | 2 +- arch/x86/xen/pci-swiotlb.c | 13 +++---------- 3 files changed, 6 insertions(+), 15 deletions(-)
arch/x86/include/asm/xen/swiotlb.h +2 -4
@@ -2,11 +2,9 @@#define _ASM_X86_XEN_SWIOTLB_H#ifdef CONFIG_PCI_XEN -extern int xen_swiotlb_init (void ); -extern void xen_swiotlb_init_alloc (void ); +extern void xen_swiotlb_init (void );#else -static inline int xen_swiotlb_init (void ) {return -ENODEV ; } -static void xen_swiotlb_init_alloc (void ) { } +static void xen_swiotlb_init (void ) { }#endif #endif
arch/x86/kernel/pci-dma.c +1 -1
@@ -130,7 +130,7 @@ void __init pci_iommu_alloc(void)amd_iommu_detect (); -xen_swiotlb_init_alloc (); +xen_swiotlb_init ();pci_swiotlb_init (); }
arch/x86/xen/pci-swiotlb.c +3 -10
@@ -970,19 +970,12 @@ static struct dma_map_ops xen_swiotlb_dma_ops = { .dma_supported = NULL, }; -int __init xen_swiotlb_init (void ) +void __init xen_swiotlb_init (void ) { -if (xen_pv_domain () &&xen_initial_domain ()) { - iommu_detected =1 ; -return 0 ; - } -return -ENODEV ; -} -void __init xen_swiotlb_init_alloc (void ) -{ -if (xen_pv_domain () &&xen_initial_domain ()) { +if (xen_initial_domain ()) {printk (KERN_INFO "PCI-DMA: Using Xen software bounce buffering for IO (Xen-SWIOTLB)\n" );xen_swiotlb_init_with_default_size (64 * (1 <<20 ));/* default to 64MB */ dma_ops = &xen_swiotlb_dma_ops; + iommu_detected =1 ; } }
Signature · 1 line
1.6.2.5