mbox series

[v4,0/8] Support Trusted Foundations firmware on Tegra30

Message ID 20190218001726.16785-1-digetx@gmail.com (mailing list archive)
Headers show
Series Support Trusted Foundations firmware on Tegra30 | expand

Message

Dmitry Osipenko Feb. 18, 2019, 12:17 a.m. UTC
Hello,

This patchset adds support for the Trusted Foundations firmware on
NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that
firmware and upstream kernel can't boot on those devices without the
firmware support.

Changelog:

v4:     - Fixed Thumb2-kernel hanging on Tegra20, turned out it was not a
          good idea to switch CPU into Thumb2 mode right after jumping into
          the reset handler.

        - Moved LP2-mode-set firmware call invocation to a later stage to
          better replicate what downstream kernel does. This change was
          suggested by Robert Yang and fixes system hang on Ouya game
          console.

        - Added references to the original work made by Michał Mirosław
          into commit messages of the relevant patches.

v3:     - Implemented suspend-resume support.

        - Reworked arm/firmware/trusted_foundations.c a tad. Now cache
          is getting properly initialized, cache enabling / disabling is
          supported.

v2:
        - The "Don't apply CPU erratas in insecure mode" patch got some
          cleanup, in particular resolved the messiness in
          __tegra_cpu_reset_handler_data.

        - Added a comment to tf_cache_write_sec(), justifying the warning
          message.

Dmitry Osipenko (8):
  ARM: trusted_foundations: Implement L2 cache initialization callback
  ARM: trusted_foundations: Make prepare_idle call to take mode argument
  ARM: trusted_foundations: Provide information about whether firmware
    is registered
  ARM: tegra: Set up L2 cache using Trusted Foundations firmware
  ARM: tegra: Don't apply CPU erratas in insecure mode
  ARM: tegra: Always boot CPU in ARM-mode
  ARM: tegra: Support L2 cache maintenance done via firmware
  ARM: tegra: Add firmware calls required for suspend-resume

 arch/arm/firmware/trusted_foundations.c    | 80 +++++++++++++++++++++-
 arch/arm/include/asm/firmware.h            |  2 +-
 arch/arm/include/asm/trusted_foundations.h | 13 ++++
 arch/arm/mach-tegra/cpuidle-tegra114.c     |  3 +-
 arch/arm/mach-tegra/pm.c                   | 50 ++++++++++++++
 arch/arm/mach-tegra/reset-handler.S        | 52 ++++++++++----
 arch/arm/mach-tegra/reset.c                |  3 +
 arch/arm/mach-tegra/reset.h                |  9 ++-
 arch/arm/mach-tegra/sleep-tegra20.S        |  4 ++
 arch/arm/mach-tegra/sleep.S                | 11 +--
 arch/arm/mach-tegra/tegra.c                | 10 +++
 11 files changed, 214 insertions(+), 23 deletions(-)

Comments

Thierry Reding Feb. 18, 2019, 8:51 a.m. UTC | #1
On Mon, Feb 18, 2019 at 03:17:18AM +0300, Dmitry Osipenko wrote:
> Hello,
> 
> This patchset adds support for the Trusted Foundations firmware on
> NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that
> firmware and upstream kernel can't boot on those devices without the
> firmware support.
> 
> Changelog:
> 
> v4:     - Fixed Thumb2-kernel hanging on Tegra20, turned out it was not a
>           good idea to switch CPU into Thumb2 mode right after jumping into
>           the reset handler.
> 
>         - Moved LP2-mode-set firmware call invocation to a later stage to
>           better replicate what downstream kernel does. This change was
>           suggested by Robert Yang and fixes system hang on Ouya game
>           console.
> 
>         - Added references to the original work made by Michał Mirosław
>           into commit messages of the relevant patches.
> 
> v3:     - Implemented suspend-resume support.
> 
>         - Reworked arm/firmware/trusted_foundations.c a tad. Now cache
>           is getting properly initialized, cache enabling / disabling is
>           supported.
> 
> v2:
>         - The "Don't apply CPU erratas in insecure mode" patch got some
>           cleanup, in particular resolved the messiness in
>           __tegra_cpu_reset_handler_data.
> 
>         - Added a comment to tf_cache_write_sec(), justifying the warning
>           message.
> 
> Dmitry Osipenko (8):
>   ARM: trusted_foundations: Implement L2 cache initialization callback
>   ARM: trusted_foundations: Make prepare_idle call to take mode argument
>   ARM: trusted_foundations: Provide information about whether firmware
>     is registered
>   ARM: tegra: Set up L2 cache using Trusted Foundations firmware
>   ARM: tegra: Don't apply CPU erratas in insecure mode
>   ARM: tegra: Always boot CPU in ARM-mode
>   ARM: tegra: Support L2 cache maintenance done via firmware
>   ARM: tegra: Add firmware calls required for suspend-resume
> 
>  arch/arm/firmware/trusted_foundations.c    | 80 +++++++++++++++++++++-
>  arch/arm/include/asm/firmware.h            |  2 +-
>  arch/arm/include/asm/trusted_foundations.h | 13 ++++
>  arch/arm/mach-tegra/cpuidle-tegra114.c     |  3 +-
>  arch/arm/mach-tegra/pm.c                   | 50 ++++++++++++++
>  arch/arm/mach-tegra/reset-handler.S        | 52 ++++++++++----
>  arch/arm/mach-tegra/reset.c                |  3 +
>  arch/arm/mach-tegra/reset.h                |  9 ++-
>  arch/arm/mach-tegra/sleep-tegra20.S        |  4 ++
>  arch/arm/mach-tegra/sleep.S                | 11 +--
>  arch/arm/mach-tegra/tegra.c                | 10 +++
>  11 files changed, 214 insertions(+), 23 deletions(-)

