Skip to content

Commit f25889f

Browse files
allenpaisjenswi-linaro
authored andcommitted
optee: fix tee out of memory failure seen during kexec reboot
The following out of memory errors are seen on kexec reboot from the optee core. [ 0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed [ 0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22 tee_shm_release() is not invoked on dma shm buffer. Implement .shutdown() method to handle the release of the buffers correctly. More info: OP-TEE/optee_os#3637 Cc: [email protected] Signed-off-by: Allen Pais <[email protected]> Reviewed-by: Tyler Hicks <[email protected]> Reviewed-by: Jens Wiklander <[email protected]> Reviewed-by: Sumit Garg <[email protected]> Signed-off-by: Jens Wiklander <[email protected]>
1 parent adf752a commit f25889f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/tee/optee/core.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
573573
return ERR_PTR(-EINVAL);
574574
}
575575

576+
/* optee_remove - Device Removal Routine
577+
* @pdev: platform device information struct
578+
*
579+
* optee_remove is called by platform subsystem to alert the driver
580+
* that it should release the device
581+
*/
582+
576583
static int optee_remove(struct platform_device *pdev)
577584
{
578585
struct optee *optee = platform_get_drvdata(pdev);
@@ -603,6 +610,18 @@ static int optee_remove(struct platform_device *pdev)
603610
return 0;
604611
}
605612

613+
/* optee_shutdown - Device Removal Routine
614+
* @pdev: platform device information struct
615+
*
616+
* platform_shutdown is called by the platform subsystem to alert
617+
* the driver that a shutdown, reboot, or kexec is happening and
618+
* device must be disabled.
619+
*/
620+
static void optee_shutdown(struct platform_device *pdev)
621+
{
622+
optee_disable_shm_cache(platform_get_drvdata(pdev));
623+
}
624+
606625
static int optee_probe(struct platform_device *pdev)
607626
{
608627
optee_invoke_fn *invoke_fn;
@@ -739,6 +758,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
739758
static struct platform_driver optee_driver = {
740759
.probe = optee_probe,
741760
.remove = optee_remove,
761+
.shutdown = optee_shutdown,
742762
.driver = {
743763
.name = "optee",
744764
.of_match_table = optee_dt_match,

0 commit comments

Comments
 (0)