@@ -1300,6 +1300,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq)
return VIRTQUEUE_NUM;
}
+static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
+{
+ /* FIXME: dynamic */
+ return size;
+}
+
struct virtio_ops p9_dev_virtio_ops = (struct virtio_ops) {
.get_config = get_config,
.get_host_features = get_host_features,
@@ -1308,6 +1314,7 @@ struct virtio_ops p9_dev_virtio_ops = (struct virtio_ops) {
.notify_vq = notify_vq,
.get_pfn_vq = get_pfn_vq,
.get_size_vq = get_size_vq,
+ .set_size_vq = set_size_vq,
};
int virtio_9p_rootdir_parser(const struct option *opt, const char *arg, int unset)
@@ -172,6 +172,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq)
return VIRTIO_CONSOLE_QUEUE_SIZE;
}
+static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
+{
+ /* FIXME: dynamic */
+ return size;
+}
+
static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) {
.get_config = get_config,
.get_host_features = get_host_features,
@@ -180,6 +186,7 @@ static struct virtio_ops con_dev_virtio_ops = (struct virtio_ops) {
.notify_vq = notify_vq,
.get_pfn_vq = get_pfn_vq,
.get_size_vq = get_size_vq,
+ .set_size_vq = set_size_vq,
};
int virtio_console__init(struct kvm *kvm)
@@ -132,6 +132,12 @@ static int get_size_vq(struct kvm *kvm, void *dev, u32 vq)
return VIRTIO_RNG_QUEUE_SIZE;
}
+static int set_size_vq(struct kvm *kvm, void *dev, u32 vq, int size)
+{
+ /* FIXME: dynamic */
+ return size;
+}
+
static struct virtio_ops rng_dev_virtio_ops = (struct virtio_ops) {
.get_config = get_config,
.get_host_features = get_host_features,
@@ -140,6 +146,7 @@ static struct virtio_ops rng_dev_virtio_ops = (struct virtio_ops) {
.notify_vq = notify_vq,
.get_pfn_vq = get_pfn_vq,
.get_size_vq = get_size_vq,
+ .set_size_vq = set_size_vq,
};
int virtio_rng__init(struct kvm *kvm)
When a guest kernel initialises a virtio device using an MMIO transport, it attempts to set the size of the virtual queue. For devices that expect a PCI transport, this is not the case and, as such, our console, 9p and rng virtio devices do not set a pointer for this function and subsequently SEGV. This patch adds a dummy implementation of the function to avoid the fatal signal. Signed-off-by: Will Deacon <will.deacon@arm.com> --- tools/kvm/virtio/9p.c | 7 +++++++ tools/kvm/virtio/console.c | 7 +++++++ tools/kvm/virtio/rng.c | 7 +++++++ 3 files changed, 21 insertions(+), 0 deletions(-)