I'm allocating a buffer in my driver using devm_kzalloc(.., .., GFP_KERNEL) and then I register this buffer as a framebuffer driver so that it appears as a file under /dev/fb0. I can then open this file and write to it. When I do it this way, everything works fine and my data arrives in the driver memory buffer.
However, if I then mmap it in the user process like this: mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, 0), using the same file fd and try to write to the returned memory space, nothing gets written into the driver memory.
Am I forgetting something here?
Got it! I was doing it all wrong. I had to setup the vm system to correctly handle mmap and this had to be done using fb_deferred_io (which I did not even have until I enabled some unrelated drivers which selected it). Then I had to use __get_free_pages instead of devm_kzmalloc() and one last detail was to use __pa(vmem) when assigning the screen buffer pointer for fbdev subsystem. Then it started working :-)