]> 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>
Sun, 25 May 2025 10:14:52 +0000 (13:14 +0300)
commit5d139247e910132082027afbc19d60a7a6cdb693
treeeaf7e6cf0a5d88defecf25102504d6b06c8d053a
parent289dcab554eddb536055e1ddc058d7d838f299af
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