mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
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>
This commit is contained in:
parent
1b7bc0a161
commit
40e4aa3432
@ -2442,6 +2442,11 @@ static int iommu_dummy(struct pci_dev *pdev)
|
|||||||
return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
|
return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int iommu_should_identity_map(struct pci_dev *pdev)
|
||||||
|
{
|
||||||
|
return pdev->dma_mask > DMA_BIT_MASK(32);
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if the pdev needs to go through non-identity map and unmap process.*/
|
/* Check if the pdev needs to go through non-identity map and unmap process.*/
|
||||||
static int iommu_no_mapping(struct pci_dev *pdev)
|
static int iommu_no_mapping(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
@ -2455,7 +2460,7 @@ static int iommu_no_mapping(struct pci_dev *pdev)
|
|||||||
|
|
||||||
found = identity_mapping(pdev);
|
found = identity_mapping(pdev);
|
||||||
if (found) {
|
if (found) {
|
||||||
if (pdev->dma_mask > DMA_BIT_MASK(32))
|
if (iommu_should_identity_map(pdev))
|
||||||
return 1;
|
return 1;
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
@ -2472,7 +2477,7 @@ static int iommu_no_mapping(struct pci_dev *pdev)
|
|||||||
* In case of a detached 64 bit DMA device from vm, the device
|
* In case of a detached 64 bit DMA device from vm, the device
|
||||||
* is put into si_domain for identity mapping.
|
* is put into si_domain for identity mapping.
|
||||||
*/
|
*/
|
||||||
if (pdev->dma_mask > DMA_BIT_MASK(32)) {
|
if (iommu_should_identity_map(pdev)) {
|
||||||
int ret;
|
int ret;
|
||||||
ret = domain_add_dev_info(si_domain, pdev);
|
ret = domain_add_dev_info(si_domain, pdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user