Prevent target code getting out of sync with Translation Blocks.

Fixes a problem where the target code gets out of sync
with the Translation Blocks (TB). LTP tests crash and QEMU
itself will crash eventually when generating new TB code
while searching for a PC in an existing TB. Debugging code
that checks that the target code and TB's are in sync confirm
that this change fixes the problem.

This is an import from git://git.qemu.org/qemu.git
    -----------------------------------------------------------------------
    commit 0b57e287138728f72d88b06e69b970c5d745c44a
    Author: David Gibson <david@gibson.dropbear.id.au>
    Date:   Mon Sep 10 12:30:57 2012 +1000

    cpu_physical_memory_write_rom() needs to do TB invalidates

    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 <david@gibson.dropbear.id.au>
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
    -----------------------------------------------------------------------

Change-Id: I2f0eeb512a289b0c9cae2e11e02c7d68eba96f05
Signed-off-by: Chris Dearman <Chris.Dearman@imgtec.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Duane Sand <Duane.Sand@imgtec.com>
exec: Introduce helper to set dirty flags.

NOTE: Cherry picked from git.qemu.org
      51d7a9eb2b64e787c90bea1027308087eac22065

This new helper/hook is used in the next patch to add
an extra call in a single place.

Change-Id: If8bfcc457f44b207d3aa7f284e337fe43e3408f6
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Pete Delaney <piet.delaney@imgtec.com>
Signed-off-by: Chris Dearman <Chris.Dearman@imgtec.com>
Signed-off-by: Duane Sand <Duane.Sand@imgtec.com>
Merge changes If8bfcc45,I2f0eeb51

* changes:
  exec: Introduce helper to set dirty flags.
  Prevent target code getting out of sync with Translation Blocks.
build-kernel.sh: add savedefconfig option

add option --savedefconfig, and it should help to maintain kernel config easily.

Change-Id: Iddf670ca914756a2a2c6894e9c8b445928c84743
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
ARM: build-kernel.sh: add --armv5 option

AOSP has dropped support for armv5, so use goldfish_armv7 as default
config
And add --armv5 option for backwards compatibility.

Change-Id: I19bf731eb3629250b98854648ec8320e2b9b3344
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
add missing android-kernel-toolchain-size symlink

size command is needed for build compressed vmlinuz on arm architecture

Change-Id: Ib2e1dcfdb6844511a8c8b1724e0f0c48960e6596
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
Merge "ARM: build-kernel.sh: add --armv5 option"
Merge "build-kernel.sh: add savedefconfig option"
Merge "add missing android-kernel-toolchain-size symlink"
build-kernel.sh: add ccache option

Change-Id: I103362f461db8c8a7a10b3833f73672331926dba
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
build-kernel.sh: apply --armv7 option when ARCH is arm

There is a bug that build script is trying with goldfish_armv7_defconfig,
when ARCH is not arm.

Change-Id: I6db744452c3f48e94e384605c59baf268f45b933
Signed-off-by: Young-Ho Cha <ganadist@gmail.com>
Merge "build-kernel.sh: apply --armv7 option when ARCH is arm"
Merge "build-kernel.sh: add ccache option"
Fix a typo.

Fix a typo that resulted in a harmless message: "7: command not found"

Change-Id: If3643a31085a4fbfaf16b599558f7caa9172d98e
Merge "Fix a typo."
Make sure less variables are been used non initialized

Change-Id: I09567ef8624d84f6f18675654545a7684f101a16
fix bug in usb hub initialization

Change-Id: I4dce451af970bd9dcaf4f2ac57325bc19cb69d82
Merge "Make sure less variables are been used non initialized"
Merge "fix bug in usb hub initialization"
goldfish_nand.c: Change sizes

Change page_size to 512 and extra_size to 0. This is needed
to use ext4 filesystems on goldfish.

Bug: https://code.google.com/p/android/issues/detail?id=38561
Change-Id: I9f9ea87f467e9f2fe913aa367ab1f891cbbca48f