Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178317735
D60582.1796489685.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D60582.1796489685.diff
View Options
diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c
--- a/sys/dev/virtio/console/virtio_console.c
+++ b/sys/dev/virtio/console/virtio_console.c
@@ -118,6 +118,7 @@
#define VTCON_FLAG_DETACHED 0x01
#define VTCON_FLAG_SIZE 0x02
#define VTCON_FLAG_MULTIPORT 0x04
+#define VTCON_FLAG_READY 0x08
/*
* Ports can be added and removed during runtime, but we have
@@ -165,6 +166,7 @@
static int vtcon_attach(device_t);
static int vtcon_detach(device_t);
static int vtcon_shutdown(device_t);
+static int vtcon_attach_completed(device_t);
static int vtcon_config_change(device_t);
static int vtcon_setup_features(struct vtcon_softc *);
@@ -270,6 +272,7 @@
DEVMETHOD(device_shutdown, vtcon_shutdown),
/* VirtIO methods. */
+ DEVMETHOD(virtio_attach_completed, vtcon_attach_completed),
DEVMETHOD(virtio_config_change, vtcon_config_change),
DEVMETHOD_END
@@ -391,9 +394,6 @@
vtcon_enable_interrupts(sc);
- vtcon_ctrl_send_control(sc, VIRTIO_CONSOLE_BAD_ID,
- VIRTIO_CONSOLE_DEVICE_READY, 1);
-
fail:
if (error)
vtcon_detach(dev);
@@ -434,6 +434,32 @@
return (0);
}
+static int
+vtcon_attach_completed(device_t dev)
+{
+ struct vtcon_softc *sc;
+ struct vtcon_port *port;
+
+ sc = device_get_softc(dev);
+
+ VTCON_LOCK(sc);
+ sc->vtcon_flags |= VTCON_FLAG_READY;
+ if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT)
+ virtqueue_notify(sc->vtcon_ctrl_rxvq);
+ port = sc->vtcon_ports[0].vcsp_port;
+ if (port != NULL) {
+ VTCON_PORT_LOCK(port);
+ virtqueue_notify(port->vtcport_invq);
+ VTCON_PORT_UNLOCK(port);
+ }
+ VTCON_UNLOCK(sc);
+
+ vtcon_ctrl_send_control(sc, VIRTIO_CONSOLE_BAD_ID,
+ VIRTIO_CONSOLE_DEVICE_READY, 1);
+
+ return (0);
+}
+
static int
vtcon_config_change(device_t dev)
{
@@ -792,7 +818,8 @@
}
if (nbufs > 0) {
- virtqueue_notify(vq);
+ if (sc->vtcon_flags & VTCON_FLAG_READY)
+ virtqueue_notify(vq);
error = 0;
}
@@ -1230,7 +1257,8 @@
}
if (nbufs > 0) {
- virtqueue_notify(vq);
+ if (port->vtcport_sc->vtcon_flags & VTCON_FLAG_READY)
+ virtqueue_notify(vq);
error = 0;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 5, 4:54 PM (4 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40605246
Default Alt Text
D60582.1796489685.diff (2 KB)
Attached To
Mode
D60582: virtio_console: Defer device notifications until DRIVER_OK
Attached
Detach File
Event Timeline