How to allocate memory and get the physical address in kernel
Hi, I am developing a kernel driver. I need to allocate buffer in the kernel driver and pass the physical address of the buffer to the Chip register so that it can generate output there. I tried using kmalloc() but I don' get any output from the chip. Is there a better way to achieve what I want?
On Wed, Feb 5, 2014 at 6:26 PM, m silverstri <michael.j.silverstri@gmail.com> wrote:
Hi,
I am developing a kernel driver. I need to allocate buffer in the kernel driver and pass the physical address of the buffer to the Chip register so that it can generate output there. Can you elaborate more here?
I tried using kmalloc() but I don' get any output from the chip. How is kmalloc related to output of the chip?
Is there a better way to achieve what I want? You are not clear what you want to achieve.Best is to post your code here so people here knows what you want to achieve.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On 2/6/14, m silverstri <michael.j.silverstri@gmail.com> wrote:
Hi,
I am developing a kernel driver. I need to allocate buffer in the kernel driver and pass the physical address of the buffer to the Chip register so that it can generate output there.
I tried using kmalloc() but I don' get any output from the chip.
kmalloc should be good enough. Just in what context you use it matters. If it's interrupt mode then do check for failure when using GFP_ATOMIC.
Is there a better way to achieve what I want?
Several others are there, but really depends on your need. If you can, try and paste some pseudo code to let us understand issue you have. If you are facing some oops paste the log.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
---P.K.S -- Pranay Srivastava
Hi Silverstri, On Thu, Feb 6, 2014 at 7:56 AM, m silverstri <michael.j.silverstri@gmail.com
wrote:
Hi,
I am developing a kernel driver. I need to allocate buffer in the kernel driver and pass the physical address of the buffer to the Chip register so that it can generate output there.
I tried using kmalloc() but I don' get any output from the chip.
If your device is not having an iommu, you need to convert the address returned by kmalloc using __pa(addr) before you program the chip. Thanks, Arun
Is there a better way to achieve what I want?
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (4)
-
anish singh -
Arun KS -
m silverstri -
Pranay Srivastava