Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Kernel driver and mmap from userspace

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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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 :-)

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!