1. 08 8月, 2018 1 次提交
    • P
      MIPS: Use read-write output operand in __write_64bit_c0_split() · 08eeb44b
      Paul Burton 提交于
      Commit c22c8043 ("MIPS: Fix input modify in
      __write_64bit_c0_split()") modified __write_64bit_c0_split() constraints
      such that we have both an input & an output which we hope to assign to
      the same registers, and modify the output rather than incorrectly
      clobbering an input.
      
      The way in which we use both an output & an input parameter with the
      input constrained to share the output registers is a little convoluted &
      also problematic for clang, which complains if the input & output values
      have different widths. For example:
      
        In file included from kernel/fork.c:98:
        ./arch/mips/include/asm/mmu_context.h:149:19: error: unsupported
          inline asm: input with type 'unsigned long' matching output with
          type 'unsigned long long'
                write_c0_entryhi(cpu_asid(cpu, next));
                ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
        ./arch/mips/include/asm/mmu_context.h:93:2: note: expanded from macro
          'cpu_asid'
                (cpu_context((cpu), (mm)) & cpu_asid_mask(&cpu_data[cpu]))
                ^
        ./arch/mips/include/asm/mipsregs.h:1617:65: note: expanded from macro
          'write_c0_entryhi'
        #define write_c0_entryhi(val)   __write_ulong_c0_register($10, 0, val)
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
        ./arch/mips/include/asm/mipsregs.h:1430:39: note: expanded from macro
          '__write_ulong_c0_register'
                        __write_64bit_c0_register(reg, sel, val);               \
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
        ./arch/mips/include/asm/mipsregs.h:1400:41: note: expanded from macro
          '__write_64bit_c0_register'
                        __write_64bit_c0_split(register, sel, value);           \
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
        ./arch/mips/include/asm/mipsregs.h:1498:13: note: expanded from macro
          '__write_64bit_c0_split'
                                : "r,0" (val));                                 \
                                         ^~~
      
      We can both fix this build failure & simplify the code somewhat by
      assigning the __tmp variable with the input value in C prior to our
      inline assembly, and then using a single read-write output operand (ie.
      a constraint beginning with +) to provide this value to our assembly.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      08eeb44b
  2. 07 8月, 2018 4 次提交
    • P
      MIPS: Avoid using array as parameter to write_c0_kpgd() · b023a939
      Paul Burton 提交于
      Passing an array (swapper_pg_dir) as the argument to write_c0_kpgd() in
      setup_pw() will become problematic if we modify __write_64bit_c0_split()
      to cast its val argument to unsigned long long, because for 32-bit
      kernel builds the size of a pointer will differ from the size of an
      unsigned long long. This would fall foul of gcc's pointer-to-int-cast
      diagnostic.
      
      Cast the value to a long, which should be the same width as the pointer
      that we ultimately want & will be sign extended if required to the
      unsigned long long that __write_64bit_c0_split() ultimately needs.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      b023a939
    • P
      MIPS: vdso: Allow clang's --target flag in VDSO cflags · ee67855e
      Paul Burton 提交于
      The MIPS VDSO code filters out a subset of known-good flags from
      KBUILD_CFLAGS to use when building VDSO libraries. When we build using
      clang we need to allow the --target flag through, otherwise we'll
      generally attempt to build the VDSO for the architecture of the build
      machine rather than for MIPS.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20154/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      ee67855e
    • P
      MIPS: genvdso: Remove GOT checks · 4467f7ad
      Paul Burton 提交于
      Our genvdso tool performs some rather paranoid checking that the VDSO
      library isn't attempting to make use of a GOT by constraining the number
      of entries that the GOT is allowed to contain to the minimum 2 entries
      that are always generated by binutils.
      
      Unfortunately lld prior to revision 334390 generates a third entry,
      which is unused & thus harmless but falls foul of genvdso's checks &
      causes the build to fail.
      
      Since we already check that the VDSO contains no relocations it seems
      reasonable to presume that it also doesn't contain use of a GOT, which
      would involve relocations. Thus rather than attempting to work around
      this issue by allowing 3 GOT entries when using lld, simply remove the
      GOT checks which seem overly paranoid.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20152/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      4467f7ad
    • R
      MIPS: Remove obsolete MIPS checks for DST node "chosen@0" · 7dc084d6
      Robert P. J. Day 提交于
      As there is precious little left in any DTS files referring to the
      node "/chosen@0" as opposed to "/chosen", remove the two checks for
      the former node name.
      
      [paul.burton@mips.com:
        The modified yamon-dt code only operates on
        arch/mips/boot/dts/mti/sead3.dts right now, and that uses chosen
        rather than chosen@0 anyway, so this should have no behavioural
        effect.]
      Signed-off-by: NRobert P. J. Day <rpjday@crashcourse.ca>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20131/
      Cc: linux-mips@linux-mips.org
      7dc084d6
  3. 03 8月, 2018 1 次提交
    • P
      MIPS: generic: Remove input symbols from defconfig · ca75e2fc
      Paul Burton 提交于
      generic_defconfig explicitly disables CONFIG_INPUT_MOUSEDEV,
      CONFIG_INPUT_KEYBOARD & CONFIG_INPUT_MOUSE which results in warnings
      when merging board config fragments if any of them require these
      options. This is the case for the ranchu board, which means we've had
      the following warning when configuring for generic platform targets
      since commit f2d0b0d5 ("MIPS: ranchu: Add Ranchu as a new
      generic-based board"):
      
        $ make ARCH=mips 32r2el_defconfig
        Using ./arch/mips/configs/generic_defconfig as base
        Merging arch/mips/configs/generic/32r2.config
        Merging arch/mips/configs/generic/el.config
        Merging ./arch/mips/configs/generic/board-sead-3.config
        Merging ./arch/mips/configs/generic/board-ranchu.config
        Value of CONFIG_INPUT_KEYBOARD is redefined by fragment ./arch/mips/configs/generic/board-ranchu.config:
        Previous value: # CONFIG_INPUT_KEYBOARD is not set
        New value: CONFIG_INPUT_KEYBOARD=y
      
        Merging ./arch/mips/configs/generic/board-ni169445.config
        Merging ./arch/mips/configs/generic/board-boston.config
        Merging ./arch/mips/configs/generic/board-ocelot.config
        Merging ./arch/mips/configs/generic/board-xilfpga.config
        scripts/kconfig/conf  --olddefconfig Kconfig
        #
        # configuration written to .config
        #
      
      Resolve this by removing mention of the CONFIG_INPUT_* Kconfig symbols
      from generic_defconfig, allowing them to take their default values &
      allowing board config fragments to enable them without warnings.
      
      This may be problematic if CONFIG_ARCH_MIGHT_HAVE_PC_SERIO is ever
      enabled for CONFIG_MIPS_GENERIC=y configurations, but for now that isn't
      the case so we can worry about that if & when it happens.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20109/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      ca75e2fc
  4. 02 8月, 2018 3 次提交
    • P
      MIPS: Delete unused code in linux32.c · 48ae93fd
      Paul Burton 提交于
      The A() & AA() macros have been unused since commit 05e43966
      ("[MIPS] Use SYSVIPC_COMPAT to fix various problems on N32"), which
      switched to the more standard compat_ptr().
      
      RLIM_INFINITY32, RESOURCE32() & struct rlimit32 have been present but
      unused since the beginning of the git era.
      
      Remove the dead code.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20108/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      48ae93fd
    • P
      MIPS: Remove unused sys_32_mmap2 · 3a1c0fc5
      Paul Burton 提交于
      The sys_32_mmap2 function has been unused since we started using syscall
      wrappers in commit dbda6ac0 ("MIPS: CVE-2009-0029: Enable syscall
      wrappers."), and is indeed identical to the sys_mips_mmap2 function that
      replaced it in sys32_call_table.
      
      Remove the dead code.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20107/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      3a1c0fc5
    • P
      MIPS: Remove nabi_no_regargs · 96a68b14
      Paul Burton 提交于
      Our sigreturn functions make use of a macro named nabi_no_regargs to
      declare 8 dummy arguments to a function, forcing the compiler to expect
      a pt_regs structure on the stack rather than in argument registers. This
      is an ugly hack which unnecessarily causes these sigreturn functions to
      need to care about the calling convention of the ABI the kernel is built
      for. Although this is abstracted via nabi_no_regargs, it's still ugly &
      unnecessary.
      
      Remove nabi_no_regargs & the struct pt_regs argument from sigreturn
      functions, and instead use current_pt_regs() to find the struct pt_regs
      on the stack, which works cleanly regardless of ABI.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20106/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      96a68b14
  5. 01 8月, 2018 2 次提交
  6. 31 7月, 2018 7 次提交
    • MIPS: Loongson: Merge load addresses · 60bc84e2
      谢致邦 (XIE Zhibang) 提交于
      Systems based upon the Loongson 1B & 1C CPUs share the same load
      address, as do those based upon Loongson 1A. Unify the definition of
      this load address to reduce duplication & avoid the need for an extra
      Loongson 1A case in future.
      
      [paul.burton@mips.com: Rewrite commit message.]
      Signed-off-by: N谢致邦 (XIE Zhibang) <Yeking@Red54.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/14927/
      Cc: linux-mips@linux-mips.org
      60bc84e2
    • MIPS: Loongson: Set Loongson32 to MIPS32R1 · 968dc5a0
      谢致邦 (XIE Zhibang) 提交于
      LS232 (Loonson 2-issue 32-bit, also called GS232 (Godson 2-issue 32-bit))
      is the CPU core (microarchitecture) of Loongson 1A/1B/1C.
      
      According to "LS232 用户手册 (LS232 User Manual)", LS232 implements the
      MIPS32 Release 1 instruction set, and part of the MIPS32 Release 2
      instruction set.
      
      In the manual, LS232 implements all of the MIPS32R2 instruction set
      except the FPU instructions, and LS232 also implements 5 FPU
      instructions of the MIPS32R2 instruction set: CEIL.L.fmt, CVT.L.fmt,
      FLOOR.L.fmt, TRUNC.L.fmt, and ROUND.L.fmt.
      
      But a bug of the DI instruction has been found during tests, the DI
      instruction can not disable interrupts in arch_local_irq_disable() with
      CONFIG_PREEMPT_NONE=y and CFLAGS='-mno-branch-likely' in some cases.
      
      [paul.burton@mips.com:
        - Remove the _MIPS_ISA redefinition to match the change made for the
          generic MIPSr1 CPUs by commit 344ebf09 ("MIPS: Always use
          -march=<arch>, not -<arch> shortcuts").]
      Signed-off-by: N谢致邦 (XIE Zhibang) <Yeking@Red54.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/16155/
      Cc: linux-mips@linux-mips.org
      Cc: ralf@linux-mips.org
      968dc5a0
    • Q
      MIPS: mscc: ocelot: add interrupt controller properties to GPIO controller · 6386889a
      Quentin Schulz 提交于
      The GPIO controller also serves as an interrupt controller for events
      on the GPIO it handles.
      
      An interrupt occurs whenever a GPIO line has changed.
      Signed-off-by: NQuentin Schulz <quentin.schulz@bootlin.com>
      Acked-by: NAlexandre Belloni <alexandre.belloni@bootlin.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20015/
      Cc: robh+dt@kernel.org
      Cc: mark.rutland@arm.com
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: linux-gpio@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: thomas.petazzoni@bootlin.com
      6386889a
    • P
      MIPS: generic: Select MIPS_AUTO_PFN_OFFSET · 0211d49e
      Paul Burton 提交于
      Enable CONFIG_MIPS_AUTO_PFN_OFFSET for the generic platform, allowing
      it to avoid wasted book-keeping for pages with addresses lower than the
      physical base address of memory.
      
      This has a minimal impact on kernel text size, with 64r6el_defconfig
      gaining 0.1% in size as reported by bloat-o-meter:
      
        add/remove: 4/1 grow/shrink: 345/13 up/down: 9017/-392 (8625)
        Function                                     old     new   delta
        pcpu_setup_first_chunk                      1444    1780    +336
        pcpu_alloc_first_chunk                       864    1136    +272
        start_kernel                                1064    1288    +224
        initcall_blacklist                           224     372    +148
        try_fill_recv                               2088    2184     +96
        ...
        Total: Before=8457273, After=8465898, chg +0.10%
      
      The gain for systems with large offsets to physical memory & the ability
      to continue using generic kernels on such systems seems well worth this
      small cost.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Suggested-by: NVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20049/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      0211d49e
    • P
      MIPS: Allow auto-dection of ARCH_PFN_OFFSET & PHYS_OFFSET · 6c359eb1
      Paul Burton 提交于
      On systems where physical memory begins at a non-zero address, defining
      PHYS_OFFSET (which influences ARCH_PFN_OFFSET) can save us time & memory
      by avoiding book-keeping for pages from address zero to the start of
      memory.
      
      Some MIPS platforms already make use of this, but with the definition of
      PHYS_OFFSET being compile-time constant it hasn't been possible to
      enable this optimization for a kernel which may run on systems with
      varying physical memory base addresses.
      
      Introduce a new Kconfig option CONFIG_MIPS_AUTO_PFN_OFFSET which, when
      enabled, makes ARCH_PFN_OFFSET a variable & detects it from the boot
      memory map (which for example may have been populated from DT). The
      relationship with PHYS_OFFSET is reversed, with PHYS_OFFSET now being
      based on ARCH_PFN_OFFSET. This is because ARCH_PFN_OFFSET is used far
      more often, so avoiding the need for runtime calculation gives us a
      smaller impact on kernel text size (0.1% rather than 0.15% for
      64r6el_defconfig).
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Suggested-by: NVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20048/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      6c359eb1
    • P
      MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET · 0494d7ff
      Paul Burton 提交于
      isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
      as being identical to physical addresses, but they fail to do so in the
      presence of a non-zero PHYS_OFFSET.
      
      Correct this by having them use virt_to_phys() & phys_to_virt(), which
      consolidates the calculations to one place & ensures that ISA bus
      addresses do indeed match physical addresses.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20047/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
      0494d7ff
    • P
      MIPS: Make (UN)CAC_ADDR() PHYS_OFFSET-agnostic · 0d0e1477
      Paul Burton 提交于
      Converting an address between cached & uncached (typically addresses in
      (c)kseg0 & (c)kseg1 or 2 xkphys regions) should not depend upon
      PHYS_OFFSET in any way - we're converting from a virtual address in one
      unmapped region to a virtual address in another unmapped region.
      
      For some reason our CAC_ADDR() & UNCAC_ADDR() macros make use of
      PAGE_OFFSET, which typically includes PHYS_OFFSET. This means that
      platforms with a non-zero PHYS_OFFSET typically have to workaround
      miscalculation by these 2 macros by also defining UNCAC_BASE to a value
      that isn't really correct.
      
      It appears that an attempt has previously been made to address this with
      commit 3f4579252aa1 ("MIPS: make CAC_ADDR and UNCAC_ADDR account for
      PHYS_OFFSET") which was later undone by commit ed3ce16c ("Revert
      "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET"") which
      also introduced the ar7 workaround. That attempt at a fix was roughly
      equivalent, but essentially caused the CAC_ADDR() & UNCAC_ADDR() macros
      to cancel out PHYS_OFFSET by adding & then subtracting it again. In his
      revert Leonid is correct that using PHYS_OFFSET makes no sense in the
      context of these macros, but appears to have missed its inclusion via
      PAGE_OFFSET which means PHYS_OFFSET actually had an effect after the
      revert rather than before it.
      
      Here we fix this by modifying CAC_ADDR() & UNCAC_ADDR() to stop using
      PAGE_OFFSET (& thus PHYS_OFFSET), instead using __pa() & __va() along
      with UNCAC_BASE.
      
      For UNCAC_ADDR(), __pa() will convert a cached address to a physical
      address which we can simply use as an offset from UNCAC_BASE to obtain
      an address in the uncached region.
      
      For CAC_ADDR() we can undo the effect of UNCAC_ADDR() by subtracting
      UNCAC_BASE and using __va() on the result.
      
      With this change made, remove definitions of UNCAC_BASE from the ar7 &
      pic32 platforms which appear to have defined them only to workaround
      this problem.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      References: 3f4579252aa1 ("MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET")
      References: ed3ce16c ("Revert "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET"")
      Patchwork: https://patchwork.linux-mips.org/patch/20046/
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
      0d0e1477
  7. 28 7月, 2018 5 次提交
  8. 27 7月, 2018 5 次提交
  9. 25 7月, 2018 12 次提交