2023-01-03 22:26:37

by Mario Limonciello

[permalink] [raw]
Subject: [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load

Now that IP version decoding is used, a number of case statements
can be combined.

Signed-off-by: Mario Limonciello <[email protected]>
---
v3->v4:
* New patch

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index f45362dd8228..83e253b5d928 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -132,14 +132,8 @@ static int psp_init_sriov_microcode(struct psp_context *psp)

switch (adev->ip_versions[MP0_HWIP][0]) {
case IP_VERSION(9, 0, 0):
- adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
- ret = psp_init_cap_microcode(psp, ucode_prefix);
- break;
- case IP_VERSION(11, 0, 9):
- adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
- ret = psp_init_cap_microcode(psp, ucode_prefix);
- break;
case IP_VERSION(11, 0, 7):
+ case IP_VERSION(11, 0, 9):
adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
ret = psp_init_cap_microcode(psp, ucode_prefix);
break;
--
2.34.1


2023-01-04 13:57:14

by Christian König

[permalink] [raw]
Subject: Re: [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load

Am 03.01.23 um 23:18 schrieb Mario Limonciello:
> Now that IP version decoding is used, a number of case statements
> can be combined.
>
> Signed-off-by: Mario Limonciello <[email protected]>

This patch can probably be pushed as small cleanup independent of the
previous patches.

In general I usually suggest to push those separately to make the patch
set concentrate on the real changes at hand.

Anyway this patch here is Reviewed-by: Christian König
<[email protected]>

Regards,
Christian.

> ---
> v3->v4:
> * New patch
>
> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index f45362dd8228..83e253b5d928 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -132,14 +132,8 @@ static int psp_init_sriov_microcode(struct psp_context *psp)
>
> switch (adev->ip_versions[MP0_HWIP][0]) {
> case IP_VERSION(9, 0, 0):
> - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
> - ret = psp_init_cap_microcode(psp, ucode_prefix);
> - break;
> - case IP_VERSION(11, 0, 9):
> - adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
> - ret = psp_init_cap_microcode(psp, ucode_prefix);
> - break;
> case IP_VERSION(11, 0, 7):
> + case IP_VERSION(11, 0, 9):
> adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MEC2;
> ret = psp_init_cap_microcode(psp, ucode_prefix);
> break;

2023-01-04 15:48:06

by Mario Limonciello

[permalink] [raw]
Subject: RE: [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load

[Public]



> -----Original Message-----
> From: Christian König <[email protected]>
> Sent: Wednesday, January 4, 2023 07:18
> To: Limonciello, Mario <[email protected]>; Deucher, Alexander
> <[email protected]>; [email protected]
> Cc: Pan, Xinhui <[email protected]>; Lazar, Lijo <[email protected]>;
> Javier Martinez Canillas <[email protected]>; dri-
> [email protected]; [email protected]; Daniel Vetter
> <[email protected]>; Carlos Soriano Sanchez <[email protected]>; David
> Airlie <[email protected]>; Koenig, Christian <[email protected]>
> Subject: Re: [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP
> microcode load
>
> Am 03.01.23 um 23:18 schrieb Mario Limonciello:
> > Now that IP version decoding is used, a number of case statements
> > can be combined.
> >
> > Signed-off-by: Mario Limonciello <[email protected]>
>
> This patch can probably be pushed as small cleanup independent of the
> previous patches.
>
> In general I usually suggest to push those separately to make the patch
> set concentrate on the real changes at hand.
>
> Anyway this patch here is Reviewed-by: Christian König
> <[email protected]>
>

Thanks!
This optimization is only possible because of earlier changes in the series.
Will add your tag for v5.

> Regards,
> Christian.
>
> > ---
> > v3->v4:
> > * New patch
> >
> > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 8 +-------
> > 1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > index f45362dd8228..83e253b5d928 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> > @@ -132,14 +132,8 @@ static int psp_init_sriov_microcode(struct
> psp_context *psp)
> >
> > switch (adev->ip_versions[MP0_HWIP][0]) {
> > case IP_VERSION(9, 0, 0):
> > - adev->virt.autoload_ucode_id =
> AMDGPU_UCODE_ID_CP_MEC2;
> > - ret = psp_init_cap_microcode(psp, ucode_prefix);
> > - break;
> > - case IP_VERSION(11, 0, 9):
> > - adev->virt.autoload_ucode_id =
> AMDGPU_UCODE_ID_CP_MEC2;
> > - ret = psp_init_cap_microcode(psp, ucode_prefix);
> > - break;
> > case IP_VERSION(11, 0, 7):
> > + case IP_VERSION(11, 0, 9):
> > adev->virt.autoload_ucode_id =
> AMDGPU_UCODE_ID_CP_MEC2;
> > ret = psp_init_cap_microcode(psp, ucode_prefix);
> > break;