qemu-e2k/hw
Philippe Mathieu-Daudé 62a9b228b5 hw/timer/slavio_timer: Allow 64-bit accesses
Per the "NCR89C105 Chip Specification" referenced in the header:

                  Chip-level Address Map

  ------------------------------------------------------------------
  | 1D0 0000 ->   | Counter/Timers                        | W,D    |
  |   1DF FFFF    |                                       |        |
  ...

  The address map indicated the allowed accesses at each address.
  [...] W indicates a word access, and D indicates a double-word
  access.

The SLAVIO timer controller is implemented expecting 32-bit accesses.
Commit a3d12d073e restricted the memory accesses to 32-bit, while
the device allows 64-bit accesses.

This was not an issue until commit 5d971f9e67 which reverted
("memory: accept mismatching sizes in memory_region_access_valid").

Fix by renaming .valid MemoryRegionOps as .impl, and add the valid
access range (W -> 4, D -> 8).

Since commit 21786c7e59 ("memory: Log invalid memory accesses")
this class of bug can be quickly debugged displaying 'guest_errors'
accesses, as:

  $ qemu-system-sparc -M SS-20 -m 256 -bios ss20_v2.25_rom -serial stdio -d guest_errors

  Power-ON Reset
  Invalid access at addr 0x0, size 8, region 'timer-1', reason: invalid size (min:4 max:4)

  $ qemu-system-sparc -M SS-20 -m 256 -bios ss20_v2.25_rom -monitor stdio -S
  (qemu) info mtree
  address-space: memory
    0000000000000000-ffffffffffffffff (prio 0, i/o): system
      ...
      0000000ff1300000-0000000ff130000f (prio 0, i/o): timer-1
             ^^^^^^^^^                                 ^^^^^^^
                   \ memory region base address and name /

  (qemu) info qtree
  bus: main-system-bus
    dev: slavio_timer, id ""              <-- device type name
      gpio-out "sysbus-irq" 17
      num_cpus = 1 (0x1)
      mmio 0000000ff1310000/0000000000000014
      mmio 0000000ff1300000/0000000000000010 <--- base address
      mmio 0000000ff1301000/0000000000000010
      mmio 0000000ff1302000/0000000000000010
      ...

Reported-by: Yap KV <yapkv@yahoo.com>
Buglink: https://bugs.launchpad.net/bugs/1906905
Fixes: a3d12d073e ("slavio_timer: convert to memory API")
CC: qemu-stable@nongnu.org
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201205150903.3062711-1-f4bug@amsat.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2021-01-06 11:41:37 +00:00
..
9pfs hw/9pfs: Fix Kconfig dependency problem between 9pfs and Xen 2020-11-05 15:21:11 +01:00
acpi qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
adc meson: convert hw/adc 2020-08-21 06:30:32 -04:00
alpha vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
arm hw: Use the PCI_DEVFN() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
audio audio/via-ac97: Simplify code and set user_creatable to false 2021-01-04 23:24:44 +01:00
avr vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
block Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
char qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
core clock: Define and use new clock_display_freq() 2021-01-04 23:24:44 +01:00
cpu cpu/core: Register core-id and nr-threads as class properties 2020-09-22 16:48:29 -04:00
cris cris: do not use ram_size global 2020-12-10 12:15:07 -05:00
display migration: Replace migration's JSON writer by the general one 2020-12-19 10:39:16 +01:00
dma hw/dma/xilinx_axidma: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
gpio nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
hppa hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
hyperv qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
i2c nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
i386 hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
ide qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
input ads7846: moves from the hw/display folder to the hw/input folder. 2020-12-13 17:54:55 +01:00
intc hw/intc: Rework Loongson LIOINTC 2021-01-04 23:24:44 +01:00
ipack Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
ipmi qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
isa vt82c686: Rename superio config related parts 2021-01-04 23:24:44 +01:00
lm32 vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
m68k hw/m68k/q800.c: Make the GLUE chip an actual QOM device 2020-12-12 18:06:01 +01:00
mem nomaintainer: Fix Lesser GPL version number 2020-11-15 17:04:40 +01:00
microblaze vl: make qemu_get_machine_opts static 2020-12-15 12:51:55 -05:00
mips hw/mips/fuloong2e: Correct cpuclock in PROM environment 2021-01-04 23:36:03 +01:00
misc qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
moxie moxie: do not use ram_size global 2020-12-10 12:15:08 -05:00
net Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
nios2 * New -action option and set-action QMP command (Alejandro) 2020-12-15 21:24:31 +00:00
nubus meson: convert hw/nubus 2020-08-21 06:30:25 -04:00
nvram Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
openrisc target/openrisc: Move pic_cpu code into CPU object proper 2020-12-15 12:04:30 +00:00
pci Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
pci-bridge qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
pci-host hw/pci-host/bonito: Use pci_config_set_interrupt_pin() 2021-01-04 23:24:44 +01:00
pcmcia pxa2xx: Move QOM macros to header 2020-08-27 14:04:55 -04:00
ppc hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
rdma Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
riscv riscv/opentitan: Update the OpenTitan memory layout 2020-12-17 21:56:44 -08:00
rtc Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
rx rx: move BIOS load from MCU to board 2020-12-10 12:15:06 -05:00
s390x Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
scsi Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
sd qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
semihosting meson: convert hw/semihosting 2020-08-21 06:30:25 -04:00
sh4 hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
smbios i386: do not use ram_size global 2020-12-10 12:15:08 -05:00
sparc vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
sparc64 vl: extract softmmu/datadir.c 2020-12-10 12:15:18 -05:00
ssi hw/core/stream: Rename StreamSlave as StreamSink 2020-12-10 12:15:04 -05:00
timer hw/timer/slavio_timer: Allow 64-bit accesses 2021-01-06 11:41:37 +00:00
tpm qdev: Move qdev_prop_tpm declaration to tpm_prop.h 2020-12-18 15:20:17 -05:00
tricore tricore tcg cpus: Fix Lesser GPL version number 2020-11-15 16:40:30 +01:00
unicore32 meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
usb Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
vfio qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() 2020-12-18 15:20:18 -05:00
virtio Machine queue, 2020-12-23 2021-01-01 22:57:15 +00:00
watchdog hw/watchdog/wdt_diag288: Remove unnecessary includes 2020-12-11 11:38:10 +01:00
xen qdev: Move softmmu properties to qdev-properties-system.h 2020-12-18 15:20:17 -05:00
xenpv meson: convert hw/arch* 2020-08-21 06:30:33 -04:00
xtensa vl: make qemu_get_machine_opts static 2020-12-15 12:51:55 -05:00
Kconfig hw/net/can: Introduce Xilinx ZynqMP CAN controller 2020-12-10 11:30:44 +00:00
meson.build meson: convert hw/arch* 2020-08-21 06:30:33 -04:00