|
@@ -150,6 +150,7 @@ struct ports_device {
|
|
|
|
|
|
/* To protect the vq operations for the control channel */
|
|
|
spinlock_t c_ivq_lock;
|
|
|
+ spinlock_t c_ovq_lock;
|
|
|
|
|
|
/* The current config space is stored here */
|
|
|
struct virtio_console_config config;
|
|
@@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
|
|
|
vq = portdev->c_ovq;
|
|
|
|
|
|
sg_init_one(sg, &cpkt, sizeof(cpkt));
|
|
|
+
|
|
|
+ spin_lock(&portdev->c_ovq_lock);
|
|
|
if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) {
|
|
|
virtqueue_kick(vq);
|
|
|
while (!virtqueue_get_buf(vq, &len))
|
|
|
cpu_relax();
|
|
|
}
|
|
|
+ spin_unlock(&portdev->c_ovq_lock);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1997,6 +2001,7 @@ static int virtcons_probe(struct virtio_device *vdev)
|
|
|
unsigned int nr_added_bufs;
|
|
|
|
|
|
spin_lock_init(&portdev->c_ivq_lock);
|
|
|
+ spin_lock_init(&portdev->c_ovq_lock);
|
|
|
INIT_WORK(&portdev->control_work, &control_work_handler);
|
|
|
|
|
|
nr_added_bufs = fill_queue(portdev->c_ivq,
|