qemu-e2k/hw/misc
Pavel Dovgalyuk afd46fcad2 icount: fix cpu_restore_state_from_tb for non-tb-exit cases
In icount mode, instructions that access io memory spaces in the middle
of the translation block invoke TB recompilation.  After recompilation,
such instructions become last in the TB and are allowed to access io
memory spaces.

When the code includes instruction like i386 'xchg eax, 0xffffd080'
which accesses APIC, QEMU goes into an infinite loop of the recompilation.

This instruction includes two memory accesses - one read and one write.
After the first access, APIC calls cpu_report_tpr_access, which restores
the CPU state to get the current eip.  But cpu_restore_state_from_tb
resets the cpu->can_do_io flag which makes the second memory access invalid.
Therefore the second memory access causes a recompilation of the block.
Then these operations repeat again and again.

This patch moves resetting cpu->can_do_io flag from
cpu_restore_state_from_tb to cpu_loop_exit* functions.

It also adds a parameter for cpu_restore_state which controls restoring
icount.  There is no need to restore icount when we only query CPU state
without breaking the TB.  Restoring it in such cases leads to the
incorrect flow of the virtual time.

In most cases new parameter is true (icount should be recalculated).
But there are two cases in i386 and openrisc when the CPU state is only
queried without the need to break the TB.  This patch fixes both of
these cases.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Message-Id: <20180409091320.12504.35329.stgit@pasha-VirtualBox>
[rth: Make can_do_io setting unconditional; move from cpu_exec;
make cpu_loop_exit_{noexc,restore} call cpu_loop_exit.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2018-04-11 09:05:22 +10:00
..
macio hw/misc/macio: Fix crash when listing device properties of macio device 2018-04-10 10:05:38 +10:00
a9scu.c
applesmc.c Convert single line fprintf(.../n) to warn_report() 2017-09-19 14:09:34 +02:00
arm11scu.c
arm_integrator_debug.c
arm_l2x0.c
arm_sysctl.c
aspeed_scu.c Fix ast2500 protection register emulation 2018-02-22 15:12:51 +00:00
aspeed_sdmc.c Fix ast2500 protection register emulation 2018-02-22 15:12:51 +00:00
auxbus.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
bcm2835_mbox.c
bcm2835_property.c
bcm2835_rng.c
cbus.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
debugexit.c
eccmemctl.c
edu.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
exynos4210_clk.c
exynos4210_pmu.c
exynos4210_rng.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
hyperv_testdev.c
imx2_wdt.c i.MX: Add code to emulate i.MX2 watchdog IP block 2018-02-09 10:40:29 +00:00
imx6_ccm.c Remove empty statements 2017-12-18 17:07:02 +03:00
imx6_src.c
imx7_ccm.c i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks 2018-02-09 10:40:29 +00:00
imx7_gpr.c i.MX: Add implementation of i.MX7 GPR IP block 2018-02-09 10:40:30 +00:00
imx7_snvs.c i.MX: Add code to emulate i.MX7 SNVS IP-block 2018-02-09 10:40:30 +00:00
imx25_ccm.c
imx31_ccm.c
imx_ccm.c
iotkit-secctl.c hw/misc/iotkit-secctl: Add remaining simple registers 2018-03-02 11:03:45 +00:00
ivshmem.c ivshmem: Disable irqfd on device reset 2018-02-07 14:09:24 +01:00
Makefile.objs hw/misc/iotkit-secctl: Arm IoT Kit security controller initial skeleton 2018-03-02 11:03:45 +00:00
max111x.c
milkymist-hpdmc.c
milkymist-pfpu.c
mips_cmgcr.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
mips_cpc.c
mips_itu.c icount: fix cpu_restore_state_from_tb for non-tb-exit cases 2018-04-11 09:05:22 +10:00
mmio_interface.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
mos6522.c misc: introduce new mos6522 VIA device and enable it for ppc builds 2018-02-11 10:18:52 +11:00
mps2-fpgaio.c hw/misc/mps2-fpgaio: FPGA control block for MPS2 AN505 2018-03-02 11:03:45 +00:00
mps2-scc.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
msf2-sysreg.c msf2: Microsemi Smartfusion2 System Register block 2017-09-21 16:36:56 +01:00
mst_fpga.c
omap_clk.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
omap_gpmc.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
omap_l4.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
omap_sdrc.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
omap_tap.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
pc-testdev.c
pci-testdev.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
puv3_pm.c
pvpanic.c hw/misc/pvpanic: extract public API from i386/pc to "hw/misc/pvpanic.h" 2017-12-18 17:07:02 +03:00
sga.c misc: remove old i386 dependency 2017-12-18 17:07:02 +03:00
slavio_misc.c
stm32f2xx_syscfg.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
tmp105.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
tmp105.h
tmp421.c
trace-events misc: don't use hwaddr as a type in trace events 2018-03-06 14:24:30 +00:00
tz-ppc.c hw/misc/tz-ppc: Model TrustZone peripheral protection controller 2018-03-02 11:03:45 +00:00
unimp.c hw/misc/unimp: Move struct to header file 2018-03-02 11:03:45 +00:00
vmcoreinfo.c dump-guest-memory.py: fix "You can't do that without a process to debug" 2018-01-02 14:49:54 +01:00
zynq_slcr.c maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
zynq-xadc.c