How to copy memory from Kernel space straight to the GPU? (using gdrcopy)

I want to enable gdrcopy functionality in kernel space and copy memory from Kernel space straight to the GPU.

I realize I will need to Write a Kernel module, and allocate memory in the Kernel and the GPU and implement functions from gdrcopy. But am unsure how to tackle this process, any help would be great!

gdr_copy_to_bar(buf_ptr + copy_offset/4, init_buf, copy_size);

I believe I need to change the init_buf to a kmalloc memory location but dont know how to go about this or if it is possible.