1. 18 10月, 2019 2 次提交
  2. 12 10月, 2019 1 次提交
  3. 08 10月, 2019 3 次提交
  4. 29 8月, 2019 2 次提交
  5. 07 8月, 2019 1 次提交
  6. 28 7月, 2019 1 次提交
  7. 26 7月, 2019 2 次提交
  8. 14 7月, 2019 1 次提交
  9. 10 7月, 2019 3 次提交
    • C
      MIPS: have "plain" make calls build dtbs for selected platforms · 870de149
      Cedric Hombourger 提交于
      commit 637dfa0fad6d91a9a709dc70549a6d20fa77f615 upstream.
      
      scripts/package/builddeb calls "make dtbs_install" after executing
      a plain make (i.e. no build targets specified). It will fail if dtbs
      were not built beforehand. Match the arm64 architecture where DTBs get
      built by the "all" target.
      Signed-off-by: NCedric Hombourger <Cedric_Hombourger@mentor.com>
      [paul.burton@mips.com: s/builddep/builddeb]
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.1+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      870de149
    • D
      MIPS: Add missing EHB in mtc0 -> mfc0 sequence. · 8957895b
      Dmitry Korotin 提交于
      commit 0b24cae4d535045f4c9e177aa228d4e97bad212c upstream.
      
      Add a missing EHB (Execution Hazard Barrier) in mtc0 -> mfc0 sequence.
      Without this execution hazard barrier it's possible for the value read
      back from the KScratch register to be the value from before the mtc0.
      
      Reproducible on P5600 & P6600.
      
      The hazard is documented in the MIPS Architecture Reference Manual Vol.
      III: MIPS32/microMIPS32 Privileged Resource Architecture (MD00088), rev
      6.03 table 8.1 which includes:
      
         Producer | Consumer | Hazard
        ----------|----------|----------------------------
         mtc0     | mfc0     | any coprocessor 0 register
      Signed-off-by: NDmitry Korotin <dkorotin@wavecomp.com>
      [paul.burton@mips.com:
        - Commit message tweaks.
        - Add Fixes tags.
        - Mark for stable back to v3.15 where P5600 support was introduced.]
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: 3d8bfdd0 ("MIPS: Use C0_KScratch (if present) to hold PGD pointer.")
      Fixes: 829dcc0a ("MIPS: Add MIPS P5600 probe support")
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.15+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8957895b
    • H
      MIPS: Fix bounds check virt_addr_valid · 2b8f8a80
      Hauke Mehrtens 提交于
      commit d6ed083f5cc621e15c15b56c3b585fd524dbcb0f upstream.
      
      The bounds check used the uninitialized variable vaddr, it should use
      the given parameter kaddr instead. When using the uninitialized value
      the compiler assumed it to be 0 and optimized this function to just
      return 0 in all cases.
      
      This should make the function check the range of the given address and
      only do the page map check in case it is in the expected range of
      virtual addresses.
      
      Fixes: 074a1e1167af ("MIPS: Bounds check virt_addr_valid")
      Cc: stable@vger.kernel.org # v4.12+
      Cc: Paul Burton <paul.burton@mips.com>
      Signed-off-by: NHauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: f4bug@amsat.org
      Cc: linux-mips@vger.kernel.org
      Cc: ysu@wavecomp.com
      Cc: jcristau@debian.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2b8f8a80
  10. 03 7月, 2019 1 次提交
    • P
      irqchip/mips-gic: Use the correct local interrupt map registers · c22cea5a
      Paul Burton 提交于
      commit 6d4d367d0e9ffab4d64a3436256a6a052dc1195d upstream.
      
      The MIPS GIC contains a block of registers used to map local interrupts
      to a particular CPU interrupt pin. Since these registers are found at a
      consecutive range of addresses we access them using an index, via the
      (read|write)_gic_v[lo]_map accessor functions. We currently use values
      from enum mips_gic_local_interrupt as those indices.
      
      Unfortunately whilst enum mips_gic_local_interrupt provides the correct
      offsets for bits in the pending & mask registers, the ordering of the
      map registers is subtly different... Compared with the ordering of
      pending & mask bits, the map registers move the FDC from the end of the
      list to index 3 after the timer interrupt. As a result the performance
      counter & software interrupts are therefore at indices 4-6 rather than
      indices 3-5.
      
      Notably this causes problems with performance counter interrupts being
      incorrectly mapped on some systems, and presumably will also cause
      problems for FDC interrupts.
      
      Introduce a function to map from enum mips_gic_local_interrupt to the
      index of the corresponding map register, and use it to ensure we access
      the map registers for the correct interrupts.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: a0dc5cb5 ("irqchip: mips-gic: Simplify gic_local_irq_domain_map()")
      Fixes: da61fcf9 ("irqchip: mips-gic: Use irq_cpu_online to (un)mask all-VP(E) IRQs")
      Reported-and-tested-by: NArcher Yan <ayan@wavecomp.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: stable@vger.kernel.org # v4.14+
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c22cea5a
  11. 25 6月, 2019 1 次提交
  12. 15 6月, 2019 1 次提交
    • S
      mips: Make sure dt memory regions are valid · 2d433cc9
      Serge Semin 提交于
      [ Upstream commit 93fa5b280761a4dbb14c5330f260380385ab2b49 ]
      
      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
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      2d433cc9
  13. 11 6月, 2019 3 次提交
    • G
      Revert "MIPS: perf: ath79: Fix perfcount IRQ assignment" · 221c44d2
      Greg Kroah-Hartman 提交于
      This reverts commit ca864881 which is
      commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 upstream.
      
      Petr writes:
      	Karl has reported to me today, that he's experiencing weird
      	reboot hang on his devices with 4.9.180 kernel and that he has
      	bisected it down to my backported patch.
      
      	I would like to kindly ask you for removal of this patch.  This
      	patch should be reverted from all stable kernels up to 5.1,
      	because perf counters were not broken on those kernels, and this
      	patch won't work on the ath79 legacy IRQ code anyway, it needs
      	new irqchip driver which was enabled on ath79 with commit
      	51fa4f8912c0 ("MIPS: ath79: drop legacy IRQ code").
      Reported-by: NPetr Štetiar <ynezz@true.cz>
      Cc: Kevin 'ldir' Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Cc: John Crispin <john@phrozen.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Paul 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>
      Cc: Sasha Levin <sashal@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      221c44d2
    • P
      MIPS: pistachio: Build uImage.gz by default · 2d9d3ab5
      Paul Burton 提交于
      commit e4f2d1af7163becb181419af9dece9206001e0a6 upstream.
      
      The pistachio platform uses the U-Boot bootloader & generally boots a
      kernel in the uImage format. As such it's useful to build one when
      building the kernel, but to do so currently requires the user to
      manually specify a uImage target on the make command line.
      
      Make uImage.gz the pistachio platform's default build target, so that
      the default is to build a kernel image that we can actually boot on a
      board such as the MIPS Creator Ci40.
      
      Marked for stable backport as far as v4.1 where pistachio support was
      introduced. This is primarily useful for CI systems such as kernelci.org
      which will benefit from us building a suitable image which can then be
      booted as part of automated testing, extending our test coverage to the
      affected stable branches.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: NKevin Hilman <khilman@baylibre.com>
      Tested-by: NKevin Hilman <khilman@baylibre.com>
      URL: https://groups.io/g/kernelci/message/388
      Cc: stable@vger.kernel.org # v4.1+
      Cc: linux-mips@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d9d3ab5
    • P
      MIPS: Bounds check virt_addr_valid · eee60963
      Paul Burton 提交于
      commit 074a1e1167afd82c26f6d03a9a8b997d564bb241 upstream.
      
      The virt_addr_valid() function is meant to return true iff
      virt_to_page() will return a valid struct page reference. This is true
      iff the address provided is found within the unmapped address range
      between PAGE_OFFSET & MAP_BASE, but we don't currently check for that
      condition. Instead we simply mask the address to obtain what will be a
      physical address if the virtual address is indeed in the desired range,
      shift it to form a PFN & then call pfn_valid(). This can incorrectly
      return true if called with a virtual address which, after masking,
      happens to form a physical address corresponding to a valid PFN.
      
      For example we may vmalloc an address in the kernel mapped region
      starting a MAP_BASE & obtain the virtual address:
      
        addr = 0xc000000000002000
      
      When masked by virt_to_phys(), which uses __pa() & in turn CPHYSADDR(),
      we obtain the following (bogus) physical address:
      
        addr = 0x2000
      
      In a common system with PHYS_OFFSET=0 this will correspond to a valid
      struct page which should really be accessed by virtual address
      PAGE_OFFSET+0x2000, causing virt_addr_valid() to incorrectly return 1
      indicating that the original address corresponds to a struct page.
      
      This is equivalent to the ARM64 change made in commit ca219452
      ("arm64: Correctly bounds check virt_addr_valid").
      
      This fixes fallout when hardened usercopy is enabled caused by the
      related commit 517e1fbe ("mm/usercopy: Drop extra
      is_vmalloc_or_module() check") which removed a check for the vmalloc
      range that was present from the introduction of the hardened usercopy
      feature.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      References: ca219452 ("arm64: Correctly bounds check virt_addr_valid")
      References: 517e1fbe ("mm/usercopy: Drop extra is_vmalloc_or_module() check")
      Reported-by: NJulien Cristau <jcristau@debian.org>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Tested-by: NYunQiang Su <ysu@wavecomp.com>
      URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929366
      Cc: stable@vger.kernel.org # v4.12+
      Cc: linux-mips@vger.kernel.org
      Cc: Yunqiang Su <ysu@wavecomp.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eee60963
  14. 09 6月, 2019 1 次提交
    • T
      KVM: s390: Do not report unusabled IDs via KVM_CAP_MAX_VCPU_ID · 6a2fbec7
      Thomas Huth 提交于
      commit a86cb413f4bf273a9d341a3ab2c2ca44e12eb317 upstream.
      
      KVM_CAP_MAX_VCPU_ID is currently always reporting KVM_MAX_VCPU_ID on all
      architectures. However, on s390x, the amount of usable CPUs is determined
      during runtime - it is depending on the features of the machine the code
      is running on. Since we are using the vcpu_id as an index into the SCA
      structures that are defined by the hardware (see e.g. the sca_add_vcpu()
      function), it is not only the amount of CPUs that is limited by the hard-
      ware, but also the range of IDs that we can use.
      Thus KVM_CAP_MAX_VCPU_ID must be determined during runtime on s390x, too.
      So the handling of KVM_CAP_MAX_VCPU_ID has to be moved from the common
      code into the architecture specific code, and on s390x we have to return
      the same value here as for KVM_CAP_MAX_VCPUS.
      This problem has been discovered with the kvm_create_max_vcpus selftest.
      With this change applied, the selftest now passes on s390x, too.
      Reviewed-by: NAndrew Jones <drjones@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Message-Id: <20190523164309.13345-9-thuth@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      6a2fbec7
  15. 04 6月, 2019 1 次提交
  16. 26 5月, 2019 1 次提交
    • F
      MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled · 9ae0f86c
      Florian Fainelli 提交于
      commit 1b1f01b653b408ebe58fec78c566d1075d285c64 upstream.
      
      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: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NPaul 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+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9ae0f86c
  17. 17 5月, 2019 1 次提交
    • P
      MIPS: perf: ath79: Fix perfcount IRQ assignment · ca864881
      Petr Štetiar 提交于
      [ Upstream commit a1e8783db8e0d58891681bc1e6d9ada66eae8e20 ]
      
      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>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ca864881
  18. 10 5月, 2019 1 次提交
  19. 02 5月, 2019 1 次提交
    • A
      MIPS: scall64-o32: Fix indirect syscall number load · 7f9c9d1d
      Aurelien Jarno 提交于
      commit 79b4a9cf0e2ea8203ce777c8d5cfa86c71eae86e upstream.
      
      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
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7f9c9d1d
  20. 27 3月, 2019 3 次提交
    • A
      MIPS: Fix kernel crash for R6 in jump label branch function · 9d91069f
      Archer Yan 提交于
      commit 47c25036b60f27b86ab44b66a8861bcf81cde39b upstream.
      
      Insert Branch instruction instead of NOP to make sure assembler don't
      patch code in forbidden slot. In jump label function, it might
      be possible to patch Control Transfer Instructions(CTIs) into
      forbidden slot, which will generate Reserved Instruction exception
      in MIPS release 6.
      Signed-off-by: NArcher Yan <ayan@wavecomp.com>
      Reviewed-by: NPaul Burton <paul.burton@mips.com>
      [paul.burton@mips.com:
        - Add MIPS prefix to subject.
        - Mark for stable from v4.0, which introduced r6 support, onwards.]
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.0+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d91069f
    • Y
      MIPS: Ensure ELF appended dtb is relocated · 6e74961b
      Yasha Cherikovsky 提交于
      commit 3f0a53bc6482fb09770982a8447981260ea258dc upstream.
      
      This fixes booting with the combination of CONFIG_RELOCATABLE=y
      and CONFIG_MIPS_ELF_APPENDED_DTB=y.
      
      Sections that appear after the relocation table are not relocated
      on system boot (except .bss, which has special handling).
      
      With CONFIG_MIPS_ELF_APPENDED_DTB, the dtb is part of the
      vmlinux ELF, so it must be relocated together with everything else.
      
      Fixes: 069fd766 ("MIPS: Reserve space for relocation table")
      Signed-off-by: NYasha Cherikovsky <yasha.che3@gmail.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.7+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e74961b
    • Y
      mips: loongson64: lemote-2f: Add IRQF_NO_SUSPEND to "cascade" irqaction. · 56bcf3df
      Yifeng Li 提交于
      commit 5f5f67da9781770df0403269bc57d7aae608fecd upstream.
      
      Timekeeping IRQs from CS5536 MFGPT are routed to i8259, which then
      triggers the "cascade" IRQ on MIPS CPU. Without IRQF_NO_SUSPEND in
      cascade_irqaction, MFGPT interrupts will be masked in suspend mode,
      and the machine would be unable to resume once suspended.
      
      Previously, MIPS IRQs were not disabled properly, so the original
      code appeared to work. Commit a3e6c1ef ("MIPS: IRQ: Fix disable_irq on
      CPU IRQs") uncovers the bug. To fix it, add IRQF_NO_SUSPEND to
      cascade_irqaction.
      
      This commit is functionally identical to 0add9c2f ("MIPS:
      Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction"), but it forgot
      to apply the same fix to Loongson2.
      Signed-off-by: NYifeng Li <tomli@tomli.me>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56bcf3df
  21. 24 3月, 2019 1 次提交
    • S
      KVM: Call kvm_arch_memslots_updated() before updating memslots · 23ad135a
      Sean Christopherson 提交于
      commit 152482580a1b0accb60676063a1ac57b2d12daf6 upstream.
      
      kvm_arch_memslots_updated() is at this point in time an x86-specific
      hook for handling MMIO generation wraparound.  x86 stashes 19 bits of
      the memslots generation number in its MMIO sptes in order to avoid
      full page fault walks for repeat faults on emulated MMIO addresses.
      Because only 19 bits are used, wrapping the MMIO generation number is
      possible, if unlikely.  kvm_arch_memslots_updated() alerts x86 that
      the generation has changed so that it can invalidate all MMIO sptes in
      case the effective MMIO generation has wrapped so as to avoid using a
      stale spte, e.g. a (very) old spte that was created with generation==0.
      
      Given that the purpose of kvm_arch_memslots_updated() is to prevent
      consuming stale entries, it needs to be called before the new generation
      is propagated to memslots.  Invalidating the MMIO sptes after updating
      memslots means that there is a window where a vCPU could dereference
      the new memslots generation, e.g. 0, and incorrectly reuse an old MMIO
      spte that was created with (pre-wrap) generation==0.
      
      Fixes: e59dbe09 ("KVM: Introduce kvm_arch_memslots_updated()")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23ad135a
  22. 14 3月, 2019 2 次提交
    • J
      MIPS: Remove function size check in get_frame_info() · cd8520a2
      Jun-Ru Chang 提交于
      [ Upstream commit 2b424cfc69728224fcb5fad138ea7260728e0901 ]
      
      Patch (b6c7a324 "MIPS: Fix get_frame_info() handling of
      microMIPS function size.") introduces additional function size
      check for microMIPS by only checking insn between ip and ip + func_size.
      However, func_size in get_frame_info() is always 0 if KALLSYMS is not
      enabled. This causes get_frame_info() to return immediately without
      calculating correct frame_size, which in turn causes "Can't analyze
      schedule() prologue" warning messages at boot time.
      
      This patch removes func_size check, and let the frame_size check run
      up to 128 insns for both MIPS and microMIPS.
      Signed-off-by: NJun-Ru Chang <jrjang@realtek.com>
      Signed-off-by: NTony Wu <tonywu@realtek.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: b6c7a324 ("MIPS: Fix get_frame_info() handling of microMIPS function size.")
      Cc: <ralf@linux-mips.org>
      Cc: <jhogan@kernel.org>
      Cc: <macro@mips.com>
      Cc: <yamada.masahiro@socionext.com>
      Cc: <peterz@infradead.org>
      Cc: <mingo@kernel.org>
      Cc: <linux-mips@vger.kernel.org>
      Cc: <linux-kernel@vger.kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      cd8520a2
    • Z
      DTS: CI20: Fix bugs in ci20's device tree. · fbc3ed13
      Zhou Yanjie 提交于
      [ Upstream commit 1ca1c87f91d9dc50d6a38e2177b2032996e7901c ]
      
      According to the Schematic, the hardware of ci20 leads to uart3,
      but not to uart2. Uart2 is miswritten in the original code.
      Signed-off-by: NZhou Yanjie <zhouyanjie@cduestc.edu.cn>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips <linux-mips@vger.kernel.org>
      Cc: linux-kernel <linux-kernel@vger.kernel.org>
      Cc: devicetree@vger.kernel.org
      Cc: robh+dt@kernel.org
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: mark.rutland@arm.com
      Cc: malat@debian.org
      Cc: ezequiel@collabora.co.uk
      Cc: ulf.hansson@linaro.org
      Cc: syq <syq@debian.org>
      Cc: jiaxun.yang <jiaxun.yang@flygoat.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      fbc3ed13
  23. 10 3月, 2019 1 次提交
  24. 06 3月, 2019 3 次提交
    • P
      MIPS: eBPF: Fix icache flush end address · 9f77e4cb
      Paul Burton 提交于
      commit d1a2930d8a992fb6ac2529449f81a0056e1b98d1 upstream.
      
      The MIPS eBPF JIT calls flush_icache_range() in order to ensure the
      icache observes the code that we just wrote. Unfortunately it gets the
      end address calculation wrong due to some bad pointer arithmetic.
      
      The struct jit_ctx target field is of type pointer to u32, and as such
      adding one to it will increment the address being pointed to by 4 bytes.
      Therefore in order to find the address of the end of the code we simply
      need to add the number of 4 byte instructions emitted, but we mistakenly
      add the number of instructions multiplied by 4. This results in the call
      to flush_icache_range() operating on a memory region 4x larger than
      intended, which is always wasteful and can cause crashes if we overrun
      into an unmapped page.
      
      Fix this by correcting the pointer arithmetic to remove the bogus
      multiplication, and use braces to remove the need for a set of brackets
      whilst also making it obvious that the target field is a pointer.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: b6bd53f9 ("MIPS: Add missing file for eBPF JIT.")
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: netdev@vger.kernel.org
      Cc: bpf@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.13+
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9f77e4cb
    • J
      MIPS: BCM63XX: provide DMA masks for ethernet devices · 4a418a3d
      Jonas Gorski 提交于
      commit 18836b48ebae20850631ee2916d0cdbb86df813d upstream.
      
      The switch to the generic dma ops made dma masks mandatory, breaking
      devices having them not set. In case of bcm63xx, it broke ethernet with
      the following warning when trying to up the device:
      
      [    2.633123] ------------[ cut here ]------------
      [    2.637949] WARNING: CPU: 0 PID: 325 at ./include/linux/dma-mapping.h:516 bcm_enetsw_open+0x160/0xbbc
      [    2.647423] Modules linked in: gpio_button_hotplug
      [    2.652361] CPU: 0 PID: 325 Comm: ip Not tainted 4.19.16 #0
      [    2.658080] Stack : 80520000 804cd3ec 00000000 00000000 804ccc00 87085bdc 87d3f9d4 804f9a17
      [    2.666707]         8049cf18 00000145 80a942a0 00000204 80ac0000 10008400 87085b90 eb3d5ab7
      [    2.675325]         00000000 00000000 80ac0000 000022b0 00000000 00000000 00000007 00000000
      [    2.683954]         0000007a 80500000 0013b381 00000000 80000000 00000000 804a1664 80289878
      [    2.692572]         00000009 00000204 80ac0000 00000200 00000002 00000000 00000000 80a90000
      [    2.701191]         ...
      [    2.703701] Call Trace:
      [    2.706244] [<8001f3c8>] show_stack+0x58/0x100
      [    2.710840] [<800336e4>] __warn+0xe4/0x118
      [    2.715049] [<800337d4>] warn_slowpath_null+0x48/0x64
      [    2.720237] [<80289878>] bcm_enetsw_open+0x160/0xbbc
      [    2.725347] [<802d1d4c>] __dev_open+0xf8/0x16c
      [    2.729913] [<802d20cc>] __dev_change_flags+0x100/0x1c4
      [    2.735290] [<802d21b8>] dev_change_flags+0x28/0x70
      [    2.740326] [<803539e0>] devinet_ioctl+0x310/0x7b0
      [    2.745250] [<80355fd8>] inet_ioctl+0x1f8/0x224
      [    2.749939] [<802af290>] sock_ioctl+0x30c/0x488
      [    2.754632] [<80112b34>] do_vfs_ioctl+0x740/0x7dc
      [    2.759459] [<80112c20>] ksys_ioctl+0x50/0x94
      [    2.763955] [<800240b8>] syscall_common+0x34/0x58
      [    2.768782] ---[ end trace fb1a6b14d74e28b6 ]---
      [    2.773544] bcm63xx_enetsw bcm63xx_enetsw.0: cannot allocate rx ring 512
      
      Fix this by adding appropriate DMA masks for the platform devices.
      
      Fixes: f8c55dc6 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
      Signed-off-by: NJonas Gorski <jonas.gorski@gmail.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: stable@vger.kernel.org # v4.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a418a3d
    • M
      MIPS: fix truncation in __cmpxchg_small for short values · 3bfa6413
      Michael Clark 提交于
      commit 94ee12b507db8b5876e31c9d6c9d84f556a4b49f upstream.
      
      __cmpxchg_small erroneously uses u8 for load comparison which can
      be either char or short. This patch changes the local variable to
      u32 which is sufficiently sized, as the loaded value is already
      masked and shifted appropriately. Using an integer size avoids
      any unnecessary canonicalization from use of non native widths.
      
      This patch is part of a series that adapts the MIPS small word
      atomics code for xchg and cmpxchg on short and char to RISC-V.
      
      Cc: RISC-V Patches <patches@groups.riscv.org>
      Cc: Linux RISC-V <linux-riscv@lists.infradead.org>
      Cc: Linux MIPS <linux-mips@linux-mips.org>
      Signed-off-by: NMichael Clark <michaeljclark@mac.com>
      [paul.burton@mips.com:
        - Fix varialble typo per Jonas Gorski.
        - Consolidate load variable with other declarations.]
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: 3ba7f44d ("MIPS: cmpxchg: Implement 1 byte & 2 byte cmpxchg()")
      Cc: stable@vger.kernel.org # v4.13+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3bfa6413
  25. 27 2月, 2019 2 次提交
    • T
      MIPS: jazz: fix 64bit build · 703f4f65
      Thomas Bogendoerfer 提交于
      [ Upstream commit 41af167fbc0032f9d7562854f58114eaa9270336 ]
      
      64bit JAZZ builds failed with
      
        linux-next/arch/mips/jazz/jazzdma.c: In function `vdma_init`:
        /linux-next/arch/mips/jazz/jazzdma.c:77:30: error: implicit declaration
          of function `KSEG1ADDR`; did you mean `CKSEG1ADDR`?
          [-Werror=implicit-function-declaration]
          pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
                                      ^~~~~~~~~
                                      CKSEG1ADDR
        /linux-next/arch/mips/jazz/jazzdma.c:77:10: error: cast to pointer from
          integer of different size [-Werror=int-to-pointer-cast]
          pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
                  ^
        In file included from /linux-next/arch/mips/include/asm/barrier.h:11:0,
                         from /linux-next/include/linux/compiler.h:248,
                         from /linux-next/include/linux/kernel.h:10,
                         from /linux-next/arch/mips/jazz/jazzdma.c:11:
        /linux-next/arch/mips/include/asm/addrspace.h:41:29: error: cast from
          pointer to integer of different size [-Werror=pointer-to-int-cast]
         #define _ACAST32_  (_ATYPE_)(_ATYPE32_) /* widen if necessary */
                                     ^
        /linux-next/arch/mips/include/asm/addrspace.h:53:25: note: in
          expansion of macro `_ACAST32_`
         #define CPHYSADDR(a)  ((_ACAST32_(a)) & 0x1fffffff)
                                 ^~~~~~~~~
        /linux-next/arch/mips/jazz/jazzdma.c:84:44: note: in expansion of
          macro `CPHYSADDR`
          r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl));
      
      Using correct casts and CKSEG1ADDR when dealing with the pgtbl setup
      fixes this.
      Signed-off-by: NThomas Bogendoerfer <tbogendoerfer@suse.de>
      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
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      703f4f65
    • A
      MIPS: ath79: Enable OF serial ports in the default config · ac3be9eb
      Alban Bedel 提交于
      [ Upstream commit 565dc8a4f55e491935bfb04866068d21784ea9a4 ]
      
      CONFIG_SERIAL_OF_PLATFORM is needed to get a working console on the OF
      boards, enable it in the default config to get a working setup out of
      the box.
      Signed-off-by: NAlban Bedel <albeu@free.fr>
      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: linux-kernel@vger.kernel.org
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ac3be9eb