On Sat, Mar 29, 2025 at 12:31 PM Rakesh J <rakeshjb...@gmail.com> wrote:
>  Paolo: You pointed out the size issue with .min_access_size = 1 and 
> .max_access_size = 4, where bswap32 was wrong for 2-byte accesses. I’ve fixed 
> this with size-appropriate swaps (bswap16 for 2-byte, bswap32 for 4-byte). On 
> the extra swap idea, I stuck with a single swap since it aligns PCI LE with 
> guest BE expectations without overcomplicating it—let me know if I 
> misunderstood.
The extra swap (compared to what the "regular" PCI data ops do) is
exactly what you were doing.

>  I’ve sent [PATCH v2] incorporating changes:
> 1.Removed gt64120_update_pci_cfgdata_mapping() and moved initialization code
>   to gt64120_realize() for a simpler MByteSwap check.
> 2.Removed unused pci_host_data_be_ops and a misleading comment in dino.h
>
> 3.Size-specific swaps (bswap16 and bswap32)
>  I included bswap16 for 2-byte accesses in v2—should this be restricted to 
> 4-byte only (bswap32) per the spec, or does GT-64120 expect 2-byte config 
> swaps too? It’s a minor tweak, so I left it in v2 for now—happy to adjust in 
> a v3 if needed.

Which swap to use is not really related to what the GT-64120 does, but
to the interface between memory.c and the MemoryRegionOps. When
access_size == 2, QEMU wants the result in bits 0..15 so you need to
use bswap16. With bswap32, the result would be in bits 16..31.

Paolo


Reply via email to