-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto: ccp: Fix S4 kernel panic issue on HYGON psp
hygon inclusion category: bugfix CVE: NA --------------------------- When running the kernel which is compiled with the config CONFIG_CRYPTO_DEV_CCP_DD=y, the S4 resume process will change the TMR region, but the CSV firmware still keeps TMR region information as before. This will lead to kernel PANIC when the system resumed from S4. To address this issue, we provide PM callbacks, the callbacks will be called during S4 and resume from S4. Signed-off-by: baizhaowei <[email protected]> Signed-off-by: hanliyang <[email protected]>
- Loading branch information
1 parent
3be1423
commit 973eb41
Showing
7 changed files
with
200 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
/* | ||
* HYGON Platform Security Processor (PSP) interface | ||
* | ||
* Copyright (C) 2024 Hygon Info Technologies Ltd. | ||
* | ||
* Author: Zhaowei Bai <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
*/ | ||
|
||
#include "sp-dev.h" | ||
|
||
#ifdef CONFIG_PM_SLEEP | ||
|
||
int hygon_sp_suspend(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_suspend(sp); | ||
|
||
return 0; | ||
} | ||
|
||
int hygon_sp_resume(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_resume(sp); | ||
|
||
return 0; | ||
} | ||
|
||
int hygon_sp_freeze(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_suspend(sp); | ||
|
||
if (sp->dev_vdata->psp_vdata) | ||
hygon_psp_dev_freeze(sp); | ||
|
||
return 0; | ||
} | ||
|
||
int hygon_sp_thaw(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_resume(sp); | ||
|
||
if (sp->dev_vdata->psp_vdata) | ||
hygon_psp_dev_thaw(sp); | ||
|
||
return 0; | ||
} | ||
|
||
int hygon_sp_poweroff(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_suspend(sp); | ||
|
||
return 0; | ||
} | ||
|
||
int hygon_sp_restore(struct sp_device *sp) | ||
{ | ||
if (sp->dev_vdata->ccp_vdata) | ||
ccp_dev_resume(sp); | ||
|
||
if (sp->dev_vdata->psp_vdata) | ||
hygon_psp_dev_restore(sp); | ||
|
||
return 0; | ||
} | ||
|
||
#endif /* CONFIG_PM_SLEEP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters