Index: sys/dev/hyperv/include/vmbus.h =================================================================== --- sys/dev/hyperv/include/vmbus.h +++ sys/dev/hyperv/include/vmbus.h @@ -172,6 +172,7 @@ uint32_t vmbus_chan_id(const struct vmbus_channel *chan); uint32_t vmbus_chan_subidx(const struct vmbus_channel *chan); bool vmbus_chan_is_primary(const struct vmbus_channel *chan); +bool vmbus_chan_is_revoked(const struct vmbus_channel *chan); const struct hyperv_guid * vmbus_chan_guid_inst(const struct vmbus_channel *chan); int vmbus_chan_prplist_nelem(int br_size, int prpcnt_max, Index: sys/dev/hyperv/vmbus/vmbus_chan.c =================================================================== --- sys/dev/hyperv/vmbus/vmbus_chan.c +++ sys/dev/hyperv/vmbus/vmbus_chan.c @@ -1220,7 +1220,7 @@ wakeup(prichan); done: /* - * Hook this channel up for later rescind. + * Hook this channel up for later revocation. */ mtx_lock(&sc->vmbus_chan_lock); vmbus_chan_ins_list(sc, newchan); @@ -1368,7 +1368,7 @@ note = (const struct vmbus_chanmsg_chrescind *)msg->msg_data; if (note->chm_chanid > VMBUS_CHAN_MAX) { - device_printf(sc->vmbus_dev, "invalid rescinded chan%u\n", + device_printf(sc->vmbus_dev, "invalid revoked chan%u\n", note->chm_chanid); return; } @@ -1403,8 +1403,12 @@ mtx_unlock(&sc->vmbus_prichan_lock); } + if (atomic_testandset_int(&chan->ch_stflags, + VMBUS_CHAN_ST_REVOKED_SHIFT)) + panic("channel has already been revoked"); + if (bootverbose) - vmbus_chan_printf(chan, "chan%u rescinded\n", note->chm_chanid); + vmbus_chan_printf(chan, "chan%u revoked\n", note->chm_chanid); /* Detach the target channel. */ taskqueue_enqueue(chan->ch_mgmt_tq, &chan->ch_detach_task); @@ -1695,3 +1699,12 @@ return (chan->ch_mgmt_tq); } + +bool +vmbus_chan_is_revoked(const struct vmbus_channel *chan) +{ + + if (chan->ch_stflags & VMBUS_CHAN_ST_REVOKED) + return (true); + return (false); +} Index: sys/dev/hyperv/vmbus/vmbus_chanvar.h =================================================================== --- sys/dev/hyperv/vmbus/vmbus_chanvar.h +++ sys/dev/hyperv/vmbus/vmbus_chanvar.h @@ -159,10 +159,12 @@ #define VMBUS_CHAN_ST_ONPRIL_SHIFT 1 #define VMBUS_CHAN_ST_ONSUBL_SHIFT 2 #define VMBUS_CHAN_ST_ONLIST_SHIFT 3 +#define VMBUS_CHAN_ST_REVOKED_SHIFT 4 /* sticky */ #define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT) #define VMBUS_CHAN_ST_ONPRIL (1 << VMBUS_CHAN_ST_ONPRIL_SHIFT) #define VMBUS_CHAN_ST_ONSUBL (1 << VMBUS_CHAN_ST_ONSUBL_SHIFT) #define VMBUS_CHAN_ST_ONLIST (1 << VMBUS_CHAN_ST_ONLIST_SHIFT) +#define VMBUS_CHAN_ST_REVOKED (1 << VMBUS_CHAN_ST_REVOKED_SHIFT) struct vmbus_softc; struct vmbus_message;