mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-12 12:25:18 +02:00
UPSTREAM: firmware: arm_ffa: Implement the FFA_NOTIFICATION_GET interface
The framework provides an interface to the receiver to determine the
identity of the notification. A receiver endpoint must use the
FFA_NOTIFICATION_GET interface to retrieve its pending notifications
and handle them.
Add the support for FFA_NOTIFICATION_GET to allow the caller(receiver)
to fetch its pending notifications from other partitions in the system.
(cherry picked from commit faa19623e3
)
Bug: 335194469
Bug: 325404073
Bug: 278749606
Link: https://lore.kernel.org/r/20231005-ffa_v1-1_notif-v4-6-cddd3237809c@arm.com
Change-Id: Iff294cd1dceb38f1287af88e8ec72d88f5200f57
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sebastian Ene <sebastianene@google.com>
This commit is contained in:
parent
c59a1c3b15
commit
f97ac1ec38
|
@ -593,6 +593,14 @@ static int ffa_notification_bitmap_destroy(void)
|
||||||
((u32)(FIELD_GET(NOTIFICATION_HIGH_MASK, (x))))
|
((u32)(FIELD_GET(NOTIFICATION_HIGH_MASK, (x))))
|
||||||
#define NOTIFICATION_BITMAP_LOW(x) \
|
#define NOTIFICATION_BITMAP_LOW(x) \
|
||||||
((u32)(FIELD_GET(NOTIFICATION_LOW_MASK, (x))))
|
((u32)(FIELD_GET(NOTIFICATION_LOW_MASK, (x))))
|
||||||
|
#define PACK_NOTIFICATION_BITMAP(low, high) \
|
||||||
|
(FIELD_PREP(NOTIFICATION_LOW_MASK, (low)) | \
|
||||||
|
FIELD_PREP(NOTIFICATION_HIGH_MASK, (high)))
|
||||||
|
|
||||||
|
#define RECEIVER_VCPU_MASK GENMASK(31, 16)
|
||||||
|
#define PACK_NOTIFICATION_GET_RECEIVER_INFO(vcpu_r, r) \
|
||||||
|
(FIELD_PREP(RECEIVER_VCPU_MASK, (vcpu_r)) | \
|
||||||
|
FIELD_PREP(RECEIVER_ID_MASK, (r)))
|
||||||
|
|
||||||
static int ffa_notification_bind_common(u16 dst_id, u64 bitmap,
|
static int ffa_notification_bind_common(u16 dst_id, u64 bitmap,
|
||||||
u32 flags, bool is_bind)
|
u32 flags, bool is_bind)
|
||||||
|
@ -636,6 +644,35 @@ int ffa_notification_set(u16 src_id, u16 dst_id, u32 flags, u64 bitmap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ffa_notify_bitmaps {
|
||||||
|
u64 sp_map;
|
||||||
|
u64 vm_map;
|
||||||
|
u64 arch_map;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify)
|
||||||
|
{
|
||||||
|
ffa_value_t ret;
|
||||||
|
u16 src_id = drv_info->vm_id;
|
||||||
|
u16 cpu_id = smp_processor_id();
|
||||||
|
u32 rec_vcpu_ids = PACK_NOTIFICATION_GET_RECEIVER_INFO(cpu_id, src_id);
|
||||||
|
|
||||||
|
invoke_ffa_fn((ffa_value_t){
|
||||||
|
.a0 = FFA_NOTIFICATION_GET, .a1 = rec_vcpu_ids, .a2 = flags,
|
||||||
|
}, &ret);
|
||||||
|
|
||||||
|
if (ret.a0 == FFA_ERROR)
|
||||||
|
return ffa_to_linux_errno((int)ret.a2);
|
||||||
|
else if (ret.a0 != FFA_SUCCESS)
|
||||||
|
return -EINVAL; /* Something else went wrong. */
|
||||||
|
|
||||||
|
notify->sp_map = PACK_NOTIFICATION_BITMAP(ret.a2, ret.a3);
|
||||||
|
notify->vm_map = PACK_NOTIFICATION_BITMAP(ret.a4, ret.a5);
|
||||||
|
notify->arch_map = PACK_NOTIFICATION_BITMAP(ret.a6, ret.a7);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ffa_run(struct ffa_device *dev, u16 vcpu)
|
static int ffa_run(struct ffa_device *dev, u16 vcpu)
|
||||||
{
|
{
|
||||||
ffa_value_t ret;
|
ffa_value_t ret;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user