Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ed0d3e6 authored by Fenghua Yu's avatar Fenghua Yu Committed by David Woodhouse
Browse files

Intel IOMMU Pass Through Support



The patch adds kernel parameter intel_iommu=pt to set up pass through
mode in context mapping entry. This disables DMAR in linux kernel; but
KVM still runs on VT-d and interrupt remapping still works.

In this mode, kernel uses swiotlb for DMA API functions but other VT-d
functionalities are enabled for KVM. KVM always uses multi level
translation page table in VT-d. By default, pass though mode is disabled
in kernel.

This is useful when people don't want to enable VT-d DMAR in kernel but
still want to use KVM and interrupt remapping for reasons like DMAR
performance concern or debug purpose.

Signed-off-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Acked-by: default avatarWeidong Han <weidong@intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 09106974
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -965,6 +965,7 @@ and is between 256 and 4096 characters. It is defined in the file
		nomerge
		forcesac
		soft
		pt	[x86, IA64]

	io7=		[HW] IO7 for Marvel based alpha systems
			See comment before marvel_specify_io7 in
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ extern void pci_iommu_shutdown(void);
extern void no_iommu_init(void);
extern int force_iommu, no_iommu;
extern int iommu_detected;
extern int iommu_pass_through;
extern void iommu_dma_init(void);
extern void machvec_init(const char *name);

+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ void __init swiotlb_dma_init(void)

void __init pci_swiotlb_init(void)
{
	if (!iommu_detected) {
	if (!iommu_detected || iommu_pass_through) {
#ifdef CONFIG_IA64_GENERIC
		swiotlb = 1;
		printk(KERN_INFO "PCI-DMA: Re-initialize machine vector.\n");
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ extern void no_iommu_init(void);
extern struct dma_map_ops nommu_dma_ops;
extern int force_iommu, no_iommu;
extern int iommu_detected;
extern int iommu_pass_through;

/* 10 seconds */
#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
+6 −0
Original line number Diff line number Diff line
@@ -160,6 +160,8 @@ again:
	return page_address(page);
}

extern int iommu_pass_through;

/*
 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter
 * documentation.
@@ -209,6 +211,10 @@ static __init int iommu_setup(char *p)
#ifdef CONFIG_SWIOTLB
		if (!strncmp(p, "soft", 4))
			swiotlb = 1;
		if (!strncmp(p, "pt", 2)) {
			iommu_pass_through = 1;
			return 1;
		}
#endif

		gart_parse_options(p);
Loading