Hi, The overall plan is to add a new flag, IO_MEM_BSWAP, which triggers byte swapping inside CPU load/store functions. Convert all PCI devices to register their memory areas via the PCI host. Then the big endian PCI hosts enable IO_MEM_BSWAP for all registered regions, simultaneously all PCI devices stop swapping bytes. Some more PCI devices can probably be compiled once, though since this is not Generic DMA, there won't be too many.
The patches are not acceptable yet, APB part should be moved from 1/4 to 2/4 even though it means a bit of extra work, this breaks bisection. Instead of PCIBus, the registration functions should take a PCIDevice parameter. 3/4 breaks several architectures. 4/4 should remove byte swapping from devices. VGA is a problem because the byte swaps are in common functions. Sparc64 almost works, other architectures show blank screen. Anyway, I thought I'll send the patches for comments. Especially, is the idea of using IO_MEM_BSWAP viable? Blue Swirl (4): pci: add I/O registration functions Convert PCI devices to use pci_register_memory() Implement byte swapped MMIO type apb: use IO_MEM_BSWAP with device registration cpu-common.h | 3 +- hw/apb_pci.c | 23 ++++++++++++++++- hw/cirrus_vga.c | 12 ++++---- hw/e1000.c | 2 +- hw/eepro100.c | 2 +- hw/isa.h | 1 + hw/isa_mmio.c | 18 ++++++++++++- hw/lsi53c895a.c | 4 +- hw/macio.c | 24 +++++++++--------- hw/msix.c | 4 +- hw/openpic.c | 6 ++-- hw/pci.c | 64 ++++++++++++++++++++++++++++------------------- hw/pci.h | 9 ++++++- hw/pcnet.c | 3 +- hw/rtl8139.c | 2 +- hw/sun4u.c | 7 ++++- hw/usb-ohci.c | 2 +- hw/vga-pci.c | 4 +- hw/vmware_vga.c | 7 ++--- hw/wdt_i6300esb.c | 2 +- softmmu_template.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++------ 21 files changed, 190 insertions(+), 78 deletions(-)