ASPM makes Spartan-6′s PCIe core miss TLP packets

The fatal error Let’s break the bad news: Spartan-6′s PCIe core may drop TLP packets sporadically when ASPM (Active State Power Management) is enabled. That means that any TLP given to the core for transmission can silently disappear, as if it was never submitted. I also suspect that the problem exists in the opposite direction. [...]

Linux character driver: What if flush() data has nowhere to go?

I know that most character drivers don’t implement the flush() method, and the more I deal with it, the more I understand why. But unfortunately, in certain modes of operation flushing is necessary, so I implemented it. One of the problems with flush() is that it’s called when the file is closed automatically as the [...]

Compiling a kernel module after “make clean” on the sources.

The textbook says, that if one wants to compile a module against a kernel, the headers must be there. Those who run distribution kernels are urged to apt-get or yum-install something, and their trouble is over. People like me, who cook their own food and download vanilla kernels, need to handle this themselves. In the [...]

Workaround: Pending signal making wait_event_interruptible() return prematurely

It all starts with this: I’m not ready to return from my character device’s release() method before I know that the underlying hardware has acknowledged the shutdown. It is actually expected to do so quickly, so I relied on a wait_event_interruptible() call within the release method to do the short wait for the acknowledge. And [...]

PCI express from a Xilinx/Altera FPGA to a Linux machine: Making it easy

Update: The project is up and running, available for a large range of FPGAs. Click here to visit its home page. Over the years in which I’ve worked on FPGA projects, I’ve always been frustrated by the difficulty of communicating with a PC. Or an embedded processor running a decent operating system, for that matter. [...]

Random notes as I wrote a PCI kernel module

These are a bunch of things I jotted down as I wrote a Linux kernel module for a PCI express peripheral I developed. About kernel module Makefiles A great guide here. lspci and setpci lspci is quite well-known. What is less known, is that it can be used to get the tree structure of bridges [...]

frandom

Frandom is a Linux kernel random number generator, which is 10-50 times faster than what you get from Linux’ built-in /dev/urandom. And it uses very little (/dev/frandom) or none (/dev/erandom) of the kernel’s entropy pool, so it is very useful for applications that require a handy source for lots of random data. Its most common [...]