From 6354d80ba028ed2a34cad1cd1d8ba27715ce9f0d Mon Sep 17 00:00:00 2001 From: sf Date: Fri, 26 Jul 2024 07:55:23 +0000 Subject: [PATCH] virtio: add/fix feature bits There was a off-by-one in unused vioblk feature defines. Fix this. Add missing feature bits from virtio 1.2 so that they are displayed with VIRTIO_DEBUG. ok jan@ --- sys/dev/pv/if_vio.c | 17 +++++++++++++++-- sys/dev/pv/vioblk.c | 5 ++++- sys/dev/pv/vioblkreg.h | 9 ++++++--- sys/dev/pv/virtio.c | 11 ++++++++++- sys/dev/pv/virtioreg.h | 11 ++++++++++- 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index 19f276cfbcf..eee59d81232 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.43 2024/07/26 06:29:01 sf Exp $ */ +/* $OpenBSD: if_vio.c,v 1.44 2024/07/26 07:55:23 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -90,7 +90,13 @@ #define VIRTIO_NET_F_GUEST_ANNOUNCE (1ULL<<21) #define VIRTIO_NET_F_MQ (1ULL<<22) #define VIRTIO_NET_F_CTRL_MAC_ADDR (1ULL<<23) - +#define VIRTIO_NET_F_HOST_USO (1ULL<<56) +#define VIRTIO_NET_F_HASH_REPORT (1ULL<<57) +#define VIRTIO_NET_F_GUEST_HDRLEN (1ULL<<59) +#define VIRTIO_NET_F_RSS (1ULL<<60) +#define VIRTIO_NET_F_RSC_EXT (1ULL<<61) +#define VIRTIO_NET_F_STANDBY (1ULL<<62) +#define VIRTIO_NET_F_SPEED_DUPLEX (1ULL<<63) /* * Config(8) flags. The lowest byte is reserved for generic virtio stuff. */ @@ -123,6 +129,13 @@ static const struct virtio_feature_name virtio_net_feature_names[] = { { VIRTIO_NET_F_GUEST_ANNOUNCE, "GuestAnnounce" }, { VIRTIO_NET_F_MQ, "MQ" }, { VIRTIO_NET_F_CTRL_MAC_ADDR, "CtrlMAC" }, + { VIRTIO_NET_F_HOST_USO, "HostUso" }, + { VIRTIO_NET_F_HASH_REPORT, "HashRpt" }, + { VIRTIO_NET_F_GUEST_HDRLEN, "GuestHdrlen" }, + { VIRTIO_NET_F_RSS, "RSS" }, + { VIRTIO_NET_F_RSC_EXT, "RSSExt" }, + { VIRTIO_NET_F_STANDBY, "Stdby" }, + { VIRTIO_NET_F_SPEED_DUPLEX, "SpdDplx" }, #endif { 0, NULL } }; diff --git a/sys/dev/pv/vioblk.c b/sys/dev/pv/vioblk.c index 6b5f56cd7b7..3be22b9309e 100644 --- a/sys/dev/pv/vioblk.c +++ b/sys/dev/pv/vioblk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblk.c,v 1.39 2024/06/26 01:40:49 jsg Exp $ */ +/* $OpenBSD: vioblk.c,v 1.40 2024/07/26 07:55:23 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch. @@ -79,8 +79,11 @@ struct virtio_feature_name vioblk_feature_names[] = { { VIRTIO_BLK_F_FLUSH, "Flush" }, { VIRTIO_BLK_F_TOPOLOGY, "Topology" }, { VIRTIO_BLK_F_CONFIG_WCE, "ConfigWCE" }, + { VIRTIO_BLK_F_MQ, "MQ" }, { VIRTIO_BLK_F_DISCARD, "Discard" }, { VIRTIO_BLK_F_WRITE_ZEROES, "Write0s" }, + { VIRTIO_BLK_F_LIFETIME, "Lifetime" }, + { VIRTIO_BLK_F_SECURE_ERASE, "SecErase" }, #endif { 0, NULL } }; diff --git a/sys/dev/pv/vioblkreg.h b/sys/dev/pv/vioblkreg.h index f444261a5cf..7c3140a1d15 100644 --- a/sys/dev/pv/vioblkreg.h +++ b/sys/dev/pv/vioblkreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vioblkreg.h,v 1.4 2019/03/24 18:22:36 sf Exp $ */ +/* $OpenBSD: vioblkreg.h,v 1.5 2024/07/26 07:55:23 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch. @@ -50,8 +50,11 @@ #define VIRTIO_BLK_F_FLUSH (1ULL<<9) #define VIRTIO_BLK_F_TOPOLOGY (1ULL<<10) #define VIRTIO_BLK_F_CONFIG_WCE (1ULL<<11) -#define VIRTIO_BLK_F_DISCARD (1ULL<<12) -#define VIRTIO_BLK_F_WRITE_ZEROES (1ULL<<13) +#define VIRTIO_BLK_F_MQ (1ULL<<12) +#define VIRTIO_BLK_F_DISCARD (1ULL<<13) +#define VIRTIO_BLK_F_WRITE_ZEROES (1ULL<<14) +#define VIRTIO_BLK_F_LIFETIME (1ULL<<15) +#define VIRTIO_BLK_F_SECURE_ERASE (1ULL<<16) /* Command */ #define VIRTIO_BLK_T_IN 0 diff --git a/sys/dev/pv/virtio.c b/sys/dev/pv/virtio.c index 40cd6a98984..7386d0ca12c 100644 --- a/sys/dev/pv/virtio.c +++ b/sys/dev/pv/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.27 2024/07/25 08:35:40 sf Exp $ */ +/* $OpenBSD: virtio.c,v 1.28 2024/07/26 07:55:23 sf Exp $ */ /* $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $ */ /* @@ -81,10 +81,19 @@ virtio_device_string(int id) #if VIRTIO_DEBUG static const struct virtio_feature_name transport_feature_names[] = { { VIRTIO_F_NOTIFY_ON_EMPTY, "NotifyOnEmpty"}, + { VIRTIO_F_ANY_LAYOUT, "AnyLayout"}, { VIRTIO_F_RING_INDIRECT_DESC, "RingIndirectDesc"}, { VIRTIO_F_RING_EVENT_IDX, "RingEventIdx"}, { VIRTIO_F_BAD_FEATURE, "BadFeature"}, { VIRTIO_F_VERSION_1, "Version1"}, + { VIRTIO_F_ACCESS_PLATFORM, "AccessPlatf"}, + { VIRTIO_F_RING_PACKED, "RingPacked"}, + { VIRTIO_F_IN_ORDER, "InOrder"}, + { VIRTIO_F_ORDER_PLATFORM, "OrderPlatf"}, + { VIRTIO_F_SR_IOV, "SrIov"}, + { VIRTIO_F_NOTIFICATION_DATA, "NotifData"}, + { VIRTIO_F_NOTIF_CONFIG_DATA, "NotifConfData"}, + { VIRTIO_F_RING_RESET, "RingReset"}, { 0, NULL} }; diff --git a/sys/dev/pv/virtioreg.h b/sys/dev/pv/virtioreg.h index 1ac17a9bd21..876033b0e1a 100644 --- a/sys/dev/pv/virtioreg.h +++ b/sys/dev/pv/virtioreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtioreg.h,v 1.5 2023/04/20 19:28:31 jcs Exp $ */ +/* $OpenBSD: virtioreg.h,v 1.6 2024/07/26 07:55:23 sf Exp $ */ /* $NetBSD: virtioreg.h,v 1.1 2011/10/30 12:12:21 hannken Exp $ */ /* @@ -85,10 +85,19 @@ /* device-independent feature bits */ #define VIRTIO_F_NOTIFY_ON_EMPTY (1ULL<<24) +#define VIRTIO_F_ANY_LAYOUT (1ULL<<27) #define VIRTIO_F_RING_INDIRECT_DESC (1ULL<<28) #define VIRTIO_F_RING_EVENT_IDX (1ULL<<29) #define VIRTIO_F_BAD_FEATURE (1ULL<<30) #define VIRTIO_F_VERSION_1 (1ULL<<32) +#define VIRTIO_F_ACCESS_PLATFORM (1ULL<<33) +#define VIRTIO_F_RING_PACKED (1ULL<<34) +#define VIRTIO_F_IN_ORDER (1ULL<<35) +#define VIRTIO_F_ORDER_PLATFORM (1ULL<<36) +#define VIRTIO_F_SR_IOV (1ULL<<37) +#define VIRTIO_F_NOTIFICATION_DATA (1ULL<<38) +#define VIRTIO_F_NOTIF_CONFIG_DATA (1ULL<<39) +#define VIRTIO_F_RING_RESET (1ULL<<40) /* device status bits */ #define VIRTIO_CONFIG_DEVICE_STATUS_RESET 0 -- 2.20.1