Lines Matching refs:smpt_info
81 struct mic_smpt_info *smpt_info = mdev->smpt; in mic_add_smpt_entry() local
85 addr += smpt_info->info.page_size) { in mic_add_smpt_entry()
86 if (!smpt_info->entry[i].ref_count && in mic_add_smpt_entry()
87 (smpt_info->entry[i].dma_addr != addr)) { in mic_add_smpt_entry()
89 smpt_info->entry[i].dma_addr = addr; in mic_add_smpt_entry()
91 smpt_info->entry[i].ref_count += ref[i - spt]; in mic_add_smpt_entry()
108 struct mic_smpt_info *smpt_info = mdev->smpt; in mic_smpt_op() local
110 spin_lock_irqsave(&smpt_info->smpt_lock, flags); in mic_smpt_op()
113 for (i = 0; i < smpt_info->info.num_reg; i++) { in mic_smpt_op()
114 if (smpt_info->entry[i].dma_addr == addr) { in mic_smpt_op()
116 addr += smpt_info->info.page_size; in mic_smpt_op()
125 for (ae = 0, i = 0; i < smpt_info->info.num_reg; i++) { in mic_smpt_op()
126 ae = (smpt_info->entry[i].ref_count == 0) ? ae + 1 : 0; in mic_smpt_op()
132 spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); in mic_smpt_op()
139 smpt_info->map_count++; in mic_smpt_op()
140 smpt_info->ref_count += (s64)size; in mic_smpt_op()
141 spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); in mic_smpt_op()
179 struct mic_smpt_info *smpt_info = mdev->smpt; in mic_to_dma_addr() local
189 dma_addr = smpt_info->entry[spt].dma_addr + in mic_to_dma_addr()
256 struct mic_smpt_info *smpt_info = mdev->smpt; in mic_unmap() local
280 spin_lock_irqsave(&smpt_info->smpt_lock, flags); in mic_unmap()
281 smpt_info->unmap_count++; in mic_unmap()
282 smpt_info->ref_count -= (s64)size; in mic_unmap()
285 smpt_info->entry[i].ref_count -= ref[i - spt]; in mic_unmap()
286 if (smpt_info->entry[i].ref_count < 0) in mic_unmap()
290 spin_unlock_irqrestore(&smpt_info->smpt_lock, flags); in mic_unmap()
358 struct mic_smpt_info *smpt_info; in mic_smpt_init() local
364 smpt_info = mdev->smpt; in mic_smpt_init()
366 smpt_info->entry = kmalloc_array(smpt_info->info.num_reg, in mic_smpt_init()
367 sizeof(*smpt_info->entry), GFP_KERNEL); in mic_smpt_init()
368 if (!smpt_info->entry) { in mic_smpt_init()
372 spin_lock_init(&smpt_info->smpt_lock); in mic_smpt_init()
373 for (i = 0; i < smpt_info->info.num_reg; i++) { in mic_smpt_init()
374 dma_addr = i * smpt_info->info.page_size; in mic_smpt_init()
375 smpt_info->entry[i].dma_addr = dma_addr; in mic_smpt_init()
376 smpt_info->entry[i].ref_count = 0; in mic_smpt_init()
379 smpt_info->ref_count = 0; in mic_smpt_init()
380 smpt_info->map_count = 0; in mic_smpt_init()
381 smpt_info->unmap_count = 0; in mic_smpt_init()
384 kfree(smpt_info); in mic_smpt_init()
397 struct mic_smpt_info *smpt_info = mdev->smpt; in mic_smpt_uninit() local
402 mdev->id, smpt_info->ref_count, in mic_smpt_uninit()
403 smpt_info->map_count, smpt_info->unmap_count); in mic_smpt_uninit()
405 for (i = 0; i < smpt_info->info.num_reg; i++) { in mic_smpt_uninit()
408 i, smpt_info->entry[i].dma_addr, in mic_smpt_uninit()
409 smpt_info->entry[i].ref_count); in mic_smpt_uninit()
410 if (smpt_info->entry[i].ref_count) in mic_smpt_uninit()
414 kfree(smpt_info->entry); in mic_smpt_uninit()
415 kfree(smpt_info); in mic_smpt_uninit()