diff options
author | Jessica Clarke <jrtc27@FreeBSD.org> | 2020-06-08 21:49:42 +0000 |
---|---|---|
committer | Jessica Clarke <jrtc27@FreeBSD.org> | 2020-06-08 21:49:42 +0000 |
commit | 16ca3d0f59bfcbf0d702db24e6a84b228bab22e7 (patch) | |
tree | 1b9561219d5e677eacac8000e1fc2b2271ffd689 /sys/dev/virtio | |
parent | 19870105e1ec677906bd4a45ec7e6d751ef0c761 (diff) | |
download | src-16ca3d0f59bfcbf0d702db24e6a84b228bab22e7.tar.gz src-16ca3d0f59bfcbf0d702db24e6a84b228bab22e7.zip |
virtio_mmio: Negotiate the upper half of the feature bits too
The feature bits are exposed as a 32-bit register with 2 banks, so we
should negotiate both halves. Notably, VIRTIO_F_VERSION_1 is in the
upper half, and will be used in an upcoming commit.
The PCI bus driver also has this bug, but the legacy BAR layout did not
include selector registers and is rather different from the modern
layout, so it remains solely as legacy.
Reviewed by: br, brooks (mentor), jhb (mentor)
Approved by: br, brooks (mentor), jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D25131
Notes
Notes:
svn path=/head/; revision=361943
Diffstat (limited to 'sys/dev/virtio')
-rw-r--r-- | sys/dev/virtio/mmio/virtio_mmio.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index 133eb5dbceac..0414706fb990 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -390,7 +390,13 @@ vtmmio_negotiate_features(device_t dev, uint64_t child_features) sc = device_get_softc(dev); + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1); host_features = vtmmio_read_config_4(sc, VIRTIO_MMIO_HOST_FEATURES); + host_features <<= 32; + + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 0); + host_features |= vtmmio_read_config_4(sc, VIRTIO_MMIO_HOST_FEATURES); + vtmmio_describe_features(sc, "host", host_features); /* @@ -402,6 +408,11 @@ vtmmio_negotiate_features(device_t dev, uint64_t child_features) sc->vtmmio_features = 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, features >> 32); + + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 0); vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES, features); return (features); |