diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-05 13:52:18 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-10-05 13:52:18 +0100 |
commit | 862b6e64648870e3427402ef63ffc16e66b2da21 (patch) | |
tree | 7db6263d9a417d8e1809efa31993673ad93efd04 /patches | |
parent | ee256fbc4042aba2db3a39ebcf434e6abce71a88 (diff) | |
download | xen-862b6e64648870e3427402ef63ffc16e66b2da21.tar.gz xen-862b6e64648870e3427402ef63ffc16e66b2da21.tar.bz2 xen-862b6e64648870e3427402ef63ffc16e66b2da21.zip |
The attached patch places an updated TPM driver into the sparse directory.
This driver allows to build a Xen0 kernel with TPM front- and backend
support and use it as a user domain kernel - something that is not
possible to do with the current TPM driver in the 2.6.12 kernel. Once this
driver appears in similar form in the kernel, I will remove it from the
sparse directory.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Leendert van Doorn <leendert@watson.ibm.com>
Diffstat (limited to 'patches')
-rw-r--r-- | patches/linux-2.6.12/tpm_partial_read.patch | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/patches/linux-2.6.12/tpm_partial_read.patch b/patches/linux-2.6.12/tpm_partial_read.patch deleted file mode 100644 index d682c9b392..0000000000 --- a/patches/linux-2.6.12/tpm_partial_read.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- ref-linux-2.6.12/drivers/char/tpm/tpm.c 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6-xen-sparse/drivers/char/tpm/tpm.c 2005-09-15 14:56:05.000000000 -0400 -@@ -473,6 +401,7 @@ ssize_t tpm_write(struct file * file, co - out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE); - - atomic_set(&chip->data_pending, out_size); -+ atomic_set(&chip->data_position, 0); - up(&chip->buffer_mutex); - - /* Set a timeout by which the reader must come claim the result */ -@@ -494,29 +423,34 @@ ssize_t tpm_read(struct file * file, cha - { - struct tpm_chip *chip = file->private_data; - int ret_size = -ENODATA; -+ int pos, pending = 0; - -- if (atomic_read(&chip->data_pending) != 0) { /* Result available */ -+ down(&chip->buffer_mutex); -+ ret_size = atomic_read(&chip->data_pending); -+ if ( ret_size > 0 ) { /* Result available */ -+ if (size < ret_size) -+ ret_size = size; -+ -+ pos = atomic_read(&chip->data_position); -+ -+ if (copy_to_user((void __user *) buf, -+ &chip->data_buffer[pos], ret_size)) { -+ ret_size = -EFAULT; -+ } else { -+ pending = atomic_read(&chip->data_pending) - ret_size; -+ if ( pending ) { -+ atomic_set( &chip->data_pending, pending ); -+ atomic_set( &chip->data_position, pos+ret_size ); -+ } -+ } -+ } -+ up(&chip->buffer_mutex); -+ -+ if ( ret_size <= 0 || pending == 0 ) { -+ atomic_set( &chip->data_pending, 0 ); - down(&chip->timer_manipulation_mutex); - del_singleshot_timer_sync(&chip->user_read_timer); - up(&chip->timer_manipulation_mutex); -- -- down(&chip->buffer_mutex); -- -- ret_size = atomic_read(&chip->data_pending); -- atomic_set(&chip->data_pending, 0); -- -- if (ret_size == 0) /* timeout just occurred */ -- ret_size = -ETIME; -- else if (ret_size > 0) { /* relay data */ -- if (size < ret_size) -- ret_size = size; -- -- if (copy_to_user((void __user *) buf, -- chip->data_buffer, ret_size)) { -- ret_size = -EFAULT; -- } -- } -- up(&chip->buffer_mutex); - } - - return ret_size; ---- ref-linux-2.6.12/drivers/char/tpm/tpm.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6-xen-sparse/drivers/char/tpm/tpm.h 2005-09-15 14:56:05.000000000 -0400 -@@ -54,6 +54,7 @@ struct tpm_chip { - /* Data passed to and from the tpm via the read/write calls */ - u8 *data_buffer; - atomic_t data_pending; -+ atomic_t data_position; - struct semaphore buffer_mutex; - - struct timer_list user_read_timer; /* user needs to claim result */ |