WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Allow adjustment of the size of TPM transfer buffers

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Allow adjustment of the size of TPM transfer buffers
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 03 Oct 2005 14:16:11 +0000
Delivery-date: Mon, 03 Oct 2005 14:13:48 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID dd87869f877ca9c68c97f36b3870908fb279edb9
# Parent  a9dce0ffc90198bbc0cef139212efd4b8f3b129b
Allow adjustment of the size of TPM transfer buffers 
to the size that a lower-layer driver supports.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>

diff -r a9dce0ffc901 -r dd87869f877c 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.c Mon Oct  3 14:04:27 2005
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.c Mon Oct  3 14:05:37 2005
@@ -30,7 +30,8 @@
 
 enum {
        TPM_MINOR = 224,        /* officially assigned */
-       TPM_BUFSIZE = 2048,
+       TPM_MIN_BUFSIZE = 2048,
+       TPM_MAX_BUFSIZE = 65536,
        TPM_NUM_DEVICES = 256,
        TPM_NUM_MASK_ENTRIES = TPM_NUM_DEVICES / (8 * sizeof(int))
 };
@@ -63,7 +64,7 @@
 
        down(&chip->buffer_mutex);
        atomic_set(&chip->data_pending, 0);
-       memset(chip->data_buffer, 0, TPM_BUFSIZE);
+       memset(chip->data_buffer, 0, chip->vendor->buffersize);
        up(&chip->buffer_mutex);
 }
 
@@ -458,7 +459,8 @@
 
        spin_unlock(&driver_lock);
 
-       chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
+       chip->data_buffer = kmalloc(chip->vendor->buffersize * sizeof(u8),
+                                   GFP_KERNEL);
        if (chip->data_buffer == NULL) {
                chip->num_opens--;
                put_device(chip->dev);
@@ -507,8 +509,8 @@
 
        down(&chip->buffer_mutex);
 
-       if (in_size > TPM_BUFSIZE)
-               in_size = TPM_BUFSIZE;
+       if (in_size > chip->vendor->buffersize)
+               in_size = chip->vendor->buffersize;
 
        if (copy_from_user
            (chip->data_buffer, (void __user *) buf, in_size)) {
@@ -517,7 +519,9 @@
        }
 
        /* atomic tpm command send and result receive */
-       out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
+       out_size = tpm_transmit(chip,
+                               chip->data_buffer,
+                               chip->vendor->buffersize);
 
        atomic_set(&chip->data_pending, out_size);
        up(&chip->buffer_mutex);
@@ -667,6 +671,12 @@
 
        chip->vendor = entry;
 
+       if (entry->buffersize < TPM_MIN_BUFSIZE) {
+               entry->buffersize = TPM_MIN_BUFSIZE;
+       } else if (entry->buffersize > TPM_MAX_BUFSIZE) {
+               entry->buffersize = TPM_MAX_BUFSIZE;
+       }
+
        chip->dev_num = -1;
 
        for (i = 0; i < TPM_NUM_MASK_ENTRIES; i++)
diff -r a9dce0ffc901 -r dd87869f877c 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.h
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.h Mon Oct  3 14:04:27 2005
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_nopci.h Mon Oct  3 14:05:37 2005
@@ -62,6 +62,7 @@
        u8 req_complete_val;
        u8 req_canceled;
        u16 base;               /* TPM base address */
+       u32 buffersize;         /* The device's requested buffersize */
 
        int (*recv) (struct tpm_chip *, u8 *, size_t);
        int (*send) (struct tpm_chip *, u8 *, size_t);
diff -r a9dce0ffc901 -r dd87869f877c 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Mon Oct  3 14:04:27 2005
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Mon Oct  3 14:05:37 2005
@@ -445,6 +445,7 @@
        .base = 0,
        .attr = TPM_DEVICE_ATTRS,
        .miscdev.fops = &tpm_xen_ops,
+       .buffersize = 64 * 1024,
 };
 
 static struct device tpm_device = {
@@ -476,6 +477,8 @@
                tpm_fe_unregister_receiver();
                return rc;
        }
+
+       tpm_xen.buffersize = tpmfe.max_tx_size;
 
        if ((rc = tpm_register_hardware_nopci(&tpm_device, &tpm_xen)) < 0) {
                device_unregister(&tpm_device);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Allow adjustment of the size of TPM transfer buffers, Xen patchbot -unstable <=