security: tf_driver: update with latest TL drop
Chris Johnson [Fri, 4 May 2012 13:49:05 +0000 (18:49 +0530)]
Tegra 2 version: TF_TEGRA2_AA01.07.34078
Tegra 3 version: TF_TEGRA3_AB01.06.34049

Bug 950169

Signed-off-by: Chris Johnson <cwj@nvidia.com>
Reviewed-on: http://git-master/r/89927
(cherry picked from commit 28fc4a5b80a0f6db3e6dc50efd8c0412e2ae11bf)

Change-Id: I41413b4f00d243e3bb56d44fb32eea29d0291401
Reviewed-on: http://git-master/r/90445
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Chris Johnson <cwj@nvidia.com>
Tested-by: Chris Johnson <cwj@nvidia.com>
Reviewed-by: Karan Jhavar <kjhavar@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

Conflicts:

security/tf_driver/tf_comm.c

Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

Rebase-Id: R7d6137a8401fe5dea232f324ad65f398f9cf67f3

security/tf_driver/s_version.h
security/tf_driver/tf_comm.c
security/tf_driver/tf_device.c

index 6244d3f..ba4d48c 100644 (file)
  */
 
 #define S_VERSION_OS "A"          /* "A" for all Android */
-#define S_VERSION_PLATFORM "B"    /* "B" for Tegra3 */
+#define S_VERSION_PLATFORM "A"    /* "A" for Tegra2 */
 
 /*
  * This version number must be updated for each new release
  */
-#define S_VERSION_MAIN  "01.03"
+#define S_VERSION_MAIN  "01.07"
 
 /*
 * If this is a patch or engineering version use the following
index 16915be..e71f37d 100644 (file)
@@ -208,6 +208,7 @@ struct tf_coarse_page_table *tf_alloc_coarse_page_table(
                }
 
                array->type = type;
+               array->ref_count = 0;
                INIT_LIST_HEAD(&(array->list));
 
                /* now allocate the actual page the page descriptor describes */
@@ -236,7 +237,7 @@ struct tf_coarse_page_table *tf_alloc_coarse_page_table(
                                 */
                                coarse_pg_table =
                                        &(array->coarse_page_tables[i]);
-                               array->ref_count = 1;
+                               array->ref_count++;
                        } else {
                                /*
                                 * The other elements are added to the free list
@@ -455,12 +456,11 @@ u32 tf_get_l2_descriptor_common(u32 vaddr, struct mm_struct *mm)
                        /*
                         * Linux's pte doesn't keep track of TEX value.
                         * Have to jump to hwpte see include/asm/pgtable.h
-                        * (-2k before 2.6.38, then +2k)
                         */
 #ifdef PTE_HWTABLE_SIZE
-                       hwpte = (u32 *) (ptep+PTE_HWTABLE_PTRS);
+                       hwpte = (u32 *) (ptep + PTE_HWTABLE_PTRS);
 #else
-                       hwpte = (u32 *) (ptep-PTRS_PER_PTE);
+                       hwpte = (u32 *) (ptep - PTRS_PER_PTE);
 #endif
                        if (((*hwpte) & L2_DESCRIPTOR_ADDR_MASK) !=
                                        ((*ptep) & L2_DESCRIPTOR_ADDR_MASK))
@@ -839,52 +839,28 @@ int tf_fill_descriptor_table(
                                        goto error;
                                }
                        }
-               } else if (is_vmalloc_addr((void *)buffer_offset_vaddr)) {
-                       /* Kernel-space memory obtained through vmalloc */
-                       dprintk(KERN_INFO
-                               "tf_fill_descriptor_table: "
-                               "vmalloc'ed buffer starting at %p\n",
-                              (void *)buffer_offset_vaddr);
-                       for (j = page_shift; j < pages_to_get; j++) {
-                               struct page *page;
-                               void *addr =
-                                       (void *)(buffer_offset_vaddr +
-                                               (j - page_shift) * PAGE_SIZE);
-                               page = vmalloc_to_page(addr);
-                               if (page == NULL) {
-                                       dprintk(KERN_ERR
-                                               "tf_fill_descriptor_table: "
-                                               "cannot map %p (vmalloc) "
-                                               "to page\n",
-                                               addr);
-                                       ret = -EFAULT;
-                                       goto error;
-                               }
-                               coarse_pg_table->descriptors[j] = (u32)page;
-                               get_page(page);
-
-                               /* change coarse page "page address" */
-                               tf_get_l2_page_descriptor(
-                                       &coarse_pg_table->descriptors[j],
-                                       flags,
-                                       &init_mm);
-                       }
                } else {
-                       /* Kernel-space memory given by a virtual address */
+                       /* Kernel-space memory */
                        dprintk(KERN_INFO
                                "tf_fill_descriptor_table: "
-                               "buffer starting at virtual address %p\n",
+                               "buffer starting at %p\n",
                               (void *)buffer_offset_vaddr);
                        for (j = page_shift; j < pages_to_get; j++) {
                                struct page *page;
                                void *addr =
                                        (void *)(buffer_offset_vaddr +
                                                (j - page_shift) * PAGE_SIZE);
-                               page = virt_to_page(addr);
+
+                               if (is_vmalloc_addr(
+                                               (void *) buffer_offset_vaddr))
+                                       page = vmalloc_to_page(addr);
+                               else
+                                       page = virt_to_page(addr);
+
                                if (page == NULL) {
                                        dprintk(KERN_ERR
                                                "tf_fill_descriptor_table: "
-                                               "cannot map %p (virtual) "
+                                               "cannot map %p (vmalloc) "
                                                "to page\n",
                                                addr);
                                        ret = -EFAULT;
@@ -1256,8 +1232,9 @@ static int tf_send_recv(struct tf_comm *comm,
        dprintk(KERN_INFO "[pid=%d] tf_send_recv(%p)\n",
                 current->pid, command);
 
-#ifdef CONFIG_TF_ZEBRA
-       tf_clock_timer_start();
+#ifdef CONFIG_FREEZER
+       saved_flags = current->flags;
+       current->flags |= PF_KTHREAD;
 #endif
 
 #ifdef CONFIG_FREEZER
index ad44b46..5d5f3c6 100644 (file)
@@ -393,7 +393,7 @@ static int __init tf_device_register(void)
        }
 
 #ifdef CONFIG_TF_DRIVER_CRYPTO_FIPS
-       error = tf_self_test_post_init(&(dev_stats->kobj));
+       error = tf_self_test_post_init(&(g_tf_dev.kobj));
        /* N.B. error > 0 indicates a POST failure, which will not
           prevent the module from loading. */
        if (error < 0) {