Просмотр исходного кода

audio-kernel: Replace struct dma_buf_map with struct iosys_map

Replace struct dam_buf_map with struct iosys_map and
Delete nonexistent header files and API calls.

Change-Id: I04f87dc9739b487b5a4fb7d7bb615198c27b9925
Signed-off-by: Prasad Kumpatla <[email protected]>
Yuhui Zhao 2 лет назад
Родитель
Сommit
8891411636
3 измененных файлов с 52 добавлено и 57 удалено
  1. 2 9
      dsp/audio_notifier.c
  2. 30 28
      dsp/msm_audio_ion.c
  3. 20 20
      dsp/msm_audio_ion_vm.c

+ 2 - 9
dsp/audio_notifier.c

@@ -18,8 +18,6 @@
 #include <dsp/audio_notifier.h>
 #include "audio_ssr.h"
 #include "audio_pdr.h"
-#include <trace/events/rproc_qcom.h>
-
 
 /* Audio states internal to notifier. Client */
 /* used states defined in audio_notifier.h */
@@ -430,14 +428,10 @@ static int audio_notifier_convert_opcode(unsigned long opcode,
 	switch (opcode) {
 	case QCOM_SSR_BEFORE_SHUTDOWN:
 	case SERVREG_SERVICE_STATE_DOWN:
-		trace_rproc_qcom_event("audio",
-			"QCOM_SSR_BEFORE_SHUTDOWN", "audio_notifier_convert_opcode_enter");
 		*notifier_opcode = AUDIO_NOTIFIER_SERVICE_DOWN;
 		break;
 	case QCOM_SSR_AFTER_POWERUP:
 	case SERVREG_SERVICE_STATE_UP:
-		trace_rproc_qcom_event(
-			"audio", "QCOM_SSR_AFTER_POWERUP", "audio_notifier_convert_opcode_enter");
 		*notifier_opcode = AUDIO_NOTIFIER_SERVICE_UP;
 		break;
 	default:
@@ -456,7 +450,7 @@ static int audio_notifier_service_cb(unsigned long opcode,
 	struct audio_notifier_cb_data data;
 
 	if (audio_notifier_convert_opcode(opcode, &notifier_opcode) < 0)
-		goto done;
+		return NOTIFY_OK;
 
 	data.service = service;
 	data.domain = domain;
@@ -475,8 +469,7 @@ static int audio_notifier_service_cb(unsigned long opcode,
 			notifier_opcode);
 
 	mutex_unlock(&notifier_mutex);
-done:
-	trace_rproc_qcom_event("audio", "audio_notifier", "audio_notifier_service_cb_exit");
+
 	return NOTIFY_OK;
 }
 

+ 30 - 28
dsp/msm_audio_ion.c

@@ -14,7 +14,7 @@
 #include <linux/list.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-buf.h>
-#include <linux/dma-buf-map.h>
+#include <linux/iosys-map.h>
 #include <linux/platform_device.h>
 #include <linux/of_device.h>
 #include <linux/export.h>
@@ -29,6 +29,8 @@
 #include <linux/msm_audio.h>
 #include <soc/qcom/secure_buffer.h>
 
+MODULE_IMPORT_NS(DMA_BUF);
+
 #define MSM_AUDIO_ION_PROBED (1 << 0)
 
 #define MSM_AUDIO_ION_PHYS_ADDR(alloc_data) \
@@ -59,7 +61,7 @@ struct msm_audio_ion_private {
 
 struct msm_audio_alloc_data {
 	size_t len;
-	struct dma_buf_map *vmap;
+	struct iosys_map *vmap;
 	struct dma_buf *dma_buf;
 	struct dma_buf_attachment *attach;
 	struct sg_table *table;
@@ -101,7 +103,7 @@ static void msm_audio_ion_add_allocation(
 }
 
 static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
-	struct msm_audio_ion_private *ion_data, struct dma_buf_map *dma_vmap)
+	struct msm_audio_ion_private *ion_data, struct iosys_map *iosys_vmap)
 {
 	int rc = 0;
 	struct msm_audio_alloc_data *alloc_data = NULL;
@@ -112,7 +114,7 @@ static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
 		goto exit;
 	}
 
-	rc = dma_buf_vmap(dma_buf, dma_vmap);
+	rc = dma_buf_vmap(dma_buf, iosys_vmap);
 	if (rc) {
 		pr_err("%s: kernel mapping of dma_buf failed\n",
 		       __func__);
@@ -127,7 +129,7 @@ static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
 	list_for_each_entry(alloc_data, &(ion_data->alloc_list),
 			    list) {
 		if (alloc_data->dma_buf == dma_buf) {
-			alloc_data->vmap = dma_vmap;
+			alloc_data->vmap = iosys_vmap;
 			break;
 		}
 	}
@@ -144,16 +146,16 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
 
 	struct msm_audio_alloc_data *alloc_data = NULL;
 	int rc = 0;
-	struct dma_buf_map *dma_vmap = NULL;
+	struct iosys_map *iosys_vmap = NULL;
 	struct device *cb_dev = ion_data->cb_dev;
 
-	dma_vmap = kzalloc(sizeof(*dma_vmap), GFP_KERNEL);
-	if (!dma_vmap)
+	iosys_vmap = kzalloc(sizeof(*iosys_vmap), GFP_KERNEL);
+	if (!iosys_vmap)
 		return -ENOMEM;
 	/* Data required per buffer mapping */
 	alloc_data = kzalloc(sizeof(*alloc_data), GFP_KERNEL);
 	if (!alloc_data) {
-		kfree(dma_vmap);
+		kfree(iosys_vmap);
 		return -ENOMEM;
 	}
 	alloc_data->dma_buf = dma_buf;
@@ -190,14 +192,14 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
 	/* physical address from mapping */
 	if (!is_iova) {
 		*addr = sg_phys(alloc_data->table->sgl);
-		rc = msm_audio_ion_map_kernel((void *)dma_buf, ion_data, dma_vmap);
+		rc = msm_audio_ion_map_kernel((void *)dma_buf, ion_data, iosys_vmap);
 		if (rc) {
 			pr_err("%s: ION memory mapping for AUDIO failed, err:%d\n",
 				__func__, rc);
 			rc = -ENOMEM;
 			goto detach_dma_buf;
 		}
-		alloc_data->vmap = dma_vmap;
+		alloc_data->vmap = iosys_vmap;
 	} else {
 		*addr = MSM_AUDIO_ION_PHYS_ADDR(alloc_data);
 	}
@@ -209,7 +211,7 @@ detach_dma_buf:
 	dma_buf_detach(alloc_data->dma_buf,
 		       alloc_data->attach);
 free_alloc_data:
-	kfree(dma_vmap);
+	kfree(iosys_vmap);
 	kfree(alloc_data);
 	alloc_data = NULL;
 
@@ -291,7 +293,7 @@ err:
 static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf, struct msm_audio_ion_private *ion_data)
 {
 	int rc = 0;
-	struct dma_buf_map *dma_vmap = NULL;
+	struct iosys_map *iosys_vmap = NULL;
 	struct msm_audio_alloc_data *alloc_data = NULL;
 	struct device *cb_dev = ion_data->cb_dev;
 
@@ -303,13 +305,13 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf, struct msm_audio_
 	list_for_each_entry(alloc_data, &(ion_data->alloc_list),
 			    list) {
 		if (alloc_data->dma_buf == dma_buf) {
-			dma_vmap = alloc_data->vmap;
+			iosys_vmap = alloc_data->vmap;
 			break;
 		}
 	}
 	mutex_unlock(&(ion_data->list_mutex));
 
-	if (!dma_vmap) {
+	if (!iosys_vmap) {
 		dev_err(cb_dev,
 			"%s: cannot find allocation for dma_buf %pK",
 			__func__, dma_buf);
@@ -317,7 +319,7 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf, struct msm_audio_
 		goto err;
 	}
 
-	dma_buf_vunmap(dma_buf, dma_vmap);
+	dma_buf_vunmap(dma_buf, iosys_vmap);
 
 	rc = dma_buf_end_cpu_access(dma_buf, DMA_BIDIRECTIONAL);
 	if (rc) {
@@ -331,7 +333,7 @@ err:
 }
 
 static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
-				 size_t *plen, struct dma_buf_map *dma_vmap,
+				 size_t *plen, struct iosys_map *iosys_vmap,
 				 struct msm_audio_ion_private *ion_data)
 {
 	int rc = 0;
@@ -350,7 +352,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
 		goto err;
 	}
 
-	rc = msm_audio_ion_map_kernel(dma_buf, ion_data, dma_vmap);
+	rc = msm_audio_ion_map_kernel(dma_buf, ion_data, iosys_vmap);
 	if (rc) {
 		pr_err("%s: ION memory mapping for AUDIO failed, err:%d\n",
 			__func__, rc);
@@ -489,13 +491,13 @@ void msm_audio_get_handle(int fd, void **handle)
  * @bufsz: buffer size
  * @paddr: Physical address to be assigned with allocated region
  * @plen: length of allocated region to be assigned
- * @dma_vmap: Virtual mapping vmap pointer to be assigned
+ * @iosys_vmap: Virtual mapping vmap pointer to be assigned
  *
  * Returns 0 on success or error on failure
  */
 static int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
 			unsigned long *ionflag, size_t bufsz,
-			dma_addr_t *paddr, size_t *plen, struct dma_buf_map *dma_vmap,
+			dma_addr_t *paddr, size_t *plen, struct iosys_map *iosys_vmap,
 			struct msm_audio_ion_private *ion_data)
 {
 	int rc = 0;
@@ -528,13 +530,13 @@ static int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
 		}
 	}
 	if (ion_data->smmu_enabled) {
-		rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, dma_vmap, ion_data);
+		rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, iosys_vmap, ion_data);
 		if (rc) {
 			pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
 			goto err;
 		}
 		pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
-				dma_vmap->vaddr, bufsz);
+				iosys_vmap->vaddr, bufsz);
 	} else {
 		msm_audio_dma_buf_map(*dma_buf, paddr, plen, true, ion_data);
 	}
