Page MenuHomeFreeBSD

[POWERPC] Switch endian of common dev information
ClosedPublic

Authored by leonardo.bianconi_eldorado.org.br on Feb 26 2021, 6:22 PM.

Details

Summary

Virtio modern has the common data organized in little endian.
POWERPC architecture, as BE, was reading and writing in the wrong
format.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

[POWERPC] Switch endian of common dev information

Virtio modern has the common data organized in little endian.
POWERPC architecture, as BE, was reading and writing in the wrong
format.

Checking endian when reading and writing in dev common.

bryanv requested changes to this revision.Mar 8 2021, 10:38 PM
bryanv added inline comments.
sys/dev/virtio/pci/virtio_pci_modern.c
148

This method signature of void pointer and size is too easy to get wrong, difficult to read, and really only makes sense as a DEVMETHOD to avoid interface explosion. Add methods for each size like already exists instead.

This revision now requires changes to proceed.Mar 8 2021, 10:38 PM

Avoid creating new function and convert endian in existing functions.

leonardo.bianconi_eldorado.org.br added inline comments.
sys/dev/virtio/pci/virtio_pci_modern.c
148

I've added the call to convert endian inside existing functions, avoiding the new one created before.

leonardo.bianconi_eldorado.org.br added inline comments.
sys/dev/virtio/pci/virtio_pci_modern.c
148

@bryanv I have added the endian change inside the existent functions, to be generic, since I didn't identify any call to these functions outside this file.
If you prefer to create specific functions for these calls, I can change it, let me know.
Thanks!

Thanks Leonardo. I've being testing this patch, it looks good to me.

@bryanv, are you ok with this change?

This revision is now accepted and ready to land.May 4 2021, 2:54 PM