drm: nouveau: Enable gp20b/gp10b firmware tag when relevant

Message ID 20180610110131.10490-1-kwizart@gmail.com
State New
Headers show
Series
  • drm: nouveau: Enable gp20b/gp10b firmware tag when relevant
Related show

Commit Message

Nicolas Chauvet June 10, 2018, 11:01 a.m.
This allows to have the related MODULE_FIRMWARE tag only
on relevant arch (arm64).
This will saves about 400k on initramfs when not relevant

Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 ++
 drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c | 2 ++
 2 files changed, 4 insertions(+)

Comments

Thierry Reding June 11, 2018, 8:33 a.m. | #1
On Sun, Jun 10, 2018 at 01:01:31PM +0200, Nicolas Chauvet wrote:
> This allows to have the related MODULE_FIRMWARE tag only
> on relevant arch (arm64).
> This will saves about 400k on initramfs when not relevant
> 
> Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 ++
>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> index 30491d132d59..df8b919dcf09 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> @@ -129,6 +129,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
>  	return 0;
>  }
>  
> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
>  MODULE_FIRMWARE("nvidia/gm20b/acr/bl.bin");
>  MODULE_FIRMWARE("nvidia/gm20b/acr/ucode_load.bin");
>  MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_bl.bin");
> @@ -144,3 +145,4 @@ MODULE_FIRMWARE("nvidia/gm20b/gr/sw_method_init.bin");
>  MODULE_FIRMWARE("nvidia/gm20b/pmu/desc.bin");
>  MODULE_FIRMWARE("nvidia/gm20b/pmu/image.bin");
>  MODULE_FIRMWARE("nvidia/gm20b/pmu/sig.bin");
> +#endif
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> index 632e9545e292..28ca29d0eeee 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> @@ -74,6 +74,7 @@ gp10b_secboot_new(struct nvkm_device *device, int index,
>  	return 0;
>  }
>  
> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
>  MODULE_FIRMWARE("nvidia/gp10b/acr/bl.bin");
>  MODULE_FIRMWARE("nvidia/gp10b/acr/ucode_load.bin");
>  MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_bl.bin");
> @@ -91,3 +92,4 @@ MODULE_FIRMWARE("nvidia/gp10b/gr/sw_method_init.bin");
>  MODULE_FIRMWARE("nvidia/gp10b/pmu/desc.bin");
>  MODULE_FIRMWARE("nvidia/gp10b/pmu/image.bin");
>  MODULE_FIRMWARE("nvidia/gp10b/pmu/sig.bin");
> +#endif

I suppose that makes sense, so:

Acked-by: Thierry Reding <treding@nvidia.com>

On a side-note, I was checking for what we do for gk20a, but it seems
like we don't have MODULE_FIRMWARE() entries for Tegra124. How do we
make sure that firmware is automatically pulled into initramfs on the
Tegra124 devices?

Thierry
Nicolas Chauvet June 11, 2018, 9:32 a.m. | #2
2018-06-11 10:33 GMT+02:00 Thierry Reding <thierry.reding@gmail.com>:
> On Sun, Jun 10, 2018 at 01:01:31PM +0200, Nicolas Chauvet wrote:
>> This allows to have the related MODULE_FIRMWARE tag only
>> on relevant arch (arm64).
>> This will saves about 400k on initramfs when not relevant
>>
>> Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
>> ---
>>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 ++
>>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
>> index 30491d132d59..df8b919dcf09 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
>> @@ -129,6 +129,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
>>       return 0;
>>  }
>>
>> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
>>  MODULE_FIRMWARE("nvidia/gm20b/acr/bl.bin");
>>  MODULE_FIRMWARE("nvidia/gm20b/acr/ucode_load.bin");
>>  MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_bl.bin");
>> @@ -144,3 +145,4 @@ MODULE_FIRMWARE("nvidia/gm20b/gr/sw_method_init.bin");
>>  MODULE_FIRMWARE("nvidia/gm20b/pmu/desc.bin");
>>  MODULE_FIRMWARE("nvidia/gm20b/pmu/image.bin");
>>  MODULE_FIRMWARE("nvidia/gm20b/pmu/sig.bin");
>> +#endif
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
>> index 632e9545e292..28ca29d0eeee 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
>> @@ -74,6 +74,7 @@ gp10b_secboot_new(struct nvkm_device *device, int index,
>>       return 0;
>>  }
>>
>> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
>>  MODULE_FIRMWARE("nvidia/gp10b/acr/bl.bin");
>>  MODULE_FIRMWARE("nvidia/gp10b/acr/ucode_load.bin");
>>  MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_bl.bin");
>> @@ -91,3 +92,4 @@ MODULE_FIRMWARE("nvidia/gp10b/gr/sw_method_init.bin");
>>  MODULE_FIRMWARE("nvidia/gp10b/pmu/desc.bin");
>>  MODULE_FIRMWARE("nvidia/gp10b/pmu/image.bin");
>>  MODULE_FIRMWARE("nvidia/gp10b/pmu/sig.bin");
>> +#endif
>
> I suppose that makes sense, so:
>
> Acked-by: Thierry Reding <treding@nvidia.com>
>
> On a side-note, I was checking for what we do for gk20a, but it seems
> like we don't have MODULE_FIRMWARE() entries for Tegra124. How do we
> make sure that firmware is automatically pulled into initramfs on the
> Tegra124 devices?
The MODULE_FIRMWARE entries related to gtk20a are located in
drivers/gpu/drm/nouveau/nouveau_platform.c
This file is only built when using ARCH_TEGRA.
I'm not aware that nouveau can build a gk20a only driver, so moving
theses entries to a gk20a specific file will have the same effect at
this time.

