diff options
| author | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-04 05:55:41 -0400 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-04 05:55:41 -0400 |
| commit | 40e4aa34324bff3938a900014254f88943d05e15 (patch) | |
| tree | 755ff279d80c99a915328b23c91d4c81dee874a7 | |
| parent | 1b7bc0a1618b4de1e6f55c6d95b790f4ab6fcd9e (diff) | |
intel-iommu: Add iommu_should_identity_map() function
We do this twice, and it's about to get more complicated. This makes the
code slightly clearer about what it's doing, too.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/pci/intel-iommu.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 73a5c71dd37d..ae5ccdf8b19f 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
| @@ -2442,6 +2442,11 @@ static int iommu_dummy(struct pci_dev *pdev) | |||
| 2442 | return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO; | 2442 | return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO; |
| 2443 | } | 2443 | } |
| 2444 | 2444 | ||
| 2445 | static int iommu_should_identity_map(struct pci_dev *pdev) | ||
| 2446 | { | ||
| 2447 | return pdev->dma_mask > DMA_BIT_MASK(32); | ||
| 2448 | } | ||
| 2449 | |||
| 2445 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ | 2450 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ |
| 2446 | static int iommu_no_mapping(struct pci_dev *pdev) | 2451 | static int iommu_no_mapping(struct pci_dev *pdev) |
| 2447 | { | 2452 | { |
| @@ -2455,7 +2460,7 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
| 2455 | 2460 | ||
| 2456 | found = identity_mapping(pdev); | 2461 | found = identity_mapping(pdev); |
| 2457 | if (found) { | 2462 | if (found) { |
| 2458 | if (pdev->dma_mask > DMA_BIT_MASK(32)) | 2463 | if (iommu_should_identity_map(pdev)) |
| 2459 | return 1; | 2464 | return 1; |
| 2460 | else { | 2465 | else { |
| 2461 | /* | 2466 | /* |
| @@ -2472,7 +2477,7 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
| 2472 | * In case of a detached 64 bit DMA device from vm, the device | 2477 | * In case of a detached 64 bit DMA device from vm, the device |
| 2473 | * is put into si_domain for identity mapping. | 2478 | * is put into si_domain for identity mapping. |
| 2474 | */ | 2479 | */ |
| 2475 | if (pdev->dma_mask > DMA_BIT_MASK(32)) { | 2480 | if (iommu_should_identity_map(pdev)) { |
| 2476 | int ret; | 2481 | int ret; |
| 2477 | ret = domain_add_dev_info(si_domain, pdev); | 2482 | ret = domain_add_dev_info(si_domain, pdev); |
| 2478 | if (ret) | 2483 | if (ret) |
