diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index d62f7c6f9a5dfeb12341e3a8fd35b3934919de35..1c6bf85a0dcf1a8356312c91d650d4db799d0f85 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -553,6 +553,12 @@ int iova_reserve_domain_addr(struct iommu_domain *domain, dma_addr_t start, dma_ unsigned long lo, hi; + if (!iovad->granule) { + unsigned long order = __ffs(domain->pgsize_bitmap); + + iovad->granule = 1UL << order; + } + lo = iova_pfn(iovad, start); hi = iova_pfn(iovad, end); diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 88a4e564920740e913b650b79306f7784c19a563..2802654406b900cf0e2f2176d933f9790e2d8272 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -3031,6 +3031,10 @@ static inline int acpi_rmrr_andd_probe(struct device *dev) pr_info("dpoint-- cannot get acpi devie corresponding pci_device\n"); return -EINVAL; } + + if (!dev->iommu) + dev->iommu = (&pci_device->dev)->iommu; + ret = acpi_rmrr_device_create_direct_mappings(iommu_get_domain_for_dev(&pci_device->dev), dev);