From: Stefan Berger Subject: [PATCH] [vTPM] State machine Date: Wed, 12 Apr 2006 17:12:01 -0400 Message-ID: <1144876321.31290.1.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-mZJMKmvgW9A69pwnnMDL" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=-mZJMKmvgW9A69pwnnMDL Content-Type: text/plain Content-Transfer-Encoding: 7bit This fixes the state machine of the vTPM driver. Signed-off-by: Stefan Berger --=-mZJMKmvgW9A69pwnnMDL Content-Disposition: attachment; filename=tpmfront-switchstate.diff Content-Type: text/x-patch; name=tpmfront-switchstate.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c =================================================================== --- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c +++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c @@ -334,12 +334,6 @@ again: goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, - "state", "%d", XenbusStateInitialised); - if (err) { - goto abort_transaction; - } - err = xenbus_transaction_end(xbt, 0); if (err == -EAGAIN) goto again; @@ -347,6 +341,9 @@ again: xenbus_dev_fatal(dev, err, "completing transaction"); goto destroy_tpmring; } + + xenbus_switch_state(dev, XenbusStateConnected); + return 0; abort_transaction: @@ -387,6 +384,7 @@ static void backend_changed(struct xenbu if (tp->is_suspended == 0) { device_unregister(&dev->dev); } + xenbus_switch_state(dev, XenbusStateClosed); break; } } @@ -439,6 +437,7 @@ static int tpmfront_suspend(struct xenbu /* lock, so no app can send */ mutex_lock(&suspend_lock); + xenbus_switch_state(dev, XenbusStateClosed); tp->is_suspended = 1; for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) { Index: root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c =================================================================== --- root.orig/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c +++ root/xen-unstable.hg/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c @@ -164,10 +164,10 @@ static void frontend_changed(struct xenb switch (frontend_state) { case XenbusStateInitialising: - case XenbusStateConnected: + case XenbusStateInitialised: break; - case XenbusStateInitialised: + case XenbusStateConnected: err = connect_ring(be); if (err) { return; --=-mZJMKmvgW9A69pwnnMDL Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-mZJMKmvgW9A69pwnnMDL--