[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [v9][PATCH 07/16] hvmloader/e820: construct guest e820 table
On 2015/7/17 18:50, Jan Beulich wrote: On 17.07.15 at 11:09, <tiejun.chen@xxxxxxxxx> wrote:And then of course there's the question of whether "nr" is really the right upper loop bound here: Just prior to this you added the hypervisor supplied entries - why would you need to iterate over them here? I.e. I'd see this better be moved ahead of that other code.Sounds you mean I should sync low/high memory in memory_map.map[] beforehand and then fulfill e820 like this,Why would you want/need to sync into memory_map.map[]? But actually I just felt this make our process clear. That's certainly not what I suggested. Do you mean I should check low/high mem before we add the hypervisor supplied entries like this? + for ( i = nr-1; i > memory_map.nr_map; i-- ) + { + uint64_t end = e820[i].addr + e820[i].size; + + if ( e820[i].type == E820_RAM && + low_mem_end > e820[i].addr && low_mem_end < end ) + { + add_high_mem = end - low_mem_end; + e820[i].size = low_mem_end - e820[i].addr; + break; + } + } + + /* And then we also need to adjust highmem. */ + if ( add_high_mem ) + { + /* Modify the existing highmem region if it exists. */ + for ( i = nr-1 ; i > memory_map.nr_map; i-- ) + { + if ( e820[i].type == E820_RAM && + e820[i].addr == ((uint64_t)1 << 32)) + { + e820[i].size += add_high_mem; + break; + } + } + + /* If there was no highmem region, just create one. */ + if ( i == memory_map.nr_map ) + { + e820[nr].addr = ((uint64_t)1 << 32); + e820[nr].size = add_high_mem; + e820[nr].type = E820_RAM; + i = nr; + nr++; + } + + /* A sanity check if high memory is broken. */ + BUG_ON( high_mem_end != e820[i].addr + e820[i].size); + } Thanks Tiejun _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |