qemu/hw/misc
Hugo Landau 5c1d3a2b6e Fix ast2500 protection register emulation
Some register blocks of the ast2500 are protected by protection key
registers which require the right magic value to be written to those
registers to allow those registers to be mutated.

Register manuals indicate that writing the correct magic value to these
registers should cause subsequent reads from those values to return 1,
and writing any other value should cause subsequent reads to return 0.

Previously, qemu implemented these registers incorrectly: the registers
were handled as simple memory, meaning that writing some value x to a
protection key register would result in subsequent reads from that
register returning the same value x. The protection was implemented by
ensuring that the current value of that register equaled the magic
value.

This modifies qemu to have the correct behaviour: attempts to write to a
ast2500 protection register results in a transition to 1 or 0 depending
on whether the written value is the correct magic. The protection logic
is updated to ensure that the value of the register is nonzero.

This bug caused deadlocks with u-boot HEAD: when u-boot is done with a
protectable register block, it attempts to lock it by writing the
bitwise inverse of the correct magic value, and then spinning forever
until the register reads as zero. Since qemu implemented writes to these
registers as ordinary memory writes, writing the inverse of the magic
value resulted in subsequent reads returning that value, leading to
u-boot spinning forever.

Signed-off-by: Hugo Landau <hlandau@devever.net>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Andrew Jeffery <andrew@aj.id.au>
Message-id: 20180220132627.4163-1-hlandau@devever.net
[PMM: fixed incorrect code indentation]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-22 15:12:51 +00:00
..
macio cuda: convert to trace-events 2018-02-16 12:14:26 +11:00
a9scu.c arm: Clean up includes 2016-01-29 15:07:23 +00:00
applesmc.c Convert single line fprintf(.../n) to warn_report() 2017-09-19 14:09:34 +02:00
arm11scu.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
arm_integrator_debug.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
arm_l2x0.c hw/misc: QOM'ify arm_l2x0.c 2016-06-14 15:59:14 +01:00
arm_sysctl.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
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 hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
bcm2835_property.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
bcm2835_rng.c bcm2835_rng: Use qcrypto_random_bytes() rather than rand() 2017-02-28 12:08:14 +00:00
cbus.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
debugexit.c x86: Clean up includes 2016-01-29 15:07:22 +00:00
eccmemctl.c hw/misc: QOM'ify eccmemctl.c 2017-06-02 05:54:43 +01:00
edu.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
exynos4210_clk.c hw/arm/exynos: Fix Linux kernel division by zero for PLLs 2017-02-28 12:08:20 +00:00
exynos4210_pmu.c hw/misc/exynos4210_pmu: Add support for system poweroff 2017-06-13 14:56:58 +01:00
exynos4210_rng.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
hyperv_testdev.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
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 hw/misc/imx6_src: Don't crash trying to reset missing CPUs 2017-03-14 16:13:22 +00:00
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 imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx31_ccm.c imx: Use 'const char', not 'char const' 2016-09-22 18:13:09 +01:00
imx_ccm.c hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00
ivshmem.c ivshmem: Disable irqfd on device reset 2018-02-07 14:09:24 +01:00
Makefile.objs misc: introduce new mos6522 VIA device and enable it for ppc builds 2018-02-11 10:18:52 +11:00
max111x.c vmstate: error hint for failed equal checks 2017-06-28 11:18:44 +02:00
milkymist-hpdmc.c milkymist: update specification URLs 2016-06-20 18:12:04 +02:00
milkymist-pfpu.c char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
mips_cmgcr.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
mips_cpc.c hw/mips_cpc: make VP correctly start from the reset vector 2016-07-12 09:10:15 +01:00
mips_itu.c cpu: move exec-all.h inclusion out of cpu.h 2016-05-19 16:42:29 +02: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-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 hw/misc: QOM'ify mst_fpga.c 2016-06-14 15:59:14 +01:00
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 os-posix: include sys/mman.h 2016-06-16 18:39:03 +02:00
pci-testdev.c pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
puv3_pm.c unicore: Clean up includes 2016-01-29 15:07:22 +00:00
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 hw/misc: QOM'ify slavio_misc.c 2017-06-02 05:54:43 +01:00
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 hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
tmp421.c hw/misc: add a TMP42{1, 2, 3} device model 2017-06-13 14:56:59 +01:00
trace-events misc: introduce new mos6522 VIA device and enable it for ppc builds 2018-02-11 10:18:52 +11:00
unimp.c unimplemented-device: Remove user_creatable flag 2017-05-17 10:37:01 -03: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 hw: explicitly include qemu/log.h 2016-05-19 16:42:29 +02:00