# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 21606b84b73098470eb0f565e68cfd961d978763
# Parent f98c8238e9095a2dad33639211ba95a2a459af12
Activate suspending/resuming of the TPM interface and add
some missing code to tpmif.py.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
diff -r f98c8238e909 -r 21606b84b730
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Oct 5
18:15:56 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Wed Oct 5
22:15:00 2005
@@ -442,26 +442,32 @@
return 0;
}
-static int tpmfront_suspend(struct xenbus_device *dev)
+static int
+tpmfront_suspend(struct xenbus_device *dev)
{
struct tpmfront_info *info = dev->data;
struct tpm_private *tp = &my_private;
-
- /* lock so no app can send */
+ u32 ctr = 0;
+
+ /* lock, so no app can send */
down(&suspend_lock);
- while (atomic_read(&tp->tx_busy)) {
- printk("---- TPMIF: Outstanding request.\n");
-#if 0
+ while (atomic_read(&tp->tx_busy) && ctr <= 25) {
+ if ((ctr % 10) == 0)
+ printk("INFO: Waiting for outstanding request.\n");
/*
- * Would like to wait until the outstanding request
- * has come back, but this does not work properly, yet.
+ * Wait for a request to be responded to.
*/
- interruptible_sleep_on_timeout(&tp->wait_q,
- 100);
-#else
- break;
-#endif
+ interruptible_sleep_on_timeout(&tp->wait_q, 100);
+ ctr++;
+ }
+
+ if (atomic_read(&tp->tx_busy)) {
+ /*
+ * A temporary work-around.
+ */
+ printk("WARNING: Resetting busy flag.");
+ atomic_set(&tp->tx_busy, 0);
}
unregister_xenbus_watch(&info->watch);
@@ -469,44 +475,34 @@
kfree(info->backend);
info->backend = NULL;
- destroy_tpmring(info, tp);
-
return 0;
}
-static int tpmif_recover(void)
-{
- return 0;
-}
-
-static int tpmfront_resume(struct xenbus_device *dev)
+static int
+tpmfront_resume(struct xenbus_device *dev)
{
struct tpmfront_info *info = dev->data;
- int err;
-
- err = talk_to_backend(dev, info);
- if (!err) {
- tpmif_recover();
- }
-
- /* unlock so apps can resume */
+ int err = talk_to_backend(dev, info);
+
+ /* unlock, so apps can resume sending */
up(&suspend_lock);
return err;
}
-static void tpmif_connect(u16 evtchn, domid_t domid)
+static void
+tpmif_connect(u16 evtchn, domid_t domid)
{
int err = 0;
struct tpm_private *tp = &my_private;
tp->evtchn = evtchn;
- tp->backend_id = domid;
-
- err = bind_evtchn_to_irqhandler(
- tp->evtchn,
- tpmif_int, SA_SAMPLE_RANDOM, "tpmif", tp);
- if ( err <= 0 ) {
+ tp->backend_id = domid;
+
+ err = bind_evtchn_to_irqhandler(tp->evtchn,
+ tpmif_int, SA_SAMPLE_RANDOM, "tpmif",
+ tp);
+ if (err <= 0) {
WPRINTK("bind_evtchn_to_irqhandler failed (err=%d)\n", err);
return;
}
@@ -641,7 +637,7 @@
if (NULL == txb) {
DPRINTK("txb (i=%d) is NULL. buffers initilized?\n", i);
- DPRINTK("Not transmittin anything!\n");
+ DPRINTK("Not transmitting anything!\n");
spin_unlock_irq(&tp->tx_lock);
return -EFAULT;
}
diff -r f98c8238e909 -r 21606b84b730 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py Wed Oct 5 18:15:56 2005
+++ b/tools/python/xen/xend/server/tpmif.py Wed Oct 5 22:15:00 2005
@@ -39,9 +39,24 @@
"""@see DevController.getDeviceDetails"""
devid = int(sxp.child_value(config, 'instance', '0'))
- log.debug("The domain has a TPM with instance %d." % devid)
+ log.info("The domain has a TPM with instance %d." % devid)
back = { 'instance' : "%i" % devid }
front = { 'handle' : "%i" % devid }
return (devid, back, front)
+
+ def configuration(self, devid):
+
+ log.info("The configuration method is called.")
+
+ result = DevContoller.configuration(self, devid)
+
+ (instance) = self.readBackend(devif,
+ 'instance')
+
+ if instance:
+ result.append(['instance', instance])
+ log.info("configuration: instance=%d." % instance)
+
+ return result
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|