mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
roms: Flush icache when writing roms to guest memory
We use the rom infrastructure to write firmware and/or initial kernel blobs into guest address space. So we're basically emulating the cache off phase on very early system bootup. That phase is usually responsible for clearing the instruction cache for anything it writes into cachable memory, to ensure that after reboot we don't happen to execute stale bits from the instruction cache. So we need to invalidate the icache every time we write a rom into guest address space. We do not need to do this for every DMA since the guest expects it has to flush the icache manually in that case. This fixes random reboot issues on e5500 (booke ppc) for me. Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
3978b863a5
commit
582b55a96a
3 changed files with 47 additions and 5 deletions
|
@ -785,6 +785,13 @@ static void rom_reset(void *unused)
|
|||
g_free(rom->data);
|
||||
rom->data = NULL;
|
||||
}
|
||||
/*
|
||||
* The rom loader is really on the same level as firmware in the guest
|
||||
* shadowing a ROM into RAM. Such a shadowing mechanism needs to ensure
|
||||
* that the instruction cache for that new region is clear, so that the
|
||||
* CPU definitely fetches its instructions from the just written data.
|
||||
*/
|
||||
cpu_flush_icache_range(rom->addr, rom->datasize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue