intel-iommu: Is this a bug?
From: Tushar Dave
Date: Mon Mar 26 2018 - 21:09:39 EST
Hi,
I am analyzing network performance with intel-iommu enabled.
And found that running with iommu=pt, for every dma map/unmap it
executes this code:
/*
* At boot time, we don't yet know if devices will be 64-bit
capable.
* Assume that they will â if they turn out not to be, then we can
* take them out of the 1:1 domain later.
*/
if (!startup) {
/*
* If the device's dma_mask is less than the system's
memory
* size then this is not a candidate for identity mapping.
*/
u64 dma_mask = *dev->dma_mask;
if (dev->coherent_dma_mask &&
dev->coherent_dma_mask < dma_mask)
dma_mask = dev->coherent_dma_mask;
return dma_mask >= dma_get_required_mask(dev);
}
Do we really need this check for every dma/unmap?
Considering it should be only during startup, shouldn't it be,
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 582fd01..3c8f14e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2929,7 +2929,7 @@ static int iommu_should_identity_map(struct device
*dev, int startup)
* Assume that they will â if they turn out not to be, then we can
* take them out of the 1:1 domain later.
*/
- if (!startup) {
+ if (startup) {
/*
* If the device's dma_mask is less than the system's
memory
* size then this is not a candidate for identity mapping.
Thanks.
-Tushar