]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
arm64: Avoid clobbering mm in erratum workaround on QDF2400
authorShanker Donthineni <shankerd@codeaurora.org>
Thu, 23 Feb 2017 03:10:48 +0000 (21:10 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 9 Mar 2017 19:08:01 +0000 (13:08 -0600)
BugLink: http://bugs.launchpad.net/bugs/1671602
Commit 38fd94b0275c ("arm64: Work around Falkor erratum 1003") tried to
work around a hardware erratum, but actually caused a system crash of
its own during switch_mm:

 cpu_do_switch_mm+0x20/0x40
 efi_virtmap_load+0x34/0x40
 virt_efi_get_next_variable+0x64/0xc8
 efivar_init+0x8c/0x348
 efisubsys_init+0xd4/0x270
 do_one_initcall+0x80/0x110
 kernel_init_freeable+0x19c/0x240
 kernel_init+0x10/0x100
 ret_from_fork+0x10/0x50

 Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b

In cpu_do_switch_mm, x1 contains the mm_struct pointer, which needs to
be preserved by the pre_ttbr0_update_workaround macro rather than passed
as a temporary.

This patch clobbers x2 and x3 instead, keeping the mm_struct intact
after the workaround has run.

Fixes: 38fd94b0275c ("arm64: Work around Falkor erratum 1003")
Tested-by: Manoj Iyer <manoj.iyer@canonical.com>
Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit ea6eac904f0a5a0c223bcfb133ec880ba9c70ae3)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
arch/arm64/mm/proc.S

index cd4d53d7e4582909f02a8aafb23ea6a5cd4a5576..877d42fb0df655c77a8fe3f0f7f517d9aa7c9247 100644 (file)
@@ -138,7 +138,7 @@ ENDPROC(cpu_do_resume)
  *     - pgd_phys - physical address of new TTB
  */
 ENTRY(cpu_do_switch_mm)
-       pre_ttbr0_update_workaround x0, x1, x2
+       pre_ttbr0_update_workaround x0, x2, x3
        mmid    x1, x1                          // get mm->context.id
        bfi     x0, x1, #48, #16                // set the ASID
        msr     ttbr0_el1, x0                   // set TTBR0