mirror of
https://github.com/opnsense/src.git
synced 2026-06-04 22:32:43 -04:00
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
This commit is contained in:
parent
19870105e1
commit
16ca3d0f59
1 changed files with 11 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue