ia64/xen-unstable

changeset 11874:2ae6000abda3

[TPM] Fix the tpm frontend to properly shut down when the domain
is shutting down (call to xenbus_frontend_closed()). Also the driver
now waits longer until an outstanding response has been received (to
support a busy system). Moves the 'Unknown' state with the other
states that are not used by the TPM frontend.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author kfraser@localhost.localdomain
date Wed Oct 18 15:16:37 2006 +0100 (2006-10-18)
parents bd6d4a499e47
children cbc181eb54fa
files linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Wed Oct 18 15:13:41 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c	Wed Oct 18 15:16:37 2006 +0100
     1.3 @@ -343,6 +343,7 @@ static void backend_changed(struct xenbu
     1.4  	case XenbusStateInitialising:
     1.5  	case XenbusStateInitWait:
     1.6  	case XenbusStateInitialised:
     1.7 +	case XenbusStateUnknown:
     1.8  		break;
     1.9  
    1.10  	case XenbusStateConnected:
    1.11 @@ -351,13 +352,14 @@ static void backend_changed(struct xenbu
    1.12  
    1.13  	case XenbusStateClosing:
    1.14  		tpmif_set_connected_state(tp, 0);
    1.15 +		xenbus_frontend_closed(dev);
    1.16  		break;
    1.17  
    1.18 -	case XenbusStateUnknown:
    1.19  	case XenbusStateClosed:
    1.20 +		tpmif_set_connected_state(tp, 0);
    1.21  		if (tp->is_suspended == 0)
    1.22  			device_unregister(&dev->dev);
    1.23 -		xenbus_switch_state(dev, XenbusStateClosed);
    1.24 +		xenbus_frontend_closed(dev);
    1.25  		break;
    1.26  	}
    1.27  }
    1.28 @@ -419,9 +421,10 @@ static int tpmfront_suspend(struct xenbu
    1.29  	mutex_lock(&suspend_lock);
    1.30  	tp->is_suspended = 1;
    1.31  
    1.32 -	for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {
    1.33 +	for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 300; ctr++) {
    1.34  		if ((ctr % 10) == 0)
    1.35 -			printk("TPM-FE [INFO]: Waiting for outstanding request.\n");
    1.36 +			printk("TPM-FE [INFO]: Waiting for outstanding "
    1.37 +			       "request.\n");
    1.38  		/*
    1.39  		 * Wait for a request to be responded to.
    1.40  		 */
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed Oct 18 15:13:41 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Wed Oct 18 15:16:37 2006 +0100
     2.3 @@ -157,10 +157,12 @@ static void frontend_changed(struct xenb
     2.4  
     2.5  	case XenbusStateClosing:
     2.6  		be->instance = -1;
     2.7 +		xenbus_switch_state(dev, XenbusStateClosing);
     2.8  		break;
     2.9  
    2.10 -	case XenbusStateUnknown:
    2.11 +	case XenbusStateUnknown: /* keep it here */
    2.12  	case XenbusStateClosed:
    2.13 +		xenbus_switch_state(dev, XenbusStateClosed);
    2.14  		device_unregister(&be->dev->dev);
    2.15  		tpmback_remove(dev);
    2.16  		break;