linux-device-driver

Linux Interrupt Handling

谁说胖子不能爱 提交于 2019-12-22 13:49:46
问题 I am trying to understand the Linux interrupt handling mechanism. I tried googling a bit but couldn't find an answer to this one. Can someone please explain it to me why the handle_IRQ_event needs to call local_irq_disable at the end? After this the control goes back to do_irq which eventually will go back to the entry point. Then who will enable the interrupts back.? It is the responsibility of the interrupt handler? If so why is that so? Edit Code for reference asmlinkage int handle_IRQ

How do “pinned” pages in Linux present (or actually “pin”) themselves

半城伤御伤魂 提交于 2019-12-22 08:57:13
问题 I am using get_user_pages in a Linux kernel driver to pin memory for the purposes of [hardware] DMA. It all seems to work fine - but I am having a hard time proving that the "pinning" is doing the proper thing. When I inspect the flags on the physical pages after doing get_user_pages - the pages don't appear "locked" (as one might think they should be). In fact, I see no difference between the flags of otherwise "active" pages vs. those I have "pinned" via get_user_pages . The only difference

Overview/reference manual for Open Firmware Device Trees

六眼飞鱼酱① 提交于 2019-12-22 06:04:44
问题 I am trying to setup a driver for an embedded PowerPC board, and the correct way to do this today is to use the OpenFirmware Device Tree datastructure (the .dtb file, compiled from a .dts file). Creating a tree is pretty easy, but how do I get my device driver to find its node and the data in it? I have not managed to find any good reference on this, and books like "Linux Device Drivers" are too much into x86 land to be of much help for device trees that mostly pertain to Power Architecture

Overview/reference manual for Open Firmware Device Trees

こ雲淡風輕ζ 提交于 2019-12-22 06:03:05
问题 I am trying to setup a driver for an embedded PowerPC board, and the correct way to do this today is to use the OpenFirmware Device Tree datastructure (the .dtb file, compiled from a .dts file). Creating a tree is pretty easy, but how do I get my device driver to find its node and the data in it? I have not managed to find any good reference on this, and books like "Linux Device Drivers" are too much into x86 land to be of much help for device trees that mostly pertain to Power Architecture

Can someone help me replace “lock_kernel” on a block device driver?

*爱你&永不变心* 提交于 2019-12-22 05:21:57
问题 Thank you for looking at this post. I am trying to patch up a network block device driver. If you need to see the sources they are at http : / / code.ximeta.com. I noticed that lock_kernel() seems deprecated as of linux 2.6.37. I read "The new way of ioctl()" and found that device drivers now should perform a specific lock before operating. So I would like some advice replacing this if possible. I have found two sections in the current code that I think are related, in the block folder

What are coding conventions for using floating-point in Linux device drivers?

两盒软妹~` 提交于 2019-12-22 03:22:41
问题 This is related to this question. I'm not an expert on Linux device drivers or kernel modules, but I've been reading "Linux Device Drivers" [O'Reilly] by Rubini & Corbet and a number of online sources, but I haven't been able to find anything on this specific issue yet. When is a kernel or driver module allowed to use floating-point registers? If so, who is responsible for saving and restoring their contents? (Assume x86-64 architecture) If I understand correctly, whenever a KM is running, it

Using stdlib.h within a device driver

心不动则不痛 提交于 2019-12-21 23:19:10
问题 I am trying to write a device driver and I need to use system() function in the driver. To use system() we need to include <stdlib.h> , which dosnt seem to work from a driver. It says no such file or directory found. Is there an alternative to stdlib.h for device drivers? Or an alternative to system() ? 回答1: stdlib.h is a user space header. User space is that set of memory locations in which user processes (i.e., everything other than the kernel) run. A process is an executing instance of a

Reading from a block device in kernel space

我怕爱的太早我们不能终老 提交于 2019-12-21 22:25:50
问题 I am writing a kernel module and need to perform reads from an existing block device. (/dev/something). Does anyone know of any other modules that do these that I can use as reference ? Any pointers would be welcome (Linux.2.6.30) 回答1: If you really absolutely must then use the filp_open , filp_close , vfs_read and vfs_write functions. The description for for filp_open states "This is the helper to open a file from kernelspace if you really have to. But in generally you should not do this, so

Built-in kernel driver still need device tree?

回眸只為那壹抹淺笑 提交于 2019-12-21 21:41:59
问题 If I build a kernel driver as a module , it can be inserted into the kernel at run-time manually with insmod or modprobe, that i am clear. But are the following statements about device tree, correct? If I build a kernel driver as a module it will be auto inserted into the kernel at boot time, depending on whether it is listed in device tree or not If I build a kernel driver as a built-in , it will be auto inserted into kernel at boot time regardless of device tree 回答1: Built-in kernel driver

Linux device driver unsafe FXSAVE/FXRSTOR bug — any precedents?

你离开我真会死。 提交于 2019-12-21 20:34:59
问题 There's a nasty problem that has temporarily stumped a number of engineers at my company trying to debug it. The C++ program is normally run on a cluster of multicore computers with MPI. It will run for a very long time -- perhaps days -- and then suddenly fail. Most of engineers working on it have eliminated any reasonable possibility of a bug in the program itself, so they're starting to assign blame to a possible hardware problem, but I suspect there must be a software problem in either a