mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
memory: add address_space_translate
Using phys_page_find to translate an AddressSpace to a MemoryRegionSection is unwieldy. It requires to pass the page index rather than the address, and later memory_region_section_addr has to be called. Replace memory_region_section_addr with a function that does all of it: call phys_page_find, compute the offset within the region, and check how big the current mapping is. This way, a large flat region can be written with a single lookup rather than a page at a time. address_space_translate will also provide a single point where IOMMU forwarding is implemented. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b018ddf633
commit
149f54b53b
5 changed files with 131 additions and 130 deletions
|
@ -1354,15 +1354,15 @@ void tb_invalidate_phys_addr(hwaddr addr)
|
|||
{
|
||||
ram_addr_t ram_addr;
|
||||
MemoryRegionSection *section;
|
||||
hwaddr l = 1;
|
||||
|
||||
section = phys_page_find(address_space_memory.dispatch,
|
||||
addr >> TARGET_PAGE_BITS);
|
||||
section = address_space_translate(&address_space_memory, addr, &addr, &l, false);
|
||||
if (!(memory_region_is_ram(section->mr)
|
||||
|| memory_region_is_romd(section->mr))) {
|
||||
return;
|
||||
}
|
||||
ram_addr = (memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK)
|
||||
+ memory_region_section_addr(section, addr);
|
||||
+ addr;
|
||||
tb_invalidate_phys_page_range(ram_addr, ram_addr + 1, 0);
|
||||
}
|
||||
#endif /* TARGET_HAS_ICE && !defined(CONFIG_USER_ONLY) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue