]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/pci-host/gt64120: Fix endianness handling
authorRakesh Jeyasingh <rakeshjb010@gmail.com>
Tue, 29 Apr 2025 17:03:53 +0000 (22:33 +0530)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 22 May 2025 11:33:00 +0000 (14:33 +0300)
commitcdf3fb061719f32d46ee620fadea37b8e55771d0
tree8db926747180de1d16b881032102e3a6afa6fb47
parent3e59fccb03eee912867b2d58dc885d48f44cec78
hw/pci-host/gt64120: Fix endianness handling

The GT-64120 PCI controller requires special handling where:
1. Host bridge(bus 0 ,device 0) must never be byte-swapped
2. Other devices follow MByteSwap bit in GT_PCI0_CMD

The previous implementation incorrectly  swapped all accesses, breaking
host bridge detection (lspci -d 11ab:4620).

Changes made:
1. Removed gt64120_update_pci_cfgdata_mapping() and moved data_mem initialization
  to gt64120_realize() for cleaner setup
2. Implemented custom read/write handlers that:
   - Preserve host bridge accesses (extract32(config_reg,11,13)==0)
   - apply swapping only for non-bridge devices in big-endian mode

Fixes: 145e2198 ("hw/mips/gt64xxx_pci: Endian-swap using PCI_HOST_BRIDGE MemoryRegionOps")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2826

Signed-off-by: Rakesh Jeyasingh <rakeshjb010@gmail.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Link: https://lore.kernel.org/r/20250429170354.150581-2-rakeshjb010@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e5894fd6f411c113e2b5f62811e96eeb5b084381)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/pci-host/gt64120.c