From 50a6b28a31a03bed650d8eb05b48b8268bac8d95 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Fri, 18 Dec 2020 15:07:14 +0000 Subject: [PATCH] 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 Pointy hat: jrtc27 --- sys/dev/virtio/mmio/virtio_mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index a9c7b65741c..348c82da352 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -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); -- 2.45.0