Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8513413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:33:41+00:00 2026-06-11T04:33:41+00:00

I am writing a device driver for a DMA device in Linux. In Linux

  • 0

I am writing a device driver for a DMA device in Linux. In Linux Device Drivers, Chapter 15, it says:

For devices with this kind of limitation, memory should be allocated
from the DMA zone by adding the GFP_DMA flag to the kmalloc or
get_free_pages call. When this flag is present, only memory that can
be addressed with 24 bits is allocated. Alternatively, you can use the
generic DMA layer (which we discuss shortly) to allocate buffers that
work around your device’s limitations

I am calling kmalloc like this:

physical_pointer0 = kmalloc(number_of_bytes, GFP_DMA);

and printing the result like this:

  printk(KERN_INFO "pinmem:pinmen_write kmalloc succeeded.  pointer is %p, buffer size is %d\n", physical_pointer0, (unsigned)number_of_bytes);

And this is what I see:

Sep  9 00:29:45 nfellman_lnx kernel: [  112.161744] pinmem:pinmen_write kmalloc succeeded.  pointer is ffff880000180000, buffer size is 320800

How can I be getting a pointer to 0xffff880000180000, which doesn’t fit in 24 bits, if I used GFP_DMA?

Could it be that this is not the physical address of my block of memory? If not (which would mean I’m completely misunderstanding kmalloc), how can I get its physical address?


I am working in OpenSuse 12.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:33:42+00:00Added an answer on June 11, 2026 at 4:33 am

    The answer to this appears to be that kmalloc doesn’t in fact return a physical pointer, but rather a linear pointer, that I must convert to physical with virt_to_phys.

    Thanks to Alex Brown for providing the answer here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a kernel object (.ko file, which is usually device driver) of Linux.
I'm learning about the blocking I/O functions for writing linux device driver and I'm
I'm new in writing Linux device driver, and I'm wondering how the kernel Makefile
I'm writing a device driver to access the memory in a FPGA on a
I'm writing a device driver that, among other things, allocates a block of memory
Introduction I heard something about writing device drivers in Java (heard as in with
I'm writing a device driver that is loaded by a 3rd-party driver. I need
I'm writing a driver and I want to get network counters of some device
I'm writing a linux kernel module that emulates a block device. There are various
I am writing a RFID device driver and encounter an compiling error below: [root@localhost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.