Author: jrtc27 Date: Mon Jun 8 21:49:42 2020 New Revision: 361943 URL: https://svnweb.freebsd.org/changeset/base/361943
Log: 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 Modified: head/sys/dev/virtio/mmio/virtio_mmio.c Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Mon Jun 8 21:38:52 2020 (r361942) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Mon Jun 8 21:49:42 2020 (r361943) @@ -390,7 +390,13 @@ vtmmio_negotiate_features(device_t dev, uint64_t child 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 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); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"