Lines Matching +full:secure +full:- +full:reg +full:- +full:access
1 // SPDX-License-Identifier: GPL-2.0-only
3 * FF-A v1.0 proxy to filter out invalid memory-sharing SMC calls issued by
4 * the host. FF-A is a slightly more palatable abbreviation of "Arm Firmware
5 * Framework for Arm A-profile", which is specified by Arm in document
8 * Copyright (C) 2022 - Google LLC
12 * all calls falling within the FF-A range. Each call is either:
14 * - Forwarded on unmodified to the SPMD at EL3
15 * - Rejected as "unsupported"
16 * - Accompanied by a host stage-2 page-table check/update and reissued
19 * accessible to the secure world using FF-A will be detected either here
22 * with the secure world).
24 * To allow the rolling-back of page-table updates and FF-A calls in the
29 #include <linux/arm-smccc.h>
40 * "ID value 0 must be returned at the Non-secure physical FF-A instance"
97 cpu_reg(ctxt, 0) = res->a0; in ffa_set_retval()
98 cpu_reg(ctxt, 1) = res->a1; in ffa_set_retval()
99 cpu_reg(ctxt, 2) = res->a2; in ffa_set_retval()
100 cpu_reg(ctxt, 3) = res->a3; in ffa_set_retval()
299 u64 sz = (u64)range->pg_cnt * FFA_PAGE_SIZE; in __ffa_host_share_ranges()
300 u64 pfn = hyp_phys_to_pfn(range->address); in __ffa_host_share_ranges()
319 u64 sz = (u64)range->pg_cnt * FFA_PAGE_SIZE; in __ffa_host_unshare_ranges()
320 u64 pfn = hyp_phys_to_pfn(range->address); in __ffa_host_unshare_ranges()
393 WARN_ON(res->a0 != FFA_SUCCESS); in do_ffa_mem_frag_tx()
398 if (res->a0 != FFA_SUCCESS && res->a0 != FFA_MEM_FRAG_RX) in do_ffa_mem_frag_tx()
410 * the host stage-2 changes. The pages previously marked as shared will in do_ffa_mem_frag_tx()
427 struct ffa_composite_mem_region *reg; in do_ffa_mem_xfer() local
458 offset = ep_mem_access->composite_off; in do_ffa_mem_xfer()
459 if (!offset || buf->ep_count != 1 || buf->sender_id != HOST_FFA_ID) { in do_ffa_mem_xfer()
469 reg = (void *)buf + offset; in do_ffa_mem_xfer()
470 nr_ranges = ((void *)buf + fraglen) - (void *)reg->constituents; in do_ffa_mem_xfer()
471 if (nr_ranges % sizeof(reg->constituents[0])) { in do_ffa_mem_xfer()
476 nr_ranges /= sizeof(reg->constituents[0]); in do_ffa_mem_xfer()
477 ret = ffa_host_share_ranges(reg->constituents, nr_ranges); in do_ffa_mem_xfer()
483 if (res->a0 != FFA_MEM_FRAG_RX) in do_ffa_mem_xfer()
486 if (res->a3 != fraglen) in do_ffa_mem_xfer()
488 } else if (res->a0 != FFA_SUCCESS) { in do_ffa_mem_xfer()
500 WARN_ON(ffa_host_unshare_ranges(reg->constituents, nr_ranges)); in do_ffa_mem_xfer()
511 struct ffa_composite_mem_region *reg; in do_ffa_mem_reclaim() local
529 if (res->a0 != FFA_MEM_RETRIEVE_RESP) in do_ffa_mem_reclaim()
532 len = res->a1; in do_ffa_mem_reclaim()
533 fraglen = res->a2; in do_ffa_mem_reclaim()
537 offset = ep_mem_access->composite_off; in do_ffa_mem_reclaim()
559 if (res->a0 != FFA_MEM_FRAG_TX) { in do_ffa_mem_reclaim()
564 fraglen = res->a3; in do_ffa_mem_reclaim()
569 if (res->a0 != FFA_SUCCESS) in do_ffa_mem_reclaim()
572 reg = (void *)buf + offset; in do_ffa_mem_reclaim()
574 WARN_ON(ffa_host_unshare_ranges(reg->constituents, in do_ffa_mem_reclaim()
575 reg->addr_range_cnt)); in do_ffa_mem_reclaim()
602 /* 32-bit variants of 64-bit calls */ in ffa_call_supported()
648 * There's no way we can tell what a non-standard SMC call might in kvm_host_ffa_handler()
652 * RNG access and crash reporting. in kvm_host_ffa_handler()
656 * the firmware doesn't expose a mechanism to access arbitrary in kvm_host_ffa_handler()
657 * non-secure memory. Short of a per-device table of SMCs, this in kvm_host_ffa_handler()
714 * Firmware returns the maximum supported version of the FF-A in hyp_ffa_init()
716 * backwards-compatible with the hyp according to the rules in DEN0077A in hyp_ffa_init()
727 return -EOPNOTSUPP; in hyp_ffa_init()
731 return -EOPNOTSUPP; in hyp_ffa_init()
734 return -EINVAL; in hyp_ffa_init()
739 return -EOPNOTSUPP; in hyp_ffa_init()
752 return -EINVAL; in hyp_ffa_init()
756 return -EOPNOTSUPP; in hyp_ffa_init()
766 (hyp_ffa_proxy_pages() - (2 * KVM_FFA_MBOX_NR_PAGES)), in hyp_ffa_init()