On Wed, Mar 13, 2024 at 10:40:21AM +0100, Markus Armbruster wrote: > I could be awkward for the use case described in PATCH 1's commit > message: > > However, we sometimes want to compare features and status bits without > caring for their exact meaning. Say we want to verify the correctness > of the virtio negotiation between guest, QEMU, and OVS-DPDK. We can use > QMP command x-query-virtio-status to retrieve vhost-user net device > features, and the "ovs-vsctl list interface" command to retrieve > interface features. Without commit f3034ad71fc, we could then simply > compare the numbers. With this commit, we first have to map from the > strings back to the numeric encoding.
So, consider how guest kernel presents features then. Do you happen to know? It's actually a binary string: static ssize_t features_show(struct device *_d, struct device_attribute *attr, char *buf) { struct virtio_device *dev = dev_to_virtio(_d); unsigned int i; ssize_t len = 0; /* We actually represent this as a bitstring, as it could be * arbitrary length in future. */ for (i = 0; i < sizeof(dev->features)*8; i++) len += sysfs_emit_at(buf, len, "%c", __virtio_test_bit(dev, i) ? '1' : '0'); len += sysfs_emit_at(buf, len, "\n"); return len; } static DEVICE_ATTR_RO(features); -- MST