msm_cvp_ioctl.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #include <linux/compat.h>
  6. #include "cvp_private.h"
  7. #include "cvp_hfi_api.h"
  8. static int _get_pkt_hdr_from_user(struct eva_kmd_arg __user *up,
  9. struct cvp_hal_session_cmd_pkt *pkt_hdr)
  10. {
  11. struct eva_kmd_hfi_packet *u;
  12. struct cvp_hfi_msg_session_hdr *hdr;
  13. hdr = (struct cvp_hfi_msg_session_hdr *)pkt_hdr;
  14. u = &up->data.hfi_pkt;
  15. if (get_user(pkt_hdr->size, &u->pkt_data[0]))
  16. return -EFAULT;
  17. if (get_user(pkt_hdr->packet_type, &u->pkt_data[1]))
  18. return -EFAULT;
  19. if (get_pkt_index(pkt_hdr) < 0) {
  20. dprintk(CVP_ERR, "user mode provides incorrect hfi\n");
  21. goto set_default_pkt_hdr;
  22. }
  23. if (pkt_hdr->size > MAX_HFI_PKT_SIZE*sizeof(unsigned int)) {
  24. dprintk(CVP_ERR, "user HFI packet too large %x\n",
  25. pkt_hdr->size);
  26. return -EINVAL;
  27. }
  28. return 0;
  29. set_default_pkt_hdr:
  30. pkt_hdr->size = get_msg_size(hdr);
  31. return 0;
  32. }
  33. static int _get_fence_pkt_hdr_from_user(struct eva_kmd_arg __user *up,
  34. struct cvp_hal_session_cmd_pkt *pkt_hdr)
  35. {
  36. struct eva_kmd_hfi_synx_packet __user *u;
  37. u = &up->data.hfi_synx_pkt;
  38. if (get_user(pkt_hdr->size, &u->pkt_data[0]))
  39. return -EFAULT;
  40. if (get_user(pkt_hdr->packet_type, &u->pkt_data[1]))
  41. return -EFAULT;
  42. if (pkt_hdr->size > (MAX_HFI_PKT_SIZE*sizeof(unsigned int)))
  43. return -EINVAL;
  44. return 0;
  45. }
  46. /* Size is in unit of u32 */
  47. static int _copy_pkt_from_user(struct eva_kmd_arg *kp,
  48. struct eva_kmd_arg __user *up,
  49. unsigned int size)
  50. {
  51. struct eva_kmd_hfi_packet *k, *u;
  52. int i;
  53. k = &kp->data.hfi_pkt;
  54. u = &up->data.hfi_pkt;
  55. for (i = 0; i < size; i++)
  56. if (get_user(k->pkt_data[i], &u->pkt_data[i]))
  57. return -EFAULT;
  58. if (get_user(k->oob_buf, &u->oob_buf))
  59. return -EFAULT;
  60. return 0;
  61. }
  62. static int _copy_synx_data_from_user(
  63. struct eva_kmd_hfi_synx_packet *k,
  64. struct eva_kmd_hfi_synx_packet __user *u)
  65. {
  66. int i;
  67. for (i = 0; i < MAX_FENCE_DATA_SIZE; i++) {
  68. if (get_user(k->fence_data[i], &u->fence_data[i]))
  69. return -EFAULT;
  70. }
  71. if (get_user(k->oob_buf, &u->oob_buf))
  72. return -EFAULT;
  73. return 0;
  74. }
  75. /* Size is in unit of u32 */
  76. static int _copy_fence_data_from_user_deprecate(
  77. struct eva_kmd_hfi_fence_packet *k,
  78. struct eva_kmd_hfi_fence_packet __user *u)
  79. {
  80. int i;
  81. for (i = 0; i < MAX_HFI_FENCE_SIZE; i++) {
  82. if (get_user(k->fence_data[i], &u->fence_data[i]))
  83. return -EFAULT;
  84. }
  85. if (get_user(k->frame_id, &u->frame_id)) {
  86. dprintk(CVP_ERR, "Failed to get frame id from fence pkt\n");
  87. return -EFAULT;
  88. }
  89. return 0;
  90. }
  91. static int _copy_fence_pkt_from_user(struct eva_kmd_arg *kp,
  92. struct eva_kmd_arg __user *up)
  93. { struct eva_kmd_hfi_synx_packet *k;
  94. struct eva_kmd_hfi_synx_packet __user *u;
  95. struct eva_kmd_hfi_fence_packet __user *u1;
  96. int i;
  97. k = &kp->data.hfi_synx_pkt;
  98. u = &up->data.hfi_synx_pkt;
  99. u1 = &up->data.hfi_fence_pkt;
  100. for (i = 0; i < MAX_HFI_PKT_SIZE; i++)
  101. if (get_user(k->pkt_data[i], &u->pkt_data[i]))
  102. return -EFAULT;
  103. if (get_user(k->fence_data[0], &u->fence_data[0]))
  104. return -EFAULT;
  105. if (k->fence_data[0] == 0xFEEDFACE)
  106. return _copy_synx_data_from_user(k, u);
  107. else
  108. return _copy_fence_data_from_user_deprecate(
  109. (struct eva_kmd_hfi_fence_packet *)k, u1);
  110. }
  111. static int _copy_frameid_from_user(struct eva_kmd_arg *kp,
  112. struct eva_kmd_arg __user *up)
  113. {
  114. if (get_user(kp->data.frame_id, &up->data.frame_id)) {
  115. dprintk(CVP_ERR, "Failed to get frame id from user\n");
  116. return -EFAULT;
  117. }
  118. return 0;
  119. }
  120. static int _copy_sysprop_from_user(struct eva_kmd_arg *kp,
  121. struct eva_kmd_arg __user *up)
  122. {
  123. struct eva_kmd_sys_properties *k, *u;
  124. k = &kp->data.sys_properties;
  125. u = &up->data.sys_properties;
  126. if (get_user(k->prop_num, &u->prop_num))
  127. return -EFAULT;
  128. if (k->prop_num < 1 || k->prop_num > 32) {
  129. dprintk(CVP_ERR, "Num of prop out of range %d\n", k->prop_num);
  130. return -EFAULT;
  131. }
  132. return _copy_pkt_from_user(kp, up,
  133. (k->prop_num*((sizeof(struct eva_kmd_sys_property)>>2)+1)));
  134. }
  135. static int _copy_pkt_to_user(struct eva_kmd_arg *kp,
  136. struct eva_kmd_arg __user *up,
  137. unsigned int size)
  138. {
  139. struct eva_kmd_hfi_packet *k, *u;
  140. int i;
  141. k = &kp->data.hfi_pkt;
  142. u = &up->data.hfi_pkt;
  143. for (i = 0; i < size; i++)
  144. if (put_user(k->pkt_data[i], &u->pkt_data[i]))
  145. return -EFAULT;
  146. if (put_user(k->oob_buf, &u->oob_buf))
  147. return -EFAULT;
  148. return 0;
  149. }
  150. static int _copy_fence_pkt_to_user(struct eva_kmd_arg *kp,
  151. struct eva_kmd_arg __user *up)
  152. {
  153. struct eva_kmd_hfi_synx_packet *k;
  154. struct eva_kmd_hfi_synx_packet __user *u;
  155. int i;
  156. k = &kp->data.hfi_synx_pkt;
  157. u = &up->data.hfi_synx_pkt;
  158. for (i = 0; i < MAX_HFI_PKT_SIZE; i++) {
  159. if (put_user(k->pkt_data[i], &u->pkt_data[i]))
  160. return -EFAULT;
  161. }
  162. if (put_user(k->oob_buf, &u->oob_buf))
  163. return -EFAULT;
  164. return 0;
  165. }
  166. static int _copy_sysprop_to_user(struct eva_kmd_arg *kp,
  167. struct eva_kmd_arg __user *up)
  168. {
  169. struct eva_kmd_sys_properties *k;
  170. struct eva_kmd_sys_properties __user *u;
  171. int i;
  172. k = &kp->data.sys_properties;
  173. u = &up->data.sys_properties;
  174. for (i = 0; i < 8; i++)
  175. if (put_user(k->prop_data[i].data, &u->prop_data[i].data))
  176. return -EFAULT;
  177. return 0;
  178. }
  179. static void print_hfi_short(struct eva_kmd_arg __user *up)
  180. {
  181. struct eva_kmd_hfi_packet *pkt;
  182. unsigned int words[5];
  183. pkt = &up->data.hfi_pkt;
  184. if (get_user(words[0], &up->type) ||
  185. get_user(words[1], &up->buf_offset) ||
  186. get_user(words[2], &up->buf_num) ||
  187. get_user(words[3], &pkt->pkt_data[0]) ||
  188. get_user(words[4], &pkt->pkt_data[1]))
  189. dprintk(CVP_ERR, "Failed to print ioctl cmd\n");
  190. dprintk(CVP_HFI, "IOCTL cmd type %#x, offset %d, num %d, pkt %d %#x\n",
  191. words[0], words[1], words[2], words[3], words[4]);
  192. }
  193. static int _copy_session_ctrl_to_user(
  194. struct eva_kmd_session_control *k,
  195. struct eva_kmd_session_control *u)
  196. {
  197. int i;
  198. if (put_user(k->ctrl_type, &u->ctrl_type))
  199. return -EFAULT;
  200. for (i = 0; i < 8; i++)
  201. if (put_user(k->ctrl_data[i], &u->ctrl_data[i]))
  202. return -EFAULT;
  203. return 0;
  204. }
  205. static int _get_session_ctrl_from_user(
  206. struct eva_kmd_session_control *k,
  207. struct eva_kmd_session_control *u)
  208. {
  209. int i;
  210. if (get_user(k->ctrl_type, &u->ctrl_type))
  211. return -EFAULT;
  212. for (i = 0; i < 8; i++)
  213. if (get_user(k->ctrl_data[i], &u->ctrl_data[i]))
  214. return -EFAULT;
  215. return 0;
  216. }
  217. static int _get_session_info_from_user(
  218. struct eva_kmd_session_info *k,
  219. struct eva_kmd_session_info __user *u)
  220. {
  221. int i;
  222. if (get_user(k->session_id, &u->session_id))
  223. return -EFAULT;
  224. for (i = 0; i < 10; i++)
  225. if (get_user(k->reserved[i], &u->reserved[i]))
  226. return -EFAULT;
  227. return 0;
  228. }
  229. static int convert_from_user(struct eva_kmd_arg *kp,
  230. unsigned long arg,
  231. struct msm_cvp_inst *inst)
  232. {
  233. int rc = 0;
  234. int i;
  235. struct eva_kmd_arg __user *up = (struct eva_kmd_arg *)arg;
  236. struct cvp_hal_session_cmd_pkt pkt_hdr;
  237. int pkt_idx;
  238. if (!kp || !up) {
  239. dprintk(CVP_ERR, "%s: invalid params\n", __func__);
  240. return -EINVAL;
  241. }
  242. print_hfi_short(up);
  243. if (get_user(kp->type, &up->type))
  244. return -EFAULT;
  245. if (get_user(kp->buf_offset, &up->buf_offset) ||
  246. get_user(kp->buf_num, &up->buf_num))
  247. return -EFAULT;
  248. switch (kp->type) {
  249. case EVA_KMD_GET_SESSION_INFO:
  250. {
  251. struct eva_kmd_session_info *k;
  252. struct eva_kmd_session_info __user *u;
  253. k = &kp->data.session;
  254. u = &up->data.session;
  255. if (_get_session_info_from_user(k, u)) {
  256. dprintk(CVP_ERR, "fail to get sess info\n");
  257. return -EFAULT;
  258. }
  259. break;
  260. }
  261. case EVA_KMD_REGISTER_BUFFER:
  262. {
  263. struct eva_kmd_buffer *k, *u;
  264. k = &kp->data.regbuf;
  265. u = &up->data.regbuf;
  266. if (get_user(k->type, &u->type) ||
  267. get_user(k->index, &u->index) ||
  268. get_user(k->fd, &u->fd) ||
  269. get_user(k->size, &u->size) ||
  270. get_user(k->offset, &u->offset) ||
  271. get_user(k->pixelformat, &u->pixelformat) ||
  272. get_user(k->flags, &u->flags))
  273. return -EFAULT;
  274. for (i = 0; i < 5; i++)
  275. if (get_user(k->reserved[i], &u->reserved[i]))
  276. return -EFAULT;
  277. break;
  278. }
  279. case EVA_KMD_UNREGISTER_BUFFER:
  280. {
  281. struct eva_kmd_buffer *k, *u;
  282. k = &kp->data.unregbuf;
  283. u = &up->data.unregbuf;
  284. if (get_user(k->type, &u->type) ||
  285. get_user(k->index, &u->index) ||
  286. get_user(k->fd, &u->fd) ||
  287. get_user(k->size, &u->size) ||
  288. get_user(k->offset, &u->offset) ||
  289. get_user(k->pixelformat, &u->pixelformat) ||
  290. get_user(k->flags, &u->flags))
  291. return -EFAULT;
  292. for (i = 0; i < 5; i++)
  293. if (get_user(k->reserved[i], &u->reserved[i]))
  294. return -EFAULT;
  295. break;
  296. }
  297. case EVA_KMD_SEND_CMD_PKT:
  298. {
  299. if (_get_pkt_hdr_from_user(up, &pkt_hdr)) {
  300. dprintk(CVP_ERR, "Invalid syscall: %x, %x, %x\n",
  301. kp->type, pkt_hdr.size, pkt_hdr.packet_type);
  302. return -EFAULT;
  303. }
  304. rc = _copy_pkt_from_user(kp, up, (pkt_hdr.size >> 2));
  305. break;
  306. }
  307. case EVA_KMD_SEND_FENCE_CMD_PKT:
  308. {
  309. if (_get_fence_pkt_hdr_from_user(up, &pkt_hdr)) {
  310. dprintk(CVP_ERR, "Invalid syscall: %x, %x, %x\n",
  311. kp->type, pkt_hdr.size, pkt_hdr.packet_type);
  312. return -EFAULT;
  313. }
  314. dprintk(CVP_HFI, "system call cmd pkt: %d 0x%x\n",
  315. pkt_hdr.size, pkt_hdr.packet_type);
  316. pkt_idx = get_pkt_index(&pkt_hdr);
  317. if (pkt_idx < 0) {
  318. dprintk(CVP_ERR, "%s incorrect packet %d, %x\n",
  319. __func__,
  320. pkt_hdr.size,
  321. pkt_hdr.packet_type);
  322. return -EFAULT;
  323. }
  324. rc = _copy_fence_pkt_from_user(kp, up);
  325. break;
  326. }
  327. case EVA_KMD_RECEIVE_MSG_PKT:
  328. break;
  329. case EVA_KMD_SESSION_CONTROL:
  330. {
  331. struct eva_kmd_session_control *k, *u;
  332. k = &kp->data.session_ctrl;
  333. u = &up->data.session_ctrl;
  334. rc = _get_session_ctrl_from_user(k, u);
  335. break;
  336. }
  337. case EVA_KMD_GET_SYS_PROPERTY:
  338. {
  339. if (_copy_sysprop_from_user(kp, up)) {
  340. dprintk(CVP_ERR, "Failed to get sysprop from user\n");
  341. return -EFAULT;
  342. }
  343. break;
  344. }
  345. case EVA_KMD_SET_SYS_PROPERTY:
  346. {
  347. if (_copy_sysprop_from_user(kp, up)) {
  348. dprintk(CVP_ERR, "Failed to set sysprop from user\n");
  349. return -EFAULT;
  350. }
  351. break;
  352. }
  353. case EVA_KMD_FLUSH_ALL:
  354. case EVA_KMD_UPDATE_POWER:
  355. break;
  356. case EVA_KMD_FLUSH_FRAME:
  357. {
  358. if (_copy_frameid_from_user(kp, up))
  359. return -EFAULT;
  360. break;
  361. }
  362. default:
  363. dprintk(CVP_ERR, "%s: unknown cmd type 0x%x\n",
  364. __func__, kp->type);
  365. rc = -EINVAL;
  366. break;
  367. }
  368. return rc;
  369. }
  370. static int _put_user_session_info(
  371. struct eva_kmd_session_info *k,
  372. struct eva_kmd_session_info __user *u)
  373. {
  374. int i;
  375. if (put_user(k->session_id, &u->session_id))
  376. return -EFAULT;
  377. for (i = 0; i < 10; i++)
  378. if (put_user(k->reserved[i], &u->reserved[i]))
  379. return -EFAULT;
  380. return 0;
  381. }
  382. static int convert_to_user(struct eva_kmd_arg *kp, unsigned long arg)
  383. {
  384. int rc = 0;
  385. int i, size;
  386. struct eva_kmd_arg __user *up = (struct eva_kmd_arg *)arg;
  387. struct cvp_hal_session_cmd_pkt pkt_hdr;
  388. if (!kp || !up) {
  389. dprintk(CVP_ERR, "%s: invalid params\n", __func__);
  390. return -EINVAL;
  391. }
  392. if (put_user(kp->type, &up->type))
  393. return -EFAULT;
  394. switch (kp->type) {
  395. case EVA_KMD_RECEIVE_MSG_PKT:
  396. {
  397. struct eva_kmd_hfi_packet *k, *u;
  398. struct cvp_hfi_msg_session_hdr *hdr;
  399. k = &kp->data.hfi_pkt;
  400. u = &up->data.hfi_pkt;
  401. hdr = (struct cvp_hfi_msg_session_hdr *)k;
  402. size = get_msg_size(hdr) >> 2;
  403. for (i = 0; i < size; i++)
  404. if (put_user(k->pkt_data[i], &u->pkt_data[i]))
  405. return -EFAULT;
  406. break;
  407. }
  408. case EVA_KMD_GET_SESSION_INFO:
  409. {
  410. struct eva_kmd_session_info *k;
  411. struct eva_kmd_session_info __user *u;
  412. k = &kp->data.session;
  413. u = &up->data.session;
  414. if (_put_user_session_info(k, u)) {
  415. dprintk(CVP_ERR, "fail to copy sess info to user\n");
  416. return -EFAULT;
  417. }
  418. break;
  419. }
  420. case EVA_KMD_REGISTER_BUFFER:
  421. {
  422. struct eva_kmd_buffer *k, *u;
  423. k = &kp->data.regbuf;
  424. u = &up->data.regbuf;
  425. if (put_user(k->type, &u->type) ||
  426. put_user(k->index, &u->index) ||
  427. put_user(k->fd, &u->fd) ||
  428. put_user(k->size, &u->size) ||
  429. put_user(k->offset, &u->offset) ||
  430. put_user(k->pixelformat, &u->pixelformat) ||
  431. put_user(k->flags, &u->flags))
  432. return -EFAULT;
  433. for (i = 0; i < 5; i++)
  434. if (put_user(k->reserved[i], &u->reserved[i]))
  435. return -EFAULT;
  436. break;
  437. }
  438. case EVA_KMD_UNREGISTER_BUFFER:
  439. {
  440. struct eva_kmd_buffer *k, *u;
  441. k = &kp->data.unregbuf;
  442. u = &up->data.unregbuf;
  443. if (put_user(k->type, &u->type) ||
  444. put_user(k->index, &u->index) ||
  445. put_user(k->fd, &u->fd) ||
  446. put_user(k->size, &u->size) ||
  447. put_user(k->offset, &u->offset) ||
  448. put_user(k->pixelformat, &u->pixelformat) ||
  449. put_user(k->flags, &u->flags))
  450. return -EFAULT;
  451. for (i = 0; i < 5; i++)
  452. if (put_user(k->reserved[i], &u->reserved[i]))
  453. return -EFAULT;
  454. break;
  455. }
  456. case EVA_KMD_SEND_CMD_PKT:
  457. {
  458. if (_get_pkt_hdr_from_user(up, &pkt_hdr))
  459. return -EFAULT;
  460. dprintk(CVP_HFI, "Send user cmd pkt: %d %d\n",
  461. pkt_hdr.size, pkt_hdr.packet_type);
  462. rc = _copy_pkt_to_user(kp, up, (pkt_hdr.size >> 2));
  463. break;
  464. }
  465. case EVA_KMD_SEND_FENCE_CMD_PKT:
  466. {
  467. if (_get_fence_pkt_hdr_from_user(up, &pkt_hdr))
  468. return -EFAULT;
  469. dprintk(CVP_HFI, "Send user cmd pkt: %d %d\n",
  470. pkt_hdr.size, pkt_hdr.packet_type);
  471. rc = _copy_fence_pkt_to_user(kp, up);
  472. break;
  473. }
  474. case EVA_KMD_SESSION_CONTROL:
  475. {
  476. struct eva_kmd_session_control *k, *u;
  477. k = &kp->data.session_ctrl;
  478. u = &up->data.session_ctrl;
  479. rc = _copy_session_ctrl_to_user(k, u);
  480. break;
  481. }
  482. case EVA_KMD_GET_SYS_PROPERTY:
  483. {
  484. if (_copy_sysprop_to_user(kp, up)) {
  485. dprintk(CVP_ERR, "Fail to copy sysprop to user\n");
  486. return -EFAULT;
  487. }
  488. break;
  489. }
  490. case EVA_KMD_FLUSH_ALL:
  491. case EVA_KMD_FLUSH_FRAME:
  492. case EVA_KMD_SET_SYS_PROPERTY:
  493. case EVA_KMD_UPDATE_POWER:
  494. break;
  495. default:
  496. dprintk(CVP_ERR, "%s: unknown cmd type 0x%x\n",
  497. __func__, kp->type);
  498. rc = -EINVAL;
  499. break;
  500. }
  501. return rc;
  502. }
  503. static long cvp_ioctl(struct msm_cvp_inst *inst,
  504. unsigned int cmd, unsigned long arg)
  505. {
  506. int rc;
  507. struct eva_kmd_arg *karg;
  508. if (!inst) {
  509. dprintk(CVP_ERR, "%s: invalid params\n", __func__);
  510. return -EINVAL;
  511. }
  512. karg = kzalloc(sizeof(*karg), GFP_KERNEL);
  513. if (!karg)
  514. return -ENOMEM;
  515. if (convert_from_user(karg, arg, inst)) {
  516. dprintk(CVP_ERR, "%s: failed to get from user cmd %x\n",
  517. __func__, karg->type);
  518. kfree(karg);
  519. return -EFAULT;
  520. }
  521. rc = msm_cvp_private((void *)inst, cmd, karg);
  522. if (rc) {
  523. dprintk(CVP_ERR, "%s: failed cmd type %x %d\n",
  524. __func__, karg->type, rc);
  525. kfree(karg);
  526. return rc;
  527. }
  528. if (convert_to_user(karg, arg)) {
  529. dprintk(CVP_ERR, "%s: failed to copy to user cmd %x\n",
  530. __func__, karg->type);
  531. kfree(karg);
  532. return -EFAULT;
  533. }
  534. kfree(karg);
  535. return rc;
  536. }
  537. long cvp_unblocked_ioctl(struct file *filp,
  538. unsigned int cmd, unsigned long arg)
  539. {
  540. struct msm_cvp_inst *inst;
  541. if (!filp || !filp->private_data) {
  542. dprintk(CVP_ERR, "%s: invalid params\n", __func__);
  543. return -EINVAL;
  544. }
  545. inst = filp->private_data;
  546. return cvp_ioctl(inst, cmd, arg);
  547. }
  548. long cvp_compat_ioctl(struct file *filp,
  549. unsigned int cmd, unsigned long arg)
  550. {
  551. struct msm_cvp_inst *inst;
  552. if (!filp || !filp->private_data) {
  553. dprintk(CVP_ERR, "%s: invalid params\n", __func__);
  554. return -EINVAL;
  555. }
  556. inst = filp->private_data;
  557. return cvp_ioctl(inst, cmd, (unsigned long)compat_ptr(arg));
  558. }