From: Will Deacon <will@kernel.org>
To: kvm@vger.kernel.org
Cc: kvmarm@lists.linux.dev, Will Deacon <will@kernel.org>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Andre Przywara <andre.przywara@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Marc Zyngier <maz@kernel.org>
Subject: [PATCH kvmtool 2/4] virtio: Factor out base features for modern virtio transports
Date: Fri, 19 Jun 2026 12:54:12 +0100 [thread overview]
Message-ID: <20260619115415.5475-3-will@kernel.org> (raw)
In-Reply-To: <20260619115415.5475-1-will@kernel.org>
In preparation for optionally enabling VIRTIO_F_ACCESS_PLATFORM,
factor out the base features for modern virtio transports.
Signed-off-by: Will Deacon <will@kernel.org>
---
include/kvm/virtio.h | 1 +
virtio/core.c | 7 +++++++
virtio/mmio-modern.c | 2 +-
virtio/pci-modern.c | 2 +-
4 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/kvm/virtio.h b/include/kvm/virtio.h
index 8b7ec1b..c95183b 100644
--- a/include/kvm/virtio.h
+++ b/include/kvm/virtio.h
@@ -277,5 +277,6 @@ void virtio_vhost_reset_vring(struct kvm *kvm, int vhost_fd, u32 index,
int virtio_vhost_set_features(int vhost_fd, u64 features);
int virtio_transport_parser(const struct option *opt, const char *arg, int unset);
+u64 virtio_get_modern_transport_features(void);
#endif /* KVM__VIRTIO_H */
diff --git a/virtio/core.c b/virtio/core.c
index 50c9ddd..8c5086d 100644
--- a/virtio/core.c
+++ b/virtio/core.c
@@ -353,6 +353,13 @@ bool virtio_access_config(struct kvm *kvm, struct virtio_device *vdev,
return true;
}
+static u64 virtio_modern_transport_features = 1ULL << VIRTIO_F_VERSION_1;
+
+u64 virtio_get_modern_transport_features(void)
+{
+ return virtio_modern_transport_features;
+}
+
int virtio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
struct virtio_ops *ops, enum virtio_trans trans,
int device_id, int subsys_id, int class)
diff --git a/virtio/mmio-modern.c b/virtio/mmio-modern.c
index 6c0bb38..7787508 100644
--- a/virtio/mmio-modern.c
+++ b/virtio/mmio-modern.c
@@ -11,7 +11,7 @@ static void virtio_mmio_config_in(struct kvm_cpu *vcpu,
struct virtio_device *vdev)
{
struct virtio_mmio *vmmio = vdev->virtio;
- u64 features = 1ULL << VIRTIO_F_VERSION_1;
+ u64 features = virtio_get_modern_transport_features();
u32 val = 0;
switch (addr) {
diff --git a/virtio/pci-modern.c b/virtio/pci-modern.c
index ef2f3e2..888afa5 100644
--- a/virtio/pci-modern.c
+++ b/virtio/pci-modern.c
@@ -148,7 +148,7 @@ static bool virtio_pci__common_read(struct virtio_device *vdev,
{
u32 val;
struct virtio_pci *vpci = vdev->virtio;
- u64 features = 1ULL << VIRTIO_F_VERSION_1;
+ u64 features = virtio_get_modern_transport_features();
switch (offset - VPCI_CFG_COMMON_START) {
case VIRTIO_PCI_COMMON_DFSELECT:
--
2.55.0.rc0.738.g0c8ab3ebcc-goog
next prev parent reply other threads:[~2026-06-19 11:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 11:54 [PATCH kvmtool 0/4] Add support for running protected VMs on arm64 Will Deacon
2026-06-19 11:54 ` [PATCH kvmtool 1/4] Sync kernel UAPI headers with v7.1 Will Deacon
2026-06-19 13:15 ` Fuad Tabba
2026-06-19 11:54 ` Will Deacon [this message]
2026-06-19 13:15 ` [PATCH kvmtool 2/4] virtio: Factor out base features for modern virtio transports Fuad Tabba
2026-06-19 16:35 ` Suzuki K Poulose
2026-06-19 11:54 ` [PATCH kvmtool 3/4] virtio: Add helper for enabling VIRTIO_F_ACCESS_PLATFORM Will Deacon
2026-06-19 13:21 ` Fuad Tabba
2026-06-19 16:36 ` Suzuki K Poulose
2026-06-19 11:54 ` [PATCH kvmtool 4/4] arm64: Add support for protected VMs Will Deacon
2026-06-19 13:49 ` Fuad Tabba
2026-06-19 13:04 ` [PATCH kvmtool 0/4] Add support for running protected VMs on arm64 Fuad Tabba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260619115415.5475-3-will@kernel.org \
--to=will@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=andre.przywara@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox