1. 15 5月, 2019 2 次提交
  2. 06 5月, 2019 2 次提交
    • S
      mips: Manually call fdt_init_reserved_mem() method · 3751cbda
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Make sure dt memory regions are valid · 93fa5b28
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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. 04 5月, 2019 2 次提交
    • S
      mips: Perform early low memory test · 2f5bd036
      Serge Semin 提交于
      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: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Dump memblock regions for debugging · 30c8f4e4
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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. 03 5月, 2019 8 次提交
    • S
      mips: Add reserve-nomap memory type support · 9b9a59db
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Use memblock to reserve the __nosave memory range · 4e50a35d
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Discard post-CMA-init foreach loop · eadb6925
      Serge Semin 提交于
      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: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Reserve memory for the kernel image resources · b93ddc4f
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • P
      MIPS: Remove duplicate EBase configuration · de56d4c1
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NSerge Semin <fancer.lancer@gmail.com>
      Tested-by: NSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      de56d4c1
    • P
      MIPS: Sync icache for whole exception vector · 783454e2
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NSerge Semin <fancer.lancer@gmail.com>
      Tested-by: NSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      783454e2
    • P
      MIPS: Always allocate exception vector for MIPSr2+ · 172dcd93
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NSerge Semin <fancer.lancer@gmail.com>
      Tested-by: NSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      172dcd93
    • P
      MIPS: Use memblock_phys_alloc() for exception vector · f995adb0
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NSerge Semin <fancer.lancer@gmail.com>
      Tested-by: NSerge Semin <fancer.lancer@gmail.com>
      Cc: linux-mips@vger.kernel.org
      f995adb0
  5. 27 4月, 2019 1 次提交
    • S
      clk: Remove CLK_IS_BASIC clk flag · 90b6c5c7
      Stephen Boyd 提交于
      This flag was historically used to indicate that a clk is a "basic" type
      of clk like a mux, divider, gate, etc. This never turned out to be very
      useful though because it was hard to cleanly split "basic" clks from
      other clks in a system. This one flag was a way for type introspection
      and it just didn't scale. If anything, it was used by the TI clk driver
      to indicate that a clk_hw wasn't contained in the SoC specific clk
      structure. We can get rid of this define now that TI is finding those
      clks a different way.
      
      Cc: Tero Kristo <t-kristo@ti.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>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Kevin Hilman <khilman@baylibre.com>
      Cc: <linux-pwm@vger.kernel.org>
      Cc: <linux-amlogic@lists.infradead.org>
      Acked-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      90b6c5c7
  6. 26 4月, 2019 1 次提交
  7. 25 4月, 2019 3 次提交
    • S
      mips: Combine memblock init and memory reservation loops · cf0c4876
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Discard rudiments from bootmem_init · 6ea3ba6f
      Serge Semin 提交于
      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: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
    • S
      mips: Make sure kernel .bss exists in boot mem pool · a703db3d
      Serge Semin 提交于
      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: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: NPaul 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
  8. 24 4月, 2019 1 次提交
  9. 20 4月, 2019 1 次提交
    • A
      net: socket: implement 64-bit timestamps · 0768e170
      Arnd Bergmann 提交于
      The 'timeval' and 'timespec' data structures used for socket timestamps
      are going to be redefined in user space based on 64-bit time_t in future
      versions of the C library to deal with the y2038 overflow problem,
      which breaks the ABI definition.
      
      Unlike many modern ioctl commands, SIOCGSTAMP and SIOCGSTAMPNS do not
      use the _IOR() macro to encode the size of the transferred data, so it
      remains ambiguous whether the application uses the old or new layout.
      
      The best workaround I could find is rather ugly: we redefine the command
      code based on the size of the respective data structure with a ternary
      operator. This lets it get evaluated as late as possible, hopefully after
      that structure is visible to the caller. We cannot use an #ifdef here,
      because inux/sockios.h might have been included before any libc header
      that could determine the size of time_t.
      
      The ioctl implementation now interprets the new command codes as always
      referring to the 64-bit structure on all architectures, while the old
      architecture specific command code still refers to the old architecture
      specific layout. The new command number is only used when they are
      actually different.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0768e170
  10. 19 4月, 2019 1 次提交
  11. 18 4月, 2019 3 次提交
  12. 17 4月, 2019 1 次提交
    • P
      MIPS: perf: ath79: Fix perfcount IRQ assignment · a1e8783d
      Petr Štetiar 提交于
      Currently it's not possible to use perf on ath79 due to genirq flags
      mismatch happening on static virtual IRQ 13 which is used for
      performance counters hardware IRQ 5.
      
      On TP-Link Archer C7v5:
      
                 CPU0
        2:          0      MIPS   2  ath9k
        4:        318      MIPS   4  19000000.eth
        7:      55034      MIPS   7  timer
        8:       1236      MISC   3  ttyS0
       12:          0      INTC   1  ehci_hcd:usb1
       13:          0  gpio-ath79   2  keys
       14:          0  gpio-ath79   5  keys
       15:         31  AR724X PCI    1  ath10k_pci
      
       $ perf top
       genirq: Flags mismatch irq 13. 00014c83 (mips_perf_pmu) vs. 00002003 (keys)
      
      On TP-Link Archer C7v4:
      
               CPU0
        4:          0      MIPS   4  19000000.eth
        5:       7135      MIPS   5  1a000000.eth
        7:      98379      MIPS   7  timer
        8:         30      MISC   3  ttyS0
       12:      90028      INTC   0  ath9k
       13:       5520      INTC   1  ehci_hcd:usb1
       14:       4623      INTC   2  ehci_hcd:usb2
       15:      32844  AR724X PCI    1  ath10k_pci
       16:          0  gpio-ath79  16  keys
       23:          0  gpio-ath79  23  keys
      
       $ perf top
       genirq: Flags mismatch irq 13. 00014c80 (mips_perf_pmu) vs. 00000080 (ehci_hcd:usb1)
      
      This problem is happening, because currently statically assigned virtual
      IRQ 13 for performance counters is not claimed during the initialization
      of MIPS PMU during the bootup, so the IRQ subsystem doesn't know, that
      this interrupt isn't available for further use.
      
      So this patch fixes the issue by simply booking hardware IRQ 5 for MIPS PMU.
      Tested-by: NKevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Signed-off-by: NPetr Štetiar <ynezz@true.cz>
      Acked-by: NJohn Crispin <john@phrozen.org>
      Acked-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      a1e8783d
  13. 16 4月, 2019 1 次提交
    • A
      MIPS: scall64-o32: Fix indirect syscall number load · 79b4a9cf
      Aurelien Jarno 提交于
      Commit 4c21b8fd (MIPS: seccomp: Handle indirect system calls (o32))
      added indirect syscall detection for O32 processes running on MIPS64,
      but it did not work correctly for big endian kernel/processes. The
      reason is that the syscall number is loaded from ARG1 using the lw
      instruction while this is a 64-bit value, so zero is loaded instead of
      the syscall number.
      
      Fix the code by using the ld instruction instead. When running a 32-bit
      processes on a 64 bit CPU, the values are properly sign-extended, so it
      ensures the value passed to syscall_trace_enter is correct.
      
      Recent systemd versions with seccomp enabled whitelist the getpid
      syscall for their internal  processes (e.g. systemd-journald), but call
      it through syscall(SYS_getpid). This fix therefore allows O32 big endian
      systems with a 64-bit kernel to run recent systemd versions.
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      Cc: <stable@vger.kernel.org> # v3.15+
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NPaul 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
      79b4a9cf
  14. 15 4月, 2019 1 次提交
  15. 13 4月, 2019 1 次提交
  16. 10 4月, 2019 3 次提交
    • P
      MIPS: generic: Enable CONFIG_JUMP_LABEL · 3e3d1dfd
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      3e3d1dfd
    • P
      MIPS: jump_label: Use compact branches for >= r6 · 9b6584e3
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      9b6584e3
    • P
      MIPS: jump_label: Remove redundant nops · c838b580
      Paul Burton 提交于
      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: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      c838b580
  17. 08 4月, 2019 2 次提交
  18. 07 4月, 2019 1 次提交
    • C
      block: remove CONFIG_LBDAF · 72deb455
      Christoph Hellwig 提交于
      Currently support for 64-bit sector_t and blkcnt_t is optional on 32-bit
      architectures.  These types are required to support block device and/or
      file sizes larger than 2 TiB, and have generally defaulted to on for
      a long time.  Enabling the option only increases the i386 tinyconfig
      size by 145 bytes, and many data structures already always use
      64-bit values for their in-core and on-disk data structures anyway,
      so there should not be a large change in dynamic memory usage either.
      
      Dropping this option removes a somewhat weird non-default config that
      has cause various bugs or compiler warnings when actually used.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      72deb455
  19. 05 4月, 2019 3 次提交
    • S
      syscalls: Remove start and number from syscall_get_arguments() args · b35f549d
      Steven Rostedt (Red Hat) 提交于
      At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
      function call syscall_get_arguments() implemented in x86 was horribly
      written and not optimized for the standard case of passing in 0 and 6 for
      the starting index and the number of system calls to get. When looking at
      all the users of this function, I discovered that all instances pass in only
      0 and 6 for these arguments. Instead of having this function handle
      different cases that are never used, simply rewrite it to return the first 6
      arguments of a system call.
      
      This should help out the performance of tracing system calls by ptrace,
      ftrace and perf.
      
      Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org
      
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: "Dmitry V. Levin" <ldv@altlinux.org>
      Cc: x86@kernel.org
      Cc: linux-snps-arc@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Cc: linux-hexagon@vger.kernel.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: linux-parisc@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linux-arch@vger.kernel.org
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> # For xtensa changes
      Acked-by: Will Deacon <will.deacon@arm.com> # For the arm64 bits
      Reviewed-by: Thomas Gleixner <tglx@linutronix.de> # for x86
      Reviewed-by: NDmitry V. Levin <ldv@altlinux.org>
      Reported-by: NAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      b35f549d
    • C
      MIPS: ralink: fix cpu clock of mt7621 and add dt clk devices · e6046b5e
      Chuanhong Guo 提交于
      For a long time the mt7621 uses a fixed cpu clock which causes a problem
      if the cpu frequency is not 880MHz.
      
      This patch fixes the cpu clock calculation and adds the cpu/bus clkdev
      which will be used in dts.
      
      Ported from OpenWrt:
      c7ca224299 ramips: fix cpu clock of mt7621 and add dt clk devices
      Signed-off-by: NWeijie Gao <hackpascal@gmail.com>
      Signed-off-by: NChuanhong Guo <gch981213@gmail.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: John Crispin <john@phrozen.org>
      Cc: linux-kernel@vger.kernel.org
      e6046b5e
    • H
      MIPS: generic: Add switchdev, pinctrl and fit to ocelot_defconfig · 6e3572e8
      Horatiu Vultur 提交于
      Some of the configuration were not selected by default anymore, therefore
      enable them again. Also remove some configs which are used for MSCC Ocelot.
      Signed-off-by: NHoratiu Vultur <horatiu.vultur@microchip.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: <alexandre.belloni@bootlin.com>
      Cc: <UNGLinuxDriver@microchip.com>
      Cc: <ralf@linux-mips.org>
      Cc: <jhogan@kernel.org>
      Cc: <linux-mips@vger.kernel.org>
      Cc: <linux-kernel@vger.kernel.org>
      6e3572e8
  20. 03 4月, 2019 2 次提交
    • W
      locking/rwsem: Remove rwsem-spinlock.c & use rwsem-xadd.c for all archs · 390a0c62
      Waiman Long 提交于
      Currently, we have two different implementation of rwsem:
      
       1) CONFIG_RWSEM_GENERIC_SPINLOCK (rwsem-spinlock.c)
       2) CONFIG_RWSEM_XCHGADD_ALGORITHM (rwsem-xadd.c)
      
      As we are going to use a single generic implementation for rwsem-xadd.c
      and no architecture-specific code will be needed, there is no point
      in keeping two different implementations of rwsem. In most cases, the
      performance of rwsem-spinlock.c will be worse. It also doesn't get all
      the performance tuning and optimizations that had been implemented in
      rwsem-xadd.c over the years.
      
      For simplication, we are going to remove rwsem-spinlock.c and make all
      architectures use a single implementation of rwsem - rwsem-xadd.c.
      
      All references to RWSEM_GENERIC_SPINLOCK and RWSEM_XCHGADD_ALGORITHM
      in the code are removed.
      Suggested-by: NPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: linux-m68k@lists.linux-m68k.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Link: https://lkml.kernel.org/r/20190322143008.21313-3-longman@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      390a0c62
    • P
      arch/tlb: Clean up simple architectures · 6137fed0
      Peter Zijlstra 提交于
      For the architectures that do not implement their own tlb_flush() but
      do already use the generic mmu_gather, there are two options:
      
       1) the platform has an efficient flush_tlb_range() and
          asm-generic/tlb.h doesn't need any overrides at all.
      
       2) the platform lacks an efficient flush_tlb_range() and
          we select MMU_GATHER_NO_RANGE to minimize full invalidates.
      
      Convert all 'simple' architectures to one of these two forms.
      
      alpha:	    has no range invalidate -> 2
      arc:	    already used flush_tlb_range() -> 1
      c6x:	    has no range invalidate -> 2
      hexagon:    has an efficient flush_tlb_range() -> 1
                  (flush_tlb_mm() is in fact a full range invalidate,
      	     so no need to shoot down everything)
      m68k:	    has inefficient flush_tlb_range() -> 2
      microblaze: has no flush_tlb_range() -> 2
      mips:	    has efficient flush_tlb_range() -> 1
      	    (even though it currently seems to use flush_tlb_mm())
      nds32:	    already uses flush_tlb_range() -> 1
      nios2:	    has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      openrisc:   has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      parisc:	    already uses flush_tlb_range() -> 1
      sparc32:    already uses flush_tlb_range() -> 1
      unicore32:  has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      xtensa:	    has efficient flush_tlb_range() -> 1
      
      Note this also fixes a bug in the existing code for a number
      platforms. Those platforms that did:
      
        tlb_end_vma() -> if (!full_mm) flush_tlb_*()
        tlb_flush -> if (full_mm) flush_tlb_mm()
      
      missed the case of shift_arg_pages(), which doesn't have @fullmm set,
      nor calls into tlb_*vma(), but still frees page-tables and thus needs
      an invalidate. The new code handles this by detecting a non-empty
      range, and either issuing the matching range invalidate or a full
      invalidate, depending on the capabilities.
      
      No change in behavior intended.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Nick Piggin <npiggin@gmail.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      6137fed0