Hi Russell,

I'm not sure if this is something that you have a vested interest in. It
looks like Tegra is the only platform that uses this, and usage is
limited to two generations (Tegra30 and Tegra114). Do you mind if I pick
this up into the Tegra tree and send this as part of the pull requests
for v5.2?

Actually, Trusted Foundations is the only firmware implementation left
in arch/arm/firmware, so how about we move this file over to
drivers/firmware (perhaps even the tegra subdirectory given that nobody
else seems to be using it) and get rid of arch/arm/firmware?

I can prepare a patch that does that on top of this series, just let me
know how you want to handle this.

Thanks,
Thierry
Dmitry Osipenko Feb. 20, 2019, 1:30 p.m. UTC | #2
18.02.2019 3:17, Dmitry Osipenko пишет:
> Hello,
> 
> This patchset adds support for the Trusted Foundations firmware on
> NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that
> firmware and upstream kernel can't boot on those devices without the
> firmware support.

Hello Michał,

Will be awesome if you could test the series on yours TF300T and report back, thanks in advance!
Michał Mirosław Feb. 20, 2019, 4:36 p.m. UTC | #3
On Wed, Feb 20, 2019 at 04:30:20PM +0300, Dmitry Osipenko wrote:
> 18.02.2019 3:17, Dmitry Osipenko пишет:
> > Hello,
> > 
> > This patchset adds support for the Trusted Foundations firmware on
> > NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that
> > firmware and upstream kernel can't boot on those devices without the
> > firmware support.
> 
> Hello Michał,
> 
> Will be awesome if you could test the series on yours TF300T and report back, thanks in advance!

I think I will be able to look into this during the weekend. Which
kernel tree do you suggest as base?

Best Regards,
Michał Mirosław
Dmitry Osipenko Feb. 20, 2019, 5:01 p.m. UTC | #4
20.02.2019 19:36, Michał Mirosław пишет:
> On Wed, Feb 20, 2019 at 04:30:20PM +0300, Dmitry Osipenko wrote:
>> 18.02.2019 3:17, Dmitry Osipenko пишет:
>>> Hello,
>>>
>>> This patchset adds support for the Trusted Foundations firmware on
>>> NVIDIA Tegra30. Pretty much all of Tegra30 consumer devices have that
>>> firmware and upstream kernel can't boot on those devices without the
>>> firmware support.
>>
>> Hello Michał,
>>
>> Will be awesome if you could test the series on yours TF300T and report back, thanks in advance!
> 
> I think I will be able to look into this during the weekend. Which
> kernel tree do you suggest as base?

Either linux-next (preferably) or the mainline v5.0 will be fine, there were no much changes for the last year in the code that this patchset touches. You could also try the grate-kernel [0] which has some extra patches that were not submitted to upstream yet, please try it if you'll experience some problems.

[0] https://github.com/grate-driver/linux/commits/master

Please test the following:

1) Kernel boots fine with all 4 CPU cores up and running.

2) LP2 CPU idling works. Test it by disabling the secondary cores:

# echo 0 | tee /sys/devices/system/cpu/cpu[1-3]/online

3) LP1 suspend-resume works. Make sure that "nvidia,suspend-mode" is set to "1" in the PMC device-tree node and that the other relevant properties are set up correctly (copy the values from TF300T downstream kernel). Test it by running this command (multiple times):

# rtcwake -m mem -s 1