1. 19 Apr, 2023 4 commits
  2. 18 Apr, 2023 7 commits
    • Huacai Chen's avatar
      LoongArch: module: set section addresses to 0x0 · 93eb1215
      Huacai Chen authored
      These got*, plt* and .text.ftrace_trampoline sections specified for
      LoongArch have non-zero addressses. Non-zero section addresses in a
      relocatable ELF would confuse GDB when it tries to compute the section
      offsets and it ends up printing wrong symbol addresses. Therefore, set
      them to zero, which mirrors the change in commit 5d8591bc
      ("arm64 module: set plt* section addresses to 0x0").
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarGuo Ren <guoren@kernel.org>
      Signed-off-by: default avatarChong Qiao <qiaochong@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      93eb1215
    • Huacai Chen's avatar
      LoongArch: Mark 3 symbol exports as non-GPL · dce5ea1d
      Huacai Chen authored
      vm_map_base, empty_zero_page and invalid_pmd_table could be accessed
      widely by some out-of-tree non-GPL but important file systems or drivers
      (e.g. OpenZFS). Let's use EXPORT_SYMBOL() instead of EXPORT_SYMBOL_GPL()
      to export them, so as to avoid build errors.
      
      1, Details about vm_map_base:
      
      This is a LoongArch-specific symbol and may be referenced through macros
      PCI_IOBASE, VMALLOC_START and VMALLOC_END.
      
      2, Details about empty_zero_page:
      
      As it stands today, only 3 architectures export empty_zero_page as a GPL
      symbol: IA64, LoongArch and MIPS. LoongArch gets the GPL export by
      inheriting from MIPS, and the MIPS export was first introduced in commit
      497d2adc ("[MIPS] Export empty_zero_page for sake of the ext4
      module."). The IA64 export was similar: commit a7d57ecf ("[IA64]
      Export three symbols for module use") did so for kvm.
      
      In both IA64 and MIPS, the export of empty_zero_page was done for
      satisfying some in-kernel component built as module (kvm and ext4
      respectively), and given its reasonably low-level nature, GPL is a
      reasonable choice. But looking at the bigger picture it is evident most
      other architectures do not regard it as GPL, so in effect the symbol
      probably should not be treated as such, in favor of consistency.
      
      3, Details about invalid_pmd_table:
      
      Keep consistency with invalid_pte_table and make it be possible by some
      modules.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      dce5ea1d
    • Huacai Chen's avatar
      LoongArch: Enable PG when wakeup from suspend · 1c1378a4
      Huacai Chen authored
      Some firmwares don't enable PG when wakeup from suspend, so do it in
      kernel. This can improve code compatibility for boot kernel.
      Signed-off-by: default avatarBaoqi Zhang <zhangbaoqi@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      1c1378a4
    • Qing Zhang's avatar
      LoongArch: Fix _CONST64_(x) as unsigned · 6637775c
      Qing Zhang authored
      Addresses should all be of unsigned type to avoid unnecessary conversions.
      Signed-off-by: default avatarQing Zhang <zhangqing@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      6637775c
    • Huacai Chen's avatar
      LoongArch: Fix build error if CONFIG_SUSPEND is not set · 1cf62488
      Huacai Chen authored
      We can see the following build error on LoongArch if CONFIG_SUSPEND is
      not set:
      
        ld: drivers/acpi/sleep.o: in function 'acpi_pm_prepare':
        sleep.c:(.text+0x2b8): undefined reference to 'loongarch_wakeup_start'
      
      Here is the call trace:
      
        acpi_pm_prepare()
          __acpi_pm_prepare()
            acpi_sleep_prepare()
              acpi_get_wakeup_address()
                loongarch_wakeup_start()
      
      Root cause: loongarch_wakeup_start() is defined in arch/loongarch/power/
      suspend_asm.S which is only built under CONFIG_SUSPEND. In order to fix
      the build error, just let acpi_get_wakeup_address() return 0 if CONFIG_
      SUSPEND is not set.
      
      Fixes: 366bb35a ("LoongArch: Add suspend (ACPI S3) support")
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Link: https://lore.kernel.org/all/11215033-fa3c-ecb1-2fc0-e9aeba47be9b@infradead.org/Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      1cf62488
    • Huacai Chen's avatar
      LoongArch: Fix probing of the CRC32 feature · df830336
      Huacai Chen authored
      Not all LoongArch processors support CRC32 instructions. This feature
      is indicated by CPUCFG1.CRC32 (Bit25) but it is wrongly defined in the
      previous versions of the ISA manual (and so does in loongarch.h). The
      CRC32 feature is set unconditionally now, so fix it.
      
      BTW, expose the CRC32 feature in /proc/cpuinfo.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      df830336
    • Huacai Chen's avatar
      LoongArch: Make WriteCombine configurable for ioremap() · 16c52e50
      Huacai Chen authored
      LoongArch maintains cache coherency in hardware, but when paired with
      LS7A chipsets the WUC attribute (Weak-ordered UnCached, which is similar
      to WriteCombine) is out of the scope of cache coherency machanism for
      PCIe devices (this is a PCIe protocol violation, which may be fixed in
      newer chipsets).
      
      This means WUC can only used for write-only memory regions now, so this
      option is disabled by default, making WUC silently fallback to SUC for
      ioremap(). You can enable this option if the kernel is ensured to run on
      hardware without this bug.
      
      Kernel parameter writecombine=on/off can be used to override the Kconfig
      option.
      
      Cc: stable@vger.kernel.org
      Suggested-by: default avatarWANG Xuerui <kernel@xen0n.name>
      Reviewed-by: default avatarWANG Xuerui <kernel@xen0n.name>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      16c52e50
  3. 16 Apr, 2023 12 commits
  4. 15 Apr, 2023 6 commits
  5. 14 Apr, 2023 11 commits