@@ -661,7 +663,7 @@ static long msm_audio_ion_ioctl(struct file *file, unsigned int ioctl_num,
 	void *mem_handle;
 	dma_addr_t paddr;
 	size_t pa_len = 0;
-	struct dma_buf_map *dma_vmap = NULL;
+	struct iosys_map *iosys_vmap = NULL;
 	int ret = 0;
 	int dest_perms_map[2] = {PERM_READ | PERM_WRITE, PERM_READ | PERM_WRITE};
 	int source_vm_map[1] = {VMID_HLOS};
@@ -676,20 +678,20 @@ static long msm_audio_ion_ioctl(struct file *file, unsigned int ioctl_num,
 	pr_debug("%s ioctl num %u\n", __func__, ioctl_num);
 	switch (ioctl_num) {
 	case IOCTL_MAP_PHYS_ADDR:
-		dma_vmap = kzalloc(sizeof(struct msm_audio_fd_data), GFP_KERNEL);
-		if (!dma_vmap)
+		iosys_vmap = kzalloc(sizeof(struct msm_audio_fd_data), GFP_KERNEL);
+		if (!iosys_vmap)
 			return -ENOMEM;
 		msm_audio_fd_data = kzalloc((sizeof(struct msm_audio_fd_data)),
 					GFP_KERNEL);
 		if (!msm_audio_fd_data) {
-			kfree(dma_vmap);
+			kfree(iosys_vmap);
 			return -ENOMEM;
 		}
 		ret = msm_audio_ion_import((struct dma_buf **)&mem_handle, (int)ioctl_param,
-					NULL, 0, &paddr, &pa_len, dma_vmap, ion_data);
+					NULL, 0, &paddr, &pa_len, iosys_vmap, ion_data);
 		if (ret < 0) {
 			pr_err("%s Memory map Failed %d\n", __func__, ret);
-			kfree(dma_vmap);
+			kfree(iosys_vmap);
 			kfree(msm_audio_fd_data);
 			return ret;
 		}

+ 20 - 20
dsp/msm_audio_ion_vm.c

@@ -14,7 +14,7 @@
 #include <linux/list.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-buf.h>
-#include <linux/dma-buf-map.h>
+#include <linux/iosys-map.h>
 #include <linux/iommu.h>
 #include <linux/platform_device.h>
 #include <linux/of_device.h>
@@ -43,7 +43,7 @@ struct msm_audio_ion_private {
 
 struct msm_audio_alloc_data {
 	size_t len;
-	struct dma_buf_map *vmap;
+	struct iosys_map *vmap;
 	struct dma_buf *dma_buf;
 	struct dma_buf_attachment *attach;
 	struct sg_table *table;
@@ -426,7 +426,7 @@ err:
 }
 
 static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
-				struct dma_buf_map *dma_vmap)
+				struct iosys_map *iosys_vmap)
 {
 	int rc = 0;
 	struct msm_audio_alloc_data *alloc_data = NULL;
@@ -437,7 +437,7 @@ static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
 		goto exit;
 	}
 
-	rc = dma_buf_vmap(dma_buf, dma_vmap);
+	rc = dma_buf_vmap(dma_buf, iosys_vmap);
 	if (rc) {
 		pr_err("%s: kernel mapping of dma_buf failed\n",
 		       __func__);
@@ -452,7 +452,7 @@ static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
 	list_for_each_entry(alloc_data, &(msm_audio_ion_data.alloc_list),
 			    list) {
 		if (alloc_data->dma_buf == dma_buf) {
-			alloc_data->vmap = dma_vmap;
+			alloc_data->vmap = iosys_vmap;
 			break;
 		}
 	}
@@ -465,7 +465,7 @@ exit:
 static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
 {
 	int rc = 0;
-	struct dma_buf_map *dma_vmap = NULL
+	struct iosys_map *iosys_vmap = NULL
 	struct msm_audio_alloc_data *alloc_data = NULL;
 	struct device *cb_dev = msm_audio_ion_data.cb_dev;
 
@@ -477,13 +477,13 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
 	list_for_each_entry(alloc_data, &(msm_audio_ion_data.alloc_list),
 			    list) {
 		if (alloc_data->dma_buf == dma_buf) {
-			dma_vmap = alloc_data->vmap;
+			iosys_vmap = alloc_data->vmap;
 			break;
 		}
 	}
 	mutex_unlock(&(msm_audio_ion_data.list_mutex));
 
-	if (!dma_vmap) {
+	if (!iosys_vmap) {
 		dev_err(cb_dev,
 			"%s: cannot find allocation for dma_buf %pK",
 			__func__, dma_buf);
@@ -491,7 +491,7 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
 		goto err;
 	}
 
-	dma_buf_vunmap(dma_buf, dma_vmap);
+	dma_buf_vunmap(dma_buf, iosys_vmap);
 
 	rc = dma_buf_end_cpu_access(dma_buf, DMA_BIDIRECTIONAL);
 	if (rc) {
@@ -505,7 +505,7 @@ err:
 }
 
 static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
-				 size_t *plen, struct dma_buf_map *dma_vmap)
+				 size_t *plen, struct iosys_map *iosys_vmap)
 {
 	int rc = 0;
 
@@ -522,7 +522,7 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
 		goto err;
 	}
 
-	rc = msm_audio_ion_map_kernel(dma_buf, dma_vmap);
+	rc = msm_audio_ion_map_kernel(dma_buf, iosys_vmap);
 	if (rc) {
 		pr_err("%s: ION memory mapping for AUDIO failed, err:%d\n",
 			__func__, rc);
@@ -552,12 +552,12 @@ err:
  * @bufsz: buffer size
  * @paddr: Physical address to be assigned with allocated region
  * @plen: length of allocated region to be assigned
- * @dma_vmap: Virtual mapping vmap pointer to be assigned
+ * @iosys_vmap: Virtual mapping vmap pointer to be assigned
  *
  * Returns 0 on success or error on failure
  */
 int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
-			dma_addr_t *paddr, size_t *plen, struct dma_buf_map *dma_vmap)
+			dma_addr_t *paddr, size_t *plen, struct iosys_map *iosys_vmap)
 {
 	int rc = -EINVAL;
 	unsigned long err_ion_ptr = 0;
@@ -593,15 +593,15 @@ int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
 		goto err;
 	}
 
-	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, dma_vmap);
+	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, iosys_vmap);
 	if (rc) {
 		pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
 		goto err;
 	}
 	pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
