@@ -1231,100 +1231,6 @@ static int vc_sm_cma_ioctl_alloc(struct vc_sm_privdata_t *private,
12311231 return ret ;
12321232}
12331233
1234- #ifndef CONFIG_ARM64
1235- /* Converts VCSM_CACHE_OP_* to an operating function. */
1236- static void (* cache_op_to_func (const unsigned int cache_op ))
1237- (const void * , const void * )
1238- {
1239- switch (cache_op ) {
1240- case VC_SM_CACHE_OP_NOP :
1241- return NULL ;
1242-
1243- case VC_SM_CACHE_OP_INV :
1244- return dmac_inv_range ;
1245- case VC_SM_CACHE_OP_CLEAN :
1246- return dmac_clean_range ;
1247- case VC_SM_CACHE_OP_FLUSH :
1248- return dmac_flush_range ;
1249-
1250- default :
1251- pr_err ("[%s]: Invalid cache_op: 0x%08x\n" , __func__ , cache_op );
1252- return NULL ;
1253- }
1254- }
1255-
1256- /*
1257- * Clean/invalid/flush cache of which buffer is already pinned (i.e. accessed).
1258- */
1259- static int clean_invalid_contig_2d (const void __user * addr ,
1260- const size_t block_count ,
1261- const size_t block_size ,
1262- const size_t stride ,
1263- const unsigned int cache_op )
1264- {
1265- size_t i ;
1266- void (* op_fn )(const void * start , const void * end );
1267-
1268- if (!block_size ) {
1269- pr_err ("[%s]: size cannot be 0\n" , __func__ );
1270- return - EINVAL ;
1271- }
1272-
1273- op_fn = cache_op_to_func (cache_op );
1274- if (!op_fn )
1275- return - EINVAL ;
1276-
1277- for (i = 0 ; i < block_count ; i ++ , addr += stride )
1278- op_fn (addr , addr + block_size );
1279-
1280- return 0 ;
1281- }
1282-
1283- static int vc_sm_cma_clean_invalid2 (unsigned int cmdnr , unsigned long arg )
1284- {
1285- struct vc_sm_cma_ioctl_clean_invalid2 ioparam ;
1286- struct vc_sm_cma_ioctl_clean_invalid_block * block = NULL ;
1287- int i , ret = 0 ;
1288-
1289- /* Get parameter data. */
1290- if (copy_from_user (& ioparam , (void * )arg , sizeof (ioparam ))) {
1291- pr_err ("[%s]: failed to copy-from-user header for cmd %x\n" ,
1292- __func__ , cmdnr );
1293- return - EFAULT ;
1294- }
1295- block = kmalloc (ioparam .op_count * sizeof (* block ), GFP_KERNEL );
1296- if (!block )
1297- return - EFAULT ;
1298-
1299- if (copy_from_user (block , (void * )(arg + sizeof (ioparam )),
1300- ioparam .op_count * sizeof (* block )) != 0 ) {
1301- pr_err ("[%s]: failed to copy-from-user payload for cmd %x\n" ,
1302- __func__ , cmdnr );
1303- ret = - EFAULT ;
1304- goto out ;
1305- }
1306-
1307- for (i = 0 ; i < ioparam .op_count ; i ++ ) {
1308- const struct vc_sm_cma_ioctl_clean_invalid_block * const op =
1309- block + i ;
1310-
1311- if (op -> invalidate_mode == VC_SM_CACHE_OP_NOP )
1312- continue ;
1313-
1314- ret = clean_invalid_contig_2d ((void __user * )op -> start_address ,
1315- op -> block_count , op -> block_size ,
1316- op -> inter_block_stride ,
1317- op -> invalidate_mode );
1318- if (ret )
1319- break ;
1320- }
1321- out :
1322- kfree (block );
1323-
1324- return ret ;
1325- }
1326- #endif
1327-
13281234static long vc_sm_cma_ioctl (struct file * file , unsigned int cmd ,
13291235 unsigned long arg )
13301236{
@@ -1416,16 +1322,6 @@ static long vc_sm_cma_ioctl(struct file *file, unsigned int cmd,
14161322 break ;
14171323 }
14181324
1419- #ifndef CONFIG_ARM64
1420- /*
1421- * Flush/Invalidate the cache for a given mapping.
1422- * Blocks must be pinned (i.e. accessed) before this call.
1423- */
1424- case VC_SM_CMA_CMD_CLEAN_INVALID2 :
1425- ret = vc_sm_cma_clean_invalid2 (cmdnr , arg );
1426- break ;
1427- #endif
1428-
14291325 default :
14301326 pr_debug ("[%s]: cmd %x tgid %u, owner %u\n" , __func__ , cmdnr ,
14311327 current -> tgid , file_data -> pid );
0 commit comments