cregit-Linux how code gets into the kernel

Release 4.11 arch/x86/xen/pci-swiotlb-xen.c

Directory: arch/x86/xen
/* Glue code to lib/swiotlb-xen.c */

#include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <xen/swiotlb-xen.h>

#include <asm/xen/hypervisor.h>
#include <xen/xen.h>
#include <asm/iommu_table.h>


#include <asm/xen/swiotlb-xen.h>
#ifdef CONFIG_X86_64
#include <asm/iommu.h>
#include <asm/dma.h>
#endif
#include <linux/export.h>


int xen_swiotlb __read_mostly;


static const struct dma_map_ops xen_swiotlb_dma_ops = {
	.alloc = xen_swiotlb_alloc_coherent,
	.free = xen_swiotlb_free_coherent,
	.sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu,
	.sync_single_for_device = xen_swiotlb_sync_single_for_device,
	.sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu,
	.sync_sg_for_device = xen_swiotlb_sync_sg_for_device,
	.map_sg = xen_swiotlb_map_sg_attrs,
	.unmap_sg = xen_swiotlb_unmap_sg_attrs,
	.map_page = xen_swiotlb_map_page,
	.unmap_page = xen_swiotlb_unmap_page,
	.dma_supported = xen_swiotlb_dma_supported,
};

/*
 * pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary
 *
 * This returns non-zero if we are forced to use xen_swiotlb (by the boot
 * option).
 */

int __init pci_xen_swiotlb_detect(void) { if (!xen_pv_domain()) return 0; /* If running as PV guest, either iommu=soft, or swiotlb=force will * activate this IOMMU. If running as PV privileged, activate it * irregardless. */ if (xen_initial_domain() || swiotlb || swiotlb_force == SWIOTLB_FORCE) xen_swiotlb = 1; /* If we are running under Xen, we MUST disable the native SWIOTLB. * Don't worry about swiotlb_force flag activating the native, as * the 'swiotlb' flag is the only one turning it on. */ swiotlb = 0; #ifdef CONFIG_X86_64 /* pci_swiotlb_detect_4gb turns on native SWIOTLB if no_iommu == 0 * (so no iommu=X command line over-writes). * Considering that PV guests do not want the *native SWIOTLB* but * only Xen SWIOTLB it is not useful to us so set no_iommu=1 here. */ if (max_pfn > MAX_DMA32_PFN) no_iommu = 1; #endif return xen_swiotlb; }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk5494.74%360.00%
Geert Uytterhoeven23.51%120.00%
Justin P. Mattock11.75%120.00%
Total57100.00%5100.00%


void __init pci_xen_swiotlb_init(void) { if (xen_swiotlb) { xen_swiotlb_init(1, true /* early */); dma_ops = &xen_swiotlb_dma_ops; #ifdef CONFIG_PCI /* Make sure ACS will be enabled */ pci_request_acs(); #endif } }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk3186.11%375.00%
Stefano Stabellini513.89%125.00%
Total36100.00%4100.00%


int pci_xen_swiotlb_init_late(void) { int rc; if (xen_swiotlb) return 0; rc = xen_swiotlb_init(1, false /* late */); if (rc) return rc; dma_ops = &xen_swiotlb_dma_ops; #ifdef CONFIG_PCI /* Make sure ACS will be enabled */ pci_request_acs(); #endif return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk4690.20%150.00%
Stefano Stabellini59.80%150.00%
Total51100.00%2100.00%

EXPORT_SYMBOL_GPL(pci_xen_swiotlb_init_late); IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, NULL, pci_xen_swiotlb_init, NULL);

Overall Contributors

PersonTokensPropCommitsCommitProp
Konrad Rzeszutek Wilk24893.94%861.54%
Stefano Stabellini103.79%17.69%
Geert Uytterhoeven20.76%17.69%
Andrzej Pietrasiewicz20.76%17.69%
Justin P. Mattock10.38%17.69%
Bart Van Assche10.38%17.69%
Total264100.00%13100.00%
Directory: arch/x86/xen
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.