-		dma_vmap->vaddr, bufsz);
+		iosys_vmap->vaddr, bufsz);
 
-	memset(dma_vmap, 0, sizeof(struct dma_buf_map));
+	memset(iosys_vmap, 0, sizeof(struct iosys_map));
 
 err:
 	return rc;
@@ -643,13 +643,13 @@ EXPORT_SYMBOL(msm_audio_is_hypervisor_supported);
  * @bufsz: buffer size
  * @paddr: Physical address to be assigned with allocated region
  * @plen: length of allocated region to be assigned
- * @dma_vmap: Virtual mapping vmap pointer to be assigned
+ * @iosys_vmap: Virtual mapping vmap pointer to be assigned
  *
  * Returns 0 on success or error on failure
  */
 int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
 			unsigned long *ionflag, size_t bufsz,
-			dma_addr_t *paddr, size_t *plen, struct dma_buf_map *dma_vmap)
+			dma_addr_t *paddr, size_t *plen, struct iosys_map *iosys_vmap)
 {
 	int rc = 0;
 
@@ -681,13 +681,13 @@ int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
 		}
 	}
 
-	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, dma_vmap);
+	rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, iosys_vmap);
 	if (rc) {
 		pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
 		goto err;
 	}
 	pr_debug("%s: mapped address = %pK, size=%zd\n", __func__,
-		dma_vmap->vaddr, bufsz);
+		iosys_vmap->vaddr, bufsz);
 
 	return 0;