ANDROID: KVM: arm64: Pass the hyp_vcpu as an argument to the FF-A handlers
Dispatch the call originating from the host to the appropriate handler and pass the hyp_vcpu to later identify which guest VM is issuing FF-A calls. Bug: 269285339 Bug: 278749606 Change-Id: I8668e37bb6bbc516100c7c2169b876101b5f8874 Signed-off-by: Sebastian Ene <sebastianene@google.com>
This commit is contained in:
@@ -189,7 +189,8 @@ static void ffa_rx_release(struct arm_smccc_res *res)
|
||||
}
|
||||
|
||||
static void do_ffa_rxtx_map(struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(phys_addr_t, tx, ctxt, 1);
|
||||
DECLARE_REG(phys_addr_t, rx, ctxt, 2);
|
||||
@@ -268,7 +269,8 @@ err_unmap:
|
||||
}
|
||||
|
||||
static void do_ffa_rxtx_unmap(struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(u32, id, ctxt, 1);
|
||||
int ret = 0;
|
||||
@@ -369,7 +371,8 @@ static int ffa_host_unshare_ranges(struct ffa_mem_region_addr_range *ranges,
|
||||
}
|
||||
|
||||
static void do_ffa_mem_frag_tx(struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(u32, handle_lo, ctxt, 1);
|
||||
DECLARE_REG(u32, handle_hi, ctxt, 2);
|
||||
@@ -428,7 +431,8 @@ out:
|
||||
|
||||
static void __do_ffa_mem_xfer(const u64 func_id,
|
||||
struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(u32, len, ctxt, 1);
|
||||
DECLARE_REG(u32, fraglen, ctxt, 2);
|
||||
@@ -514,15 +518,16 @@ err_unshare:
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
#define do_ffa_mem_xfer(fid, res, ctxt) \
|
||||
#define do_ffa_mem_xfer(fid, res, ctxt, hyp_vcpu) \
|
||||
do { \
|
||||
BUILD_BUG_ON((fid) != FFA_FN64_MEM_SHARE && \
|
||||
(fid) != FFA_FN64_MEM_LEND); \
|
||||
__do_ffa_mem_xfer((fid), (res), (ctxt)); \
|
||||
__do_ffa_mem_xfer((fid), (res), (ctxt), (hyp_vcpu)); \
|
||||
} while (0);
|
||||
|
||||
static void do_ffa_mem_reclaim(struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(u32, handle_lo, ctxt, 1);
|
||||
DECLARE_REG(u32, handle_hi, ctxt, 2);
|
||||
@@ -741,7 +746,8 @@ unlock:
|
||||
}
|
||||
|
||||
static void do_ffa_part_get(struct arm_smccc_res *res,
|
||||
struct kvm_cpu_context *ctxt)
|
||||
struct kvm_cpu_context *ctxt,
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
DECLARE_REG(u32, uuid0, ctxt, 1);
|
||||
DECLARE_REG(u32, uuid1, ctxt, 2);
|
||||
@@ -821,30 +827,30 @@ bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
|
||||
goto out_handled;
|
||||
/* Memory management */
|
||||
case FFA_FN64_RXTX_MAP:
|
||||
do_ffa_rxtx_map(&res, host_ctxt);
|
||||
do_ffa_rxtx_map(&res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_RXTX_UNMAP:
|
||||
do_ffa_rxtx_unmap(&res, host_ctxt);
|
||||
do_ffa_rxtx_unmap(&res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_MEM_SHARE:
|
||||
case FFA_FN64_MEM_SHARE:
|
||||
do_ffa_mem_xfer(FFA_FN64_MEM_SHARE, &res, host_ctxt);
|
||||
do_ffa_mem_xfer(FFA_FN64_MEM_SHARE, &res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_MEM_RECLAIM:
|
||||
do_ffa_mem_reclaim(&res, host_ctxt);
|
||||
do_ffa_mem_reclaim(&res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_MEM_LEND:
|
||||
case FFA_FN64_MEM_LEND:
|
||||
do_ffa_mem_xfer(FFA_FN64_MEM_LEND, &res, host_ctxt);
|
||||
do_ffa_mem_xfer(FFA_FN64_MEM_LEND, &res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_MEM_FRAG_TX:
|
||||
do_ffa_mem_frag_tx(&res, host_ctxt);
|
||||
do_ffa_mem_frag_tx(&res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
case FFA_VERSION:
|
||||
do_ffa_version(&res, host_ctxt);
|
||||
goto out_handled;
|
||||
case FFA_PARTITION_INFO_GET:
|
||||
do_ffa_part_get(&res, host_ctxt);
|
||||
do_ffa_part_get(&res, host_ctxt, NULL);
|
||||
goto out_handled;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user