hw/isa/isa-bus: Ensure ISA I/O regions are 8/16/32-bit accessible
RFC 1/1 hw/isa/isa-bus: Ensure ISA I/O regions are 8/16/32-bit accessible
Since commit 5d971f9e67 we don't accept mismatching sizes in memory_region_access_valid(). This gives troubles when a device is on an ISA bus, because the CPU is free to use 8/16/32-bit accesses on the bus, regardless what range is valid for the device.
Add a check to ensure devices plugged on the ISA bus can accept 8/16/32-bits accesses.
Related bug reports:
- https://lore.kernel.org/xen-devel/[email protected]/T/
- https://bugs.debian.org/964793
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964247
- https://bugs.launchpad.net/bugs/1886318
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
---
MST: I really don't like this approach, I think the ISA bus
should adjust the access.
--- hw/isa/isa-bus.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
hw/isa/isa-bus.c +11 -0
@@ -132,6 +132,17 @@ static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport)void isa_register_ioport (ISADevice *dev,MemoryRegion *io,uint16_t start) { +if (io->ops->valid.min_access_size >1 ) { +/* CPU can always use 8-bit accesses on an ISA bus */ +error_report ("ISA device '%s' requires I/O min_access_size of 1" , +object_get_typename (OBJECT (dev))); +exit (1 ); + }else if (io->ops->valid.max_access_size <4 ) { +/* CPU can always use 32-bit accesses on an ISA bus */ +error_report ("ISA device '%s' requires I/O max_access_size of 4" , +object_get_typename (OBJECT (dev))); +exit (1 ); + }memory_region_add_subregion (isabus->address_space_io, start, io);isa_init_ioport (dev, start); }
Signature · 1 line
2.21.3