vmbus: keep pointer to ring buffer page
Avoid going from struct page to virt address (and back) by just keeping pointer to the allocated pages instead of virt address. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
800b932969
commit
52a42c2a90
@@ -130,11 +130,12 @@ static int hv_uio_ring_mmap(struct file *filp, struct kobject *kobj,
|
||||
= container_of(kobj, struct vmbus_channel, kobj);
|
||||
struct hv_device *dev = channel->primary_channel->device_obj;
|
||||
u16 q_idx = channel->offermsg.offer.sub_channel_index;
|
||||
void *ring_buffer = page_address(channel->ringbuffer_page);
|
||||
|
||||
dev_dbg(&dev->device, "mmap channel %u pages %#lx at %#lx\n",
|
||||
q_idx, vma_pages(vma), vma->vm_pgoff);
|
||||
|
||||
return vm_iomap_memory(vma, virt_to_phys(channel->ringbuffer_pages),
|
||||
return vm_iomap_memory(vma, virt_to_phys(ring_buffer),
|
||||
channel->ringbuffer_pagecount << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
@@ -223,7 +224,7 @@ hv_uio_probe(struct hv_device *dev,
|
||||
/* mem resources */
|
||||
pdata->info.mem[TXRX_RING_MAP].name = "txrx_rings";
|
||||
pdata->info.mem[TXRX_RING_MAP].addr
|
||||
= (uintptr_t)dev->channel->ringbuffer_pages;
|
||||
= (uintptr_t)page_address(dev->channel->ringbuffer_page);
|
||||
pdata->info.mem[TXRX_RING_MAP].size
|
||||
= dev->channel->ringbuffer_pagecount << PAGE_SHIFT;
|
||||
pdata->info.mem[TXRX_RING_MAP].memtype = UIO_MEM_LOGICAL;
|
||||
|
Reference in New Issue
Block a user