43 #include <linux/kernel.h>
44 #include <linux/module.h>
48 #include <linux/kdev_t.h>
50 #include <linux/sched.h>
52 #include <linux/poll.h>
53 #include <linux/wait.h>
54 #include <linux/pci.h>
56 #include <linux/slab.h>
58 #include <asm/current.h>
63 #include <asm/cacheflush.h>
70 #include <crypto/sha.h>
72 #include <crypto/aes.h>
82 #define CREATE_TRACE_POINTS
90 #define sep_dump_message(sep) _sep_dump_message(sep)
92 #define sep_dump_message(sep)
113 unsigned long lck_flags;
115 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_queue_status_remove\n",
118 if (!queue_elem || !(*queue_elem)) {
132 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_queue_status_remove return\n",
156 unsigned long lck_flags;
195 static int sep_allocate_dmatables_region(
struct sep_device *sep,
196 void **dmatables_region,
198 const u32 table_count)
200 const size_t new_len =
203 void *tmp_region =
NULL;
205 dev_dbg(&sep->
pdev->dev,
"[PID%d] dma_ctx = 0x%p\n",
207 dev_dbg(&sep->
pdev->dev,
"[PID%d] dmatables_region = 0x%p\n",
208 current->pid, dmatables_region);
210 if (!dma_ctx || !dmatables_region) {
212 "[PID%d] dma context/region uninitialized\n",
217 dev_dbg(&sep->
pdev->dev,
"[PID%d] newlen = 0x%08zX\n",
224 "[PID%d] no mem for dma tables region\n",
230 if (*dmatables_region) {
232 kfree(*dmatables_region);
233 *dmatables_region =
NULL;
236 *dmatables_region = tmp_region;
255 "[PID%d] no transactions, returning\n",
257 goto end_function_setpid;
276 "[PID%d] no transactions, breaking\n",
281 "[PID%d] transactions ongoing, sleeping\n",
287 dev_dbg(&sep->
pdev->dev,
"[PID%d] received signal\n",
317 static inline int sep_check_transaction_owner(
struct sep_device *sep)
319 dev_dbg(&sep->
pdev->dev,
"[PID%d] transaction pid = %d\n",
340 static void _sep_dump_message(
struct sep_device *sep)
346 for (count = 0; count < 10 * 4; count += 4)
348 "[PID%d] Word %d of the message is %x\n",
359 static int sep_map_and_alloc_shared_area(
struct sep_device *sep)
367 "[PID%d] shared memory dma_alloc_coherent failed\n",
372 "[PID%d] shared_addr %zx bytes @%p (bus %llx)\n",
383 static void sep_unmap_and_free_shared_area(
struct sep_device *sep)
399 static void *sep_shared_bus_to_virt(
struct sep_device *sep,
440 dev_dbg(&sep_dev->
pdev->dev,
"[PID%d] priv is 0x%p\n",
463 "[PID%d] sep_free_dma_table_data_handler\n",
466 if (!dma_ctx || !(*dma_ctx)) {
469 "[PID%d] no DMA context or context already freed\n",
475 dev_dbg(&sep->
pdev->dev,
"[PID%d] (*dma_ctx)->nr_dcb_creat 0x%x\n",
477 (*dma_ctx)->nr_dcb_creat);
479 for (dcb_counter = 0;
480 dcb_counter < (*dma_ctx)->nr_dcb_creat; dcb_counter++) {
481 dma = &(*dma_ctx)->dma_res_arr[dcb_counter];
500 if (((*dma_ctx)->secure_dma ==
false) &&
522 if (((*dma_ctx)->secure_dma ==
false) &&
567 (*dma_ctx)->nr_dcb_creat = 0;
568 (*dma_ctx)->num_lli_tables_created = 0;
574 "[PID%d] sep_free_dma_table_data_handler end\n",
588 static int sep_end_transaction_handler(
struct sep_device *sep,
601 if (sep_check_transaction_owner(sep)) {
602 dev_dbg(&sep->
pdev->dev,
"[PID%d] not transaction owner\n",
624 #ifdef SEP_ENABLE_RUNTIME_PM
627 pm_runtime_mark_last_busy(&sep->
pdev->dev);
628 pm_runtime_put_autosuspend(&sep->
pdev->dev);
636 dev_dbg(&sep->
pdev->dev,
"[PID%d] waking up next transaction\n",
652 static int sep_release(
struct inode *inode,
struct file *filp)
662 sep_end_transaction_handler(sep, dma_ctx, call_status,
684 unsigned long error = 0;
711 goto end_function_with_error;
714 dev_dbg(&sep->
pdev->dev,
"[PID%d] shared_addr is %p\n",
722 dev_dbg(&sep->
pdev->dev,
"[PID%d] remap_pfn_range failed\n",
725 goto end_function_with_error;
733 end_function_with_error:
735 sep_end_transaction_handler(sep,
NULL, call_status,
758 unsigned long lock_irq_flag;
761 if (sep_check_transaction_owner(sep)) {
762 dev_dbg(&sep->
pdev->dev,
"[PID%d] poll pid not owner\n",
771 dev_warn(&sep->
pdev->dev,
"[PID%d] sendmsg not called\n",
779 dev_dbg(&sep->
pdev->dev,
"[PID%d] poll: calling wait sep_event\n",
785 "[PID%d] poll: send_ct is %lx reply ct is %lx\n",
790 if ((retval2 != 0x0) && (retval2 != 0x8)) {
791 dev_dbg(&sep->
pdev->dev,
"[PID%d] poll; poll error %x\n",
800 spin_unlock_irqrestore(&sep->
snd_rply_lck, lock_irq_flag);
803 "[PID%d] poll: data ready check (GPR2) %x\n",
807 if ((retval >> 30) & 0x1) {
809 "[PID%d] poll: SEP printf request\n",
817 "[PID%d] poll: SEP request\n",
821 "[PID%d] poll: normal return\n",
825 "[PID%d] poll; SEP reply POLLIN|POLLRDNORM\n",
831 spin_unlock_irqrestore(&sep->
snd_rply_lck, lock_irq_flag);
833 "[PID%d] poll; no reply; returning mask of 0\n",
862 static unsigned long sep_set_time(
struct sep_device *sep)
871 time_addr = sep_time_address(sep);
874 time_addr[1] =
time.tv_sec;
876 dev_dbg(&sep->
pdev->dev,
"[PID%d] time.tv_sec is %lu\n",
878 dev_dbg(&sep->
pdev->dev,
"[PID%d] time_addr is %p\n",
880 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep->shared_addr is %p\n",
897 unsigned long lock_irq_flag;
907 dev_warn(&sep->
pdev->dev,
"start message token not present\n");
914 if ((*msg_pool < 2) ||
930 #if defined(CONFIG_PM_RUNTIME) && defined(SEP_ENABLE_RUNTIME_PM)
931 dev_dbg(&sep->
pdev->dev,
"[PID%d] before pm sync status 0x%X\n",
933 sep->
pdev->dev.power.runtime_status);
935 pm_runtime_get_sync(&sep->
pdev->dev);
950 spin_unlock_irqrestore(&sep->
snd_rply_lck, lock_irq_flag);
953 "[PID%d] sep_send_command_handler send_ct %lx reply_ct %lx\n",
978 static int sep_crypto_dma(
999 temp_sg = scatterwalk_sg_next(temp_sg);
1002 "There are (hex) %x segments in sg\n", count_segment);
1006 count_segment, direction);
1009 "There are (hex) %x maps in sg\n", count_mapped);
1011 if (count_mapped == 0) {
1019 if (sep_dma ==
NULL) {
1020 dev_dbg(&sep->
pdev->dev,
"Cannot allocate dma_maps\n");
1027 dev_dbg(&sep->
pdev->dev,
"(all hex) map %x dma %lx len %lx\n",
1028 ct1, (
unsigned long)sep_dma[ct1].
dma_addr,
1029 (
unsigned long)sep_dma[ct1].
size);
1032 *dma_maps = sep_dma;
1033 return count_mapped;
1056 static int sep_crypto_lli(
1071 nbr_ents = sep_crypto_dma(sep, sg, maps, direction);
1072 if (nbr_ents <= 0) {
1073 dev_dbg(&sep->
pdev->dev,
"crypto_dma failed %x\n",
1082 if (sep_lli ==
NULL) {
1083 dev_dbg(&sep->
pdev->dev,
"Cannot allocate lli_maps\n");
1090 for (ct1 = 0; ct1 < nbr_ents; ct1 += 1) {
1094 if (sep_map[ct1].
size > data_size)
1122 static int sep_lock_kernel_pages(
struct sep_device *sep,
1123 unsigned long kernel_virt_addr,
1151 num_pages = sep_crypto_lli(sep, sg, &map_array, &lli_array,
1152 data_size, direction);
1154 if (num_pages <= 0) {
1155 dev_dbg(&sep->
pdev->dev,
"sep_crypto_lli returned error %x\n",
1164 *lli_array_ptr = lli_array;
1176 *lli_array_ptr = lli_array;
1205 static int sep_lock_user_pages(
struct sep_device *sep,
1223 struct page **page_array;
1230 end_page = (app_virt_addr + data_size - 1) >>
PAGE_SHIFT;
1232 num_pages = end_page - start_page + 1;
1235 "[PID%d] lock user pages app_virt_addr is %x\n",
1238 dev_dbg(&sep->
pdev->dev,
"[PID%d] data_size is (hex) %x\n",
1240 dev_dbg(&sep->
pdev->dev,
"[PID%d] start_page is (hex) %x\n",
1242 dev_dbg(&sep->
pdev->dev,
"[PID%d] end_page is (hex) %x\n",
1244 dev_dbg(&sep->
pdev->dev,
"[PID%d] num_pages is (hex) %x\n",
1256 "[PID%d] kmalloc for map_array failed\n",
1259 goto end_function_with_error1;
1267 "[PID%d] kmalloc for lli_array failed\n",
1270 goto end_function_with_error2;
1278 0, page_array,
NULL);
1283 if (result != num_pages) {
1285 "[PID%d] not all pages locked by get_user_pages, "
1286 "result 0x%X, num_pages 0x%X\n",
1287 current->pid, result, num_pages);
1289 goto end_function_with_error3;
1292 dev_dbg(&sep->
pdev->dev,
"[PID%d] get_user_pages succeeded\n",
1299 for (count = 0; count <
num_pages; count++) {
1312 "[PID%d] lli_array[%x].bus_address is %08lx, "
1313 "lli_array[%x].block_size is (hex) %x\n",
current->pid,
1314 count, (
unsigned long)lli_array[count].
bus_address,
1330 "[PID%d] After check if page 0 has all data\n",
1333 "[PID%d] lli_array[0].bus_address is (hex) %08lx, "
1334 "lli_array[0].block_size is (hex) %x\n",
1337 lli_array[0].block_size);
1341 if (num_pages > 1) {
1344 if (lli_array[num_pages - 1].
block_size == 0)
1348 "[PID%d] After last page size adjustment\n",
1351 "[PID%d] lli_array[%x].bus_address is (hex) %08lx, "
1352 "lli_array[%x].block_size is (hex) %x\n",
1355 (
unsigned long)lli_array[num_pages - 1].
bus_address,
1362 *lli_array_ptr = lli_array;
1373 *lli_array_ptr = lli_array;
1386 end_function_with_error3:
1390 end_function_with_error2:
1393 end_function_with_error1:
1414 static int sep_lli_table_secure_dma(
struct sep_device *sep,
1434 end_page = (app_virt_addr + data_size - 1) >> PAGE_SHIFT;
1436 num_pages = end_page - start_page + 1;
1439 "[PID%d] lock user pages app_virt_addr is %x\n",
1442 dev_dbg(&sep->
pdev->dev,
"[PID%d] data_size is (hex) %x\n",
1444 dev_dbg(&sep->
pdev->dev,
"[PID%d] start_page is (hex) %x\n",
1446 dev_dbg(&sep->
pdev->dev,
"[PID%d] end_page is (hex) %x\n",
1448 dev_dbg(&sep->
pdev->dev,
"[PID%d] num_pages is (hex) %x\n",
1456 "[PID%d] kmalloc for lli_array failed\n",
1465 for (count = 0; count <
num_pages; count++) {
1473 "[PID%d] lli_array[%x].bus_address is %08lx, "
1474 "lli_array[%x].block_size is (hex) %x\n",
1476 count, (
unsigned long)lli_array[count].
bus_address,
1492 "[PID%d] After check if page 0 has all data\n"
1493 "lli_array[0].bus_address is (hex) %08lx, "
1494 "lli_array[0].block_size is (hex) %x\n",
1497 lli_array[0].block_size);
1500 if (num_pages > 1) {
1503 if (lli_array[num_pages - 1].
block_size == 0)
1507 "[PID%d] After last page size adjustment\n"
1508 "lli_array[%x].bus_address is (hex) %08lx, "
1509 "lli_array[%x].block_size is (hex) %x\n",
1511 (
unsigned long)lli_array[num_pages - 1].
bus_address,
1515 *lli_array_ptr = lli_array;
1536 static u32 sep_calculate_lli_table_max_size(
struct sep_device *sep,
1538 u32 num_array_entries,
1539 u32 *last_table_flag)
1543 u32 table_data_size = 0;
1545 u32 next_table_data_size;
1547 *last_table_flag = 0;
1555 (counter < num_array_entries); counter++)
1556 table_data_size += lli_in_array_ptr[counter].
block_size;
1563 if (counter == num_array_entries) {
1565 *last_table_flag = 1;
1573 next_table_data_size = 0;
1574 for (; counter < num_array_entries; counter++) {
1585 if (next_table_data_size &&
1589 next_table_data_size);
1592 return table_data_size;
1607 static void sep_build_lli_table(
struct sep_device *sep,
1610 u32 *num_processed_entries_ptr,
1611 u32 *num_table_entries_ptr,
1612 u32 table_data_size)
1615 u32 curr_table_data_size;
1620 curr_table_data_size = 0;
1622 *num_table_entries_ptr = 1;
1625 "[PID%d] build lli table table_data_size: (hex) %x\n",
1626 current->pid, table_data_size);
1629 while (curr_table_data_size < table_data_size) {
1631 (*num_table_entries_ptr)++;
1639 curr_table_data_size += lli_array_ptr[array_counter].
block_size;
1642 "[PID%d] lli_table_ptr is %p\n",
1645 "[PID%d] lli_table_ptr->bus_address: %08lx\n",
1650 "[PID%d] lli_table_ptr->block_size is (hex) %x\n",
1654 if (curr_table_data_size > table_data_size) {
1656 "[PID%d] curr_table_data_size too large\n",
1662 (curr_table_data_size - table_data_size);
1670 (curr_table_data_size - table_data_size);
1676 "[PID%d] lli_table_ptr->bus_address is %08lx\n",
1680 "[PID%d] lli_table_ptr->block_size is (hex) %x\n",
1693 *num_processed_entries_ptr += array_counter;
1710 dev_dbg(&sep->
pdev->dev,
"[PID%d] sh virt to phys v %p\n",
1712 dev_dbg(&sep->
pdev->dev,
"[PID%d] sh virt to phys p %08lx\n",
1730 static void *sep_shared_area_bus_to_virt(
struct sep_device *sep,
1733 dev_dbg(&sep->
pdev->dev,
"[PID%d] shared bus to virt b=%lx v=%lx\n",
1735 (
unsigned long)bus_address, (
unsigned long)(sep->
shared_addr +
1750 static void sep_debug_print_lli_tables(
struct sep_device *sep,
1752 unsigned long num_table_entries,
1753 unsigned long table_data_size)
1756 unsigned long table_count = 1;
1757 unsigned long entries_count = 0;
1759 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_debug_print_lli_tables start\n",
1761 if (num_table_entries == 0) {
1762 dev_dbg(&sep->
pdev->dev,
"[PID%d] no table to print\n",
1767 while ((
unsigned long) lli_table_ptr->
bus_address != 0xffffffff) {
1769 "[PID%d] lli table %08lx, "
1770 "table_data_size is (hex) %lx\n",
1771 current->pid, table_count, table_data_size);
1773 "[PID%d] num_table_entries is (hex) %lx\n",
1774 current->pid, num_table_entries);
1777 for (entries_count = 0; entries_count < num_table_entries;
1778 entries_count++, lli_table_ptr++) {
1781 "[PID%d] lli_table_ptr address is %08lx\n",
1783 (
unsigned long) lli_table_ptr);
1786 "[PID%d] phys address is %08lx "
1787 "block size is (hex) %x\n",
current->pid,
1796 "[PID%d] phys lli_table_ptr->block_size "
1802 "[PID%d] phys lli_table_ptr->physical_address "
1808 table_data_size = lli_table_ptr->
block_size & 0xffffff;
1809 num_table_entries = (lli_table_ptr->
block_size >> 24) & 0xff;
1812 "[PID%d] phys table_data_size is "
1813 "(hex) %lx num_table_entries is"
1814 " %lx bus_address is%lx\n",
1820 if ((
unsigned long)lli_table_ptr->
bus_address != 0xffffffff)
1822 sep_shared_bus_to_virt(sep,
1827 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_debug_print_lli_tables end\n",
1844 static void sep_prepare_empty_lli_table(
struct sep_device *sep,
1846 u32 *num_entries_ptr,
1847 u32 *table_data_size_ptr,
1848 void **dmatables_region,
1860 if (dmatables_region && *dmatables_region)
1861 lli_table_ptr = *dmatables_region;
1878 *num_entries_ptr = 2;
1879 *table_data_size_ptr = 0;
1900 static int sep_prepare_input_dma_table(
struct sep_device *sep,
1901 unsigned long app_virt_addr,
1905 u32 *num_entries_ptr,
1906 u32 *table_data_size_ptr,
1908 void **dmatables_region,
1918 u32 current_entry = 0;
1920 u32 sep_lli_entries = 0;
1924 u32 table_data_size = 0;
1926 u32 last_table_flag = 0;
1928 u32 num_entries_in_table = 0;
1930 void *lli_table_alloc_addr =
NULL;
1931 void *dma_lli_table_alloc_addr =
NULL;
1932 void *dma_in_lli_table_ptr =
NULL;
1935 "[PID%d] prepare intput dma tbl data size: (hex) %x\n",
1938 dev_dbg(&sep->
pdev->dev,
"[PID%d] block_size is (hex) %x\n",
1946 lli_table_alloc_addr = (
void *)(sep->
shared_addr +
1951 if (data_size == 0) {
1952 if (dmatables_region) {
1953 error = sep_allocate_dmatables_region(sep,
1961 sep_prepare_empty_lli_table(sep, lli_table_ptr,
1962 num_entries_ptr, table_data_size_ptr,
1963 dmatables_region, dma_ctx);
1964 goto update_dcb_counter;
1969 error = sep_lock_kernel_pages(sep, app_virt_addr,
1977 error = sep_lock_user_pages(sep, app_virt_addr,
1985 "[PID%d] output sep_in_num_pages is (hex) %x\n",
1990 info_entry_ptr =
NULL;
1995 dma_lli_table_alloc_addr = lli_table_alloc_addr;
1996 if (dmatables_region) {
1997 error = sep_allocate_dmatables_region(sep,
2003 lli_table_alloc_addr = *dmatables_region;
2007 while (current_entry < sep_lli_entries) {
2012 dma_in_lli_table_ptr =
2020 if (dma_lli_table_alloc_addr >
2026 goto end_function_error;
2034 table_data_size = sep_calculate_lli_table_max_size(sep,
2035 &lli_array_ptr[current_entry],
2036 (sep_lli_entries - current_entry),
2043 if (!last_table_flag)
2048 "[PID%d] output table_data_size is (hex) %x\n",
2053 sep_build_lli_table(sep, &lli_array_ptr[current_entry],
2055 ¤t_entry, &num_entries_in_table, table_data_size);
2057 if (info_entry_ptr ==
NULL) {
2060 *lli_table_ptr = sep_shared_area_virt_to_bus(sep,
2061 dma_in_lli_table_ptr);
2062 *num_entries_ptr = num_entries_in_table;
2063 *table_data_size_ptr = table_data_size;
2066 "[PID%d] output lli_table_in_ptr is %08lx\n",
2068 (
unsigned long)*lli_table_ptr);
2073 sep_shared_area_virt_to_bus(sep,
2074 dma_in_lli_table_ptr);
2076 ((num_entries_in_table) << 24) |
2080 info_entry_ptr = in_lli_table_ptr + num_entries_in_table - 1;
2083 if (!dmatables_region) {
2085 sep_shared_area_bus_to_virt(sep, *lli_table_ptr),
2086 *num_entries_ptr, *table_data_size_ptr);
2090 kfree(lli_array_ptr);
2101 kfree(lli_array_ptr);
2130 static int sep_construct_dma_tables_from_lli(
2133 u32 sep_in_lli_entries,
2135 u32 sep_out_lli_entries,
2139 u32 *in_num_entries_ptr,
2140 u32 *out_num_entries_ptr,
2141 u32 *table_data_size_ptr,
2142 void **dmatables_region,
2146 void *lli_table_alloc_addr =
NULL;
2151 void *dma_lli_table_alloc_addr =
NULL;
2165 u32 current_in_entry = 0;
2167 u32 current_out_entry = 0;
2169 u32 in_table_data_size = 0;
2171 u32 out_table_data_size = 0;
2173 u32 last_table_flag = 0;
2175 u32 table_data_size = 0;
2177 u32 num_entries_in_table = 0;
2179 u32 num_entries_out_table = 0;
2182 dev_warn(&sep->
pdev->dev,
"DMA context uninitialized\n");
2187 lli_table_alloc_addr = (
void *)(sep->
shared_addr +
2191 SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP)));
2192 dma_lli_table_alloc_addr = lli_table_alloc_addr;
2194 if (dmatables_region) {
2196 if (sep_allocate_dmatables_region(sep,
2199 2*sep_in_lli_entries))
2201 lli_table_alloc_addr = *dmatables_region;
2205 while (current_in_entry < sep_in_lli_entries) {
2209 dma_in_lli_table_ptr =
2220 dma_out_lli_table_ptr =
2224 if ((dma_lli_table_alloc_addr +
sizeof(
struct sep_lli_entry) *
2230 dev_warn(&sep->
pdev->dev,
"dma table limit overrun\n");
2243 in_table_data_size =
2244 sep_calculate_lli_table_max_size(sep,
2245 &lli_in_array[current_in_entry],
2246 (sep_in_lli_entries - current_in_entry),
2250 out_table_data_size =
2251 sep_calculate_lli_table_max_size(sep,
2252 &lli_out_array[current_out_entry],
2253 (sep_out_lli_entries - current_out_entry),
2256 if (!last_table_flag) {
2257 in_table_data_size = (in_table_data_size /
2259 out_table_data_size = (out_table_data_size /
2263 table_data_size = in_table_data_size;
2264 if (table_data_size > out_table_data_size)
2265 table_data_size = out_table_data_size;
2268 "[PID%d] construct tables from lli"
2269 " in_table_data_size is (hex) %x\n",
current->pid,
2270 in_table_data_size);
2273 "[PID%d] construct tables from lli"
2274 "out_table_data_size is (hex) %x\n",
current->pid,
2275 out_table_data_size);
2278 sep_build_lli_table(sep, &lli_in_array[current_in_entry],
2281 &num_entries_in_table,
2285 sep_build_lli_table(sep, &lli_out_array[current_out_entry],
2288 &num_entries_out_table,
2292 if (info_in_entry_ptr ==
NULL) {
2295 sep_shared_area_virt_to_bus(sep, dma_in_lli_table_ptr);
2297 *in_num_entries_ptr = num_entries_in_table;
2299 *lli_table_out_ptr =
2300 sep_shared_area_virt_to_bus(sep,
2301 dma_out_lli_table_ptr);
2303 *out_num_entries_ptr = num_entries_out_table;
2304 *table_data_size_ptr = table_data_size;
2307 "[PID%d] output lli_table_in_ptr is %08lx\n",
2309 (
unsigned long)*lli_table_in_ptr);
2311 "[PID%d] output lli_table_out_ptr is %08lx\n",
2313 (
unsigned long)*lli_table_out_ptr);
2317 sep_shared_area_virt_to_bus(sep,
2318 dma_in_lli_table_ptr);
2321 ((num_entries_in_table) << 24) |
2326 sep_shared_area_virt_to_bus(sep,
2327 dma_out_lli_table_ptr);
2330 ((num_entries_out_table) << 24) |
2334 "[PID%d] output lli_table_in_ptr:%08lx %08x\n",
2340 "[PID%d] output lli_table_out_ptr:"
2348 info_in_entry_ptr = in_lli_table_ptr +
2349 num_entries_in_table - 1;
2350 info_out_entry_ptr = out_lli_table_ptr +
2351 num_entries_out_table - 1;
2354 "[PID%d] output num_entries_out_table is %x\n",
2356 (
u32)num_entries_out_table);
2358 "[PID%d] output info_in_entry_ptr is %lx\n",
2360 (
unsigned long)info_in_entry_ptr);
2362 "[PID%d] output info_out_entry_ptr is %lx\n",
2364 (
unsigned long)info_out_entry_ptr);
2368 if (!dmatables_region) {
2369 sep_debug_print_lli_tables(
2372 sep_shared_area_bus_to_virt(sep, *lli_table_in_ptr),
2373 *in_num_entries_ptr,
2374 *table_data_size_ptr);
2378 if (!dmatables_region) {
2379 sep_debug_print_lli_tables(
2382 sep_shared_area_bus_to_virt(sep, *lli_table_out_ptr),
2383 *out_num_entries_ptr,
2384 *table_data_size_ptr);
2409 static int sep_prepare_input_output_dma_table(
struct sep_device *sep,
2410 unsigned long app_virt_in_addr,
2411 unsigned long app_virt_out_addr,
2416 u32 *in_num_entries_ptr,
2417 u32 *out_num_entries_ptr,
2418 u32 *table_data_size_ptr,
2420 void **dmatables_region,
2435 if (data_size == 0) {
2437 if (dmatables_region) {
2438 error = sep_allocate_dmatables_region(
2446 sep_prepare_empty_lli_table(sep, lli_table_in_ptr,
2447 in_num_entries_ptr, table_data_size_ptr,
2448 dmatables_region, dma_ctx);
2450 sep_prepare_empty_lli_table(sep, lli_table_out_ptr,
2451 out_num_entries_ptr, table_data_size_ptr,
2452 dmatables_region, dma_ctx);
2454 goto update_dcb_counter;
2462 if (is_kva ==
true) {
2463 dev_dbg(&sep->
pdev->dev,
"[PID%d] Locking kernel input pages\n",
2465 error = sep_lock_kernel_pages(sep, app_virt_in_addr,
2470 "[PID%d] sep_lock_kernel_pages for input "
2471 "virtual buffer failed\n",
current->pid);
2476 dev_dbg(&sep->
pdev->dev,
"[PID%d] Locking kernel output pages\n",
2478 error = sep_lock_kernel_pages(sep, app_virt_out_addr,
2484 "[PID%d] sep_lock_kernel_pages for output "
2485 "virtual buffer failed\n",
current->pid);
2487 goto end_function_free_lli_in;
2493 dev_dbg(&sep->
pdev->dev,
"[PID%d] Locking user input pages\n",
2495 error = sep_lock_user_pages(sep, app_virt_in_addr,
2500 "[PID%d] sep_lock_user_pages for input "
2501 "virtual buffer failed\n",
current->pid);
2508 dev_dbg(&sep->
pdev->dev,
"[PID%d] in secure_dma\n",
2510 error = sep_lli_table_secure_dma(sep,
2511 app_virt_out_addr, data_size, &lli_out_array,
2515 "[PID%d] secure dma table setup "
2516 " for output virtual buffer failed\n",
2519 goto end_function_free_lli_in;
2523 dev_dbg(&sep->
pdev->dev,
"[PID%d] not in secure_dma\n",
2527 "[PID%d] Locking user output pages\n",
2530 error = sep_lock_user_pages(sep, app_virt_out_addr,
2536 "[PID%d] sep_lock_user_pages"
2537 " for output virtual buffer failed\n",
2540 goto end_function_free_lli_in;
2546 "[PID%d] After lock; prep input output dma table sep_in_num_pages is (hex) %x\n",
2550 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_out_num_pages is (hex) %x\n",
2555 "[PID%d] SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP is (hex) %x\n",
2556 current->pid, SEP_DRIVER_ENTRIES_PER_TABLE_IN_SEP);
2559 dev_dbg(&sep->
pdev->dev,
"[PID%d] calling create table from lli\n",
2561 error = sep_construct_dma_tables_from_lli(
2568 block_size, lli_table_in_ptr, lli_table_out_ptr,
2569 in_num_entries_ptr, out_num_entries_ptr,
2570 table_data_size_ptr, dmatables_region, dma_ctx);
2574 "[PID%d] sep_construct_dma_tables_from_lli failed\n",
2576 goto end_function_with_error;
2579 kfree(lli_out_array);
2580 kfree(lli_in_array);
2588 end_function_with_error:
2593 kfree(lli_out_array);
2596 end_function_free_lli_in:
2601 kfree(lli_in_array);
2627 unsigned long app_in_address,
2628 unsigned long app_out_address,
2631 u32 tail_block_size,
2636 void **dmatables_region,
2649 u32 in_first_num_entries = 0;
2653 u32 out_first_num_entries = 0;
2655 u32 first_data_size = 0;
2657 dev_dbg(&sep->
pdev->dev,
"[PID%d] app_in_address %lx\n",
2658 current->pid, app_in_address);
2660 dev_dbg(&sep->
pdev->dev,
"[PID%d] app_out_address %lx\n",
2661 current->pid, app_out_address);
2663 dev_dbg(&sep->
pdev->dev,
"[PID%d] data_in_size %x\n",
2666 dev_dbg(&sep->
pdev->dev,
"[PID%d] block_size %x\n",
2669 dev_dbg(&sep->
pdev->dev,
"[PID%d] tail_block_size %x\n",
2670 current->pid, tail_block_size);
2685 dev_warn(&sep->
pdev->dev,
"[PID%d] no DMA context pointer\n",
2693 dev_dbg(&sep->
pdev->dev,
"[PID%d] DMA context already set\n",
2696 *dma_ctx = kzalloc(
sizeof(**dma_ctx),
GFP_KERNEL);
2699 "[PID%d] Not enough memory for DMA context\n",
2705 "[PID%d] Created DMA context addr at 0x%p\n",
2709 (*dma_ctx)->secure_dma = secure_dma;
2712 (*dma_ctx)->src_sg = src_sg;
2713 (*dma_ctx)->dst_sg = dst_sg;
2717 dev_dbg(&sep->
pdev->dev,
"[PID%d] no more DCBs available\n",
2720 goto end_function_error;
2725 dcb_table_ptr = dcb_region;
2729 ((*dma_ctx)->nr_dcb_creat *
2743 if (isapplet ==
true) {
2747 if (is_kva ==
true) {
2749 goto end_function_error;
2752 (
void __user *)app_in_address,
2755 goto end_function_error;
2762 if (app_out_address)
2775 if (!app_out_address) {
2778 if (tail_block_size == block_size)
2786 if (tail_size >
sizeof(dcb_table_ptr->
tail_data))
2788 if (is_kva ==
true) {
2790 goto end_function_error;
2794 (
void __user *)(app_in_address +
2795 data_in_size -
tail_size), tail_size)) {
2797 goto end_function_error;
2800 if (app_out_address)
2807 data_in_size - tail_size;
2815 data_in_size = (data_in_size -
tail_size);
2819 if (app_out_address) {
2821 error = sep_prepare_input_output_dma_table(sep,
2826 &in_first_mlli_address,
2827 &out_first_mlli_address,
2828 &in_first_num_entries,
2829 &out_first_num_entries,
2836 error = sep_prepare_input_dma_table(sep,
2840 &in_first_mlli_address,
2841 &in_first_num_entries,
2850 "prepare DMA table call failed "
2851 "from prepare DCB call\n");
2852 goto end_function_error;
2883 static int sep_free_dma_tables_and_dcb(
struct sep_device *sep,
bool isapplet,
2887 unsigned long pt_hold;
2894 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_free_dma_tables_and_dcb\n",
2897 if (((*dma_ctx)->secure_dma ==
false) && (isapplet ==
true)) {
2898 dev_dbg(&sep->
pdev->dev,
"[PID%d] handling applet\n",
2911 for (i = 0; dma_ctx && *dma_ctx &&
2914 pt_hold = (
unsigned long)dcb_table_ptr->
2916 tail_pt = (
void *)pt_hold;
2917 if (is_kva ==
true) {
2922 (
void __user *)tail_pt,
2938 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep_free_dma_tables_and_dcb end\n",
2953 static int sep_prepare_dcb_handler(
struct sep_device *sep,
unsigned long arg,
2969 "[PID%d] prep dcb handler app_in_address is %08llx\n",
2970 current->pid, command_args.app_in_address);
2972 "[PID%d] app_out_address is %08llx\n",
2973 current->pid, command_args.app_out_address);
2975 "[PID%d] data_size is %x\n",
2976 current->pid, command_args.data_in_size);
2978 "[PID%d] block_size is %x\n",
2979 current->pid, command_args.block_size);
2981 "[PID%d] tail block_size is %x\n",
2982 current->pid, command_args.tail_block_size);
2984 "[PID%d] is_applet is %x\n",
2985 current->pid, command_args.is_applet);
2987 if (!command_args.app_in_address) {
2989 "[PID%d] null app_in_address\n",
current->pid);
2995 (
unsigned long)command_args.app_in_address,
2996 (
unsigned long)command_args.app_out_address,
2997 command_args.data_in_size, command_args.block_size,
2998 command_args.tail_block_size,
2999 command_args.is_applet,
false,
3014 static int sep_free_dcb_handler(
struct sep_device *sep,
3017 if (!dma_ctx || !(*dma_ctx)) {
3019 "[PID%d] no dma context defined, nothing to free\n",
3024 dev_dbg(&sep->
pdev->dev,
"[PID%d] free dcbs num of DCBs %x\n",
3026 (*dma_ctx)->nr_dcb_creat);
3028 return sep_free_dma_tables_and_dcb(sep,
false,
false, dma_ctx);
3039 static long sep_ioctl(
struct file *filp,
unsigned int cmd,
unsigned long arg)
3048 dev_dbg(&sep->
pdev->dev,
"[PID%d] ioctl cmd 0x%x\n",
3050 dev_dbg(&sep->
pdev->dev,
"[PID%d] dma context addr 0x%p\n",
3054 error = sep_check_transaction_owner(sep);
3056 dev_dbg(&sep->
pdev->dev,
"[PID%d] ioctl pid is not owner\n",
3065 "[PID%d] mmap not called\n",
current->pid);
3079 "[PID%d] SEP_IOCSENDSEPCOMMAND start\n",
3084 "[PID%d] send msg already done\n",
3095 "[PID%d] SEP_IOCSENDSEPCOMMAND end\n",
3100 "[PID%d] SEP_IOCENDTRANSACTION start\n",
3102 error = sep_end_transaction_handler(sep, dma_ctx, call_status,
3105 "[PID%d] SEP_IOCENDTRANSACTION end\n",
3110 "[PID%d] SEP_IOCPREPAREDCB start\n",
3114 "[PID%d] SEP_IOCPREPAREDCB_SECURE_DMA start\n",
3119 "[PID%d] dcb prep needed before send msg\n",
3127 "[PID%d] dcb null arg\n",
current->pid);
3135 "[PID%d] SEP_IOCPREPAREDCB (no secure_dma)\n",
3138 error = sep_prepare_dcb_handler(sep, arg,
false,
3143 "[PID%d] SEP_IOC_POC (with secure_dma)\n",
3146 error = sep_prepare_dcb_handler(sep, arg,
true,
3153 dev_dbg(&sep->
pdev->dev,
"[PID%d] SEP_IOCFREEDCB start\n",
3157 "[PID%d] SEP_IOCFREEDCB_SECURE_DMA start\n",
3159 error = sep_free_dcb_handler(sep, dma_ctx);
3160 dev_dbg(&sep->
pdev->dev,
"[PID%d] SEP_IOCFREEDCB end\n",
3183 unsigned long lock_irq_flag;
3189 #if defined(CONFIG_PM_RUNTIME) && defined(SEP_ENABLE_RUNTIME_PM)
3191 dev_dbg(&sep->
pdev->dev,
"interrupt during pwr save\n");
3197 dev_dbg(&sep->
pdev->dev,
"interrupt while nobody using sep\n");
3204 dev_dbg(&sep->
pdev->dev,
"sep int: IRR REG val: %x\n", reg_val);
3206 if (reg_val & (0x1 << 13)) {
3211 spin_unlock_irqrestore(&sep->
snd_rply_lck, lock_irq_flag);
3213 dev_dbg(&sep->
pdev->dev,
"sep int: send_ct %lx reply_ct %lx\n",
3219 goto finished_interrupt;
3225 "SEP Interrupt - GPR2 is %08x\n", reg_val2);
3229 if ((reg_val2 >> 30) & 0x1) {
3230 dev_dbg(&sep->
pdev->dev,
"int: printf request\n");
3231 }
else if (reg_val2 >> 31) {
3232 dev_dbg(&sep->
pdev->dev,
"int: daemon request\n");
3238 dev_dbg(&sep->
pdev->dev,
"int: not SEP interrupt\n");
3257 static int sep_reconfig_shared_area(
struct sep_device *sep)
3262 unsigned long end_time;
3265 dev_dbg(&sep->
pdev->dev,
"reconfig shared; sending %08llx to sep\n",
3275 while ((
time_before(jiffies, end_time)) && (ret_val != 0xffffffff) &&
3281 dev_warn(&sep->
pdev->dev,
"could not reconfig shared area\n");
3287 dev_dbg(&sep->
pdev->dev,
"reconfig shared area end\n");
3302 void **dmatables_region,
3305 void *dmaregion_free_start =
NULL;
3306 void *dmaregion_free_end =
NULL;
3307 void *dcbregion_free_start =
NULL;
3308 void *dcbregion_free_end =
NULL;
3311 dev_dbg(&sep->
pdev->dev,
"[PID%d] activating dcb/dma region\n",
3316 "[PID%d] invalid number of dcbs to activate 0x%08X\n",
3324 dmaregion_free_end = dmaregion_free_start
3327 if (dmaregion_free_start
3332 memcpy(dmaregion_free_start,
3336 kfree(*dmatables_region);
3337 *dmatables_region =
NULL;
3342 dcbregion_free_end = dcbregion_free_start +
3346 if (dcbregion_free_start
3348 > dcbregion_free_end) {
3353 memcpy(dcbregion_free_start,
3358 dev_dbg(&sep->
pdev->dev,
"activate: input table\n");
3359 sep_debug_print_lli_tables(sep,
3361 (*dcb_region)->input_mlli_address),
3362 (*dcb_region)->input_mlli_num_entries,
3363 (*dcb_region)->input_mlli_data_size);
3365 dev_dbg(&sep->
pdev->dev,
"activate: output table\n");
3366 sep_debug_print_lli_tables(sep,
3368 (*dcb_region)->output_mlli_address),
3369 (*dcb_region)->output_mlli_num_entries,
3370 (*dcb_region)->output_mlli_data_size);
3373 "[PID%d] printing activated tables\n",
current->pid);
3376 kfree(*dmatables_region);
3377 *dmatables_region =
NULL;
3397 void **dmatables_region,
3400 const u32 num_dcbs,
bool secure_dma)
3406 dev_dbg(&sep->
pdev->dev,
"[PID%d] creating dcb/dma region\n",
3409 if (!dcb_region || !dma_ctx || !dmatables_region || !user_dcb_args) {
3416 "[PID%d] invalid number of dcbs 0x%08X\n",
3425 dev_warn(&sep->
pdev->dev,
"[PID%d] no memory for dcb args\n",
3439 *dcb_region = kzalloc(num_dcbs *
sizeof(
struct sep_dcblock),
3441 if (!(*dcb_region)) {
3447 for (i = 0; i < num_dcbs; i++) {
3452 dcb_args[i].block_size,
3456 *dcb_region, dmatables_region,
3462 "[PID%d] dma table creation failed\n",
3467 if (dcb_args[i].app_in_address != 0)
3493 void **dmatables_region,
3501 dev_dbg(&sep->
pdev->dev,
"[PID%d] creating dcb/dma region\n",
3504 if (!dcb_region || !dma_ctx || !dmatables_region || !dcb_data) {
3511 "[PID%d] invalid number of dcbs 0x%08X\n",
3517 dev_dbg(&sep->
pdev->dev,
"[PID%d] num_dcbs is %d\n",
3521 *dcb_region = kzalloc(num_dcbs *
sizeof(
struct sep_dcblock),
3523 if (!(*dcb_region)) {
3529 for (i = 0; i < num_dcbs; i++) {
3539 *dcb_region, dmatables_region,
3545 "[PID%d] dma table creation failed\n",
3566 dev_dbg(&sep->
pdev->dev,
"[PID%d] activating msg region\n",
3569 if (!msg_region || !(*msg_region) ||
3572 "[PID%d] invalid act msgarea len 0x%08zX\n",
3591 const void __user *msg_user,
3592 const size_t msg_len)
3596 dev_dbg(&sep->
pdev->dev,
"[PID%d] creating msg region\n",
3604 "[PID%d] invalid creat msgarea len 0x%08zX\n",
3612 if (!(*msg_region)) {
3614 "[PID%d] no mem for msgarea context\n",
3627 if (error && msg_region) {
3647 char __user *buf_user,
size_t count_user,
3655 ssize_t error = 0, error_tmp = 0;
3658 error = sep_check_transaction_owner(sep);
3660 dev_dbg(&sep->
pdev->dev,
"[PID%d] read pid is not owner\n",
3669 "[PID%d] fastcall write not called\n",
3672 goto end_function_error;
3677 "[PID%d] null user buffer\n",
3680 goto end_function_error;
3691 dev_dbg(&sep->
pdev->dev,
"[PID%d] count_user = 0x%08zX\n",
3700 goto end_function_error;
3708 error_tmp = sep_free_dcb_handler(sep, dma_ctx);
3714 error_tmp = sep_end_transaction_handler(sep, dma_ctx, call_status,
3718 "[PID%d] ending transaction failed\n",
3734 const char __user *buf_user,
3735 const size_t count_user)
3738 size_t actual_count = 0;
3742 "[PID%d] null user buffer\n",
3750 "[PID%d] too small message size 0x%08zX\n",
3764 "[PID%d] invalid fastcall magic 0x%08X\n",
3770 dev_dbg(&sep->
pdev->dev,
"[PID%d] fastcall hdr num of DCBs 0x%08X\n",
3772 dev_dbg(&sep->
pdev->dev,
"[PID%d] fastcall hdr msg len 0x%08X\n",
3775 if (SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES < args->msg_len ||
3778 "[PID%d] invalid message length\n",
3788 if (actual_count != count_user) {
3790 "[PID%d] inconsistent message "
3791 "sizes 0x%08zX vs 0x%08zX\n",
3792 current->pid, actual_count, count_user);
3812 const char __user *buf_user,
size_t count_user,
3820 void *msg_region =
NULL;
3821 void *dmatables_region =
NULL;
3827 dev_dbg(&sep->
pdev->dev,
"[PID%d] sep dev is 0x%p\n",
3829 dev_dbg(&sep->
pdev->dev,
"[PID%d] private_data is 0x%p\n",
3832 error = sep_fastcall_args_get(sep, &call_hdr, buf_user, count_user);
3839 my_secure_dma =
false;
3841 my_secure_dma =
true;
3849 "[PID%d] waiting for double buffering region access\n",
3852 dev_dbg(&sep->
pdev->dev,
"[PID%d] double buffering region start\n",
3856 goto end_function_error;
3865 error = sep_create_dcb_dmatables_context(sep,
3873 goto end_function_error_doublebuf;
3878 error = sep_create_msgarea_context(sep,
3883 goto end_function_error_doublebuf;
3885 dev_dbg(&sep->
pdev->dev,
"[PID%d] updating queue status\n",
3893 if (!my_queue_elem) {
3895 "[PID%d] updating queue status error\n",
current->pid);
3897 goto end_function_error_doublebuf;
3905 dev_dbg(&sep->
pdev->dev,
"[PID%d] interrupted by signal\n",
3908 goto end_function_error_doublebuf;
3911 dev_dbg(&sep->
pdev->dev,
"[PID%d] saving queue element\n",
3916 error = sep_activate_msgarea_context(sep, &msg_region,
3919 goto end_function_error_clear_transact;
3929 goto end_function_error_clear_transact;
3935 goto end_function_error_clear_transact;
3938 private_data->
dma_ctx = dma_ctx;
3944 dev_dbg(&sep->
pdev->dev,
"[PID%d] double buffering region end\n",
3949 end_function_error_clear_transact:
3950 sep_end_transaction_handler(sep, &dma_ctx, call_status,
3953 end_function_error_doublebuf:
3955 dev_dbg(&sep->
pdev->dev,
"[PID%d] double buffering region end\n",
3964 kfree(dmatables_region);
3978 static loff_t sep_seek(
struct file *filp, loff_t offset,
int origin)
3998 .unlocked_ioctl = sep_ioctl,
4001 .release = sep_release,
4020 sep_sysfs_read(
struct file *filp,
struct kobject *kobj,
4022 char *
buf, loff_t
pos,
size_t count)
4024 unsigned long lck_flags;
4025 size_t nleft =
count;
4038 if (count <
sizeof(queue_num)
4044 memcpy(buf, &queue_num,
sizeof(queue_num));
4045 buf +=
sizeof(queue_num);
4046 nleft -=
sizeof(queue_num);
4049 if (i++ > queue_num)
4053 nleft -=
sizeof(queue_elem->
data);
4054 buf +=
sizeof(queue_elem->
data);
4058 return count - nleft;
4068 .attr = {.name =
"queue_status", .mode = 0444},
4069 .read = sep_sysfs_read,
4080 static int sep_register_driver_with_fs(
struct sep_device *sep)
4090 dev_warn(&sep->
pdev->dev,
"misc reg fails for SEP %x\n",
4098 dev_warn(&sep->
pdev->dev,
"sysfs attribute1 fails for SEP %x\n",
4121 if (sep_dev !=
NULL) {
4122 dev_dbg(&pdev->
dev,
"only one SEP supported.\n");
4129 dev_warn(&pdev->
dev,
"error enabling pci device\n");
4135 if (sep_dev ==
NULL) {
4137 "can't kmalloc the sep_device structure\n");
4139 goto end_function_disable_device;
4161 "sep probe: PCI obtained, device being prepared\n");
4166 dev_warn(&sep->
pdev->dev,
"Error getting register start\n");
4168 goto end_function_free_sep_dev;
4173 dev_warn(&sep->
pdev->dev,
"Error getting register end\n");
4175 goto end_function_free_sep_dev;
4181 dev_warn(&sep->
pdev->dev,
"Error getting register virtual\n");
4183 goto end_function_free_sep_dev;
4187 "Register area start %llx end %llx virtual %p\n",
4199 if (sep_map_and_alloc_shared_area(sep)) {
4202 goto end_function_error;
4221 goto end_function_deallocate_sep_shared_area;
4224 error = sep_reconfig_shared_area(sep);
4226 goto end_function_free_irq;
4232 error = sep_register_driver_with_fs(sep);
4235 dev_err(&sep->
pdev->dev,
"error registering dev file\n");
4236 goto end_function_free_irq;
4240 #ifdef SEP_ENABLE_RUNTIME_PM
4241 pm_runtime_put_noidle(&sep->
pdev->dev);
4245 pm_runtime_use_autosuspend(&sep->
pdev->dev);
4246 pm_runtime_mark_last_busy(&sep->
pdev->dev);
4250 #if defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE)
4253 dev_err(&sep->
pdev->dev,
"crypto setup failed\n");
4254 goto end_function_free_irq;
4259 end_function_free_irq:
4262 end_function_deallocate_sep_shared_area:
4264 sep_unmap_and_free_shared_area(sep);
4269 end_function_free_sep_dev:
4274 end_function_disable_device:
4289 static void sep_remove(
struct pci_dev *pdev)
4297 #if defined(CONFIG_CRYPTO) || defined(CONFIG_CRYPTO_MODULE)
4304 sep_unmap_and_free_shared_area(sep_dev);
4307 #ifdef SEP_ENABLE_RUNTIME_PM
4311 pm_runtime_get_noresume(&sep->
pdev->dev);
4329 #ifdef SEP_ENABLE_RUNTIME_PM
4339 static int sep_pci_resume(
struct device *
dev)
4372 static int sep_pci_suspend(
struct device *dev)
4397 static int sep_pm_runtime_resume(
struct device *dev)
4404 dev_dbg(&sep->
pdev->dev,
"pm runtime resume called\n");
4417 retval2 &= 0x00000008;
4425 dev_warn(&sep->
pdev->dev,
"scu boot bit not set at resume\n");
4449 static int sep_pm_runtime_suspend(
struct device *dev)
4453 dev_dbg(&sep->
pdev->dev,
"pm runtime suspend called\n");
4468 .runtime_resume = sep_pm_runtime_resume,
4469 .runtime_suspend = sep_pm_runtime_suspend,
4470 .resume = sep_pci_resume,
4471 .suspend = sep_pci_suspend,
4483 #ifdef SEP_ENABLE_RUNTIME_PM
4488 .name =
"sep_sec_driver",
4489 .id_table = sep_pci_id_tbl,
4491 .remove = sep_remove