diff mbox series

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

Message ID 20230428185543.8381-5-mario.limonciello@amd.com
State New
Headers show
Series Add dynamic boost control support | expand

Commit Message

Mario Limonciello April 28, 2023, 6:55 p.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>
---
 drivers/crypto/ccp/psp-dev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Tom Lendacky May 1, 2023, 6:47 p.m. UTC | #1
On 4/28/23 13:55, 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>
> ---
>   drivers/crypto/ccp/psp-dev.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
> index e3d6955d3265..e9136e398174 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 psp_init() fails, should we check for and call clear_psp_master_device now?

Thanks,
Tom

>   
> -	if (sp->set_psp_master_device)
> -		sp->set_psp_master_device(sp);
> -
>   	/* Enable interrupt */
>   	iowrite32(-1, psp->io_regs + psp->vdata->inten_reg);
>
Mario Limonciello May 1, 2023, 7:57 p.m. UTC | #2
On 5/1/2023 13:47, Tom Lendacky wrote:
> On 4/28/23 13:55, 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>
>> ---
>>   drivers/crypto/ccp/psp-dev.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
>> index e3d6955d3265..e9136e398174 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 psp_init() fails, should we check for and call 
> clear_psp_master_device now?
> 

Yes; that's reasonable, thanks.  I will change accordingly.

> Thanks,
> Tom
> 
>> -    if (sp->set_psp_master_device)
>> -        sp->set_psp_master_device(sp);
>> -
>>       /* Enable interrupt */
>>       iowrite32(-1, psp->io_regs + psp->vdata->inten_reg);
diff mbox series

Patch

diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c
index e3d6955d3265..e9136e398174 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);