Skip to content

Commit

Permalink
notif: fix build when NS_VIRTUALIZATION is enabled
Browse files Browse the repository at this point in the history
Right now OP-TEE build fails if CFG_NS_VIRTUALIZATION=y and
CFG_CORE_ASYNC_NOTIF=n with the following error:

core/kernel/notif.c: In function 'nex_init_notif':
core/kernel/notif.c:185:42: error: 'notif_data_id' undeclared (first use in this function); did you mean 'notif_wait'?
  185 |         return virt_add_guest_spec_data(&notif_data_id,
      |                                          ^~~~~~~~~~~~~
      |                                          notif_wait
core/kernel/notif.c:185:42: note: each undeclared identifier is reported only once for each function it appears in
core/kernel/notif.c:186:48: error: invalid application of 'sizeof' to incomplete type 'struct notif_data'
  186 |                                         sizeof(struct notif_data), NULL);
      |                                                ^~~~~~
core/kernel/notif.c:187:1: warning: control reaches end of non-void function [-Wreturn-type]
  187 | }
      | ^

Move `#ifdef CFG_NS_VIRTUALIZATION` section under
`#ifdef CFG_CORE_ASYNC_NOTIF` to fix this.

Signed-off-by: Volodymyr Babchuk <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
  • Loading branch information
lorc authored and jforissier committed Oct 2, 2024
1 parent 4626faf commit 718cc2b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions core/kernel/notif.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ void notif_deliver_event(enum notif_event ev)
mutex_unlock(&notif_mutex);
virt_put_guest(prtn);
}

#ifdef CFG_NS_VIRTUALIZATION
static TEE_Result nex_init_notif(void)
{
return virt_add_guest_spec_data(&notif_data_id,
sizeof(struct notif_data), NULL);
}
nex_early_init(nex_init_notif);
#endif

#endif /*CFG_CORE_ASYNC_NOTIF*/

static TEE_Result notif_rpc(uint32_t func, uint32_t value1, uint32_t value2)
Expand All @@ -179,11 +189,3 @@ TEE_Result notif_wait_timeout(uint32_t value, uint32_t timeout_ms)
return notif_rpc(OPTEE_RPC_NOTIFICATION_WAIT, value, timeout_ms);
}

#ifdef CFG_NS_VIRTUALIZATION
static TEE_Result nex_init_notif(void)
{
return virt_add_guest_spec_data(&notif_data_id,
sizeof(struct notif_data), NULL);
}
nex_early_init(nex_init_notif);
#endif

0 comments on commit 718cc2b

Please sign in to comment.