diff --git a/drivers/misc/sdma-dae/sdma_auth.c b/drivers/misc/sdma-dae/sdma_auth.c index 7fa01e9bb931a15b7bd17c349d3d3ae734303106..e15a7d4b96ce98c40e1add17b8d5d126a7e96f4a 100644 --- a/drivers/misc/sdma-dae/sdma_auth.c +++ b/drivers/misc/sdma-dae/sdma_auth.c @@ -191,11 +191,11 @@ int sdma_auth_add(u32 pasid, u32 num, u32 *pid_list) if (owner) { ret = sdma_add_authority_ht(owner, num, pid_list); if (ret < 0) - pr_err("add_pid_ht failed\n"); + pr_err("Add_pid_ht failed\n"); } else { ret = sdma_create_authority_ht(pid, pasid, num, pid_list); if (ret < 0) - pr_err("create_pid_ht failed\n"); + pr_err("Create_pid_ht failed\n"); } write_unlock(&g_authority->owner_pid_lock); @@ -214,13 +214,13 @@ int sdma_check_authority(u32 pasid, u32 owner_pid, u32 submitter_pid, u32 *owner read_lock(&g_authority->owner_pid_lock); entry = sdma_search_owner_pid_ht(owner_pid); if (!entry) { - pr_err("the owner_pid_ht[%u] not exist\n", owner_pid); + pr_err("The owner_pid_ht[%u] not exist\n", owner_pid); read_unlock(&g_authority->owner_pid_lock); return -ENODATA; } sub_entry = sdma_search_submitter_pid(entry, submitter_pid); if (!sub_entry) { - pr_err("the submitter[%u] not authorithed\n", submitter_pid); + pr_err("The submitter[%u] not authorithed\n", submitter_pid); read_unlock(&g_authority->owner_pid_lock); return -ENODATA; } diff --git a/drivers/misc/sdma-dae/sdma_cdev.c b/drivers/misc/sdma-dae/sdma_cdev.c index 44d03ea532d81b905cb02e8259b2fc28c1ff72be..efa942ef2588eaa7ba0dd22a33bf6b1fd757babd 100644 --- a/drivers/misc/sdma-dae/sdma_cdev.c +++ b/drivers/misc/sdma-dae/sdma_cdev.c @@ -526,11 +526,11 @@ static int __do_sdma_open(struct hisi_sdma_device *psdma_dev, struct file *file) ret = sdma_add_pid_ref(psdma_dev, (u32)current->tgid); if (ret != 0) { - dev_err(&psdma_dev->pdev->dev, "alloc pid_ref hash failed\n"); + dev_err(&psdma_dev->pdev->dev, "Alloc pid_ref hash failed\n"); goto free_ida; } - dev_dbg(&psdma_dev->pdev->dev, "%s: ida alloc id = %d\n", __func__, id); + dev_dbg(&psdma_dev->pdev->dev, "Ida alloc id = %d\n", id); data = kmalloc_node(sizeof(struct file_open_data), GFP_KERNEL, psdma_dev->node_idx); if (!data) { ret = -ENOMEM; @@ -543,7 +543,7 @@ static int __do_sdma_open(struct hisi_sdma_device *psdma_dev, struct file *file) handle = iommu_sva_bind_device(&psdma_dev->pdev->dev, current->mm, NULL); if (IS_ERR(handle)) { - dev_err(&psdma_dev->pdev->dev, "failed to bind sva, %ld\n", PTR_ERR(handle)); + dev_err(&psdma_dev->pdev->dev, "Failed to bind sva, %ld\n", PTR_ERR(handle)); ret = (int)PTR_ERR(handle); goto mmu_resume_unreg; } @@ -606,13 +606,13 @@ static int ioctl_sdma_unpin_umem(struct file *file, unsigned long arg) ida = (int)(cookie >> COOKIE_IDA_SHIFT); if (ida != data->ida) { - dev_err(&data->psdma_dev->pdev->dev, "invalid process unpin umem!\n"); + dev_err(&data->psdma_dev->pdev->dev, "Invalid process unpin umem!\n"); return -EPERM; } ret = sdma_umem_release(cookie); if (ret) - dev_err(&data->psdma_dev->pdev->dev, "umem release fail!\n"); + dev_err(&data->psdma_dev->pdev->dev, "Umem release fail!\n"); return ret; } @@ -625,7 +625,7 @@ static int ioctl_sdma_pin_umem(struct file *file, unsigned long arg) if (copy_from_user(&umemInfo, (struct hisi_sdma_umem_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_umem_info))) { - dev_err(&data->psdma_dev->pdev->dev, "umem_info copy from user failed!\n"); + dev_err(&data->psdma_dev->pdev->dev, "Umem_info copy from user failed!\n"); return -EFAULT; } @@ -636,7 +636,7 @@ static int ioctl_sdma_pin_umem(struct file *file, unsigned long arg) if (copy_to_user((struct hisi_sdma_umem_info __user *)(uintptr_t)arg, &umemInfo, sizeof(struct hisi_sdma_umem_info))) { sdma_umem_release(umemInfo.cookie); - dev_err(&data->psdma_dev->pdev->dev, "umem_info copy to user failed!\n"); + dev_err(&data->psdma_dev->pdev->dev, "Umem_info copy to user failed!\n"); return -EFAULT; } @@ -693,7 +693,7 @@ static int ioctl_sdma_get_chn(struct file *file, unsigned long arg) bitmap_clear(pdev->channel_map, idx, 1); pdev->nr_channel_used++; } else { - dev_err(&pdev->pdev->dev, "fail to allocate usable exclusive chn!\n"); + dev_err(&pdev->pdev->dev, "Fail to allocate usable exclusive chn!\n"); ret = -ENOSPC; goto unlock; } @@ -709,7 +709,7 @@ static int ioctl_sdma_get_chn(struct file *file, unsigned long arg) goto put_chn; } spin_unlock(&pdev->channel_lock); - dev_dbg(&pdev->pdev->dev, "sdma get chn %u\n", idx); + dev_dbg(&pdev->pdev->dev, "SDMA get chn %u\n", idx); return 0; @@ -736,18 +736,18 @@ static int ioctl_sdma_put_chn(struct file *file, unsigned long arg) u32 idx; if (copy_from_user(&idx, (u32 __user *)(uintptr_t)arg, sizeof(u32))) { - dev_err(dev, "put user chn failed\n"); + dev_err(dev, "Put user chn failed\n"); return -EFAULT; } if (idx < share_chns || idx >= pdev->nr_channel) { - dev_err(dev, "put idx = %u is err\n", idx); + dev_err(dev, "Put idx = %u is err\n", idx); return -EFAULT; } pchannel = pdev->channels + idx; if (!sdma_check_ida_val(pchannel, data->ida)) { - dev_err(dev, "invalid process put chn by sdma exclusive channel%u\n", idx); + dev_err(dev, "Invalid process put chn by sdma exclusive channel%u\n", idx); return -EPERM; } @@ -757,7 +757,7 @@ static int ioctl_sdma_put_chn(struct file *file, unsigned long arg) bitmap_set(pdev->channel_map, idx - share_chns, 1); pdev->nr_channel_used--; sdma_reset_ida_val(pchannel); - dev_dbg(dev, "sdma put chn %u\n", idx); + dev_dbg(dev, "SDMA put chn %u\n", idx); list_del(&c->chn_list); kfree(c); break; @@ -791,11 +791,11 @@ static int ioctl_get_near_sdmaid(struct file *file SDMA_UNUSED, unsigned long ar nid = numa_node_id(); if (nid < 0) { - pr_err("sdma numa_node not reported!\n"); + pr_err("SDMA numa_node not reported!\n"); return -EINVAL; } if (num <= 0 || num > HISI_SDMA_MAX_DEVS) { - pr_err("device num wrong, cannot use sdma!\n"); + pr_err("Device num wrong, cannot use sdma!\n"); return -ENOENT; } @@ -805,10 +805,10 @@ static int ioctl_get_near_sdmaid(struct file *file SDMA_UNUSED, unsigned long ar sdma_numa[i].idx = sdma_dev->idx; sdma_numa[i].pxm = sdma_dev->node_idx; if (sdma_numa[i].pxm < 0) { - dev_err(dev, "sdma%d PXM domain not reported!\n", sdma_numa[i].idx); + dev_err(dev, "SDMA%d PXM domain not reported!\n", sdma_numa[i].idx); return -ENODATA; } - dev_dbg(dev, "sdma%d PXM = %d\n", sdma_numa[i].idx, sdma_numa[i].pxm); + dev_dbg(dev, "SDMA%d PXM = %d\n", sdma_numa[i].idx, sdma_numa[i].pxm); } sort(sdma_numa, num, sizeof(struct hisi_sdma_numa_domain), cmp, NULL); @@ -944,7 +944,7 @@ static int ioctl_sdma_add_authority_ht(struct file *file, unsigned long arg) if (copy_from_user(&pid_info, (struct hisi_sdma_pid_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_pid_info))) { - dev_err(&pdev->pdev->dev, "get hisi_sdma_pid_info failed\n"); + dev_err(&pdev->pdev->dev, "Get hisi_sdma_pid_info failed\n"); return -EFAULT; } list_num = pid_info.num; @@ -958,7 +958,7 @@ static int ioctl_sdma_add_authority_ht(struct file *file, unsigned long arg) if (copy_from_user(pid_list, (void __user *)pid_info.pid_list_addr, list_num * sizeof(u32))) { - dev_err(&pdev->pdev->dev, "get pid_list failed\n"); + dev_err(&pdev->pdev->dev, "Get pid_list failed\n"); ret = -EFAULT; goto free_list; } @@ -979,7 +979,7 @@ static int sdma_verify_src_dst(struct file_open_data *data, struct pasid_info *p if (task_list.opcode == HISI_SDMA_HBM_CACHE_PRELOAD_MODE) { pasid->src_pasid = data->pasid; pasid->dst_pasid = 0; - dev_dbg(dev, "unter hbm cach preload mode\n"); + dev_dbg(dev, "Under hbm cache preload mode\n"); return 0; } @@ -994,7 +994,7 @@ static int sdma_verify_src_dst(struct file_open_data *data, struct pasid_info *p } if (ret < 0) - dev_err(dev, "no authority:tgid[%u] src_pid[%u] dst_pid[%u]\n", + dev_err(dev, "No authority:tgid[%u] src_pid[%u] dst_pid[%u]\n", pid, task_list.src_process_id, task_list.dst_process_id); return ret; @@ -1143,7 +1143,7 @@ static int ioctl_sdma_send_task(struct file *file, unsigned long arg) if (copy_from_user(&task_info, (struct hisi_sdma_task_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_task_info))) { - dev_err(dev, "get hisi_sdma_task_info failed\n"); + dev_err(dev, "Get hisi_sdma_task_info failed\n"); return -EFAULT; } ret = sdma_task_info_validate(data, &task_info); @@ -1157,19 +1157,19 @@ static int ioctl_sdma_send_task(struct file *file, unsigned long arg) if (copy_from_user(task_list, (void __user *)task_info.task_addr, task_info.task_cnt * sizeof(struct hisi_sdma_sqe_task))) { - dev_err(dev, "get hisi_sdma_sqe_task failed\n"); + dev_err(dev, "Get hisi_sdma_sqe_task failed\n"); ret = -EFAULT; goto free_list; } ret = sdma_send_task_kernel(data, &task_info, task_list); if (ret < 0) { - dev_err(dev, "exec sdma_send_task_kernel failed\n"); + dev_err(dev, "Execute sdma_send_task_kernel failed\n"); goto free_list; } if (copy_to_user((struct hisi_sdma_task_info __user *)(uintptr_t)arg, &task_info, sizeof(struct hisi_sdma_task_info))) { - dev_err(dev, "set hisi_sdma_task_info failed\n"); + dev_err(dev, "Set hisi_sdma_task_info failed\n"); ret = -EFAULT; } @@ -1211,7 +1211,7 @@ static int sdma_operation_reg(struct file_open_data *data, unsigned long arg, if (copy_from_user(®_info, (struct hisi_sdma_reg_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_reg_info))) { - dev_err(dev, "get hisi_sdma_reg_info failed\n"); + dev_err(dev, "Get hisi_sdma_reg_info failed\n"); return -EFAULT; } @@ -1232,7 +1232,7 @@ static int sdma_operation_reg(struct file_open_data *data, unsigned long arg, if (copy_to_user((struct hisi_sdma_reg_info __user *)(uintptr_t)arg, ®_info, sizeof(struct hisi_sdma_reg_info))) { spin_unlock(&pchannel->owner_chn_lock); - dev_err(dev, "copy reg_info to user failed\n"); + dev_err(dev, "Copy reg_info to user failed\n"); return -EFAULT; } } else if (reg_info.type == HISI_SDMA_WRITE_REG) { @@ -1245,7 +1245,7 @@ static int sdma_operation_reg(struct file_open_data *data, unsigned long arg, set_func(pchannel, reg_info.reg_value); } else { spin_unlock(&pchannel->owner_chn_lock); - dev_err(dev, "cq_head value illegal!\n"); + dev_err(dev, "Cq_head value illegal!\n"); return -EINVAL; } } @@ -1294,7 +1294,7 @@ static int ioctl_sdma_dfx_reg(struct file *file, unsigned long arg) dev = &pdev->pdev->dev; if (copy_from_user(®_info, (struct hisi_sdma_reg_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_reg_info))) { - dev_err(dev, "dfx_reg copy from user failed\n"); + dev_err(dev, "Dfx_reg copy from user failed\n"); return -EFAULT; } @@ -1313,7 +1313,7 @@ static int ioctl_sdma_dfx_reg(struct file *file, unsigned long arg) reg_info.reg_value = sdma_channel_get_dfx(pchannel); if (copy_to_user((struct hisi_sdma_reg_info __user *)(uintptr_t)arg, ®_info, sizeof(struct hisi_sdma_reg_info))) { - dev_err(dev, "dfx_reg copy to user failed\n"); + dev_err(dev, "Dfx_reg copy to user failed\n"); return -EFAULT; } @@ -1331,7 +1331,7 @@ static int ioctl_sdma_sqe_cnt_reg(struct file *file, unsigned long arg) dev = &pdev->pdev->dev; if (copy_from_user(®_info, (struct hisi_sdma_reg_info __user *)(uintptr_t)arg, sizeof(struct hisi_sdma_reg_info))) { - dev_err(dev, "get hisi_sdma_reg_info failed\n"); + dev_err(dev, "Get hisi_sdma_reg_info failed\n"); return -EFAULT; } if (reg_info.chn >= pdev->nr_channel) { @@ -1409,18 +1409,18 @@ static int sdma_core_open(struct inode *inode, struct file *file) u32 sdma_idx; if (g_info.core_dev->sdma_device_num == 0) { - pr_err("cannot find a sdma device\n"); + pr_err("Cannot find a sdma device\n"); return -ENODEV; } sdma_dev = inode->i_rdev; sdma_idx = MINOR(sdma_dev); if (sdma_idx >= HISI_SDMA_MAX_DEVS) { - pr_err("wrong id of sdma device\n"); + pr_err("Wrong id of sdma device\n"); return -ENODEV; } psdma_dev = g_info.core_dev->sdma_devices[sdma_idx]; if (!psdma_dev) { - pr_err("cannot find sdma%u\n", sdma_idx); + pr_err("Cannot find sdma%u\n", sdma_idx); return -ENODEV; } @@ -1437,13 +1437,13 @@ ssize_t sdma_read_info(struct file *file, char __user *buf SDMA_UNUSED, size_t s bool mode = *(g_info.sdma_mode); if (mode == HISI_SDMA_FAST_MODE) - dev_info(dev, "sdma is running unter fast mode\n"); + dev_info(dev, "SDMA is running unter fast mode\n"); else - dev_info(dev, "sdma is running unter safe mode\n"); + dev_info(dev, "SDMA is running unter safe mode\n"); if (share_chns > pdev->nr_channel) share_chns = pdev->nr_channel; - dev_info(dev, "sdma%u has %u channels in total, %u share_channels\n", + dev_info(dev, "SDMA%u has %u channels in total, %u share_channels\n", pdev->idx, pdev->nr_channel, share_chns); return 0; @@ -1462,7 +1462,7 @@ static int sdma_dev_release(struct inode *inode SDMA_UNUSED, struct file *file) spin_lock(&pdev->channel_lock); list_for_each_entry_safe(c, n, &data->non_share_chn_list, chn_list) { - dev_dbg(dev, "release non_share_chn%u\n", c->chn_idx); + dev_dbg(dev, "Release non_share_chn%u\n", c->chn_idx); pchannel = pdev->channels + c->chn_idx; sdma_reset_ida_val(pchannel); bitmap_set(pdev->channel_map, c->chn_idx - share_chns, 1); @@ -1472,12 +1472,12 @@ static int sdma_dev_release(struct inode *inode SDMA_UNUSED, struct file *file) } list_for_each_entry_safe(c, n, &data->share_chn_list, chn_list) { - dev_dbg(dev, "release share_chn%u\n", c->chn_idx); + dev_dbg(dev, "Release share_chn%u\n", c->chn_idx); pchannel = pdev->channels + c->chn_idx; pchannel->cnt_used--; if (pchannel->sync_info_base->lock != 0 && pchannel->sync_info_base->lock_pid == (u32)current->tgid) { - dev_warn(dev, "process %d exit with lock\n", current->tgid); + dev_warn(dev, "Process %d exit with lock\n", current->tgid); pchannel->sync_info_base->lock_pid = 0; /* clear lockpid before release lock */ wmb(); @@ -1517,13 +1517,23 @@ static int remap_addr_range(u32 chn_num, u64 offset, u64 size, struct hisi_sdma_ { struct hisi_sdma_channel *pchannel; bool mode = *(g_info.sdma_mode); + u64 reg_max_size = PAGE_SIZE; + u64 sq_max_size = PAGE_SIZE; + u64 cq_max_size = PAGE_SIZE; u64 sync_size; + if (HISI_SDMA_REG_SIZE >= PAGE_SIZE) + reg_max_size = HISI_SDMA_REG_SIZE; + if (HISI_SDMA_SQ_SIZE >= PAGE_SIZE) + sq_max_size = HISI_SDMA_SQ_SIZE; + if (HISI_SDMA_CQ_SIZE >= PAGE_SIZE) + cq_max_size = HISI_SDMA_CQ_SIZE; + sync_size = (u64)((sizeof(struct hisi_sdma_queue_info) + PAGE_SIZE - ALIGN_NUM) / PAGE_SIZE * PAGE_SIZE); if (offset >= chn_num * (HISI_SDMA_MMAP_SHMEM + 1)) { - pr_err("sdma mmap offset exceed range\n"); + pr_err("SDMA mmap offset exceed range\n"); return -EINVAL; } @@ -1531,32 +1541,32 @@ static int remap_addr_range(u32 chn_num, u64 offset, u64 size, struct hisi_sdma_ spin_lock(&pchannel->owner_chn_lock); if (sdma_check_channel_permission(pchannel, ida, pchannel->idx)) { spin_unlock(&pchannel->owner_chn_lock); - pr_err("sdma invalid process mmap\n"); + pr_err("SDMA invalid process mmap\n"); return -EPERM; } spin_unlock(&pchannel->owner_chn_lock); if (offset < chn_num * HISI_SDMA_MMAP_CQE) { - if (mode == HISI_SDMA_SAFE_MODE || size > HISI_SDMA_SQ_SIZE) { - pr_err("sdma mmap size exceed sqe range\n"); + if (mode == HISI_SDMA_SAFE_MODE || size > sq_max_size) { + pr_err("SDMA mmap size exceed sqe range\n"); return -EINVAL; } return HISI_SDMA_MMAP_SQE; } else if (offset < chn_num * HISI_SDMA_MMAP_IO) { - if (size > HISI_SDMA_CQ_SIZE) { - pr_err("sdma mmap size exceed cqe range\n"); + if (size > cq_max_size) { + pr_err("SDMA mmap size exceed cqe range\n"); return -EINVAL; } return HISI_SDMA_MMAP_CQE; } else if (offset < chn_num * HISI_SDMA_MMAP_SHMEM) { - if (mode == HISI_SDMA_SAFE_MODE || size > HISI_SDMA_REG_SIZE) { - pr_err("sdma not support io reg mmap\n"); + if (mode == HISI_SDMA_SAFE_MODE || size > reg_max_size) { + pr_err("SDMA not support io reg mmap\n"); return -EINVAL; } return HISI_SDMA_MMAP_IO; } else { if (size > sync_size) { - pr_err("sdma mmap size exceed share mem range\n"); + pr_err("SDMA mmap size exceed share mem range\n"); return -EINVAL; } return HISI_SDMA_MMAP_SHMEM; @@ -1565,7 +1575,7 @@ static int remap_addr_range(u32 chn_num, u64 offset, u64 size, struct hisi_sdma_ static int sdma_vma_remap(struct vm_area_struct *vma) { - pr_err("sdma vma remap not supported!\n"); + pr_err("SDMA vma remap not supported!\n"); return -EINVAL; } @@ -1591,7 +1601,7 @@ static int sdma_dev_mmap(struct file *file, struct vm_area_struct *vma) vma->vm_ops = &sdma_vm_ops; vma->vm_flags |= VM_DONTEXPAND | VM_WIPEONFORK | VM_DONTCOPY | VM_IO; - dev_dbg(dev, "sdma total channel num = %u, user mmap offset = 0x%llx", chn_num, offset); + dev_dbg(dev, "SDMA total channel num = %u, user mmap offset = 0x%llx", chn_num, offset); switch (remap_addr_range(chn_num, offset, size, chn_base, data->ida)) { case HISI_SDMA_MMAP_SQE: pchan = chn_base + offset; @@ -1623,7 +1633,7 @@ static int sdma_dev_mmap(struct file *file, struct vm_area_struct *vma) return -EINVAL; } if (ret) - dev_err(dev, "sdma mmap failed!\n"); + dev_err(dev, "SDMA mmap failed!\n"); return ret; } diff --git a/drivers/misc/sdma-dae/sdma_dbg.c b/drivers/misc/sdma-dae/sdma_dbg.c index eb090c6b40f797158859c831781c74032f401452..dbd361f09a141d8800df2584cb90c94e1556c5fa 100644 --- a/drivers/misc/sdma-dae/sdma_dbg.c +++ b/drivers/misc/sdma-dae/sdma_dbg.c @@ -68,7 +68,7 @@ static void sdma_scan_channel_status(struct seq_file *f, struct hisi_sdma_device seq_puts(f, "pause! maybe reusable after module reset\n"); } } - seq_printf(f, "\nSDMA[%u] has %u share_chn usable, %u exclusive_chn unusable\n", + seq_printf(f, "\nSDMA[%u] has %u share_chn usable, %u exclusive_chn usable\n", psdma_dev->idx, available_share_chn_num, available_exclusive_chn_num); split_line(f); } diff --git a/drivers/misc/sdma-dae/sdma_irq.c b/drivers/misc/sdma-dae/sdma_irq.c index 3ab70780618cf7aaf2a642c14729d3615d360d85..ad4c588758fc4b217d6f88475aed9da41e105f98 100644 --- a/drivers/misc/sdma-dae/sdma_irq.c +++ b/drivers/misc/sdma-dae/sdma_irq.c @@ -46,7 +46,7 @@ irqreturn_t sdma_chn_ioe_irq_handle(int irq, void *psdma_dev) sdma_channel_clear_cqe_status(sdma->io_base + chn * HISI_SDMA_CHANNEL_IOMEM_SIZE); spin_unlock(&err_set_lock[chn]); - dev_info(&sdma->pdev->dev, "sdma chn[%d], sqe[%u] error status = %u, ioe clear\n", + dev_info(&sdma->pdev->dev, "SDMA chn[%d], sqe[%u] error status = %u, ioe clear\n", chn, cqe_sqeid, err_status); return IRQ_HANDLED; @@ -72,7 +72,7 @@ int sdma_irq_init(struct hisi_sdma_device *sdma) for (i = 0; i < irq_cnt; i++) { vir_irq = platform_get_irq(pdev, i); if (vir_irq < 0) { - dev_err(&pdev->dev, "get vir_irq[idx:%u] failed:%d!\n", i, vir_irq); + dev_err(&pdev->dev, "Get vir_irq[idx:%u] failed:%d!\n", i, vir_irq); sdma->irq[i] = -1; continue; } @@ -86,7 +86,7 @@ int sdma_irq_init(struct hisi_sdma_device *sdma) ret = devm_request_irq(&sdma->pdev->dev, sdma->irq[i], sdma_chn_ioe_irq_handle, IRQF_ONESHOT, HISI_SDMA_IRQ_FUNC_NAME, sdma); if (ret != 0) { - dev_err(&pdev->dev, "request_irq failed, ret=%d", ret); + dev_err(&pdev->dev, "Request_irq failed, ret=%d", ret); return ret; } } diff --git a/drivers/misc/sdma-dae/sdma_main.c b/drivers/misc/sdma-dae/sdma_main.c index 8b4d330e15eba65539bfb633f54c481b4cef6a32..81558862ded895ce4878e782d42c996e1614fec8 100644 --- a/drivers/misc/sdma-dae/sdma_main.c +++ b/drivers/misc/sdma-dae/sdma_main.c @@ -19,7 +19,7 @@ #define BASE_DIR "sdma" /* Subdir in /sys/kernel/debug/ */ #define UPPER_SHIFT 32 #define MAX_INPUT_LENGTH 128 -#define SDMA_VERSION "1.0.3" +#define SDMA_VERSION "1.0.4" u32 share_chns = 16; module_param(share_chns, uint, RW_R_R); @@ -46,21 +46,21 @@ static bool sdma_channel_alloc_sq_cq(struct hisi_sdma_channel *pchan, u32 idx) } page_list = alloc_pages_node(idx, GFP_KERNEL | __GFP_ZERO, get_order(HISI_SDMA_SQ_SIZE)); if (!page_list) { - pr_err("sdma channel%u: alloc sq page_list failed\n", pchan->idx); + pr_err("SDMA channel%u: alloc sq page_list failed\n", pchan->idx); return false; } pchan->sq_base = (struct hisi_sdma_sq_entry *)page_to_virt(page_list); page_list = alloc_pages_node(idx, GFP_KERNEL | __GFP_ZERO, get_order(HISI_SDMA_CQ_SIZE)); if (!page_list) { - pr_err("sdma channel%u: alloc cq page_list failed\n", pchan->idx); + pr_err("SDMA channel%u: alloc cq page_list failed\n", pchan->idx); return false; } pchan->cq_base = (struct hisi_sdma_cq_entry *)page_to_virt(page_list); page_list = alloc_pages_node(idx, GFP_KERNEL | __GFP_ZERO, get_order(sync_size)); if (!page_list) { - pr_err("sdma channel%u: alloc sync_info page_list failed\n", pchan->idx); + pr_err("SDMA channel%u: alloc sync_info page_list failed\n", pchan->idx); return false; } pchan->sync_info_base = (struct hisi_sdma_queue_info *)page_to_virt(page_list); @@ -115,7 +115,7 @@ static void sdma_channel_reset(struct hisi_sdma_channel *pchan) while (!sdma_channel_is_paused(pchan)) { msleep(HISI_SDMA_FSM_INTERVAL); if (++i > HISI_SDMA_FSM_TIMEOUT) { - pr_warn("chn%u cannot get paused\n", pchan->idx); + pr_warn("Chn%u cannot get paused\n", pchan->idx); return; } } @@ -123,7 +123,7 @@ static void sdma_channel_reset(struct hisi_sdma_channel *pchan) while (!sdma_channel_is_quiescent(pchan)) { msleep(HISI_SDMA_FSM_INTERVAL); if (++i > HISI_SDMA_FSM_TIMEOUT) { - pr_warn("chn%u cannot get quiescent\n", pchan->idx); + pr_warn("Chn%u cannot get quiescent\n", pchan->idx); return; } } @@ -132,7 +132,7 @@ static void sdma_channel_reset(struct hisi_sdma_channel *pchan) while (!sdma_channel_is_idle(pchan)) { msleep(HISI_SDMA_FSM_INTERVAL); if (++i > HISI_SDMA_FSM_TIMEOUT) { - pr_warn("chn%u cannot get idle\n", pchan->idx); + pr_warn("Chn%u cannot get idle\n", pchan->idx); return; } } @@ -204,7 +204,7 @@ static int sdma_init_channels(struct hisi_sdma_device *psdma_dev) } if (share_chns > chn_num) { - dev_warn(&psdma_dev->pdev->dev, "share_chns max val = %u!\n", chn_num); + dev_warn(&psdma_dev->pdev->dev, "Share_chns max val = %u!\n", chn_num); share_chns = chn_num; } bitmap_set(psdma_dev->channel_map, 0, chn_num - share_chns); @@ -245,7 +245,7 @@ static int sdma_device_add(struct hisi_sdma_device *psdma_dev) if (IS_ERR(device_create(sdma_class, NULL, devno, NULL, "sdma%u", idx))) { spin_unlock(&hisi_sdma_core_device.device_lock); - dev_err(&psdma_dev->pdev->dev, "device_create failed\n"); + dev_err(&psdma_dev->pdev->dev, "Device_create failed\n"); cdev_del(cdev); return -ENODEV; } @@ -275,26 +275,26 @@ static int of_sdma_collect_info(struct platform_device *pdev, struct hisi_sdma_d res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (res == NULL) { - dev_err(&pdev->dev, "get io_base info from dtb failed\n"); + dev_err(&pdev->dev, "Get io_base info from dtb failed\n"); return -ENOMEM; } psdma_dev->base_addr = res->start; psdma_dev->base_addr_size = resource_size(res); if (psdma_dev->base_addr_size < psdma_dev->nr_channel * HISI_SDMA_CHANNEL_IOMEM_SIZE || psdma_dev->base_addr_size > HISI_SDMA_MAX_BASE_ADDR_SIZE) { - dev_err(&pdev->dev, "io reg size wrong!\n"); + dev_err(&pdev->dev, "IO reg size wrong!\n"); return -EFAULT; } res = platform_get_resource(pdev, IORESOURCE_MEM, 1); if (res == NULL) { - dev_err(&pdev->dev, "get common reg info from dtb failed\n"); + dev_err(&pdev->dev, "Get common reg info from dtb failed\n"); return -ENOMEM; } psdma_dev->common_base_addr = res->start; psdma_dev->common_base_addr_size = resource_size(res); if (psdma_dev->common_base_addr_size != HISI_SDMA_MAX_COMMEN_BASE_ADDR_SIZE) { - dev_err(&pdev->dev, "global io reg size wrong!\n"); + dev_err(&pdev->dev, "Global io reg size wrong!\n"); return -EFAULT; } @@ -303,7 +303,7 @@ static int of_sdma_collect_info(struct platform_device *pdev, struct hisi_sdma_d dev_err(&pdev->dev, "Get irq_cnt failed!\n"); return -EINVAL; } - dev_dbg(&pdev->dev, "get irq_cnt:%d\n", psdma_dev->irq_cnt); + dev_dbg(&pdev->dev, "Get irq_cnt:%d\n", psdma_dev->irq_cnt); return 0; } @@ -333,7 +333,7 @@ static int sdma_init_device_info(struct hisi_sdma_device *psdma_dev) psdma_dev->io_orig_base = ioremap(psdma_dev->base_addr, psdma_dev->base_addr_size); if (!psdma_dev->io_orig_base) { - dev_err(&psdma_dev->pdev->dev, "remap io reg failed!\n"); + dev_err(&psdma_dev->pdev->dev, "Remap io reg failed!\n"); return -EFAULT; } @@ -341,7 +341,7 @@ static int sdma_init_device_info(struct hisi_sdma_device *psdma_dev) psdma_dev->common_base_addr_size); if (!psdma_dev->common_base) { iounmap(psdma_dev->io_orig_base); - dev_err(&psdma_dev->pdev->dev, "remap io common base failed!\n"); + dev_err(&psdma_dev->pdev->dev, "Remap io common base failed!\n"); return -EFAULT; } psdma_dev->io_base = psdma_dev->io_orig_base + HISI_SDMA_CH_OFFSET; @@ -377,13 +377,13 @@ static int sdma_smmu_enable(struct device *dev) ret = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_IOPF); if (ret) { - dev_err(dev, "failed to enable IOPF feature! ret = %d\n", ret); + dev_err(dev, "Failed to enable IOPF feature! ret = %d\n", ret); return ret; } ret = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA); if (ret) { - dev_err(dev, "failed to enable SVA feature! ret = %d\n", ret); + dev_err(dev, "Failed to enable SVA feature! ret = %d\n", ret); iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_IOPF); return ret; } @@ -400,7 +400,7 @@ static int sdma_device_probe(struct platform_device *pdev) device_num = hisi_sdma_core_device.sdma_device_num; if (!node_online(pdev->dev.numa_node)) { - pr_info("numa_node %d not online, register sdma%u failed\n", pdev->dev.numa_node, + pr_info("Numa_node %d not online, register sdma%u failed\n", pdev->dev.numa_node, device_num); node_id = 0; } else @@ -421,7 +421,7 @@ static int sdma_device_probe(struct platform_device *pdev) ret = of_sdma_collect_info(pdev, psdma_dev); if (ret < 0) { - dev_err(&psdma_dev->pdev->dev, "collect device info failed, %d\n", ret); + dev_err(&psdma_dev->pdev->dev, "Collect device info failed, %d\n", ret); goto free_dev; } @@ -442,7 +442,7 @@ static int sdma_device_probe(struct platform_device *pdev) if (ret) goto sva_device_shutdown; - dev_info(&pdev->dev, "sdma%u registered\n", psdma_dev->idx); + dev_info(&pdev->dev, "SDMA%u registered\n", psdma_dev->idx); return 0; @@ -467,7 +467,7 @@ static int sdma_device_remove(struct platform_device *pdev) iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_SVA); iommu_dev_disable_feature(&pdev->dev, IOMMU_DEV_FEAT_IOPF); sdma_deinit_device_info(psdma_dev); - dev_info(&pdev->dev, "sdma%u removed\n", psdma_dev->idx); + dev_info(&pdev->dev, "SDMA%u removed\n", psdma_dev->idx); kfree(psdma_dev); @@ -532,13 +532,13 @@ static int __init sdma_driver_init(void) sdma_class = class_create(THIS_MODULE, "sdma"); if (IS_ERR(sdma_class)) { - pr_err("class_create() failed for sdma_class: %ld\n", PTR_ERR(sdma_class)); + pr_err("Class_create() failed for sdma_class: %ld\n", PTR_ERR(sdma_class)); goto destroy_ida; } sdma_class->devnode = sdma_devnode; ret = alloc_chrdev_region(&sdma_dev, 0, HISI_SDMA_MAX_DEVS, "sdma"); if (ret < 0) { - pr_err("alloc_chrdev_region() failed for sdma\n"); + pr_err("Alloc_chrdev_region() failed for sdma\n"); goto destroy_class; } spin_lock_init(&hisi_sdma_core_device.device_lock); @@ -549,17 +549,17 @@ static int __init sdma_driver_init(void) ret = platform_driver_register(&sdma_driver); if (ret) { - pr_err("sdma platform_driver_register failed!\n"); + pr_err("SDMA platform_driver_register failed!\n"); goto remove_debugfs; } if (sdma_hash_init()) { - pr_err("sdma_hash alloc failed!\n"); + pr_err("SDMA hash alloc failed!\n"); goto unregister_driver; } if (sdma_authority_hash_init()) { - pr_err("sdma_authority_hash alloc failed!\n"); + pr_err("SDMA authority_hash alloc failed!\n"); goto umem_hash_free; } diff --git a/drivers/misc/sdma-dae/sdma_umem.c b/drivers/misc/sdma-dae/sdma_umem.c index 74293e692931554210d841f4eb9b3ae1f969cb8d..e63fc19d5713b05f0d0d88a74daa09ceb7679404 100644 --- a/drivers/misc/sdma-dae/sdma_umem.c +++ b/drivers/misc/sdma-dae/sdma_umem.c @@ -34,7 +34,7 @@ static int region_cleanup(int id, void *p, void *data) struct pin_mem *pmem = p; WARN_ON(pmem->idr != id); - pr_debug("%s: free region idr = %d\n", __func__, id); + pr_debug("Function %s: free region idr = %d\n", __func__, id); free_region(pmem->list_head); kfree(pmem->list_head); kfree(p); @@ -67,7 +67,7 @@ void sdma_hash_free_entry(int key) struct hash_entry *entry; struct hlist_node *node_tmp; - pr_debug("%s: free ida %d\n", __func__, key); + pr_debug("Function %s: free ida %d\n", __func__, key); spin_lock(&g_hash_table->hash_lock); hash_for_each_possible_safe(g_hash_table->sdma_fd_ht, entry, node_tmp, node, key) @@ -115,7 +115,7 @@ static int record_umem(u64 addr, struct list_head *list_head, int ida, u64 *cook if (!entry) { ret = -ENOMEM; spin_unlock(&g_hash_table->hash_lock); - pr_err("Sdma failed to alloc hash_entry!\n"); + pr_err("SDMA failed to alloc hash_entry!\n"); goto free_pmem; } entry_find = false; @@ -130,7 +130,7 @@ static int record_umem(u64 addr, struct list_head *list_head, int ida, u64 *cook if (entry_find == false) hash_del(&entry->node); spin_unlock(&g_hash_table->hash_lock); - pr_err("Sdma failed to alloc idr!\n"); + pr_err("SDMA failed to alloc idr!\n"); if (entry_find) goto free_pmem; else @@ -140,7 +140,7 @@ static int record_umem(u64 addr, struct list_head *list_head, int ida, u64 *cook pmem->idr = idr; spin_unlock(&g_hash_table->hash_lock); *cookie = ((u64)ida << COOKIE_IDA_SHIFT) + idr; - pr_debug("record addr: ida = %d, idr = %d\n", ida, idr); + pr_debug("Record addr: ida = %d, idr = %d\n", ida, idr); return 0; @@ -166,17 +166,17 @@ static int pin_umem(u64 addr, int npages, struct list_head *p_head) page_list = (struct page **)(uintptr_t)__get_free_pages(GFP_KERNEL, get_order(to_pin_pages * sizeof(struct page *))); if (!page_list) { - pr_err("Sdma failed to alloc page list!\n"); + pr_err("SDMA failed to alloc page list!\n"); return -ENOMEM; } pinned = pin_user_pages_fast(pin_addr, to_pin_pages, FOLL_WRITE, page_list); if (pinned < 0) { - pr_err("Sdma failed to pin user pages!\n"); + pr_err("SDMA failed to pin user pages!\n"); ret = pinned; goto free_pages; } else if (pinned != to_pin_pages) { - pr_err("Invalid number of pages. Sdma pinned %d pages, expect %d pages\n", + pr_err("Invalid number of pages. SDMA pinned %d pages, expect %d pages\n", pinned, to_pin_pages); ret = -EINVAL; goto unpin_page; @@ -213,7 +213,7 @@ int sdma_umem_get(u64 addr, u32 size, int ida, u64 *cookie) /* Check overflow */ if (((addr + size) < addr) || PAGE_ALIGN(addr + size) < (addr + size)) { - pr_err("Sdma input size is overflow!\n"); + pr_err("SDMA input size is overflow!\n"); return -EINVAL; } @@ -225,7 +225,7 @@ int sdma_umem_get(u64 addr, u32 size, int ida, u64 *cookie) npages = (PAGE_ALIGN(addr + size) - ALIGN_DOWN(addr, PAGE_SIZE)) / PAGE_SIZE; ret = pin_umem(addr, npages, p_head); if (ret != 0) { - pr_err("Sdma failed to pin_umem\n"); + pr_err("SDMA failed to pin_umem\n"); free_region(p_head); kfree(p_head); return ret; @@ -233,7 +233,7 @@ int sdma_umem_get(u64 addr, u32 size, int ida, u64 *cookie) ret = record_umem(addr, p_head, ida, cookie); if (ret) { - pr_err("Sdma failed to record umem\n"); + pr_err("SDMA failed to record umem\n"); free_region(p_head); kfree(p_head); return ret; @@ -251,19 +251,19 @@ int sdma_umem_release(u64 cookie) fd_ida = (int)(cookie >> COOKIE_IDA_SHIFT); idr = (int)(cookie & COOKIE_IDA_MASK); - pr_debug("release addr: ida = %d, idr = %d\n", fd_ida, idr); + pr_debug("Release addr: ida = %d, idr = %d\n", fd_ida, idr); spin_lock(&g_hash_table->hash_lock); entry = hash_lookup_entry(fd_ida); if (!entry) { spin_unlock(&g_hash_table->hash_lock); - pr_err("Sdma cookie_ida is invalid!\n"); + pr_err("SDMA cookie_ida is invalid!\n"); return -EFAULT; } pmem = idr_find(&entry->pin_mem_region, idr); if (!pmem) { spin_unlock(&g_hash_table->hash_lock); - pr_err("Sdma cookie_idr is invalid!\n"); + pr_err("SDMA cookie_idr is invalid!\n"); return -EFAULT; }