1. 16 Apr, 2021 9 commits
    • Huacai Chen's avatar
      MIPS: Loongson64: Add kexec/kdump support · 6ce48897
      Huacai Chen authored
      Add kexec/kdump support for Loongson64 by:
      1, Provide Loongson-specific kexec functions: loongson_kexec_prepare(),
         loongson_kexec_shutdown() and loongson_crash_shutdown();
      2, Provide Loongson-specific assembly code in kexec_smp_wait();
      
      To start Loongson64, The boot CPU needs 3 parameters:
      fw_arg0: the number of arguments in cmdline (i.e., argc).
      fw_arg1: structure holds cmdline such as "root=/dev/sda1 console=tty"
               (i.e., argv).
      fw_arg2: environment (i.e., envp, additional boot parameters from LEFI).
      
      Non-boot CPUs do not need one parameter as the IPI mailbox base address.
      They query their own IPI mailbox to get PC, SP and GP in a loopi, until
      the boot CPU brings them up.
      
      loongson_kexec_prepare(): Setup cmdline for kexec/kdump. The kexec/kdump
      cmdline comes from kexec's "append" option string. This structure will
      be parsed in fw_init_cmdline() of arch/mips/fw/lib/cmdline.c. Both image
      ->control_code_page and the cmdline need to be in a safe memory region
      (memory allocated by the old kernel may be corrupted by the new kernel).
      In order to maintain compatibility for the old firmware, the low 2MB is
      reserverd and safe for Loongson. So let KEXEC_CTRL_CODE and KEXEC_ARGV_
      ADDR be here. LEFI parameters may be corrupted at runtime, so backup it
      at mips_reboot_setup(), and then restore it at loongson_kexec_shutdown()
      /loongson_crash_shutdown().
      
      loongson_kexec_shutdown(): Wake up all present CPUs and let them go to
      reboot_code_buffer. Pass the kexec parameters to kexec_args.
      
      loongson_crash_shutdown(): Pass the kdump parameters to kexec_args.
      
      The assembly part in kexec_smp_wait provide a routine as BIOS does, in
      order to keep secondary CPUs in a querying loop.
      
      The layout of low 2MB memory in our design:
      0x80000000, the first MB, the first 64K, Exception vectors
      0x80010000, the first MB, the second 64K, STR (suspend) data
      0x80020000, the first MB, the third and fourth 64K, UEFI HOB
      0x80040000, the first MB, the fifth 64K, RT-Thread for SMC
      0x80100000, the second MB, the first 64K, KEXEC code
      0x80108000, the second MB, the second 64K, KEXEC data
      
      Cc: Eric Biederman <ebiederm@xmission.com>
      Tested-by: default avatarJinyang He <hejinyang@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@kernel.org>
      Signed-off-by: default avatarJinyang He <hejinyang@loongson.cn>
      Signed-off-by: default avatarYouling Tang <tangyouling@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      6ce48897
    • Ilya Lipnitskiy's avatar
      MIPS: pci-legacy: use generic pci_enable_resources · 99bca615
      Ilya Lipnitskiy authored
      Follow the reasoning from commit 842de40d ("PCI: add generic
      pci_enable_resources()"):
      
        The only functional difference from the MIPS version is that the
        generic one uses "!r->parent" to check for resource collisions
        instead of "!r->start && r->end".
      
      That should have no effect on any pci-legacy driver.
      Suggested-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      99bca615
    • Ilya Lipnitskiy's avatar
      MIPS: pci-legacy: remove busn_resource field · 0af83d2e
      Ilya Lipnitskiy authored
      No drivers set the busn_resource field in the pci_controller struct.
      Commit 7ee214b5 ("MIPS: PCI: Remove unused busn_offset") almost
      removed it over 3 years ago. Remove it for good to free up memory and
      eliminate messages like:
        pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      0af83d2e
    • Ilya Lipnitskiy's avatar
      MIPS: pci-legacy: remove redundant info messages · 317f553b
      Ilya Lipnitskiy authored
      Remove the following pci-legacy message:
        PCI host bridge /pci@440000/host-bridge ranges:
         MEM 0x0000000020000000..0x000000002fffffff
          IO 0x0000000000460000..0x000000000046ffff
      
      It is followed shortly by the same data from pci_register_host_bridge:
        PCI host bridge to bus 0000:00
        pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
        pci_bus 0000:00: root bus resource [io  0x460000-0x46ffff]
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      317f553b
    • Ilya Lipnitskiy's avatar
      MIPS: pci-legacy: stop using of_pci_range_to_resource · 3ecb9dc1
      Ilya Lipnitskiy authored
      Mirror commit aeba3731 ("powerpc/pci: Fix IO space breakage after
      of_pci_range_to_resource() change").
      
      Most MIPS platforms do not define PCI_IOBASE, nor implement
      pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS
      platforms. of_pci_range_to_resource passes the _start address_ of the IO
      range into pci_address_to_pio, which then checks it against
      IO_SPACE_LIMIT and fails, because for MIPS platforms that use
      pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much
      higher than 0xffff.
      
      In fact, pci-mt7621 in staging already works around this problem, see
      commit 09dd629e ("staging: mt7621-pci: fix io space and properly set
      resource limits")
      
      So just stop using of_pci_range_to_resource, which does not work for
      MIPS.
      
      Fixes PCI errors like:
        pci_bus 0000:00: root bus resource [io  0xffffffff]
      
      Fixes: 0b0b0893 ("of/pci: Fix the conversion of IO ranges into IO resources")
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Liviu Dudau <Liviu.Dudau@arm.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      3ecb9dc1
    • Ilya Lipnitskiy's avatar
      MIPS: pci-rt3883: more accurate DT error messages · 2f802e17
      Ilya Lipnitskiy authored
      Existing strings do not make sense: one is always NULL and the other
      refers to the wrong parent node.
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      2f802e17
    • Ilya Lipnitskiy's avatar
      MIPS: pci-rt3883: trivial: remove unused variable · becb0425
      Ilya Lipnitskiy authored
      Fixes the following compiler warning:
        warning: unused variable 'flags' [-Wunused-variable]
      
      Fixes: e5067c71 ("MIPS: pci-rt3883: Remove odd locking in PCI config space access code")
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Acked-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Cc: trivial@kernel.org
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      becb0425
    • Ilya Lipnitskiy's avatar
      MIPS: pci-rt2880: remove unneeded locks · 791a7be2
      Ilya Lipnitskiy authored
      Mirror pci-rt3883 fix from commit e5067c71 ("MIPS: pci-rt3883:
      Remove odd locking in PCI config space access code"). pci-rt2880 shares
      the driver layout with pci-rt3883 and the same reasons apply.
      
      Caller (generic PCI code) already does proper locking, so no need to add
      another one here. Local PCI read/write functions are never called
      simultaneously, also they do not require synchronization with the PCI
      controller ops, since they are used before the controller registration.
      Suggested-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Reviewed-by: default avatarSergey Ryazanov <ryazanov.s.a@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      791a7be2
    • Ilya Lipnitskiy's avatar
      MIPS: pci-rt2880: fix slot 0 configuration · 8e98b697
      Ilya Lipnitskiy authored
      pci_fixup_irqs() used to call pcibios_map_irq on every PCI device, which
      for RT2880 included bus 0 slot 0. After pci_fixup_irqs() got removed,
      only slots/funcs with devices attached would be called. While arguably
      the right thing, that left no chance for this driver to ever initialize
      slot 0, effectively bricking PCI and USB on RT2880 devices such as the
      Belkin F5D8235-4 v1.
      
      Slot 0 configuration needs to happen after PCI bus enumeration, but
      before any device at slot 0x11 (func 0 or 1) is talked to. That was
      determined empirically by testing on a Belkin F5D8235-4 v1 device. A
      minimal BAR 0 config write followed by read, then setting slot 0
      PCI_COMMAND to MASTER | IO | MEMORY is all that seems to be required for
      proper functionality.
      
      Tested by ensuring that full- and high-speed USB devices get enumerated
      on the Belkin F5D8235-4 v1 (with an out of tree DTS file from OpenWrt).
      
      Fixes: 04c81c72 ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Tobias Wolf <dev-NTEO@vplace.de>
      Cc: <stable@vger.kernel.org> # v4.14+
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      8e98b697
  2. 15 Apr, 2021 1 commit
  3. 13 Apr, 2021 1 commit
  4. 12 Apr, 2021 4 commits
  5. 09 Apr, 2021 1 commit
  6. 07 Apr, 2021 1 commit
  7. 06 Apr, 2021 13 commits
  8. 30 Mar, 2021 1 commit
  9. 29 Mar, 2021 7 commits
    • Qing Zhang's avatar
      MIPS: Loongson64: enable CONFIG_USB_SERIAL_PL2303 · 19f0e8cd
      Qing Zhang authored
      When using the Loongson-3A4000 machine for serial port debugging,
      there is no /dev/ttyUSB* output, which makes the serial port unavailable,
      For convenience, we open this configuration.
      
      zhangqing@loongson-pc:~$ cat /sys/firmware/lefi/boardinfo
      Board Info
      Manufacturer		: THTF
      Board Name		: THTF-LS3A4000-7A1000-ML4A
      Family			: LOONGSON3
      
      BIOS Info
      Vendor			: ZD tech
      Version			: ZD tech-V2.1.1
      ROM Size		: 4 KB
      Release Date		: 2020-06-29
      
      zhangqing@loongson-pc:~$ lsusb
      Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 005 Device 003: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
      Bus 005 Device 002: ID 0c45:760b Microdia USB Keyboard
      Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
      Bus 003 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
      Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
      Signed-off-by: default avatarQing Zhang <zhangqing@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      19f0e8cd
    • Ilya Lipnitskiy's avatar
      crypto: mips: add poly1305-core.S to .gitignore · dc92d0df
      Ilya Lipnitskiy authored
      poly1305-core.S is an auto-generated file, so it should be ignored.
      
      Fixes: a11d055e ("crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation")
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      dc92d0df
    • Chuanhong Guo's avatar
      MIPS: ralink: mt7621: add memory detection support · 139c949f
      Chuanhong Guo authored
      mt7621 has the following memory map:
      0x0-0x1c000000: lower 448m memory
      0x1c000000-0x2000000: peripheral registers
      0x20000000-0x2400000: higher 64m memory
      
      detect_memory_region in arch/mips/kernel/setup.c only adds the first
      memory region and isn't suitable for 512m memory detection because
      it may accidentally read the memory area for peripheral registers.
      
      This commit adds memory detection capability for mt7621:
        1. Add the highmem area when 512m is detected.
        2. Guard memcmp from accessing peripheral registers:
           This only happens when a user decided to change kernel load address
           to 256m or higher address. Since this is a quite unusual case, we
           just skip 512m testing and return 256m as memory size.
      Signed-off-by: default avatarChuanhong Guo <gch981213@gmail.com>
      [Minor commit message reword, make mt7621_memory_detect static]
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      139c949f
    • Ilya Lipnitskiy's avatar
      MIPS: ralink: annotate prom_soc_init() with __init · 8eb6eb48
      Ilya Lipnitskiy authored
      prom_soc_init is only called from prom_init in arch/mips/ralink/prom.c,
      which is already annotated with __init, so annotate prom_soc_init with
      __init too.
      Signed-off-by: default avatarIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      8eb6eb48
    • Julian Braha's avatar
      arch: mips: fix unmet dependency for MTD_COMPLEX_MAPPINGS · f766b28a
      Julian Braha authored
      When CAVIUM_OCTEON_SOC is enabled, and MTD is disabled,
      Kbuild gives the following warning:
      
      WARNING: unmet direct dependencies detected for MTD_COMPLEX_MAPPINGS
        Depends on [n]: MTD [=n] && HAS_IOMEM [=y]
        Selected by [y]:
        - CAVIUM_OCTEON_SOC [=y] && <choice>
      
      This is because CAVIUM_OCTEON_SOC selects MTD_COMPLEX_MAPPINGS,
      without selecting or depending on MTD, despite MTD_COMPLEX_MAPPINGS
      depending on MTD.
      Signed-off-by: default avatarJulian Braha <julianbraha@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      f766b28a
    • Julian Braha's avatar
      arch: mips: fix unmet dependency for DEBUG_INFO · e87f69a5
      Julian Braha authored
      When SB1XXX_CORELIS is enabled, COMPILE_TEST is disabled,
      and DEBUG_KERNEL is disabled, Kbuild gives the
      following warning:
      
      WARNING: unmet direct dependencies detected for DEBUG_INFO
        Depends on [n]: DEBUG_KERNEL [=n] && !COMPILE_TEST [=n]
        Selected by [y]:
        - SB1XXX_CORELIS [=y] && SIBYTE_SB1xxx_SOC [=y] && !COMPILE_TEST [=n]
      
      This is because SB1XXX_CORELIS selects DEBUG_INFO without
      selecting or depending on DEBUG_KERNEL, despite DEBUG_INFO
      depending on DEBUG_KERNEL.
      Signed-off-by: default avatarJulian Braha <julianbraha@gmail.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      e87f69a5
    • Tiezhu Yang's avatar
      MIPS/bpf: Enable bpf_probe_read{, str}() on MIPS again · 66633abd
      Tiezhu Yang authored
      After commit 0ebeea8c ("bpf: Restrict bpf_probe_read{, str}() only to
      archs where they work"), bpf_probe_read{, str}() functions were no longer
      available on MIPS, so there exist some errors when running bpf program:
      
      root@linux:/home/loongson/bcc# python examples/tracing/task_switch.py
      bpf: Failed to load program: Invalid argument
      [...]
      11: (85) call bpf_probe_read#4
      unknown func bpf_probe_read#4
      [...]
      Exception: Failed to load BPF program count_sched: Invalid argument
      
      ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE should be restricted to archs
      with non-overlapping address ranges, but they can overlap in EVA mode
      on MIPS, so select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA in
      arch/mips/Kconfig, otherwise the bpf old helper bpf_probe_read() will
      not be available.
      
      This is similar with the commit d195b1d1 ("powerpc/bpf: Enable
      bpf_probe_read{, str}() on powerpc again").
      
      Fixes: 0ebeea8c ("bpf: Restrict bpf_probe_read{, str}() only to archs where they work")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      66633abd
  10. 25 Mar, 2021 2 commits