aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSepherosa Ziehau <sephe@FreeBSD.org>2016-11-23 05:03:44 +0000
committerSepherosa Ziehau <sephe@FreeBSD.org>2016-11-23 05:03:44 +0000
commitfb6216bd43a3231aa6c97a033c736727ad893f5d (patch)
treee06e5cdade13bcd2a92bef37c6d7db32d48abc96
parent5e2be2f66070fb1c7e853cd4056460c6aa56cb2d (diff)
downloadsrc-fb6216bd43a3231aa6c97a033c736727ad893f5d.tar.gz
src-fb6216bd43a3231aa6c97a033c736727ad893f5d.zip
hyperv/vmbus: Set a mark on the revoked channel.
This will be used to fix device detach DEVMETHOD for revoked primary channel. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8522
Notes
Notes: svn path=/head/; revision=309030
-rw-r--r--sys/dev/hyperv/include/vmbus.h1
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_chan.c19
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_chanvar.h2
3 files changed, 19 insertions, 3 deletions
diff --git a/sys/dev/hyperv/include/vmbus.h b/sys/dev/hyperv/include/vmbus.h
index 6c7e99304754..56b463a08993 100644
--- a/sys/dev/hyperv/include/vmbus.h
+++ b/sys/dev/hyperv/include/vmbus.h
@@ -172,6 +172,7 @@ int vmbus_chan_send_prplist(struct vmbus_channel *chan,
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,
diff --git a/sys/dev/hyperv/vmbus/vmbus_chan.c b/sys/dev/hyperv/vmbus/vmbus_chan.c
index 1cd5f2b0ac97..3e8ea3912f4e 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chan.c
+++ b/sys/dev/hyperv/vmbus/vmbus_chan.c
@@ -1220,7 +1220,7 @@ vmbus_chan_add(struct vmbus_channel *newchan)
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 @@ vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc,
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 @@ vmbus_chan_msgproc_chrescind(struct vmbus_softc *sc,
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 @@ vmbus_chan_mgmt_tq(const struct vmbus_channel *chan)
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);
+}
diff --git a/sys/dev/hyperv/vmbus/vmbus_chanvar.h b/sys/dev/hyperv/vmbus/vmbus_chanvar.h
index b415d0079eb3..ebadb2cba4d8 100644
--- a/sys/dev/hyperv/vmbus/vmbus_chanvar.h
+++ b/sys/dev/hyperv/vmbus/vmbus_chanvar.h
@@ -159,10 +159,12 @@ struct vmbus_channel {
#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;