aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorKONRAD Frederic <fred.konrad@greensocs.com>2016-10-19 15:06:49 +0200
committerEdgar E. Iglesias <edgar.iglesias@xilinx.com>2017-06-27 15:09:15 +0200
commitc93567463532f46f7c860fc6b431566b71adbd6b (patch)
tree78bce090046159a6a2c619c2b818493520a4f224 /accel
parent7cc2298c46a6afa4f4ff7e5cd262809c782d701b (diff)
downloadqemu-c93567463532f46f7c860fc6b431566b71adbd6b.zip
qemu-c93567463532f46f7c860fc6b431566b71adbd6b.tar.gz
qemu-c93567463532f46f7c860fc6b431566b71adbd6b.tar.bz2
exec: allow to get a pointer for some mmio memory region
This introduces a special callback which allows to run code from some MMIO devices. SysBusDevice with a MemoryRegion which implements the request_ptr callback will be notified when the guest try to execute code from their offset. Then it will be able to eg: pre-load some code from an SPI device or ask a pointer from an external simulator, etc.. When the pointer or the data in it are no longer valid the device has to invalidate it. Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/cputlb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 95265a0..1900936 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -858,6 +858,16 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env, target_ulong addr)
pd = iotlbentry->addr & ~TARGET_PAGE_MASK;
mr = iotlb_to_region(cpu, pd, iotlbentry->attrs);
if (memory_region_is_unassigned(mr)) {
+ qemu_mutex_lock_iothread();
+ if (memory_region_request_mmio_ptr(mr, addr)) {
+ qemu_mutex_unlock_iothread();
+ /* A MemoryRegion is potentially added so re-run the
+ * get_page_addr_code.
+ */
+ return get_page_addr_code(env, addr);
+ }
+ qemu_mutex_unlock_iothread();
+
cpu_unassigned_access(cpu, addr, false, true, 0, 4);
/* The CPU's unassigned access hook might have longjumped out
* with an exception. If it didn't (or there was no hook) then