TPM: Provide a facility for a userspace TPM emulator [ver #4]

Provide a misc device file (/dev/tpm_emul) by which a userspace TPM emulator
can set up a virtual TPM device under the control of the TPM frontend.  The
way this works is:

 (1) The emulator opens /dev/tpm_emul which is provided by the tpm_user
     driver.

 (2) tpm_user registers a TPM device and the tpm driver creates a /dev/tpmN
     misc device for the trousers package and suchlike to access.

 (3) The emulator sits in read() on the emulator device waiting for a command
     to come through.

 (4) tpm_user passes requests from /dev/tpmN to the emulator's read() call.

 (5) The emulator processes the request.

 (6) The emulator either write()'s the reply or calls ioctl(fd,0,0) to cancel
     the command.

 (7) The emulator goes back to read() to wait for the next command.

 (8) tpm_user passes the reply back to the tpm driver which passes it back to
     /dev/tpmN.

When the emulator closes /dev/tpm_emul, the TPM driver is unregistered and the
/dev/tpmN misc device is then removed.  Any outstanding requests are aborted
and -EIO will be returned from then on.  Multiple TPMs can be registered.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>