Skip to content

Commit 42fb33d

Browse files
Sebastian Eneoupton
authored andcommitted
KVM: arm64: Use FF-A 1.1 with pKVM
Now that the layout of the structures is compatible with 1.1 it is time to probe the 1.1 version of the FF-A protocol inside the hypervisor. If the TEE doesn't support it, it should return the minimum supported version. Signed-off-by: Sebastian Ene <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Tested-by: Sudeep Holla <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 0dd60c4 commit 42fb33d

File tree

1 file changed

+8
-4
lines changed
  • arch/arm64/kvm/hyp/nvhe

1 file changed

+8
-4
lines changed

arch/arm64/kvm/hyp/nvhe/ffa.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static __always_inline void do_ffa_mem_xfer(const u64 func_id,
457457
memcpy(buf, host_buffers.tx, fraglen);
458458

459459
ep_mem_access = (void *)buf +
460-
ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0);
460+
ffa_mem_desc_offset(buf, 0, hyp_ffa_version);
461461
offset = ep_mem_access->composite_off;
462462
if (!offset || buf->ep_count != 1 || buf->sender_id != HOST_FFA_ID) {
463463
ret = FFA_RET_INVALID_PARAMETERS;
@@ -536,7 +536,7 @@ static void do_ffa_mem_reclaim(struct arm_smccc_res *res,
536536
fraglen = res->a2;
537537

538538
ep_mem_access = (void *)buf +
539-
ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0);
539+
ffa_mem_desc_offset(buf, 0, hyp_ffa_version);
540540
offset = ep_mem_access->composite_off;
541541
/*
542542
* We can trust the SPMD to get this right, but let's at least
@@ -844,7 +844,7 @@ int hyp_ffa_init(void *pages)
844844
if (kvm_host_psci_config.smccc_version < ARM_SMCCC_VERSION_1_2)
845845
return 0;
846846

847-
arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_0, 0, 0, 0, 0, 0, 0, &res);
847+
arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_1, 0, 0, 0, 0, 0, 0, &res);
848848
if (res.a0 == FFA_RET_NOT_SUPPORTED)
849849
return 0;
850850

@@ -864,7 +864,11 @@ int hyp_ffa_init(void *pages)
864864
if (FFA_MAJOR_VERSION(res.a0) != 1)
865865
return -EOPNOTSUPP;
866866

867-
hyp_ffa_version = FFA_VERSION_1_0;
867+
if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1))
868+
hyp_ffa_version = res.a0;
869+
else
870+
hyp_ffa_version = FFA_VERSION_1_1;
871+
868872
tx = pages;
869873
pages += KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE;
870874
rx = pages;

0 commit comments

Comments
 (0)