drivers/iommu: Import OnePlus Changes
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
This commit is contained in:
parent
b5b260b215
commit
03e22b2b7c
|
@ -3129,12 +3129,12 @@ static size_t arm_smmu_map_sg(struct iommu_domain *domain, unsigned long iova,
|
|||
|
||||
out:
|
||||
arm_smmu_assign_table(smmu_domain);
|
||||
arm_smmu_secure_domain_unlock(smmu_domain);
|
||||
|
||||
if (size_to_unmap) {
|
||||
arm_smmu_unmap(domain, __saved_iova_start, size_to_unmap);
|
||||
iova = __saved_iova_start;
|
||||
}
|
||||
arm_smmu_secure_domain_unlock(smmu_domain);
|
||||
arm_smmu_release_prealloc_memory(smmu_domain, &nonsecure_pool);
|
||||
return iova - __saved_iova_start;
|
||||
}
|
||||
|
|
|
@ -1296,17 +1296,13 @@ static int exynos_iommu_of_xlate(struct device *dev,
|
|||
return -ENODEV;
|
||||
|
||||
data = platform_get_drvdata(sysmmu);
|
||||
if (!data) {
|
||||
put_device(&sysmmu->dev);
|
||||
if (!data)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!owner) {
|
||||
owner = kzalloc(sizeof(*owner), GFP_KERNEL);
|
||||
if (!owner) {
|
||||
put_device(&sysmmu->dev);
|
||||
if (!owner)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
INIT_LIST_HEAD(&owner->controllers);
|
||||
mutex_init(&owner->rpm_lock);
|
||||
|
|
|
@ -479,18 +479,12 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
|
|||
|
||||
/* Enable interrupt-remapping */
|
||||
iommu->gcmd |= DMA_GCMD_IRE;
|
||||
iommu->gcmd &= ~DMA_GCMD_CFI; /* Block compatibility-format MSIs */
|
||||
writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
|
||||
|
||||
IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
|
||||
readl, (sts & DMA_GSTS_IRES), sts);
|
||||
|
||||
/* Block compatibility-format MSIs */
|
||||
if (sts & DMA_GSTS_CFIS) {
|
||||
iommu->gcmd &= ~DMA_GCMD_CFI;
|
||||
writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
|
||||
IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
|
||||
readl, !(sts & DMA_GSTS_CFIS), sts);
|
||||
}
|
||||
|
||||
/*
|
||||
* With CFI clear in the Global Command register, we should be
|
||||
* protected from dangerous (i.e. compatibility) interrupts
|
||||
|
@ -607,21 +601,13 @@ out_free_table:
|
|||
|
||||
static void intel_teardown_irq_remapping(struct intel_iommu *iommu)
|
||||
{
|
||||
struct fwnode_handle *fn;
|
||||
|
||||
if (iommu && iommu->ir_table) {
|
||||
if (iommu->ir_msi_domain) {
|
||||
fn = iommu->ir_msi_domain->fwnode;
|
||||
|
||||
irq_domain_remove(iommu->ir_msi_domain);
|
||||
irq_domain_free_fwnode(fn);
|
||||
iommu->ir_msi_domain = NULL;
|
||||
}
|
||||
if (iommu->ir_domain) {
|
||||
fn = iommu->ir_domain->fwnode;
|
||||
|
||||
irq_domain_remove(iommu->ir_domain);
|
||||
irq_domain_free_fwnode(fn);
|
||||
iommu->ir_domain = NULL;
|
||||
}
|
||||
free_pages((unsigned long)iommu->ir_table->base,
|
||||
|
|
|
@ -863,9 +863,7 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
|
|||
for (i = 0 ; i < mag->size; ++i) {
|
||||
struct iova *iova = private_find_iova(iovad, mag->pfns[i]);
|
||||
|
||||
if (WARN_ON(!iova))
|
||||
continue;
|
||||
|
||||
BUG_ON(!iova);
|
||||
private_free_iova(iovad, iova);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,11 +101,8 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
|
|||
mutex_lock(&iommu_debug_lock);
|
||||
|
||||
bytes = omap_iommu_dump_ctx(obj, p, count);
|
||||
if (bytes < 0)
|
||||
goto err;
|
||||
bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
|
||||
|
||||
err:
|
||||
mutex_unlock(&iommu_debug_lock);
|
||||
kfree(buf);
|
||||
|
||||
|
|
Loading…
Reference in New Issue