Skip to content

Commit fe2ddb6

Browse files
committed
firmware: arm_ffa: Implement the FFA_RUN interface
FFA_RUN is used by a scheduler to allocate CPU cycles to a target endpoint execution context specified in the target information parameter. If the endpoint execution context is in the waiting/blocked state, it transitions to the running state. Expose the ability to call FFA_RUN in order to give any partition in the system cpu cycles to perform IMPDEF functionality. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent 933db70 commit fe2ddb6

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,23 @@ static int ffa_notification_bind_common(u16 dst_id, u64 bitmap,
616616
return 0;
617617
}
618618

619+
static int ffa_run(struct ffa_device *dev, u16 vcpu)
620+
{
621+
ffa_value_t ret;
622+
u32 target = dev->vm_id << 16 | vcpu;
623+
624+
invoke_ffa_fn((ffa_value_t){ .a0 = FFA_RUN, .a1 = target, }, &ret);
625+
626+
while (ret.a0 == FFA_INTERRUPT)
627+
invoke_ffa_fn((ffa_value_t){ .a0 = FFA_RUN, .a1 = ret.a1, },
628+
&ret);
629+
630+
if (ret.a0 == FFA_ERROR)
631+
return ffa_to_linux_errno((int)ret.a2);
632+
633+
return 0;
634+
}
635+
619636
static void ffa_set_up_mem_ops_native_flag(void)
620637
{
621638
if (!ffa_features(FFA_FN_NATIVE(MEM_LEND), 0, NULL, NULL) ||
@@ -700,10 +717,15 @@ static const struct ffa_mem_ops ffa_drv_mem_ops = {
700717
.memory_lend = ffa_memory_lend,
701718
};
702719

720+
static const struct ffa_cpu_ops ffa_drv_cpu_ops = {
721+
.run = ffa_run,
722+
};
723+
703724
static const struct ffa_ops ffa_drv_ops = {
704725
.info_ops = &ffa_drv_info_ops,
705726
.msg_ops = &ffa_drv_msg_ops,
706727
.mem_ops = &ffa_drv_mem_ops,
728+
.cpu_ops = &ffa_drv_cpu_ops,
707729
};
708730

709731
void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid)

include/linux/arm_ffa.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,15 @@ struct ffa_mem_ops {
387387
int (*memory_lend)(struct ffa_mem_ops_args *args);
388388
};
389389

390+
struct ffa_cpu_ops {
391+
int (*run)(struct ffa_device *dev, u16 vcpu);
392+
};
393+
390394
struct ffa_ops {
391395
const struct ffa_info_ops *info_ops;
392396
const struct ffa_msg_ops *msg_ops;
393397
const struct ffa_mem_ops *mem_ops;
398+
const struct ffa_cpu_ops *cpu_ops;
394399
};
395400

396401
#endif /* _LINUX_ARM_FFA_H */

0 commit comments

Comments
 (0)