1. 14 Jun, 2018 1 commit
  2. 19 Feb, 2018 2 commits
  3. 13 Feb, 2018 1 commit
    • Marcin Nowakowski's avatar
      MIPS: Fix incorrect mem=X@Y handling · 67a3ba25
      Marcin Nowakowski authored
      Commit 73fbc1eb
      
       ("MIPS: fix mem=X@Y commandline processing") added a
      fix to ensure that the memory range between PHYS_OFFSET and low memory
      address specified by mem= cmdline argument is not later processed by
      free_all_bootmem.  This change was incorrect for systems where the
      commandline specifies more than 1 mem argument, as it will cause all
      memory between PHYS_OFFSET and each of the memory offsets to be marked
      as reserved, which results in parts of the RAM marked as reserved
      (Creator CI20's u-boot has a default commandline argument 'mem=256M@0x0
      mem=768M@0x30000000').
      
      Change the behaviour to ensure that only the range between PHYS_OFFSET
      and the lowest start address of the memories is marked as protected.
      
      This change also ensures that the range is marked protected even if it's
      only defined through the devicetree and not only via commandline
      arguments.
      Reported-by: default avatarMathieu Malaterre <mathieu.malaterre@gmail.com>
      Signed-off-by: default avatarMarcin Nowakowski <marcin.nowakowski@mips.com>
      Fixes: 73fbc1eb
      
       ("MIPS: fix mem=X@Y commandline processing")
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # v4.11+
      Tested-by: default avatarMathieu Malaterre <malat@debian.org>
      Patchwork: https://patchwork.linux-mips.org/patch/18562/
      
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      67a3ba25
  4. 18 Jan, 2018 1 commit
    • Paul Burton's avatar
      MIPS: Setup boot_command_line before plat_mem_setup · 8ce355cf
      Paul Burton authored
      
      
      Platforms using DT will typically call __dt_setup_arch from
      plat_mem_setup. This in turn calls early_init_dt_scan. When
      CONFIG_CMDLINE is set, this leads to its value being copied into
      boot_command_line by early_init_dt_scan_chosen. If this happens before
      the code setting up boot_command_line in arch_mem_init runs, that code
      will go on to append CONFIG_CMDLINE (via builtin_cmdline) to
      boot_command_line again, duplicating it. For some command line
      parameters (eg. earlycon) this can be a problem. Set up
      boot_command_line before early_init_dt_scan_chosen gets called such that
      it will not write CONFIG_CMDLINE in this scenario & the arguments aren't
      duplicated.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Acked-by: default avatarMathieu Malaterre <malat@debian.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Maarten ter Huurne <maarten@treewalker.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/18483/
      
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      8ce355cf
  5. 13 Nov, 2017 1 commit
  6. 29 Jun, 2017 1 commit
    • Miodrag Dinic's avatar
      MIPS: cmdline: Add support for 'memmap' parameter · 296a7624
      Miodrag Dinic authored
      
      
      Implement support for parsing 'memmap' kernel command line parameter.
      
      This patch covers parsing of the following two formats for 'memmap'
      parameter values:
      
        - nn[KMG]@ss[KMG]
        - nn[KMG]$ss[KMG]
      
        ([KMG] = K M or G (kilo, mega, giga))
      
      These two allowed formats for parameter value are already documented
      in file kernel-parameters.txt in Documentation/admin-guide folder.
      Some architectures already support them, but Mips did not prior to
      this patch.
      
      Excerpt from Documentation/admin-guide/kernel-parameters.txt:
      
      memmap=nn[KMG]@ss[KMG]
          [KNL] Force usage of a specific region of memory.
          Region of memory to be used is from ss to ss+nn.
      
      memmap=nn[KMG]$ss[KMG]
          Mark specific memory as reserved.
          Region of memory to be reserved is from ss to ss+nn.
          Example: Exclude memory from 0x18690000-0x1869ffff
              memmap=64K$0x18690000
              or
              memmap=0x10000$0x18690000
      
      There is no need to update this documentation file with respect to
      this patch.
      Signed-off-by: default avatarMiodrag Dinic <miodrag.dinic@imgtec.com>
      Signed-off-by: default avatarGoran Ferenc <goran.ferenc@imgtec.com>
      Signed-off-by: default avatarAleksandar Markovic <aleksandar.markovic@imgtec.com>
      Cc: James.Hogan@imgtec.com
      Cc: Paul.Burton@imgtec.com
      Cc: Raghu.Gandham@imgtec.com
      Cc: Leonid.Yegoshin@imgtec.com
      Cc: Douglas.Leung@imgtec.com
      Cc: Petar.Jovanovic@imgtec.com
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16508/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      296a7624
  7. 03 Jan, 2017 6 commits
  8. 04 Nov, 2016 1 commit
    • James Hogan's avatar
      MIPS: Fix max_low_pfn with disabled highmem · 16a767ec
      James Hogan authored
      
      
      When low memory doesn't reach HIGHMEM_START (e.g. up to 256MB at PA=0 is
      common) and highmem is present above HIGHMEM_START (e.g. on Malta the
      RAM overlayed by the IO region is aliased at PA=0x90000000), max_low_pfn
      will be initially calculated very large and then clipped down to
      HIGHMEM_START.
      
      This causes crashes when reading /sys/kernel/mm/page_idle/bitmap
      (i.e. CONFIG_IDLE_PAGE_TRACKING=y) when highmem is disabled. pfn_valid()
      will compare against max_mapnr which is derived from max_low_pfn when
      there is no highend_pfn set up, and will return true for PFNs right up
      to HIGHMEM_START, even though they are beyond the end of low memory and
      no page structs will actually exist for these PFNs.
      
      This is fixed by skipping high memory regions when initially calculating
      max_low_pfn if highmem is disabled, so it doesn't get clipped too high.
      We also clip regions which overlap the highmem boundary when highmem is
      disabled, so that max_pfn doesn't extend into highmem either.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/14490/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      16a767ec
  9. 29 Sep, 2016 1 commit
    • Paul Burton's avatar
      MIPS: Fix detection of unsupported highmem with cache aliases · 058effe7
      Paul Burton authored
      
      
      The paging_init() function contains code which detects that highmem is
      in use but unsupported due to dcache aliasing. However this code was
      ineffective because it was being run before the caches are probed,
      meaning that cpu_has_dc_aliases would always evaluate to false (unless a
      platform overrides it to a compile-time constant) and the detection of
      the unsupported case is never triggered. The kernel would then go on to
      attempt to use highmem & either hit coherency issues or trigger the
      BUG_ON in flush_kernel_dcache_page().
      
      Fix this by running paging_init() later than cpu_cache_init(), such that
      the cpu_has_dc_aliases macro will evaluate correctly & the unsupported
      highmem case will be detected successfully.
      
      This then leads to a formerly hidden issue in that
      mem_init_free_highmem() will attempt to free all highmem pages, even
      though we're avoiding use of them & don't have valid page structs for
      them. This leads to an invalid pointer dereference & a TLB exception.
      Avoid this by skipping the loop in mem_init_free_highmem() if
      cpu_has_dc_aliases evaluates true.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: Rabin Vincent <rabinv@axis.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>
      Cc: Aurelien Jarno <aurelien@aurel32.net>
      Cc: Jaedon Shin <jaedon.shin@gmail.com>
      Cc: Toshi Kani <toshi.kani@hpe.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Sergey Ryazanov <ryazanov.s.a@gmail.com>
      Cc: Jonas Gorski <jogo@openwrt.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/14184/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      058effe7
  10. 13 Sep, 2016 1 commit
    • James Hogan's avatar
      MIPS: Fix memory regions reaching top of physical · 58cae9b0
      James Hogan authored
      
      
      Memory regions added with add_memory_region() at the top of the physical
      address space will have their end address overflow to 0. This causes
      them to be rejected as invalid, and would cause various other issues
      later on.
      
      This causes issues on Malta and Boston platforms when wanting to use all
      2GB of RAM on a 32-bit kernel, either via highmem (using physical
      addresses 0x90000000..0xFFFFFFFF), or with the Malta Enhanced Virtual
      Addressing (EVA) layout which exposes the whole 0x80000000..0xFFFFFFFF
      physical address range to kernel mode at 0x00000000..0x7FFFFFFF.
      
      Due to the abundance of these non-overflow assumptions and the fact that
      memblock already avoids the arithmetic overflow by limiting the size of
      new memory regions without the arch code knowing it (in particular
      mem_init_free_highmem() will trigger a page dump due to nonzero mapcount
      on the last page), it is simpler and safer to just limit the size of the
      region in a similar way to memblock but at the arch level to allow most
      of the RAM to be used without arithmetic overflows.
      
      Therefore we detect this case specifically and reduce the size of the
      region slightly to avoid the arithmetic overflows and cause the last
      page to be ignored.
      Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13857/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      58cae9b0
  11. 02 Aug, 2016 1 commit
    • Jonas Gorski's avatar
      MIPS: store the appended dtb address in a variable · 15f37e15
      Jonas Gorski authored
      
      
      Instead of rewriting the arguments to match the UHI spec, store the
      address of a appended or UHI supplied dtb in fw_supplied_dtb.
      
      That way the original bootloader arugments are kept intact while still
      making the use of an appended dtb invisible for mach code.
      
      Mach code can still find out if it is an appended dtb by comparing
      fw_arg1 with fw_supplied_dtb.
      Signed-off-by: default avatarJonas Gorski <jogo@openwrt.org>
      Cc: Kevin Cernekee <cernekee@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: John Crispin <john@phrozen.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Alban Bedel <albeu@free.fr>
      Cc: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
      Cc: Antony Pavlov <antonynpavlov@gmail.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/13699/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      15f37e15
  12. 13 May, 2016 6 commits
  13. 09 May, 2016 1 commit
  14. 09 Feb, 2016 1 commit
    • Paul Burton's avatar
      MIPS: Fix early CM probing · 3af5a67c
      Paul Burton authored
      Commit c014d164
      
       ("MIPS: Add platform callback before initializing
      the L2 cache") added a platform_early_l2_init function in order to allow
      platforms to probe for the CM before L2 initialisation is performed, so
      that CM GCRs are available to mips_sc_probe.
      
      That commit actually fails to do anything useful, since it checks
      mips_cm_revision to determine whether it should call mips_cm_probe but
      the result of mips_cm_revision will always be 0 until mips_cm_probe has
      been called. Thus the "early" mips_cm_probe call never occurs.
      
      Fix this & drop the useless weak platform_early_l2_init function by
      simply calling mips_cm_probe from setup_arch. For platforms that don't
      select CONFIG_MIPS_CM this will be a no-op, and for those that do it
      removes the requirement for them to call mips_cm_probe manually
      (although doing so isn't harmful for now).
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Jaedon Shin <jaedon.shin@gmail.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Jonas Gorski <jogo@openwrt.org>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12475/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      3af5a67c
  15. 30 Jan, 2016 1 commit
    • Toshi Kani's avatar
      arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM · 35d98e93
      Toshi Kani authored
      
      
      Set IORESOURCE_SYSTEM_RAM in flags of resource ranges with
      "System RAM", "Kernel code", "Kernel data", and "Kernel bss".
      
      Note that:
      
       - IORESOURCE_SYSRAM (i.e. modifier bit) is set in flags when
         IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined
         as (IORESOURCE_MEM|IORESOURCE_SYSRAM).
      
       - Some archs do not set 'flags' for children nodes, such as
         "Kernel code".  This patch does not change 'flags' in this
         case.
      Signed-off-by: default avatarToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luis R. Rodriguez <mcgrof@suse.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Toshi Kani <toshi.kani@hp.com>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-mm <linux-mm@kvack.org>
      Cc: linux-parisc@vger.kernel.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: sparclinux@vger.kernel.org
      Link: http://lkml.kernel.org/r/1453841853-11383-7-git-send-email-bp@alien8.de
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      35d98e93
  16. 24 Jan, 2016 1 commit
  17. 12 Nov, 2015 1 commit
  18. 11 Nov, 2015 1 commit
    • Jonas Gorski's avatar
      MIPS: Make the kernel arguments from dtb available · 2024972e
      Jonas Gorski authored
      
      
      Similar to how arm allows using selecting between bootloader arguments,
      dtb arguments and both, allow to select them on mips. But since we have
      less control over the place of the dtb do not modify it but instead use
      the boot_command_line for merging them.
      
      The default is "use bootloader arguments" to keep the current behaviour
      as default.
      Signed-off-by: default avatarJonas Gorski <jogo@openwrt.org>
      Cc: linux-mips@linux-mips.org
      Cc: Kevin Cernekee <cernekee@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: John Crispin <blogic@openwrt.org>
      Cc: Ganesan Ramalingam <ganesanr@broadcom.com>
      Cc: Jayachandran C <jchandra@broadcom.com>
      Cc: Andrew Bresticker <abrestic@chromium.org>
      Cc: James Hartley <james.hartley@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11284/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      2024972e
  19. 26 Oct, 2015 1 commit
    • Paul Burton's avatar
      MIPS: Declare mips_debugfs_dir in a header · 75dcfc1d
      Paul Burton authored
      
      
      We have many extern declarations of mips_debugfs_dir through arch/mips/
      in various C files. Unify them by declaring mips_debugfs_dir in a
      header, including it in each affected C file & removing the duplicate
      declarations.
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: Joe Perches <joe@perches.com>
      Cc: Jaedon Shin <jaedon.shin@gmail.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: David Daney <david.daney@cavium.com>
      Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: James Cowgill <James.Cowgill@imgtec.com>
      Patchwork: https://patchwork.linux-mips.org/patch/11181/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      75dcfc1d
  20. 22 Sep, 2015 1 commit
  21. 07 Aug, 2015 1 commit
  22. 09 Jul, 2015 1 commit
    • Alexander Sverdlin's avatar
      MIPS: bootmem: Don't use memory holes for page bitmap · a6335fa1
      Alexander Sverdlin authored
      Commit f9a7febd leads to a fact that mapstart and therefore a page bitmap for
      bootmem allocator immediately follows initrd_end. This doesn't always work
      well on Octeon, where there are holes in PFN ranges (refer to 5b3b1688 and
      4MB-aligned PFN allocation). Depending on the inird location it could happen,
      that mapstart would be in an area not allocated by plat_mem_setup() in
      arch/mips/cavium-octeon/setup.c, but in the alignment hole between initrd and
      the next PFN area. Later on this memory will be unconditionally made available
      to buddy allocator at the end of free_all_bootmem_core() (mm/bootmem.c).
      All of this results in Linux using the memory not designated for Linux in
      Octeon's plat_mem_setup(), which in turn means corruption of the memory used
      by another OS/baremetal code on the same SoC.
      
      It doesn't look to me as a problem of Octeon platform code, but rather as an
      inability of f9a7febd
      
       to deal correctly with the fragmented memory-mappings.
      Proposed fix moves the check for initrd address to the same calculation-loop
      in bootmem_init() (arch/mips/kernel/setup.c), which also accounts for kernel
      code location. This should result in mapstart located starting from the first
      PFN area after kernel code AND initrd.
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Cc: linux-mips@linux-mips.org
      Cc: David Daney <david.daney@cavium.com>
      Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Steven J. Hill <Steven.Hill@imgtec.com>
      Cc: Yusuf Khan <yusuf.khan@nokia.com>
      Cc: Michael Kreuzer <michael.kreuzer@nokia.com>
      Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
      Patchwork: https://patchwork.linux-mips.org/patch/10594/
      
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      a6335fa1
  23. 31 Mar, 2015 1 commit
  24. 12 Dec, 2014 1 commit
  25. 24 Nov, 2014 4 commits
  26. 29 Oct, 2014 1 commit