@@ -101,9 +101,20 @@ struct fastrpc_invoke_buf {
101
101
u32 pgidx ; /* index to start of contiguous region */
102
102
};
103
103
104
- struct fastrpc_remote_arg {
105
- u64 pv ;
106
- u64 len ;
104
+ struct fastrpc_remote_dmahandle {
105
+ s32 fd ; /* dma handle fd */
106
+ u32 offset ; /* dma handle offset */
107
+ u32 len ; /* dma handle length */
108
+ };
109
+
110
+ struct fastrpc_remote_buf {
111
+ u64 pv ; /* buffer pointer */
112
+ u64 len ; /* length of buffer */
113
+ };
114
+
115
+ union fastrpc_remote_arg {
116
+ struct fastrpc_remote_buf buf ;
117
+ struct fastrpc_remote_dmahandle dma ;
107
118
};
108
119
109
120
struct fastrpc_mmap_rsp_msg {
@@ -217,7 +228,7 @@ struct fastrpc_invoke_ctx {
217
228
struct work_struct put_work ;
218
229
struct fastrpc_msg msg ;
219
230
struct fastrpc_user * fl ;
220
- struct fastrpc_remote_arg * rpra ;
231
+ union fastrpc_remote_arg * rpra ;
221
232
struct fastrpc_map * * maps ;
222
233
struct fastrpc_buf * buf ;
223
234
struct fastrpc_invoke_args * args ;
@@ -767,7 +778,7 @@ static int fastrpc_map_create(struct fastrpc_user *fl, int fd,
767
778
* >>>>>> START of METADATA <<<<<<<<<
768
779
* +---------------------------------+
769
780
* | Arguments |
770
- * | type:(struct fastrpc_remote_arg)|
781
+ * | type:(union fastrpc_remote_arg)|
771
782
* | (0 - N) |
772
783
* +---------------------------------+
773
784
* | Invoke Buffer list |
@@ -792,7 +803,7 @@ static int fastrpc_get_meta_size(struct fastrpc_invoke_ctx *ctx)
792
803
{
793
804
int size = 0 ;
794
805
795
- size = (sizeof (struct fastrpc_remote_arg ) +
806
+ size = (sizeof (struct fastrpc_remote_buf ) +
796
807
sizeof (struct fastrpc_invoke_buf ) +
797
808
sizeof (struct fastrpc_phy_page )) * ctx -> nscalars +
798
809
sizeof (u64 ) * FASTRPC_MAX_FDLIST +
@@ -857,7 +868,7 @@ static struct fastrpc_phy_page *fastrpc_phy_page_start(struct fastrpc_invoke_buf
857
868
static int fastrpc_get_args (u32 kernel , struct fastrpc_invoke_ctx * ctx )
858
869
{
859
870
struct device * dev = ctx -> fl -> sctx -> dev ;
860
- struct fastrpc_remote_arg * rpra ;
871
+ union fastrpc_remote_arg * rpra ;
861
872
struct fastrpc_invoke_buf * list ;
862
873
struct fastrpc_phy_page * pages ;
863
874
int inbufs , i , oix , err = 0 ;
@@ -893,8 +904,8 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
893
904
i = ctx -> olaps [oix ].raix ;
894
905
len = ctx -> args [i ].length ;
895
906
896
- rpra [i ].pv = 0 ;
897
- rpra [i ].len = len ;
907
+ rpra [i ].buf . pv = 0 ;
908
+ rpra [i ].buf . len = len ;
898
909
list [i ].num = len ? 1 : 0 ;
899
910
list [i ].pgidx = i ;
900
911
@@ -904,7 +915,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
904
915
if (ctx -> maps [i ]) {
905
916
struct vm_area_struct * vma = NULL ;
906
917
907
- rpra [i ].pv = (u64 ) ctx -> args [i ].ptr ;
918
+ rpra [i ].buf . pv = (u64 ) ctx -> args [i ].ptr ;
908
919
pages [i ].addr = ctx -> maps [i ]-> phys ;
909
920
910
921
mmap_read_lock (current -> mm );
@@ -931,7 +942,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
931
942
if (rlen < mlen )
932
943
goto bail ;
933
944
934
- rpra [i ].pv = args - ctx -> olaps [oix ].offset ;
945
+ rpra [i ].buf . pv = args - ctx -> olaps [oix ].offset ;
935
946
pages [i ].addr = ctx -> buf -> phys -
936
947
ctx -> olaps [oix ].offset +
937
948
(pkt_size - rlen );
@@ -945,7 +956,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
945
956
}
946
957
947
958
if (i < inbufs && !ctx -> maps [i ]) {
948
- void * dst = (void * )(uintptr_t )rpra [i ].pv ;
959
+ void * dst = (void * )(uintptr_t )rpra [i ].buf . pv ;
949
960
void * src = (void * )(uintptr_t )ctx -> args [i ].ptr ;
950
961
951
962
if (!kernel ) {
@@ -961,12 +972,15 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
961
972
}
962
973
963
974
for (i = ctx -> nbufs ; i < ctx -> nscalars ; ++ i ) {
964
- rpra [i ].pv = (u64 ) ctx -> args [i ].ptr ;
965
- rpra [i ].len = ctx -> args [i ].length ;
966
975
list [i ].num = ctx -> args [i ].length ? 1 : 0 ;
967
976
list [i ].pgidx = i ;
968
- pages [i ].addr = ctx -> maps [i ]-> phys ;
969
- pages [i ].size = ctx -> maps [i ]-> size ;
977
+ if (ctx -> maps [i ]) {
978
+ pages [i ].addr = ctx -> maps [i ]-> phys ;
979
+ pages [i ].size = ctx -> maps [i ]-> size ;
980
+ }
981
+ rpra [i ].dma .fd = ctx -> args [i ].fd ;
982
+ rpra [i ].dma .len = ctx -> args [i ].length ;
983
+ rpra [i ].dma .offset = (u64 ) ctx -> args [i ].ptr ;
970
984
}
971
985
972
986
bail :
@@ -979,7 +993,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
979
993
static int fastrpc_put_args (struct fastrpc_invoke_ctx * ctx ,
980
994
u32 kernel )
981
995
{
982
- struct fastrpc_remote_arg * rpra = ctx -> rpra ;
996
+ union fastrpc_remote_arg * rpra = ctx -> rpra ;
983
997
struct fastrpc_user * fl = ctx -> fl ;
984
998
struct fastrpc_map * mmap = NULL ;
985
999
struct fastrpc_invoke_buf * list ;
@@ -996,9 +1010,9 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
996
1010
997
1011
for (i = inbufs ; i < ctx -> nbufs ; ++ i ) {
998
1012
if (!ctx -> maps [i ]) {
999
- void * src = (void * )(uintptr_t )rpra [i ].pv ;
1013
+ void * src = (void * )(uintptr_t )rpra [i ].buf . pv ;
1000
1014
void * dst = (void * )(uintptr_t )ctx -> args [i ].ptr ;
1001
- u64 len = rpra [i ].len ;
1015
+ u64 len = rpra [i ].buf . len ;
1002
1016
1003
1017
if (!kernel ) {
1004
1018
if (copy_to_user ((void __user * )dst , src , len ))
0 commit comments