Lines Matching refs:res

74 static void ffa_to_smccc_error(struct arm_smccc_res *res, u64 ffa_errno)  in ffa_to_smccc_error()  argument
76 *res = (struct arm_smccc_res) { in ffa_to_smccc_error()
82 static void ffa_to_smccc_res_prop(struct arm_smccc_res *res, int ret, u64 prop) in ffa_to_smccc_res_prop() argument
85 *res = (struct arm_smccc_res) { .a0 = FFA_SUCCESS, in ffa_to_smccc_res_prop()
88 ffa_to_smccc_error(res, ret); in ffa_to_smccc_res_prop()
92 static void ffa_to_smccc_res(struct arm_smccc_res *res, int ret) in ffa_to_smccc_res() argument
94 ffa_to_smccc_res_prop(res, ret, 0); in ffa_to_smccc_res()
98 struct arm_smccc_res *res) in ffa_set_retval() argument
100 cpu_reg(ctxt, 0) = res->a0; in ffa_set_retval()
101 cpu_reg(ctxt, 1) = res->a1; in ffa_set_retval()
102 cpu_reg(ctxt, 2) = res->a2; in ffa_set_retval()
103 cpu_reg(ctxt, 3) = res->a3; in ffa_set_retval()
116 struct arm_smccc_res res; in ffa_map_hyp_buffers() local
123 &res); in ffa_map_hyp_buffers()
125 return res.a0 == FFA_SUCCESS ? FFA_RET_SUCCESS : res.a2; in ffa_map_hyp_buffers()
130 struct arm_smccc_res res; in ffa_unmap_hyp_buffers() local
135 &res); in ffa_unmap_hyp_buffers()
137 return res.a0 == FFA_SUCCESS ? FFA_RET_SUCCESS : res.a2; in ffa_unmap_hyp_buffers()
140 static void ffa_mem_frag_tx(struct arm_smccc_res *res, u32 handle_lo, in ffa_mem_frag_tx() argument
146 res); in ffa_mem_frag_tx()
149 static void ffa_mem_frag_rx(struct arm_smccc_res *res, u32 handle_lo, in ffa_mem_frag_rx() argument
155 res); in ffa_mem_frag_rx()
158 static void ffa_mem_xfer(struct arm_smccc_res *res, u64 func_id, u32 len, in ffa_mem_xfer() argument
163 res); in ffa_mem_xfer()
166 static void ffa_mem_reclaim(struct arm_smccc_res *res, u32 handle_lo, in ffa_mem_reclaim() argument
172 res); in ffa_mem_reclaim()
175 static void ffa_retrieve_req(struct arm_smccc_res *res, u32 len) in ffa_retrieve_req() argument
180 res); in ffa_retrieve_req()
183 static void ffa_rx_release(struct arm_smccc_res *res) in ffa_rx_release() argument
188 res); in ffa_rx_release()
191 static void do_ffa_rxtx_map(struct arm_smccc_res *res, in do_ffa_rxtx_map() argument
256 ffa_to_smccc_res(res, ret); in do_ffa_rxtx_map()
270 static void do_ffa_rxtx_unmap(struct arm_smccc_res *res, in do_ffa_rxtx_unmap() argument
300 ffa_to_smccc_res(res, ret); in do_ffa_rxtx_unmap()
371 static void do_ffa_mem_frag_tx(struct arm_smccc_res *res, in do_ffa_mem_frag_tx() argument
403 ffa_mem_reclaim(res, handle_lo, handle_hi, 0); in do_ffa_mem_frag_tx()
404 WARN_ON(res->a0 != FFA_SUCCESS); in do_ffa_mem_frag_tx()
408 ffa_mem_frag_tx(res, handle_lo, handle_hi, fraglen, endpoint_id); in do_ffa_mem_frag_tx()
409 if (res->a0 != FFA_SUCCESS && res->a0 != FFA_MEM_FRAG_RX) in do_ffa_mem_frag_tx()
416 ffa_to_smccc_res(res, ret); in do_ffa_mem_frag_tx()
430 struct arm_smccc_res *res, in __do_ffa_mem_xfer() argument
494 ffa_mem_xfer(res, func_id, len, fraglen); in __do_ffa_mem_xfer()
496 if (res->a0 != FFA_MEM_FRAG_RX) in __do_ffa_mem_xfer()
499 if (res->a3 != fraglen) in __do_ffa_mem_xfer()
501 } else if (res->a0 != FFA_SUCCESS) { in __do_ffa_mem_xfer()
509 ffa_to_smccc_res(res, ret); in __do_ffa_mem_xfer()
517 #define do_ffa_mem_xfer(fid, res, ctxt) \ argument
521 __do_ffa_mem_xfer((fid), (res), (ctxt)); \
524 static void do_ffa_mem_reclaim(struct arm_smccc_res *res, in do_ffa_mem_reclaim() argument
547 ffa_retrieve_req(res, sizeof(*buf)); in do_ffa_mem_reclaim()
549 if (res->a0 != FFA_MEM_RETRIEVE_RESP) in do_ffa_mem_reclaim()
552 len = res->a1; in do_ffa_mem_reclaim()
553 fraglen = res->a2; in do_ffa_mem_reclaim()
566 ffa_rx_release(res); in do_ffa_mem_reclaim()
572 ffa_rx_release(res); in do_ffa_mem_reclaim()
578 ffa_rx_release(res); in do_ffa_mem_reclaim()
581 ffa_mem_frag_rx(res, handle_lo, handle_hi, fragoff); in do_ffa_mem_reclaim()
582 if (res->a0 != FFA_MEM_FRAG_TX) { in do_ffa_mem_reclaim()
587 fraglen = res->a3; in do_ffa_mem_reclaim()
589 ffa_rx_release(res); in do_ffa_mem_reclaim()
592 ffa_mem_reclaim(res, handle_lo, handle_hi, flags); in do_ffa_mem_reclaim()
593 if (res->a0 != FFA_SUCCESS) in do_ffa_mem_reclaim()
604 ffa_to_smccc_res(res, ret); in do_ffa_mem_reclaim()
637 static bool do_ffa_features(struct arm_smccc_res *res, in do_ffa_features() argument
662 ffa_to_smccc_res_prop(res, ret, prop); in do_ffa_features()
669 struct arm_smccc_res res; in hyp_ffa_post_init() local
671 arm_smccc_1_1_smc(FFA_ID_GET, 0, 0, 0, 0, 0, 0, 0, &res); in hyp_ffa_post_init()
672 if (res.a0 != FFA_SUCCESS) in hyp_ffa_post_init()
675 if (res.a2 != HOST_FFA_ID) in hyp_ffa_post_init()
679 0, 0, 0, 0, 0, 0, &res); in hyp_ffa_post_init()
680 if (res.a0 != FFA_SUCCESS) in hyp_ffa_post_init()
683 switch (res.a2) { in hyp_ffa_post_init()
703 static void do_ffa_version(struct arm_smccc_res *res, in do_ffa_version() argument
709 res->a0 = FFA_RET_NOT_SUPPORTED; in do_ffa_version()
715 res->a0 = hyp_ffa_version; in do_ffa_version()
726 res); in do_ffa_version()
727 if (res->a0 == FFA_RET_NOT_SUPPORTED) in do_ffa_version()
734 res->a0 = FFA_RET_NOT_SUPPORTED; in do_ffa_version()
737 res->a0 = hyp_ffa_version; in do_ffa_version()
743 static void do_ffa_part_get(struct arm_smccc_res *res, in do_ffa_part_get() argument
755 ffa_to_smccc_res(res, FFA_RET_BUSY); in do_ffa_part_get()
761 res); in do_ffa_part_get()
763 if (res->a0 != FFA_SUCCESS) in do_ffa_part_get()
766 count = res->a2; in do_ffa_part_get()
775 partition_sz = res->a3; in do_ffa_part_get()
783 ffa_to_smccc_res(res, FFA_RET_ABORTED); in do_ffa_part_get()
794 struct arm_smccc_res res; in kvm_host_ffa_handler() local
813 ffa_to_smccc_error(&res, FFA_RET_INVALID_PARAMETERS); in kvm_host_ffa_handler()
819 if (!do_ffa_features(&res, host_ctxt)) in kvm_host_ffa_handler()
824 do_ffa_rxtx_map(&res, host_ctxt); in kvm_host_ffa_handler()
827 do_ffa_rxtx_unmap(&res, host_ctxt); in kvm_host_ffa_handler()
831 do_ffa_mem_xfer(FFA_FN64_MEM_SHARE, &res, host_ctxt); in kvm_host_ffa_handler()
834 do_ffa_mem_reclaim(&res, host_ctxt); in kvm_host_ffa_handler()
838 do_ffa_mem_xfer(FFA_FN64_MEM_LEND, &res, host_ctxt); in kvm_host_ffa_handler()
841 do_ffa_mem_frag_tx(&res, host_ctxt); in kvm_host_ffa_handler()
844 do_ffa_version(&res, host_ctxt); in kvm_host_ffa_handler()
847 do_ffa_part_get(&res, host_ctxt); in kvm_host_ffa_handler()
854 ffa_to_smccc_error(&res, FFA_RET_NOT_SUPPORTED); in kvm_host_ffa_handler()
856 ffa_set_retval(host_ctxt, &res); in kvm_host_ffa_handler()
862 struct arm_smccc_res res; in hyp_ffa_init() local
868 arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_1, 0, 0, 0, 0, 0, 0, &res); in hyp_ffa_init()
869 if (res.a0 == FFA_RET_NOT_SUPPORTED) in hyp_ffa_init()
885 if (FFA_MAJOR_VERSION(res.a0) != 1) in hyp_ffa_init()
888 if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1)) in hyp_ffa_init()
889 hyp_ffa_version = res.a0; in hyp_ffa_init()