This prevents multiple messages for the same type of device.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
struct virtio_pci vpci;
struct virtio_9p_config *config;
- int compat_id;
u32 features;
/* virtio queue */
#include <net/9p/9p.h>
static LIST_HEAD(devs);
+static int compat_id = -1;
/* Warning: Immediately use value returned from this function */
static const char *rel_to_abs(struct p9_dev *p9dev,
struct virt_queue *queue;
void *p;
- compat__remove_message(p9dev->compat_id);
+ compat__remove_message(compat_id);
queue = &p9dev->vqs[vq];
queue->pfn = pfn;
list_add(&p9dev->list, &devs);
- p9dev->compat_id = compat__add_message("virtio-9p device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-9p device was not detected",
"While you have requested a virtio-9p device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "
u16 stat_count;
int stat_waitfd;
- int compat_id;
struct virtio_balloon_config config;
};
static struct bln_dev bdev;
extern struct kvm *kvm;
+static int compat_id = -1;
static bool virtio_bln_do_io_request(struct kvm *kvm, struct bln_dev *bdev, struct virt_queue *queue)
{
struct virt_queue *queue;
void *p;
- compat__remove_message(bdev->compat_id);
+ compat__remove_message(compat_id);
queue = &bdev->vqs[vq];
queue->pfn = pfn;
.get_size_vq = get_size_vq,
};
- bdev.compat_id = compat__add_message("virtio-balloon device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-balloon device was not detected",
"While you have requested a virtio-balloon device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "
struct virtio_pci vpci;
struct virtio_blk_config blk_config;
struct disk_image *disk;
- int compat_id;
u32 features;
struct virt_queue vqs[NUM_VIRT_QUEUES];
};
static LIST_HEAD(bdevs);
+static int compat_id;
static void virtio_blk_do_io_request(struct kvm *kvm, void *param)
{
struct virt_queue *queue;
void *p;
- compat__remove_message(bdev->compat_id);
+ compat__remove_message(compat_id);
queue = &bdev->vqs[vq];
queue->pfn = pfn;
list_add_tail(&bdev->list, &bdevs);
- bdev->compat_id = compat__add_message("virtio-blk device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-blk device was not detected",
"While you have requested a virtio-blk device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "
struct virt_queue vqs[VIRTIO_CONSOLE_NUM_QUEUES];
struct virtio_console_config config;
u32 features;
- int compat_id;
struct thread_pool__job jobs[VIRTIO_CONSOLE_NUM_QUEUES];
};
},
};
+static int compat_id = -1;
+
/*
* Interrupts are injected for hvc0 only.
*/
assert(vq < VIRTIO_CONSOLE_NUM_QUEUES);
- compat__remove_message(cdev.compat_id);
+ compat__remove_message(compat_id);
queue = &cdev.vqs[vq];
queue->pfn = pfn;
.get_size_vq = get_size_vq,
};
- cdev.compat_id = compat__add_message("virtio-console device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-console device was not detected",
"While you have requested a virtio-console device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "
struct virt_queue vqs[VIRTIO_NET_NUM_QUEUES];
struct virtio_net_config config;
u32 features;
- int compat_id;
pthread_t io_rx_thread;
pthread_mutex_t io_rx_lock;
};
static LIST_HEAD(ndevs);
+static int compat_id = -1;
static void *virtio_net_rx_thread(void *p)
{
struct virt_queue *queue;
void *p;
- compat__remove_message(ndev->compat_id);
+ compat__remove_message(compat_id);
queue = &ndev->vqs[vq];
queue->pfn = pfn;
virtio_net__io_thread_init(params->kvm, ndev);
- ndev->compat_id = compat__add_message("virtio-net device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-net device was not detected",
"While you have requested a virtio-net device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "
struct virtio_pci vpci;
int fd;
- int compat_id;
/* virtio queue */
struct virt_queue vqs[NUM_VIRT_QUEUES];
};
static LIST_HEAD(rdevs);
+static int compat_id = -1;
static void set_config(struct kvm *kvm, void *dev, u8 data, u32 offset)
{
struct rng_dev_job *job;
void *p;
- compat__remove_message(rdev->compat_id);
+ compat__remove_message(compat_id);
queue = &rdev->vqs[vq];
queue->pfn = pfn;
list_add_tail(&rdev->list, &rdevs);
- rdev->compat_id = compat__add_message("virtio-rng device was not detected",
+ if (compat_id != -1)
+ compat_id = compat__add_message("virtio-rng device was not detected",
"While you have requested a virtio-rng device, "
"the guest kernel didn't seem to detect it.\n"
"Please make sure that the kernel was compiled "