]> nv-tegra.nvidia Code Review - linux-4.9.git/commit
memory: tegra: avoid divide-by-zero during boot on TX1
authorStephen Warren <swarren@nvidia.com>
Thu, 11 Oct 2018 20:39:04 +0000 (14:39 -0600)
committermobile promotions <svcmobile_promotions@nvidia.com>
Fri, 19 Oct 2018 00:22:02 +0000 (17:22 -0700)
commit0bd114d70e66c08edac661fa9937aa23b1ded6ad
treed8d922e39b2b6f1b6c123fe91b80bf4ce9aa9bfd
parentcaccb0c7eb9466ccd3710b264e66b4bf42844ee8
memory: tegra: avoid divide-by-zero during boot on TX1

gcc 7.3 detects a code-path that can perform a divide-by-zero and replaces
this with an explicit "brk #0x3e8" (i.e. "brk #1000") instruction, which
causes a crash if the code is executed. This happens in the EMC driver
when Jetson TX1 is booting:

Unexpected kernel BRK exception at EL1
Unhandled debug exception: ptrace BRK handler (0xf20003e8) at 0x0000000000000000

This occurs because update_clock_tree_delay() always calculates "cval" in
various code-paths, but has only calculated the inputs to cval's
calculation in certain cases, hence causing divide-by-zero to occur in
other cases. This patch skips the calculation of cval except in the cases
where the input values have been calculated. This is acceptable since the
value of cval is only used in those same cases.

Bug 200442298

Change-Id: I9d3f67d9e59e8b432c93b3785129c05a89e3de5f
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1924870
(cherry picked from commit 0d2b169473775719a6e1721287f7037953ef3699 in dev-kernel-4.9)
Reviewed-on: https://git-master.nvidia.com/r/1929075
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
drivers/memory/tegra/tegra210-emc-cc-r21021.c