[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 07/60] cpu_physical_memory_write_rom() needs to do
From: |
Michael Tokarev |
Subject: |
[Qemu-stable] [PATCH 07/60] cpu_physical_memory_write_rom() needs to do TB invalidates |
Date: |
Mon, 4 Feb 2013 14:40:17 +0400 |
From: David Gibson <address@hidden>
cpu_physical_memory_write_rom(), despite the name, can also be used to
write images into RAM - and will often be used that way if the machine
uses load_image_targphys() into RAM addresses.
However, cpu_physical_memory_write_rom(), unlike cpu_physical_memory_rw()
doesn't invalidate any cached TBs which might be affected by the region
written.
This was breaking reset (under full emu) on the pseries machine - we loaded
our firmware image into RAM, and while executing it rewrite the code at
the entry point (correctly causing a TB invalidate/refresh). When we
reset the firmware image was reloaded, but the TB from the rewrite was
still active and caused us to get an illegal instruction trap.
This patch fixes the bug by duplicating the tb invalidate code from
cpu_physical_memory_rw() in cpu_physical_memory_write_rom().
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 0b57e287138728f72d88b06e69b970c5d745c44a)
Signed-off-by: Michael Tokarev <address@hidden>
---
exec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/exec.c b/exec.c
index 0a67f07..8e97f93 100644
--- a/exec.c
+++ b/exec.c
@@ -3625,6 +3625,13 @@ void cpu_physical_memory_write_rom(target_phys_addr_t
addr,
/* ROM/RAM case */
ptr = qemu_get_ram_ptr(addr1);
memcpy(ptr, buf, l);
+ if (!cpu_physical_memory_is_dirty(addr1)) {
+ /* invalidate code */
+ tb_invalidate_phys_page_range(addr1, addr1 + l, 0);
+ /* set dirty bit */
+ cpu_physical_memory_set_dirty_flags(
+ addr1, (0xff & ~CODE_DIRTY_FLAG));
+ }
qemu_put_ram_ptr(ptr);
}
len -= l;
--
1.7.10.4
- [Qemu-stable] [PATCH 32/60] qed: refuse unaligned zero writes with a backing file, (continued)
- [Qemu-stable] [PATCH 32/60] qed: refuse unaligned zero writes with a backing file, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 15/60] i386: kvm: bit 10 of CPUID[8000_0001].EDX is reserved, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 47/60] kvm: fix incorrect length in a loop over kvm dirty pages map, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 45/60] e1000: Discard packets that are too long if !SBP and !LPE, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 46/60] e1000: Discard oversized packets based on SBP|LPE, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 38/60] xhci: fix usb name in caps, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 33/60] e1000: drop check_rxov, always treat RX ring with RDH == RDT as empty, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 20/60] ui/vnc: Only report/use TIGHT_PNG encoding if enabled., Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 21/60] vnc: fix "info vnc" with "-vnc ..., reverse=on", Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 56/60] target-xtensa: fix search_pc for the last TB opcode, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 07/60] cpu_physical_memory_write_rom() needs to do TB invalidates,
Michael Tokarev <=
- [Qemu-stable] [PATCH 26/60] target-i386: Allow tsc-frequency to be larger then 2.147G, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 42/60] target-mips: fix wrong microMIPS opcode encoding, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 57/60] buffered_file: do not send more than s->bytes_xfer bytes per tick, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 25/60] hw: Fix return value check for bdrv_read, bdrv_write, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 30/60] MIPS: Correct FCR0 initialization, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 11/60] net: add -netdev options to man page, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 50/60] slirp: Don't crash on packets from 0.0.0.0/8., Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 58/60] qxl: save qemu_create_displaysurface_from result, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 49/60] tap: reset vnet header size on open, Michael Tokarev, 2013/02/04
- [Qemu-stable] [PATCH 19/60] fix entry pointer for ELF kernels loaded with -kernel option, Michael Tokarev, 2013/02/04