On 15 September 2013 17:16, Marcel Apfelbaum <marce...@redhat.com> wrote: > Priority is used to make visible some subregions by obscuring > the parent MemoryRegion addresses overlapping with the subregion. > > By allowing the priority to be negative the opposite can be done: > Allow a subregion to be visible on all the addresses not covered > by the parent MemoryRegion or other subregions. > > Signed-off-by: Marcel Apfelbaum <marce...@redhat.com>
Codewise this looks good, so: Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> If you have to do a v5 for some reason it would be nice to: 1. update docs/memory.txt to say that priority is a signed value. Here's my suggested text from my comments on v2 of your patch (for adding to the 'Overlapping regions and priority' section): ====begin==== Priority values are signed, and the default value is zero. This means that you can use memory_region_add_subregion_overlap() both to specify a region that must sit 'above' any others (with a positive priority) and also a background region that sits 'below' others (with a negative priority). ====endit==== 2. improve the commit message so it doesn't imply that this is allowing us to do something previously impossible. (There is no difference between having a region at priority -1 and five at priority 0, versus one region at priority 0 and five at priority 1 -- it's merely more convenient to be able to create the five regions at default priority (0) and have one special case for the background region, rather than having to specify the priority explicitly for the five others.) I would suggest as a commit message: ===begin=== memory: Change MemoryRegion priorities from unsigned to signed When memory regions overlap, priority can be used to specify which of them takes priority. By making the priority values signed rather than unsigned, we make it more convenient to implement a situation where one "background" region should appear only where no other region exists: rather than having to explicitly specify a high priority for all the other regions, we can let them take the default (zero) priority and specify a negative priority for the background region. ===endit=== (I have read MST's followup suggested improved commit message and borrowed bits of it for this.) -- PMM