diff mbox series

[v3,04/10] crypto: ccp: move setting PSP master to earlier in the init

Message ID 20230519032448.94279-5-mario.limonciello@amd.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series Add dynamic boost control support | expand

Commit Message

Mario Limonciello May 19, 2023, 3:24 a.m. UTC
Dynamic boost control needs to use platform access symbols
that look for the PSP master as part of initialization.

So move the PSP master before psp_init() so that dynamic boost
control can be initialized properly.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v2->v3:
 * Clean up master device if psp_init() failed
---
 drivers/crypto/ccp/psp-dev.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Tom Lendacky May 23, 2023, 9:21 p.m. UTC | #1
On 5/18/23 22:24, Mario Limonciello wrote:
> Dynamic boost control needs to use platform access symbols
> that look for the PSP master as part of initialization.
> 
> So move the PSP master before psp_init() so that dynamic boost
> control can be initialized properly.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
> v2->v3:
>   * Clean up master device if psp_init() failed
> ---
>   drivers/crypto/ccp/psp-dev.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
> index e3d6955d3265..3390f0bd6408 100644
> --- a/drivers/crypto/ccp/psp-dev.c
> +++ b/drivers/crypto/ccp/psp-dev.c
> @@ -173,13 +173,14 @@ int psp_dev_init(struct sp_device *sp)
>   		goto e_err;
>   	}
>   
> +	/* master device must be set for platform access */
> +	if (psp->sp->set_psp_master_device)
> +		psp->sp->set_psp_master_device(psp->sp);
> +
>   	ret = psp_init(psp);
>   	if (ret)
>   		goto e_irq;
>   
> -	if (sp->set_psp_master_device)
> -		sp->set_psp_master_device(sp);
> -
>   	/* Enable interrupt */
>   	iowrite32(-1, psp->io_regs + psp->vdata->inten_reg);
>   
> @@ -188,6 +189,9 @@ int psp_dev_init(struct sp_device *sp)
>   	return 0;
>   
>   e_irq:
> +	if (sp->clear_psp_master_device)
> +		sp->clear_psp_master_device(sp);
> +
>   	sp_free_psp_irq(psp->sp, psp);
>   e_err:
>   	sp->psp_data = NULL;
diff mbox series

Patch

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index e3d6955d3265..3390f0bd6408 100644
--- a/drivers/crypto/ccp/psp-dev.c
+++ b/drivers/crypto/ccp/psp-dev.c
@@ -173,13 +173,14 @@  int psp_dev_init(struct sp_device *sp)
 		goto e_err;
 	}
 
+	/* master device must be set for platform access */
+	if (psp->sp->set_psp_master_device)
+		psp->sp->set_psp_master_device(psp->sp);
+
 	ret = psp_init(psp);
 	if (ret)
 		goto e_irq;
 
-	if (sp->set_psp_master_device)
-		sp->set_psp_master_device(sp);
-
 	/* Enable interrupt */
 	iowrite32(-1, psp->io_regs + psp->vdata->inten_reg);
 
@@ -188,6 +189,9 @@  int psp_dev_init(struct sp_device *sp)
 	return 0;
 
 e_irq:
+	if (sp->clear_psp_master_device)
+		sp->clear_psp_master_device(sp);
+
 	sp_free_psp_irq(psp->sp, psp);
 e_err:
 	sp->psp_data = NULL;