• Lars-Peter Clausen's avatar
    regmap: rbtree: Make cache_present bitmap per node · 3f4ff561
    Lars-Peter Clausen authored
    With devices which have a dense and small register map but placed at a large
    offset the global cache_present bitmap imposes a huge memory overhead. Making
    the cache_present per rbtree node avoids the issue and easily reduces the memory
    footprint by a factor of ten. For devices with a more sparse map or without a
    large base register offset the memory usage might increase slightly by a few
    bytes, but not significantly. E.g. for a device which has ~50 registers at
    offset 0x4000 the memory footprint of the register cache goes down form 2496
    bytes to 175 bytes.
    
    Moving the bitmap to a per node basis means that the handling of the bitmap is
    now cache implementation specific and can no longer be managed by the core. The
    regcache_sync_block() function is extended by a additional parameter so that the
    cache implementation can tell the core which registers in the block are set and
    which are not. The parameter is optional and if NULL the core assumes that all
    registers are set. The rbtree cache also needs to implement its own drop
    callback instead of relying on the core to handle this.
    Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: default avatarMark Brown <broonie@linaro.org>
    3f4ff561
regcache.c 15.7 KB