Thx for the review.
Thierry Reding June 11, 2018, 11:10 a.m. | #3
On Mon, Jun 11, 2018 at 11:32:53AM +0200, Nicolas Chauvet wrote:
> 2018-06-11 10:33 GMT+02:00 Thierry Reding <thierry.reding@gmail.com>:
> > On Sun, Jun 10, 2018 at 01:01:31PM +0200, Nicolas Chauvet wrote:
> >> This allows to have the related MODULE_FIRMWARE tag only
> >> on relevant arch (arm64).
> >> This will saves about 400k on initramfs when not relevant
> >>
> >> Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
> >> ---
> >>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c | 2 ++
> >>  drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c | 2 ++
> >>  2 files changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> >> index 30491d132d59..df8b919dcf09 100644
> >> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> >> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
> >> @@ -129,6 +129,7 @@ gm20b_secboot_new(struct nvkm_device *device, int index,
> >>       return 0;
> >>  }
> >>
> >> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
> >>  MODULE_FIRMWARE("nvidia/gm20b/acr/bl.bin");
> >>  MODULE_FIRMWARE("nvidia/gm20b/acr/ucode_load.bin");
> >>  MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_bl.bin");
> >> @@ -144,3 +145,4 @@ MODULE_FIRMWARE("nvidia/gm20b/gr/sw_method_init.bin");
> >>  MODULE_FIRMWARE("nvidia/gm20b/pmu/desc.bin");
> >>  MODULE_FIRMWARE("nvidia/gm20b/pmu/image.bin");
> >>  MODULE_FIRMWARE("nvidia/gm20b/pmu/sig.bin");
> >> +#endif
> >> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> >> index 632e9545e292..28ca29d0eeee 100644
> >> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> >> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
> >> @@ -74,6 +74,7 @@ gp10b_secboot_new(struct nvkm_device *device, int index,
> >>       return 0;
> >>  }
> >>
> >> +#if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
> >>  MODULE_FIRMWARE("nvidia/gp10b/acr/bl.bin");
> >>  MODULE_FIRMWARE("nvidia/gp10b/acr/ucode_load.bin");
> >>  MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_bl.bin");
> >> @@ -91,3 +92,4 @@ MODULE_FIRMWARE("nvidia/gp10b/gr/sw_method_init.bin");
> >>  MODULE_FIRMWARE("nvidia/gp10b/pmu/desc.bin");
> >>  MODULE_FIRMWARE("nvidia/gp10b/pmu/image.bin");
> >>  MODULE_FIRMWARE("nvidia/gp10b/pmu/sig.bin");
> >> +#endif
> >
> > I suppose that makes sense, so:
> >
> > Acked-by: Thierry Reding <treding@nvidia.com>
> >
> > On a side-note, I was checking for what we do for gk20a, but it seems
> > like we don't have MODULE_FIRMWARE() entries for Tegra124. How do we
> > make sure that firmware is automatically pulled into initramfs on the
> > Tegra124 devices?
> The MODULE_FIRMWARE entries related to gtk20a are located in
> drivers/gpu/drm/nouveau/nouveau_platform.c
> This file is only built when using ARCH_TEGRA.
> I'm not aware that nouveau can build a gk20a only driver, so moving
> theses entries to a gk20a specific file will have the same effect at
> this time.

Huh... you're right. I must've screwed up my git grep invocation. All
looks well, then.

Thierry

Patch

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
index 30491d132d59..df8b919dcf09 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gm20b.c
@@ -129,6 +129,7 @@  gm20b_secboot_new(struct nvkm_device *device, int index,
 	return 0;
 }
 
+#if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
 MODULE_FIRMWARE("nvidia/gm20b/acr/bl.bin");
 MODULE_FIRMWARE("nvidia/gm20b/acr/ucode_load.bin");
 MODULE_FIRMWARE("nvidia/gm20b/gr/fecs_bl.bin");
@@ -144,3 +145,4 @@  MODULE_FIRMWARE("nvidia/gm20b/gr/sw_method_init.bin");
 MODULE_FIRMWARE("nvidia/gm20b/pmu/desc.bin");
 MODULE_FIRMWARE("nvidia/gm20b/pmu/image.bin");
 MODULE_FIRMWARE("nvidia/gm20b/pmu/sig.bin");
+#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
index 632e9545e292..28ca29d0eeee 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/gp10b.c
@@ -74,6 +74,7 @@  gp10b_secboot_new(struct nvkm_device *device, int index,
 	return 0;
 }
 
+#if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC)
 MODULE_FIRMWARE("nvidia/gp10b/acr/bl.bin");
 MODULE_FIRMWARE("nvidia/gp10b/acr/ucode_load.bin");
 MODULE_FIRMWARE("nvidia/gp10b/gr/fecs_bl.bin");
@@ -91,3 +92,4 @@  MODULE_FIRMWARE("nvidia/gp10b/gr/sw_method_init.bin");
 MODULE_FIRMWARE("nvidia/gp10b/pmu/desc.bin");
 MODULE_FIRMWARE("nvidia/gp10b/pmu/image.bin");
 MODULE_FIRMWARE("nvidia/gp10b/pmu/sig.bin");
+#endif