1. 09 May, 2019 4 commits
    • Thomas Bogendoerfer's avatar
      MIPS: SGI-IP27: abstract chipset irq from bridge · e6308b6d
      Thomas Bogendoerfer authored
      Bridge ASIC is widely used in different SGI systems, but the connected
      chipset is either HUB, HEART or BEDROCK. This commit switches to
      irq domain hierarchy for hub and bridge interrupts to get bridge
      setup out of hub interrupt code.
      Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
      [paul.burton@mips.com:
        Resolve conflict with commit 69a07a41 ("MIPS: SGI-IP27: rework HUB
        interrupts").]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      e6308b6d
    • Thomas Bogendoerfer's avatar
      MIPS: SGI-IP27: use generic PCI driver · a57140e9
      Thomas Bogendoerfer authored
      Converted bridge code to a platform driver using the PCI generic driver
      framework and use adding platform devices during xtalk scan. This allows
      easier sharing bridge driver for other SGI platforms like IP30 (Octane) and
      IP35 (Origin 3k, Fuel, Tezro).
      Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
      [paul.burton@mips.com:
        - Leave __phys_to_dma(), __dma_to_phys() & pcibus_to_node() in
          arch/mips/pci/pci-ip27.c since the motivation for moving them
          disappeared when the driver stopped being moved to drivers/pci.]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      a57140e9
    • Paul Cercueil's avatar
      MIPS: Fix Ingenic SoCs sometimes reporting wrong ISA · 8041edb5
      Paul Cercueil authored
      The config0 register in the Xburst CPUs with a processor ID of
      PRID_COMP_INGENIC_D0 report themselves as MIPS32r2 compatible,
      but they don't actually support this ISA.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: od@zcrc.me
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      8041edb5
    • Florian Fainelli's avatar
      MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled · 1b1f01b6
      Florian Fainelli authored
      arch/mips/kernel/perf_event_mipsxx.c: In function 'mipsxx_pmu_enable_event':
      arch/mips/kernel/perf_event_mipsxx.c:326:21: error: unused variable 'event' [-Werror=unused-variable]
        struct perf_event *event = container_of(evt, struct perf_event, hw);
                           ^~~~~
      
      Fix this by making use of IS_ENABLED() to simplify the code and avoid
      unnecessary ifdefery.
      
      Fixes: 84002c88 ("MIPS: perf: Fix perf with MT counting other threads")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.18+
      1b1f01b6
  2. 06 May, 2019 2 commits
    • Serge Semin's avatar
      mips: Manually call fdt_init_reserved_mem() method · 3751cbda
      Serge Semin authored
      Since memblock-patchset was introduced the reserved-memory nodes are
      supported being declared in dt-files. So these nodes are actually parsed
      during the arch setup procedure when the early_init_fdt_scan_reserved_mem()
      method is called. But due to the arch-specific boot mem_map container
      utilization we need to manually call the fdt_init_reserved_mem() method
      after all the available and reserved memory has been moved to memblock.
      The first function call performed before bootmem_init() by the
      early_init_fdt_scan_reserved_mem() routine fails due to the lack of any
      memblock memory regions to allocate from at that stage.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      3751cbda
    • Serge Semin's avatar
      mips: Make sure dt memory regions are valid · 93fa5b28
      Serge Semin authored
      There are situations when memory regions coming from dts may be
      too big for the platform physical address space. This especially
      concerns XPA-capable systems. Bootloader may determine more than 4GB
      memory available and pass it to the kernel over dts memory node, while
      kernel is built without XPA/64BIT support. In this case the region
      may either simply be truncated by add_memory_region() method
      or by u64->phys_addr_t type casting. But in worst case the method
      can even drop the memory region if it exceeds PHYS_ADDR_MAX size.
      So lets make sure the retrieved from dts memory regions are valid,
      and if some of them aren't, just manually truncate them with a warning
      printed out.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      93fa5b28
  3. 03 May, 2019 2 commits
    • Serge Semin's avatar
      mips: Perform early low memory test · 2f5bd036
      Serge Semin authored
      memblock subsystem provides a method to optionally test the passed
      memory region in case if it was requested via special kernel boot
      argument. Lets add the function at the bottom of the arch_mem_init()
      method. Testing at this point in the boot sequence should be safe since all
      critical areas are now reserved and a minimum of allocations have been
      done.
      Reviewed-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      2f5bd036
    • Serge Semin's avatar
      mips: Dump memblock regions for debugging · 30c8f4e4
      Serge Semin authored
      It is useful to have the whole memblock memory space printed to console
      when basic memlock initializations are done. It can be performed by
      ready-to-use method memblock_dump_all(), which prints the available
      and reserved memory spaces if memblock=debug kernel parameter is
      specified. Lets call it at the very end of arch_mem_init() function,
      when all memblock memory and reserved regions are defined, but before
      any serious allocation is performed.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Serge Semin <Sergey.Semin@t-platforms.ru>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      30c8f4e4
  4. 02 May, 2019 8 commits
    • Serge Semin's avatar
      mips: Add reserve-nomap memory type support · 9b9a59db
      Serge Semin authored
      It might be necessary to prevent the virtual mapping creation for a
      requested memory region. For instance there is a "no-map" property
      indicating exactly this feature. In this case we need to not only
      reserve the specified region by pretending it doesn't exist in the
      memory space, but completely remove the range from system just by
      removing it from memblock. The same way it's done in default
      early_init_dt_reserve_memory_arch() method.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      9b9a59db
    • Serge Semin's avatar
      mips: Use memblock to reserve the __nosave memory range · 4e50a35d
      Serge Semin authored
      Originally before legacy bootmem was removed, the memory for the range was
      correctly reserved by reserve_bootmem_region(). But since memblock has been
      selected for early memory allocation the function can be utilized only
      after paging is fully initialized (as it is done by memblock_free_all()
      function). So calling it from arch_mem_init() method is prone to errors,
      and at this stage we need to reserve the memory in the memblock allocator.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      4e50a35d
    • Serge Semin's avatar
      mips: Discard post-CMA-init foreach loop · eadb6925
      Serge Semin authored
      Really the loop is pointless, since it walks over memblock-reserved
      memory regions and mark them as reserved in memblock. Before
      bootmem was removed from the kernel, this loop had been
      used to map the memory reserved by CMA into the legacy bootmem
      allocator. But now the early memory allocator is memblock,
      which is used by CMA for reservation, so we don't need any mapping
      anymore.
      Reviewed-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      eadb6925
    • Serge Semin's avatar
      mips: Reserve memory for the kernel image resources · b93ddc4f
      Serge Semin authored
      The reserved_end variable had been used by the bootmem_init() code
      to find a lowest limit of memory available for memmap blob. The original
      code just tried to find a free memory space higher than kernel was placed.
      This limitation seems justified for the memmap ragion search process, but
      I can't see any obvious reason to reserve the unused space below kernel
      seeing some platforms place it much higher than standard 1MB. Moreover
      the RELOCATION config enables it to be loaded at any memory address.
      So lets reserve the memory occupied by the kernel only, leaving the region
      below being free for allocations. After doing this we can now discard the
      code freeing a space between kernel _text and VMLINUX_LOAD_ADDRESS symbols
      since it's going to be free anyway (unless marked as reserved by
      platforms).
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      b93ddc4f
    • Paul Burton's avatar
      MIPS: Remove duplicate EBase configuration · de56d4c1
      Paul Burton authored
      Clean up our configuration of the EBase register by making
      configure_exception_vector() write to it unconditionally on systems
      implementing MIPSr2 or higher, and removing the duplicate code in
      per_cpu_trap_init(). The latter would have duplicated work on systems
      with vectored interrupts, and didn't set BEV for safety like the
      configure_exception_vector() version of the code does.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      de56d4c1
    • Paul Burton's avatar
      MIPS: Sync icache for whole exception vector · 783454e2
      Paul Burton authored
      Rather than performing cache flushing for a fixed 0x400 bytes, use the
      actual size of the vector in order to ensure we cover all emitted code
      on systems that make use of vectored interrupts.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      783454e2
    • Paul Burton's avatar
      MIPS: Always allocate exception vector for MIPSr2+ · 172dcd93
      Paul Burton authored
      Currently we allocate the exception vector on systems which use a
      vectored interrupt mode, but otherwise attempt to reuse whatever
      exception vector the bootloader uses.
      
      This can be problematic for a number of reasons:
      
        1) The memory isn't properly marked reserved in the memblock
           allocator. We've relied on the fact that EBase is generally in the
           memory below the kernel image which we don't free, but this is
           about to change.
      
        2) Recent versions of U-Boot place their exception vector high in
           kseg0, in memory which isn't protected by being lower than the
           kernel anyway & can end up being clobbered.
      
        3) We are unnecessarily reliant upon there being memory at the address
           EBase points to upon entry to the kernel. This is often the case,
           but if the bootloader doesn't configure EBase & leaves it with its
           default value then we rely upon there being memory at physical
           address 0 for no good reason.
      
      Improve this situation by allocating the exception vector in all cases
      when running on MIPSr2 or higher, and reserving the memory for MIPSr1 or
      lower. This ensures we don't clobber the exception vector in any
      configuration, and for MIPSr2 & higher removes the need for memory at
      physical address 0.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      172dcd93
    • Paul Burton's avatar
      MIPS: Use memblock_phys_alloc() for exception vector · f995adb0
      Paul Burton authored
      Allocate the exception vector using memblock_phys_alloc() which gives us
      a physical address, rather than the previous convoluted setup which
      obtained a virtual address using memblock_alloc(), converted it to a
      physical address & then back to a virtual address.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reviewed-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Tested-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      f995adb0
  5. 24 Apr, 2019 3 commits
    • Serge Semin's avatar
      mips: Combine memblock init and memory reservation loops · cf0c4876
      Serge Semin authored
      Before bootmem was completely removed from the kernel, the last loop
      in the bootmem_init() had been used to reserve the correspondingly
      marked regions, initialize sparsemem sections and to free the low memory
      pages, which then would be used for early memory allocations. After the
      bootmem removing patchset had been merged the loop was left to do the first
      two things only. But it didn't do them quite well.
      
      First of all it leaves the BOOT_MEM_INIT_RAM memory types unreserved,
      which is definitely bug (although it isn't noticeable due to being used
      by the kernel region only, which is fully marked as reserved). Secondly
      the reservation is supposed to be done for any memory including the
      high one. (I couldn't figure out why the highmem was ignored in the first
      place, since platforms and dts' may declare any memory region for
      reservation) Thirdly the reserved_end variable had been used here to not
      accidentally free memory occupied by kernel. Since we already reserved the
      corresponding region higher in this method there is no need in using the
      variable here anymore. Fourthly the sparsemem should be aware of all the
      memory types in the system including the ROM_DATA even if it is going to
      be reserved for the whole system uptime. Finally after all these notes are
      fixed the loop of memory reservation can be freely merged into the memory
      installation loop as it's done in this patch.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      cf0c4876
    • Serge Semin's avatar
      mips: Discard rudiments from bootmem_init · 6ea3ba6f
      Serge Semin authored
      There is a pointless code left in the bootmem_init() method since
      the bootmem allocator removal. First part resides the PFN ranges
      calculation loop. The conditional expressions and continue operator
      are useless there, since nothing is done after them. Second part is
      in RAM ranges installation loop. We can simplify the conditions cascade
      a bit without much of the logic redefinition, so to reduce the code
      length. In particular the end boundary value can be verified after
      the possible reduction to be below max_low_pfn.
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      6ea3ba6f
    • Serge Semin's avatar
      mips: Make sure kernel .bss exists in boot mem pool · a703db3d
      Serge Semin authored
      Current MIPS platform code makes sure the kernel text, data and init
      sections are added to the boot memory map pool right after the
      arch-specific memory setup method has been executed. But for some reason
      the MIPS platform code skipped the kernel .bss section, which definitely
      should be in the boot mem pool as well in any case. Lets fix this just be
      adding the space between __bss_start and __bss_stop.
      Reviewed-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Thomas Bogendoerfer <tbogendoerfer@suse.de>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      a703db3d
  6. 23 Apr, 2019 1 commit
  7. 12 Apr, 2019 1 commit
  8. 09 Apr, 2019 4 commits
    • Paul Burton's avatar
      MIPS: generic: Enable CONFIG_JUMP_LABEL · 3e3d1dfd
      Paul Burton authored
      Enable CONFIG_JUMP_LABEL for generic configs in order to better optimize
      at runtime and get better test coverage for our jump label support.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      3e3d1dfd
    • Paul Burton's avatar
      MIPS: jump_label: Use compact branches for >= r6 · 9b6584e3
      Paul Burton authored
      MIPSr6 introduced compact branches which have no delay slots. Make use
      of them for jump labels in order to avoid the need for a nop to fill the
      branch or jump delay slot, saving 4 bytes of code for each static branch.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      9b6584e3
    • Paul Burton's avatar
      MIPS: jump_label: Remove redundant nops · c838b580
      Paul Burton authored
      Both arch_static_branch() & arch_static_branch_jump() emit a control
      transfer instruction (ie. branch or jump) without disabling assembler
      re-ordering. As such the assembler will automatically fill their delay
      slots.
      
      Both functions follow their branch or jump with an explicit nop that at
      first appears to be there to fill the delay slot, but given that the
      assembler will do that the explicit nops serve no purpose & we end up
      with our branch or jump followed by 2 nops. Remove the redundant nops.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      c838b580
    • Paul Burton's avatar
      Merge tag 'mips_fixes_5.1_1' into mips-next · ec86e545
      Paul Burton authored
      A small batch of MIPS fixes for 5.1:
      
      - An interrupt masking fix for Loongson-based Lemote 2F systems (fixing
        a regression from v3.19).
      
      - A relocation fix for configurations in which the devicetree is stored
        in an ELF section (fixing a regression from v4.7).
      
      - Fix jump labels for MIPSr6 kernels where they previously could
        inadvertently place a control transfer instruction in a forbidden slot
        & take unexpected exceptions (fixing MIPSr6 support added in v4.0).
      
      - Extend an existing USB power workaround for the Netgear WNDR3400 to v2
        boards in addition to the v3 ones that already used it.
      
      - Remove the custom MIPS32 definition of __kernel_fsid_t to make it
        consistent with MIPS64 & every other architecture, in particular
        resolving issues for code which tries to print the val field whose
        type previously differed (though had identical memory layout).
      
      Merged into mips-next to gain the MIPSr6 jump label fix before enabling
      jump labels by default for generic kernel builds.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      ec86e545
  9. 04 Apr, 2019 1 commit
  10. 25 Mar, 2019 1 commit
    • Paul Burton's avatar
      MIPS: KVM: Use prandom_u32_max() to generate tlbwr index · e6331a32
      Paul Burton authored
      Emulation of the tlbwr instruction, which writes a TLB entry to a random
      index in the TLB, currently uses get_random_bytes() to generate a 4 byte
      random number which we then mask to form the index. This is overkill in
      a couple of ways:
      
        - We don't need 4 bytes here since we mask the value to form a 6 bit
          number anyway, so we waste /dev/random entropy generating 3 random
          bytes that are unused.
      
        - We don't need crypto-grade randomness here - the architecture spec
          allows implementations to use any algorithm & merely encourages that
          some pseudo-randomness be used rather than a simple counter. The
          fast prandom_u32() function fits that criteria well.
      
      So rather than using get_random_bytes() & consuming /dev/random entropy,
      switch to using the faster prandom_u32_max() which provides what we need
      here whilst also performing the masking/modulo for us.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reported-by: default avatarGeorge Spelvin <lkml@sdf.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      e6331a32
  11. 19 Mar, 2019 5 commits
    • Enrico Weigelt, metux IT consult's avatar
      arch: mips: Kconfig: pedantic formatting · 371a4151
      Enrico Weigelt, metux IT consult authored
      Formatting of Kconfig files doesn't look so pretty, so let the
      Great White Handkerchief come around and clean it up.
      Signed-off-by: default avatarEnrico Weigelt, metux IT consult <info@metux.net>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: hauke@hauke-m.de
      Cc: zajec5@gmail.com
      Cc: f.fainelli@gmail.com
      Cc: bcm-kernel-feedback-list@broadcom.com
      Cc: linux-mips@vger.kernel.org
      371a4151
    • Hassan Naveed's avatar
      MIPS: eBPF: Initial eBPF support for MIPS32 architecture. · 716850ab
      Hassan Naveed authored
      Currently MIPS32 supports a JIT for classic BPF only, not extended BPF.
      This patch adds JIT support for extended BPF on MIPS32, so code is
      actually JIT'ed instead of being only interpreted. Instructions with
      64-bit operands are not supported at this point.
      We can delete classic BPF because the kernel will translate classic BPF
      programs into extended BPF and JIT them, eliminating the need for
      classic BPF.
      Signed-off-by: default avatarHassan Naveed <hnaveed@wavecomp.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: kafai@fb.com
      Cc: songliubraving@fb.com
      Cc: yhs@fb.com
      Cc: netdev@vger.kernel.org
      Cc: bpf@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: open list:MIPS <linux-mips@linux-mips.org>
      Cc: open list <linux-kernel@vger.kernel.org>
      716850ab
    • Hassan Naveed's avatar
      MIPS: eBPF: Provide eBPF support for MIPS64R6 · 6c2c8a18
      Hassan Naveed authored
      Currently eBPF support is available on MIPS64R2 only. Use MIPS64R6
      variants of instructions like multiply, divide, movn, movz so eBPF
      can run on the newer ISA. Also, we only need to check ISA revision
      before JIT'ing code, because we know the CPU is running a 64-bit
      kernel because eBPF JIT is only included in kernels with CONFIG_64BIT=y
      due to Kconfig dependencies.
      Signed-off-by: default avatarHassan Naveed <hnaveed@wavecomp.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: kafai@fb.com
      Cc: songliubraving@fb.com
      Cc: yhs@fb.com
      Cc: netdev@vger.kernel.org
      Cc: bpf@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: open list:MIPS <linux-mips@linux-mips.org>
      Cc: open list <linux-kernel@vger.kernel.org>
      6c2c8a18
    • Hassan Naveed's avatar
      MIPS: uasm: Add div, mul and sel instructions for mipsr6 · 0d1d17b9
      Hassan Naveed authored
      Add the following instructions for use by eBPF on mipsr6:
      insn_ddivu_r6, insn_divu_r6, insn_dmodu, insn_dmulu, insn_modu,
      insn_mulu, insn_seleqz, insn_selnez
      Signed-off-by: default avatarHassan Naveed <hnaveed@wavecomp.com>
      Reviewed-by: default avatarPaul Burton <paul.burton@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: kafai@fb.com
      Cc: songliubraving@fb.com
      Cc: yhs@fb.com
      Cc: netdev@vger.kernel.org
      Cc: bpf@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: open list:MIPS <linux-mips@linux-mips.org>
      Cc: open list <linux-kernel@vger.kernel.org>
      0d1d17b9
    • Valentin Schneider's avatar
      MIPS: entry: Remove unneeded need_resched() loop · b8f3b15a
      Valentin Schneider authored
      Since the enabling and disabling of IRQs within preempt_schedule_irq()
      is contained in a need_resched() loop, we don't need the outer arch
      code loop.
      
      Note that commit a18815ab ("Use preempt_schedule_irq.") initially
      removed the existing loop, but missed the final branch to restore_all.
      Commit cdaed73a ("Fix preemption bug.") missed that and reintroduced
      the loop.
      Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: linux-kernel@vger.kernel.org
      b8f3b15a
  12. 17 Mar, 2019 8 commits