diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2017-05-24 16:00:52 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-05-26 15:55:23 +1000 |
commit | 36ec8dd69028adaa1ad2dc5d6a84bba229032adf (patch) | |
tree | 066dd690d5f9fc09055a5411da7587dc6d46e2f0 /core/mem_region.c | |
parent | 0039819f46e71a2f549b7a418dc5440fb04156b6 (diff) | |
download | skiboot-36ec8dd69028adaa1ad2dc5d6a84bba229032adf.zip skiboot-36ec8dd69028adaa1ad2dc5d6a84bba229032adf.tar.gz skiboot-36ec8dd69028adaa1ad2dc5d6a84bba229032adf.tar.bz2 |
mem_region: Add HW-only memory resevations
Add a new type of memory reservation that indicates a memory region is
only used by hardware and should not be touched by software. This is
needed for the in-memory tracing buffers. These reservations have the
"no-map" property which indicates that the host kernel should not setup
any virtual address mappings that cover this range, unless of course a
device driver does so explicitly.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/mem_region.c')
-rw-r--r-- | core/mem_region.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/core/mem_region.c b/core/mem_region.c index a8a92ff..ebca447 100644 --- a/core/mem_region.c +++ b/core/mem_region.c @@ -756,13 +756,14 @@ static bool add_region(struct mem_region *region) return true; } -void mem_reserve_fw(const char *name, uint64_t start, uint64_t len) +static void mem_reserve(enum mem_region_type type, const char *name, + uint64_t start, uint64_t len) { struct mem_region *region; bool added = true; lock(&mem_region_lock); - region = new_region(name, start, len, NULL, REGION_FW_RESERVED); + region = new_region(name, start, len, NULL, type); assert(region); if (!mem_region_init_done) @@ -774,6 +775,16 @@ void mem_reserve_fw(const char *name, uint64_t start, uint64_t len) unlock(&mem_region_lock); } +void mem_reserve_fw(const char *name, uint64_t start, uint64_t len) +{ + mem_reserve(REGION_FW_RESERVED, name, start, len); +} + +void mem_reserve_hwbuf(const char *name, uint64_t start, uint64_t len) +{ + mem_reserve(REGION_RESERVED, name, start, len); +} + static bool matches_chip_id(const __be32 ids[], size_t num, u32 chip_id) { size_t i; @@ -1169,6 +1180,14 @@ static void mem_region_add_dt_reserved_node(struct dt_node *parent, region->node = dt_new_addr(parent, name, region->start); assert(region->node); dt_add_property_u64s(region->node, "reg", region->start, region->len); + + /* + * This memory is used by hardware and may need special handling. Ask + * the host kernel not to map it by default. + */ + if (region->type == REGION_RESERVED) + dt_add_property(region->node, "no-map", NULL, 0); + free(name); } |