From 802038d3725c87459397a1dfd7b9c00d93ef4955 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Thu, 26 Apr 2012 18:39:55 -0700 Subject: security: tf_driver: update with latest TL drop Tegra 2 version: TF_TEGRA2_AA01.07.34078 Tegra 3 version: TF_TEGRA3_AB01.06.34049 Bug 950169 Signed-off-by: Chris Johnson 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 Tested-by: Chris Johnson Reviewed-by: Karan Jhavar Reviewed-by: Yu-Huan Hsu --- security/tf_driver/s_version.h | 4 +-- security/tf_driver/tf_comm.c | 56 +++++++++++------------------------------- security/tf_driver/tf_device.c | 2 +- 3 files changed, 17 insertions(+), 45 deletions(-) (limited to 'security/tf_driver') diff --git a/security/tf_driver/s_version.h b/security/tf_driver/s_version.h index 6244d3fe7e8d..ba4d48c6f417 100644 --- a/security/tf_driver/s_version.h +++ b/security/tf_driver/s_version.h @@ -33,12 +33,12 @@ */ #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 diff --git a/security/tf_driver/tf_comm.c b/security/tf_driver/tf_comm.c index 16915beb406d..ad45d31d80b9 100644 --- a/security/tf_driver/tf_comm.c +++ b/security/tf_driver/tf_comm.c @@ -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,10 +1232,6 @@ 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(); -#endif - #ifdef CONFIG_FREEZER saved_flags = current->flags; current->flags |= PF_FREEZER_NOSIG; diff --git a/security/tf_driver/tf_device.c b/security/tf_driver/tf_device.c index ad44b46c2067..5d5f3c63ce88 100644 --- a/security/tf_driver/tf_device.c +++ b/security/tf_driver/tf_device.c @@ -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) { -- cgit v1.2.3