Allow opening virtio-console ports from the host side before guest
enumerates them. Approved by: trasz Sponsored by: iXsystems, Inc.
This commit is contained in:
parent
18ec6fbc3a
commit
962094d52a
@ -90,6 +90,7 @@ struct pci_vtcon_port {
|
||||
bool vsp_enabled;
|
||||
bool vsp_console;
|
||||
bool vsp_rx_ready;
|
||||
bool vsp_open;
|
||||
int vsp_rxq;
|
||||
int vsp_txq;
|
||||
void * vsp_arg;
|
||||
@ -116,6 +117,7 @@ struct pci_vtcon_softc {
|
||||
char * vsc_rootdir;
|
||||
int vsc_kq;
|
||||
int vsc_nports;
|
||||
bool vsc_ready;
|
||||
struct pci_vtcon_port vsc_control_port;
|
||||
struct pci_vtcon_port vsc_ports[VTCON_MAXPORTS];
|
||||
struct pci_vtcon_config *vsc_config;
|
||||
@ -359,6 +361,7 @@ pci_vtcon_sock_accept(int fd __unused, enum ev_type t __unused, void *arg)
|
||||
sock->vss_open = true;
|
||||
sock->vss_conn_fd = s;
|
||||
sock->vss_conn_evp = mevent_add(s, EVF_READ, pci_vtcon_sock_rx, sock);
|
||||
|
||||
pci_vtcon_open_port(sock->vss_port, true);
|
||||
}
|
||||
|
||||
@ -454,11 +457,15 @@ pci_vtcon_control_tx(struct pci_vtcon_port *port, void *arg, struct iovec *iov,
|
||||
|
||||
switch (ctrl->event) {
|
||||
case VTCON_DEVICE_READY:
|
||||
sc->vsc_ready = true;
|
||||
/* set port ready events for registered ports */
|
||||
for (i = 0; i < VTCON_MAXPORTS; i++) {
|
||||
tmp = &sc->vsc_ports[i];
|
||||
if (tmp->vsp_enabled)
|
||||
pci_vtcon_announce_port(tmp);
|
||||
|
||||
if (tmp->vsp_open)
|
||||
pci_vtcon_open_port(tmp, true);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -500,6 +507,11 @@ pci_vtcon_open_port(struct pci_vtcon_port *port, bool open)
|
||||
{
|
||||
struct pci_vtcon_control event;
|
||||
|
||||
if (!port->vsp_sc->vsc_ready) {
|
||||
port->vsp_open = true;
|
||||
return;
|
||||
}
|
||||
|
||||
event.id = port->vsp_id;
|
||||
event.event = VTCON_PORT_OPEN;
|
||||
event.value = (int)open;
|
||||
|
Loading…
x
Reference in New Issue
Block a user