diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2019-09-06 02:14:49 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-09-11 06:34:29 -0400 |
commit | e5e04d051979dbd636a99099b7a595093c50a4bc (patch) | |
tree | 02c641871e285fea720da12bd1420bc865ccae83 /drivers/iommu/intel-iommu.c | |
parent | 3fc1ca00653db6371585e3c21c4b873b2f20e60a (diff) |
iommu/vt-d: Check whether device requires bounce buffer
This adds a helper to check whether a device needs to
use bounce buffer. It also provides a boot time option
to disable the bounce buffer. Users can use this to
prevent the iommu driver from using the bounce buffer
for performance gain.
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Tested-by: Xu Pengfei <pengfei.xu@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 12d094d08c0a..ce6baabc9dcc 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -360,6 +360,7 @@ static int dmar_forcedac; | |||
360 | static int intel_iommu_strict; | 360 | static int intel_iommu_strict; |
361 | static int intel_iommu_superpage = 1; | 361 | static int intel_iommu_superpage = 1; |
362 | static int iommu_identity_mapping; | 362 | static int iommu_identity_mapping; |
363 | static int intel_no_bounce; | ||
363 | 364 | ||
364 | #define IDENTMAP_ALL 1 | 365 | #define IDENTMAP_ALL 1 |
365 | #define IDENTMAP_GFX 2 | 366 | #define IDENTMAP_GFX 2 |
@@ -373,6 +374,9 @@ EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); | |||
373 | static DEFINE_SPINLOCK(device_domain_lock); | 374 | static DEFINE_SPINLOCK(device_domain_lock); |
374 | static LIST_HEAD(device_domain_list); | 375 | static LIST_HEAD(device_domain_list); |
375 | 376 | ||
377 | #define device_needs_bounce(d) (!intel_no_bounce && dev_is_pci(d) && \ | ||
378 | to_pci_dev(d)->untrusted) | ||
379 | |||
376 | /* | 380 | /* |
377 | * Iterate over elements in device_domain_list and call the specified | 381 | * Iterate over elements in device_domain_list and call the specified |
378 | * callback @fn against each element. | 382 | * callback @fn against each element. |
@@ -455,6 +459,9 @@ static int __init intel_iommu_setup(char *str) | |||
455 | printk(KERN_INFO | 459 | printk(KERN_INFO |
456 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); | 460 | "Intel-IOMMU: not forcing on after tboot. This could expose security risk for tboot\n"); |
457 | intel_iommu_tboot_noforce = 1; | 461 | intel_iommu_tboot_noforce = 1; |
462 | } else if (!strncmp(str, "nobounce", 8)) { | ||
463 | pr_info("Intel-IOMMU: No bounce buffer. This could expose security risks of DMA attacks\n"); | ||
464 | intel_no_bounce = 1; | ||
458 | } | 465 | } |
459 | 466 | ||
460 | str += strcspn(str, ","); | 467 | str += strcspn(str, ","); |