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

Commit b11e9bf9 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: cvp: Remove deprecated IOMMU API references"

parents 79990339 1f39a5e5
Loading
Loading
Loading
Loading
+7 −28
Original line number Diff line number Diff line
@@ -1067,23 +1067,6 @@ static void __set_threshold_registers(struct iris_hfi_device *device)
		dprintk(CVP_ERR, "Failed to restore threshold values\n");
}

static void __iommu_detach(struct iris_hfi_device *device)
{
	struct context_bank_info *cb;

	if (!device || !device->res) {
		dprintk(CVP_ERR, "Invalid parameter: %pK\n", device);
		return;
	}

	list_for_each_entry(cb, &device->res->context_banks, list) {
		if (cb->dev)
			__depr_arm_iommu_detach_device(cb->dev);
		if (cb->mapping)
			__depr_arm_iommu_release_mapping(cb->mapping);
	}
}

#ifdef USE_DEVFREQ_SCALE_BUS
static int __devfreq_target(struct device *devfreq_dev,
		unsigned long *freq, u32 flags)
@@ -1834,7 +1817,7 @@ static void __interface_queues_release(struct iris_hfi_device *device)
			false, device->res, 0);

		for (i = 0; cb && i < num_entries; i++) {
			iommu_unmap(cb->mapping->domain,
			iommu_unmap(cb->domain,
						mem_map[i].virtual_addr,
						mem_map[i].size);
		}
@@ -1869,7 +1852,7 @@ static void __interface_queues_release(struct iris_hfi_device *device)

static int __get_qdss_iommu_virtual_addr(struct iris_hfi_device *dev,
		struct cvp_hfi_mem_map *mem_map,
		struct dma_iommu_mapping *mapping)
		struct iommu_domain *domain)
{
	int i;
	int rc = 0;
@@ -1881,8 +1864,8 @@ static int __get_qdss_iommu_virtual_addr(struct iris_hfi_device *dev,
		return -ENODATA;

	for (i = 0; i < num_entries; i++) {
		if (mapping) {
			rc = iommu_map(mapping->domain, iova,
		if (domain) {
			rc = iommu_map(domain, iova,
					qdss_addr_tbl[i].start,
					qdss_addr_tbl[i].size,
					IOMMU_READ | IOMMU_WRITE);
@@ -1910,8 +1893,8 @@ static int __get_qdss_iommu_virtual_addr(struct iris_hfi_device *dev,
		dprintk(CVP_ERR,
			"QDSS mapping failed, Freeing other entries %d\n", i);

		for (--i; mapping && i >= 0; i--) {
			iommu_unmap(mapping->domain,
		for (--i; domain && i >= 0; i--) {
			iommu_unmap(domain,
				mem_map[i].virtual_addr,
				mem_map[i].size);
		}
@@ -2064,7 +2047,7 @@ static int __interface_queues_init(struct iris_hfi_device *dev)
			return -EINVAL;
		}

		rc = __get_qdss_iommu_virtual_addr(dev, mem_map, cb->mapping);
		rc = __get_qdss_iommu_virtual_addr(dev, mem_map, cb->domain);
		if (rc) {
			dprintk(CVP_ERR,
				"IOMMU mapping failed, Freeing qdss memdata\n");
@@ -5073,10 +5056,6 @@ void cvp_venus_hfi_delete_device(void *device)

	dev = (struct iris_hfi_device *) device;

	mutex_lock(&dev->lock);
	__iommu_detach(dev);
	mutex_unlock(&dev->lock);

	list_for_each_entry_safe(close, tmp, &hal_ctxt.dev_head, list) {
		if (close->cvp_hal_data->irq == dev->cvp_hal_data->irq) {
			hal_ctxt.dev_count--;
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ enum hal_buffer {

struct cvp_dma_mapping_info {
	struct device *dev;
	struct dma_iommu_mapping *mapping;
	struct iommu_domain *domain;
	struct sg_table *table;
	struct dma_buf_attachment *attach;
	struct dma_buf *buf;
+3 −3
Original line number Diff line number Diff line
@@ -97,15 +97,15 @@ static struct msm_cvp_common_data sm8250_common_data[] = {
	},
	{
		.key = "qcom,power-collapse-delay",
		.value = 1500,
		.value = 3000,
	},
	{
		.key = "qcom,hw-resp-timeout",
		.value = 1000,
		.value = 2000,
	},
	{
		.key = "qcom,dsp-resp-timeout",
		.value = 2000
		.value = 1000
	},
	{
		.key = "qcom,debug-timeout",
+12 −75
Original line number Diff line number Diff line
@@ -898,23 +898,10 @@ return rc;
	return rc;
}

static int get_secure_vmid(struct context_bank_info *cb)
{
	if (!strcasecmp(cb->name, "cvp_sec_pixel"))
		return VMID_CP_PIXEL;
	else if (!strcasecmp(cb->name, "cvp_sec_nonpixel"))
		return VMID_CP_NON_PIXEL;

	WARN(1, "No matching secure vmid for cb name: %s\n",
		cb->name);
	return VMID_INVAL;
}

static int msm_cvp_setup_context_bank(struct msm_cvp_platform_resources *res,
		struct context_bank_info *cb, struct device *dev)
{
	int rc = 0;
	int secure_vmid = VMID_INVAL;
	struct bus_type *bus;

	if (!dev || !cb || !res) {
@@ -931,46 +918,6 @@ static int msm_cvp_setup_context_bank(struct msm_cvp_platform_resources *res,
		goto remove_cb;
	}

	cb->mapping = __depr_arm_iommu_create_mapping(bus, cb->addr_range.start,
					cb->addr_range.size);
	if (IS_ERR_OR_NULL(cb->mapping)) {
		dprintk(CVP_ERR, "%s - failed to create mapping\n", __func__);
		rc = PTR_ERR(cb->mapping) ?: -ENODEV;
		goto remove_cb;
	}

	if (cb->is_secure) {
		secure_vmid = get_secure_vmid(cb);
		rc = iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_SECURE_VMID, &secure_vmid);
		if (rc) {
			dprintk(CVP_ERR,
				"%s - Couldn't arm_iommu_set_attr vmid\n",
				__func__);
			goto release_mapping;
		}
	}

	if (res->cache_pagetables) {
		int cache_pagetables = 1;

		rc = iommu_domain_set_attr(cb->mapping->domain,
			DOMAIN_ATTR_USE_UPSTREAM_HINT, &cache_pagetables);
		if (rc) {
			WARN_ONCE(rc,
				"%s: failed to set cache pagetables attribute, %d\n",
				__func__, rc);
			rc = 0;
		}
	}

	rc = __depr_arm_iommu_attach_device(cb->dev, cb->mapping);
	if (rc) {
		dprintk(CVP_ERR, "%s - Couldn't arm_iommu_attach_device\n",
			__func__);
		goto release_mapping;
	}

	/*
	 * configure device segment size and segment boundary to ensure
	 * iommu mapping returns one mapping (which is required for partial
@@ -984,14 +931,12 @@ static int msm_cvp_setup_context_bank(struct msm_cvp_platform_resources *res,

	dprintk(CVP_DBG, "Attached %s and created mapping\n", dev_name(dev));
	dprintk(CVP_DBG,
		"Context bank name:%s, buffer_type: %#x, is_secure: %d, address range start: %#x, size: %#x, dev: %pK, mapping: %pK",
		"Context bank name:%s, buffer_type: %#x, is_secure: %d, address range start: %#x, size: %#x, dev: %pK",
		cb->name, cb->buffer_type, cb->is_secure, cb->addr_range.start,
		cb->addr_range.size, cb->dev, cb->mapping);
		cb->addr_range.size, cb->dev);

	return rc;

release_mapping:
	__depr_arm_iommu_release_mapping(cb->mapping);
remove_cb:
	return rc;
}
@@ -1065,7 +1010,7 @@ static int msm_cvp_populate_context_bank(struct device *dev,
	}

	dprintk(CVP_DBG, "%s: context bank has name %s\n", __func__, cb->name);
	rc = of_property_read_u32_array(np, "virtual-addr-pool",
	rc = of_property_read_u32_array(np, "qcom,iommu-dma-addr-pool",
			(u32 *)&cb->addr_range, 2);
	if (rc) {
		dprintk(CVP_ERR,
@@ -1074,7 +1019,7 @@ static int msm_cvp_populate_context_bank(struct device *dev,
		goto err_setup_cb;
	}

	cb->is_secure = of_property_read_bool(np, "qcom,secure-context-bank");
	cb->is_secure = of_property_read_bool(np, "qcom,iommu-vmid");
	dprintk(CVP_DBG, "context bank %s : secure = %d\n",
			cb->name, cb->is_secure);

@@ -1090,28 +1035,20 @@ static int msm_cvp_populate_context_bank(struct device *dev,
		cb->name, cb->addr_range.start,
		cb->addr_range.size, cb->buffer_type);

	rc = msm_cvp_setup_context_bank(&core->resources, cb, dev);
	if (rc) {
		dprintk(CVP_ERR, "Cannot setup context bank %d\n", rc);
	cb->domain = iommu_get_domain_for_dev(dev);
	if (IS_ERR_OR_NULL(cb->domain)) {
		dprintk(CVP_ERR, "Create domain failed\n");
		rc = -ENODEV;
		goto err_setup_cb;
	}

	if (core->resources.non_fatal_pagefaults) {
		int data = 1;

		dprintk(CVP_DBG, "set non-fatal-faults attribute on %s\n",
				dev_name(dev));
		rc = iommu_domain_set_attr(cb->mapping->domain,
					DOMAIN_ATTR_NON_FATAL_FAULTS, &data);
	rc = msm_cvp_setup_context_bank(&core->resources, cb, dev);
	if (rc) {
			dprintk(CVP_WARN,
				"%s: set non fatal attribute failed: %s %d\n",
				__func__, dev_name(dev), rc);
			/* ignore the error */
		}
		dprintk(CVP_ERR, "Cannot setup context bank %d\n", rc);
		goto err_setup_cb;
	}

	iommu_set_fault_handler(cb->mapping->domain,
	iommu_set_fault_handler(cb->domain,
		msm_cvp_smmu_fault_handler, (void *)core);

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ struct context_bank_info {
	bool is_secure;
	struct addr_range addr_range;
	struct device *dev;
	struct dma_iommu_mapping *mapping;
	struct iommu_domain *domain;
};

struct buffer_usage_table {
Loading