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

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

Merge "msm: wfd: Revert back to using 32 bit physical addresses"

parents ca9537c1 4d182585
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -2023,7 +2023,7 @@ static long venc_alloc_recon_buffers(struct v4l2_subdev *sd, void *arg)
	struct vcd_property_hdr vcd_property_hdr;
	struct vcd_property_buffer_size control;
	struct vcd_property_enc_recon_buffer *ctrl = NULL;
	dma_addr_t phy_addr;
	unsigned long phy_addr;
	int i = 0;
	int heap_mask = 0;
	u32 ion_flags = 0;
@@ -2080,8 +2080,8 @@ static long venc_alloc_recon_buffers(struct v4l2_subdev *sd, void *arg)
					0, 0);
				 if (rc || !phy_addr) {
					WFD_MSG_ERR(
						"ion map iommu failed, rc = %d, phy_addr = 0x%pa\n",
						rc, &phy_addr);
						"ion map iommu failed, rc = %d, phy_addr = 0x%lx\n",
						rc, phy_addr);
					goto unmap_ion_alloc;
				}

@@ -2424,7 +2424,7 @@ long venc_mmap(struct v4l2_subdev *sd, void *arg)
	struct mem_region_map *mmap = arg;
	struct mem_region *mregion = NULL;
	unsigned long rc = 0, size = 0;
	dma_addr_t paddr = 0;
	void *paddr = NULL;

	if (!sd) {
		WFD_MSG_ERR("Subdevice required for %s\n", __func__);
@@ -2442,18 +2442,18 @@ long venc_mmap(struct v4l2_subdev *sd, void *arg)

	if (inst->secure) {
		rc = ion_phys(mmap->ion_client, mregion->ion_handle,
				&paddr,
				(unsigned long *)&paddr,
				(size_t *)&size);
	} else {
		rc = ion_map_iommu(mmap->ion_client, mregion->ion_handle,
				VIDEO_DOMAIN, VIDEO_MAIN_POOL, SZ_4K,
				0, &paddr,
				0, (unsigned long *)&paddr,
				&size, 0, 0);
	}

	if (rc) {
		WFD_MSG_ERR("Failed to get physical addr\n");
		paddr = 0;
		paddr = NULL;
	} else if (size < mregion->size) {
		WFD_MSG_ERR("Failed to map enough memory\n");
		rc = -ENOMEM;
+12 −1
Original line number Diff line number Diff line
@@ -29,10 +29,21 @@ enum venc_event {
	VENC_EVENT_HARDWARE_ERROR,
};

/*
 * Converts a dma_addr_t (which _might_ be 64 bits) to a void *, which
 * might be 32 bits. See dma_addr_to_u32 in mdp-subdev.h for more details.
 */
static inline void *dma_addr_to_void_ptr(dma_addr_t x)
{
	u32 temp = (u32)x;
	WARN_ON((dma_addr_t)temp != x);
	return (void *)temp;
}

struct mem_region {
	struct list_head list;
	u8 *kvaddr;
	dma_addr_t paddr;
	u8 *paddr;
	u32 size;
	u32 offset;
	u32 fd;
+8 −6
Original line number Diff line number Diff line
@@ -667,7 +667,7 @@ static long venc_set_input_buffer(struct v4l2_subdev *sd, void *arg)

	*mregion = *(struct mem_region *)arg;
	populate_planes(planes, inst->num_input_planes,
			(void *)mregion->paddr, mregion->size);
			mregion->paddr, mregion->size);

	buf = (struct v4l2_buffer) {
		.index = get_list_len(&inst->registered_input_bufs),
@@ -729,6 +729,7 @@ static int venc_map_user_to_kernel(struct venc_inst *inst,
	int rc = 0;
	unsigned long size = 0, align_req = 0, flags = 0;
	int domain = 0, partition = 0;
	dma_addr_t paddr = 0;

	if (!mregion) {
		rc = -EINVAL;
@@ -778,7 +779,7 @@ static int venc_map_user_to_kernel(struct venc_inst *inst,

	rc = ion_map_iommu(venc_ion_client, mregion->ion_handle,
			domain, partition, align_req, 0,
			&mregion->paddr, &size, 0, 0);
			&paddr, &size, 0, 0);
	if (rc) {
		WFD_MSG_ERR("Failed to map into iommu\n");
		goto venc_map_iommu_map_fail;
@@ -787,6 +788,7 @@ static int venc_map_user_to_kernel(struct venc_inst *inst,
		goto venc_map_iommu_size_fail;
	}

	mregion->paddr = dma_addr_to_void_ptr(paddr);
	return 0;
venc_map_iommu_size_fail:
	ion_unmap_iommu(venc_ion_client, mregion->ion_handle,
@@ -826,7 +828,7 @@ static int venc_unmap_user_to_kernel(struct venc_inst *inst,
	if (mregion->paddr) {
		ion_unmap_iommu(venc_ion_client, mregion->ion_handle,
				domain, partition);
		mregion->paddr = 0;
		mregion->paddr = NULL;
	}

	if (!IS_ERR_OR_NULL(mregion->kvaddr)) {
@@ -886,7 +888,7 @@ static long venc_set_output_buffer(struct v4l2_subdev *sd, void *arg)
	}

	populate_planes(planes, inst->num_output_planes,
			(void *)mregion->paddr, mregion->size);
			mregion->paddr, mregion->size);

	buf = (struct v4l2_buffer) {
		.index = get_list_len(&inst->registered_output_bufs),
@@ -1378,7 +1380,7 @@ long venc_mmap(struct v4l2_subdev *sd, void *arg)
		goto venc_map_iommu_size_fail;
	}

	mregion->paddr = paddr;
	mregion->paddr = dma_addr_to_void_ptr(paddr);
	return rc;

venc_map_iommu_size_fail:
@@ -1427,7 +1429,7 @@ long venc_munmap(struct v4l2_subdev *sd, void *arg)
	if (mregion->paddr) {
		ion_unmap_iommu(mmap->ion_client, mregion->ion_handle,
			domain, partition);
		mregion->paddr = 0;
		mregion->paddr = NULL;
	}

	if (inst->secure)
+2 −2
Original line number Diff line number Diff line
@@ -211,12 +211,12 @@ int mdp_mmap(struct v4l2_subdev *sd, void *arg)
	if (use_iommu) {
		rc = ion_map_iommu(mmap->ion_client, mregion->ion_handle,
				domain, GEN_POOL, SZ_4K, 0,
				&mregion->paddr,
				(unsigned long *)&mregion->paddr,
				(unsigned long *)&mregion->size,
				0, 0);
	} else {
		rc = ion_phys(mmap->ion_client,	mregion->ion_handle,
				&mregion->paddr,
				(unsigned long *)&mregion->paddr,
				(size_t *)&mregion->size);
	}

+3 −2
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
	struct mem_region_map *mmap = arg;
	struct mem_region *mregion;
	int domain = -1;
	dma_addr_t paddr;
	struct mdp_instance *inst = NULL;

	if (!mmap || !mmap->mregion || !mmap->cookie) {
@@ -222,8 +223,7 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
					MDP_IOMMU_DOMAIN_NS);

	rc = ion_map_iommu(mmap->ion_client, mregion->ion_handle,
			domain, 0, align, 0,
			&mregion->paddr,
			domain, 0, align, 0, &paddr,
			(unsigned long *)&mregion->size,
			0, 0);
	if (rc) {
@@ -231,6 +231,7 @@ static int mdp_mmap(struct v4l2_subdev *sd, void *arg)
				!inst->secure ? "non" : "", rc);
		goto iommu_fail;
	}
	mregion->paddr = dma_addr_to_void_ptr(paddr);

	return 0;
iommu_fail:
Loading