Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69e558df authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge remote-tracking branch 'origin/dev/msm-3.18-drm_kms' into msm-3.18"

parents 9c28cdb9 7d4c5bd5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -406,7 +406,6 @@ int msm_gem_get_iova_locked(struct drm_gem_object *obj, int id,

				ret = mmu->funcs->map(mmu, pa,
						msm_obj->domain[id].sgt,
						obj->size,
						IOMMU_READ | IOMMU_NOEXEC);
				if (ret) {
					DRM_ERROR("Unable to map phy buf=%p\n",
@@ -677,8 +676,7 @@ void msm_gem_free_object(struct drm_gem_object *obj)
				uint32_t offset = msm_obj->domain[id].iova;

				mmu->funcs->unmap(mmu, offset,
					msm_obj->domain[id].sgt,
					obj->size);
					msm_obj->domain[id].sgt);
			} else {
				dma_unmap_sg(mmu->dev,
					msm_obj->domain[id].sgt->sgl,
+7 −11
Original line number Diff line number Diff line
@@ -43,13 +43,13 @@ static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt)
	iommu_detach_device(iommu->domain, mmu->dev);
}

static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
		struct sg_table *sgt, unsigned len, int prot)
static int msm_iommu_map(struct msm_mmu *mmu, dma_addr_t iova,
		struct sg_table *sgt, int prot)
{
	struct msm_iommu *iommu = to_msm_iommu(mmu);
	struct iommu_domain *domain = iommu->domain;
	struct scatterlist *sg;
	unsigned int da = iova;
	dma_addr_t da = iova;
	unsigned int i, j;
	int ret;

@@ -57,11 +57,9 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
		return -EINVAL;

	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
		u32 pa = sg_phys(sg) - sg->offset;
		dma_addr_t pa = sg_phys(sg) - sg->offset;
		size_t bytes = sg->length + sg->offset;

		VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);

		ret = iommu_map(domain, da, pa, bytes, prot);
		if (ret)
			goto fail;
@@ -82,13 +80,13 @@ fail:
	return ret;
}

static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
		struct sg_table *sgt, unsigned len)
static int msm_iommu_unmap(struct msm_mmu *mmu, dma_addr_t iova,
		struct sg_table *sgt)
{
	struct msm_iommu *iommu = to_msm_iommu(mmu);
	struct iommu_domain *domain = iommu->domain;
	struct scatterlist *sg;
	unsigned int da = iova;
	dma_addr_t da = iova;
	int i;

	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
@@ -99,8 +97,6 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
		if (unmapped < bytes)
			return unmapped;

		VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);

		BUG_ON(!PAGE_ALIGNED(bytes));

		da += bytes;
+4 −4
Original line number Diff line number Diff line
@@ -35,10 +35,10 @@ enum msm_mmu_domain_type {
struct msm_mmu_funcs {
	int (*attach)(struct msm_mmu *mmu, const char **names, int cnt);
	void (*detach)(struct msm_mmu *mmu, const char **names, int cnt);
	int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt,
			unsigned len, int prot);
	int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt,
			unsigned len);
	int (*map)(struct msm_mmu *mmu, dma_addr_t iova,
			struct sg_table *sgt, int prot);
	int (*unmap)(struct msm_mmu *mmu, dma_addr_t iova,
			struct sg_table *sgt);
	int (*map_sg)(struct msm_mmu *mmu, struct sg_table *sgt,
			enum dma_data_direction dir);
	void (*unmap_sg)(struct msm_mmu *mmu, struct sg_table *sgt,
+9 −13
Original line number Diff line number Diff line
@@ -96,16 +96,17 @@ static void msm_smmu_detach(struct msm_mmu *mmu, const char **names, int cnt)
	DBG("detaching");
}

static int msm_smmu_map(struct msm_mmu *mmu, uint32_t iova,
		struct sg_table *sgt, unsigned len, int prot)
static int msm_smmu_map(struct msm_mmu *mmu, dma_addr_t iova,
		struct sg_table *sgt, int prot)
{
	struct msm_smmu *smmu = to_msm_smmu(mmu);
	struct msm_smmu_client *client = msm_smmu_to_client(smmu);
	struct iommu_domain *domain;
	struct scatterlist *sg;
	unsigned int da = iova;
	dma_addr_t da = iova;
	unsigned int i, j;
	int ret;
	size_t bytes;

	if (!client)
		return -ENODEV;
@@ -115,11 +116,9 @@ static int msm_smmu_map(struct msm_mmu *mmu, uint32_t iova,
		return -EINVAL;

	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
		u32 pa = sg_phys(sg) - sg->offset;
		dma_addr_t pa = sg_phys(sg) - sg->offset;
		size_t bytes = sg->length + sg->offset;

		VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);

		ret = iommu_map(domain, da, pa, bytes, prot);
		if (ret)
			goto fail;
@@ -133,8 +132,7 @@ fail:
	da = iova;

	for_each_sg(sgt->sgl, sg, i, j) {
		size_t bytes = sg->length + sg->offset;

		bytes = sg->length + sg->offset;
		iommu_unmap(domain, da, bytes);
		da += bytes;
	}
@@ -164,14 +162,14 @@ static void msm_smmu_unmap_sg(struct msm_mmu *mmu, struct sg_table *sgt,
	dma_unmap_sg(client->dev, sgt->sgl, sgt->nents, dir);
}

static int msm_smmu_unmap(struct msm_mmu *mmu, uint32_t iova,
		struct sg_table *sgt, unsigned len)
static int msm_smmu_unmap(struct msm_mmu *mmu, dma_addr_t iova,
		struct sg_table *sgt)
{
	struct msm_smmu *smmu = to_msm_smmu(mmu);
	struct msm_smmu_client *client = msm_smmu_to_client(smmu);
	struct iommu_domain *domain;
	struct scatterlist *sg;
	unsigned int da = iova;
	dma_addr_t da = iova;
	int i;

	if (!client)
@@ -189,8 +187,6 @@ static int msm_smmu_unmap(struct msm_mmu *mmu, uint32_t iova,
		if (unmapped < bytes)
			return unmapped;

		VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);

		WARN_ON(!PAGE_ALIGNED(bytes));

		da += bytes;