virtio_mmio: Fix feature negotiation copy-paste issue in r361943

This caused us to write to the low half of the feature word twice, once with
the high bits and once with the low bits. Common legacy device implementations
seem to be fairly lenient about being able to write to the feature bits
multiple times, but Arm's models use a stricter implementation that will ignore
the second write. This fixes using vtnet(4) on those models.

Reported by:	Jean-Philippe Brucker <jean-philippe@linaro.org>
Pointy hat:	jrtc27
This commit is contained in:
Jessica Clarke 2020-12-18 15:07:14 +00:00
parent b62ae61446
commit 50a6b28a31

View File

@ -409,10 +409,10 @@ vtmmio_negotiate_features(device_t dev, uint64_t child_features)
vtmmio_describe_features(sc, "negotiated", features);
vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1);
vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES_SEL, 1);
vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES, features >> 32);
vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 0);
vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES_SEL, 0);
vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES, features);
return (features);