Thread (30 messages) flat view 30 messages, 4 authors, 2021-03-01
STALE2034d REVIEWED: 1 (0M)

1 review trailer.

[PATCH linux-next 1/9] vdpa_sim: Consider read only supported features instead of current

From: Parav Pandit <hidden>
Date: 2021-02-24 06:19:07
Subsystem: the rest, virtio core · Maintainers: Linus Torvalds, "Michael S. Tsirkin", Jason Wang, Eugenio Pérez

To honor VIRTIO_F_VERSION_1 feature bit, during endianness detection,
consider the read only supported features bit instead of current
features bit which can be modified by the driver.

This enables vdpa_sim_net driver to invoke cpu_to_vdpasim16() early
enough just after vdpasim device creation in subsequent patch.

Signed-off-by: Parav Pandit <redacted>
Reviewed-by: Eli Cohen <redacted>
---
 drivers/vdpa/vdpa_sim/vdpa_sim.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h
index 6d75444f9948..176d641a0939 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.h
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h
@@ -11,6 +11,7 @@
 #include <linux/virtio_byteorder.h>
 #include <linux/vhost_iotlb.h>
 #include <uapi/linux/virtio_config.h>
+#include <linux/bits.h>
 
 #define VDPASIM_FEATURES	((1ULL << VIRTIO_F_ANY_LAYOUT) | \
 				 (1ULL << VIRTIO_F_VERSION_1)  | \
@@ -71,7 +72,8 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *attr);
 static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim)
 {
 	return virtio_legacy_is_little_endian() ||
-		(vdpasim->features & (1ULL << VIRTIO_F_VERSION_1));
+		(vdpasim->dev_attr.supported_features &
+		 BIT_ULL(VIRTIO_F_VERSION_1));
 }
 
 static inline u16 vdpasim16_to_cpu(struct vdpasim *vdpasim, __virtio16 val)
-- 
2.26.2

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help