RFC: inlining device register accesses

From: Enrico Weigelt
Date: Fri Jun 29 2018 - 10:51:12 EST


Hi folks,

I've got a weird idea, that I'd like to hear your oppinion about:

In drivers we have lots of cases, where things like register accesses
sometimes (on specific boards+cpus) *could* be done by direct memory
access, while many times we need more complex operations, like talking
to an I2C controller. Certainly, we dont wanna have lots of different
bus-specific code pathes in the drivers - same issue as why regmap
has been invented.

Maybe we could declare the actual register access in a more abstract
way (macros ? dsl ?), so under the hood different code pathes can be
generated and picked dynamically via kprobes-alike approach. If the
device happens to be directly cpu-accessible, ops for direct memory
access are inserted, otherwise appropriate function calls. Or maybe
the bpf jit somehow could be abused for that ?


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@xxxxxxxxx -- +49-151-27565287