Page MenuHomeFreeBSD

fix virtio Device Configuration Space on big endian platforms (i.e. PowerPC64). Also enable virtio drivers on default PowerPC64 kernel configuration
AbandonedPublic

Authored by alfredo on Apr 3 2019, 6:28 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 28 2024, 8:50 PM
Unknown Object (File)
Sep 14 2024, 3:02 PM
Unknown Object (File)
Sep 13 2024, 5:59 AM
Unknown Object (File)
Sep 8 2024, 7:57 PM
Unknown Object (File)
Sep 4 2024, 9:46 AM
Unknown Object (File)
Aug 31 2024, 1:46 AM
Unknown Object (File)
Aug 17 2024, 7:15 PM
Unknown Object (File)
Jun 23 2024, 3:22 PM

Details

Reviewers
jhibbits
bryanv
Summary

virtio-net and virtio-scsi driver didn't work on PowerPC64 due to an endianess problem on Device Configuration Space area. This area was assumed to be in same endianess as the guest OS, but virtio-1.x spec says:

2.3 Device Configuration Space
Device configuration space is generally used for rarely-changing or initialization-time parameters. Where configuration fields are optional, their existence is indicated by feature bits: Future versions of this specification will likely extend the device configuration space by adding extra fields at the tail. Note: The device configuration space uses the little-endian format for multi-byte fields.

This patch fixes the endianess on Big Endian platforms such as PowerPC64 and enables it on default kernel configuration.

Reference: http://docs.oasis-open.org/virtio/virtio/v1.0/cs04/virtio-v1.0-cs04.html#x1-170003

Test Plan

Check virtio-net and virtio-scsi on PowerPC64 elfv2 kernel, on QEMU using the following parameters:

qemu-system-ppc64 -name guest=alfredo3 -m 4096 -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd -drive if=none,id=hd,file=vdisks/vm3-disk1.qcow2,format=qcow2 -device virtio-net-pci,netdev=vneta0,disable-legacy=off,disable-modern=off -netdev tap,id=vneta0 -nographic -vga none -cpu POWER8E -smp 8 -enable-kvm -machine pseries-3.0,accel=kvm,cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken,cap-hpt-max-page-size=16M -mem-prealloc -mem-path /dev/hugepages

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23499
Build 22505: arc lint + arc unit

Event Timeline

bryanv requested changes to this revision.Apr 3 2019, 7:08 PM

This is not correct. You are quoting from the V1 spec but the FreeBSD VirtIO drivers are written against the pre-V1 (0.9.5 aka legacy) which uses guest endian.

I have a rather dated branch that adds support for V1 but I have not had the time to commit it: https://github.com/bryanv/freebsd/tree/virtio

This revision now requires changes to proceed.Apr 3 2019, 7:08 PM
alfredo edited the summary of this revision. (Show Details)
alfredo edited the test plan for this revision. (Show Details)

remove LE/BE ifdefs as recommended

bryanv requested changes to this revision.Apr 3 2019, 7:27 PM

Please reread my prior comment. This is not correct.

This revision now requires changes to proceed.Apr 3 2019, 7:27 PM

Please reread my prior comment. This is not correct.

I see, I wasn't aware of this, thank you for your feedback.
Sounds like the issue is different, I guess FreeBSD virtio drivers shouldn't be attaching on this setup. It needs more investigation.

Abandoning this change as it requires more investigation whatever problem is on QEMU or FreeBSD