Greetings all,
I've been asked to scope (and initially plan) a Linux driver
development effort and could really use some insight so I don't go
off the rails.
The Basics: The hardware is an embedded system with an Xscale
processor running at least Linux 2.6.18 and 512MB of private SDRAM.
(There are multiple CPUs but only this one will run Linux.) The
proposed driver is to support an IPC system that uses another 256MB
of shared SDRAM with an FPGA providing the SDRAM's memory controller
and what amounts to a malloc/free interface to it for each CPU.
Plan: We're considering each IPC connection to be a pair of circular
buffers containing "references" (I'm thinking of offsets from the
memory's base address) to buffers in the shared memory as the
foundation for the IPC system. A major goal is to allow references to
those buffers to be meaningful to all CPUs so we can pass them around
and not need to copy the data.
Each CPU will have this memory at some physical address and those
with MMUs would map that memory into virtual space. This mapping is
where I need to verify my thinking. I've mapped hardware like this
before but never so much.
-- Question 1 --
Will I be able to map a 256MB range of physical address space into a
256MB range of kernel virtual space such that the whole range remains
contiguous? What I mean is that I want Vbase+offset to refer to Pbase
+offset for all offsets in the 256MB range.
Is there something special I'd have to do when establishing the
mapping to request this level of physical contiguity?
-- Question 2 --
Given that this is the basis for a multi-CPU IPC system what steps do
I need to take to have the address range be non-cached? There no way
caching would work since there's no way for the other CPUs to
participate in a cache coherency or snooping protocol. (The CPUs are
not all the same architecture.)
-- Question 3 --
If my thinking above is OK then what would be the best approach to
allow that kernel virtual space (or perhaps only part of it) to also
be mapped into a sufficiently privileged user land process? Is mmap()
of /dev/mem appropriate or would that be a crude hack?
Further, that process would need to convert the buffer offsets into
usable VAs by adding them to the base VA of its mmap mapping. So I'd
need the 1:1 VA/PA address contiguity in the user land mapping too.
Is that possible?
-- Question 4 --
Can I do all the mapping and setup from my driver module or will I
need to add support directly to the kernel source (in addition to the
code needed in a module)? Obviously it would make version control
easier if it was module-only but if that's not going to work the
sooner I know this the better.
Thanks for any assistance and guidance if I'm off in the weeds.
-Mike
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