Skip to content

Commit 40aacb3

Browse files
committed
Merge tag 'loongarch-fixes-6.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen: "Some bug fixes, some build fixes, a comment fix and a trivial cleanup" * tag 'loongarch-fixes-6.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: tools/loongarch: Use __SIZEOF_LONG__ to define __BITS_PER_LONG LoongArch: Replace hard-coded values in comments with VALEN LoongArch: Clean up plat_swiotlb_setup() related code LoongArch: Check unwind_error() in arch_stack_walk() LoongArch: Adjust user_regset_copyin parameter to the correct offset LoongArch: Adjust user_watch_state for explicit alignment LoongArch: module: set section addresses to 0x0 LoongArch: Mark 3 symbol exports as non-GPL LoongArch: Enable PG when wakeup from suspend LoongArch: Fix _CONST64_(x) as unsigned LoongArch: Fix build error if CONFIG_SUSPEND is not set LoongArch: Fix probing of the CRC32 feature LoongArch: Make WriteCombine configurable for ioremap()
2 parents af67688 + b5533e9 commit 40aacb3

File tree

22 files changed

+121
-49
lines changed

22 files changed

+121
-49
lines changed

Documentation/admin-guide/kernel-parameters.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ parameter is applicable::
128128
KVM Kernel Virtual Machine support is enabled.
129129
LIBATA Libata driver is enabled
130130
LP Printer support is enabled.
131+
LOONGARCH LoongArch architecture is enabled.
131132
LOOP Loopback device support is enabled.
132133
M68k M68k architecture is enabled.
133134
These options have more detailed description inside of

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6933,6 +6933,12 @@
69336933
When enabled, memory and cache locality will be
69346934
impacted.
69356935

6936+
writecombine= [LOONGARCH] Control the MAT (Memory Access Type) of
6937+
ioremap_wc().
6938+
6939+
on - Enable writecombine, use WUC for ioremap_wc()
6940+
off - Disable writecombine, use SUC for ioremap_wc()
6941+
69366942
x2apic_phys [X86-64,APIC] Use x2apic physical mode instead of
69376943
default x2apic cluster mode on platforms
69386944
supporting x2apic.

arch/loongarch/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,22 @@ config ARCH_IOREMAP
447447
protection support. However, you can enable LoongArch DMW-based
448448
ioremap() for better performance.
449449

450+
config ARCH_WRITECOMBINE
451+
bool "Enable WriteCombine (WUC) for ioremap()"
452+
help
453+
LoongArch maintains cache coherency in hardware, but when paired
454+
with LS7A chipsets the WUC attribute (Weak-ordered UnCached, which
455+
is similar to WriteCombine) is out of the scope of cache coherency
456+
machanism for PCIe devices (this is a PCIe protocol violation, which
457+
may be fixed in newer chipsets).
458+
459+
This means WUC can only used for write-only memory regions now, so
460+
this option is disabled by default, making WUC silently fallback to
461+
SUC for ioremap(). You can enable this option if the kernel is ensured
462+
to run on hardware without this bug.
463+
464+
You can override this setting via writecombine=on/off boot parameter.
465+
450466
config ARCH_STRICT_ALIGN
451467
bool "Enable -mstrict-align to prevent unaligned accesses" if EXPERT
452468
default y

arch/loongarch/include/asm/acpi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ extern void loongarch_suspend_enter(void);
4141

4242
static inline unsigned long acpi_get_wakeup_address(void)
4343
{
44+
#ifdef CONFIG_SUSPEND
4445
extern void loongarch_wakeup_start(void);
4546
return (unsigned long)loongarch_wakeup_start;
47+
#endif
48+
return 0UL;
4649
}
4750

4851
#endif /* _ASM_LOONGARCH_ACPI_H */

arch/loongarch/include/asm/addrspace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ extern unsigned long vm_map_base;
7171
#define _ATYPE32_ int
7272
#define _ATYPE64_ __s64
7373
#ifdef CONFIG_64BIT
74-
#define _CONST64_(x) x ## L
74+
#define _CONST64_(x) x ## UL
7575
#else
76-
#define _CONST64_(x) x ## LL
76+
#define _CONST64_(x) x ## ULL
7777
#endif
7878
#endif
7979

arch/loongarch/include/asm/bootinfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const char *get_system_type(void);
1313
extern void init_environ(void);
1414
extern void memblock_init(void);
1515
extern void platform_init(void);
16-
extern void plat_swiotlb_setup(void);
1716
extern int __init init_numa_memory(void);
1817

1918
struct loongson_board_info {

arch/loongarch/include/asm/cpu-features.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#define cpu_has_fpu cpu_opt(LOONGARCH_CPU_FPU)
4343
#define cpu_has_lsx cpu_opt(LOONGARCH_CPU_LSX)
4444
#define cpu_has_lasx cpu_opt(LOONGARCH_CPU_LASX)
45+
#define cpu_has_crc32 cpu_opt(LOONGARCH_CPU_CRC32)
4546
#define cpu_has_complex cpu_opt(LOONGARCH_CPU_COMPLEX)
4647
#define cpu_has_crypto cpu_opt(LOONGARCH_CPU_CRYPTO)
4748
#define cpu_has_lvz cpu_opt(LOONGARCH_CPU_LVZ)

arch/loongarch/include/asm/cpu.h

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,32 +78,34 @@ enum cpu_type_enum {
7878
#define CPU_FEATURE_FPU 3 /* CPU has FPU */
7979
#define CPU_FEATURE_LSX 4 /* CPU has LSX (128-bit SIMD) */
8080
#define CPU_FEATURE_LASX 5 /* CPU has LASX (256-bit SIMD) */
81-
#define CPU_FEATURE_COMPLEX 6 /* CPU has Complex instructions */
82-
#define CPU_FEATURE_CRYPTO 7 /* CPU has Crypto instructions */
83-
#define CPU_FEATURE_LVZ 8 /* CPU has Virtualization extension */
84-
#define CPU_FEATURE_LBT_X86 9 /* CPU has X86 Binary Translation */
85-
#define CPU_FEATURE_LBT_ARM 10 /* CPU has ARM Binary Translation */
86-
#define CPU_FEATURE_LBT_MIPS 11 /* CPU has MIPS Binary Translation */
87-
#define CPU_FEATURE_TLB 12 /* CPU has TLB */
88-
#define CPU_FEATURE_CSR 13 /* CPU has CSR */
89-
#define CPU_FEATURE_WATCH 14 /* CPU has watchpoint registers */
90-
#define CPU_FEATURE_VINT 15 /* CPU has vectored interrupts */
91-
#define CPU_FEATURE_CSRIPI 16 /* CPU has CSR-IPI */
92-
#define CPU_FEATURE_EXTIOI 17 /* CPU has EXT-IOI */
93-
#define CPU_FEATURE_PREFETCH 18 /* CPU has prefetch instructions */
94-
#define CPU_FEATURE_PMP 19 /* CPU has perfermance counter */
95-
#define CPU_FEATURE_SCALEFREQ 20 /* CPU supports cpufreq scaling */
96-
#define CPU_FEATURE_FLATMODE 21 /* CPU has flat mode */
97-
#define CPU_FEATURE_EIODECODE 22 /* CPU has EXTIOI interrupt pin decode mode */
98-
#define CPU_FEATURE_GUESTID 23 /* CPU has GuestID feature */
99-
#define CPU_FEATURE_HYPERVISOR 24 /* CPU has hypervisor (running in VM) */
81+
#define CPU_FEATURE_CRC32 6 /* CPU has CRC32 instructions */
82+
#define CPU_FEATURE_COMPLEX 7 /* CPU has Complex instructions */
83+
#define CPU_FEATURE_CRYPTO 8 /* CPU has Crypto instructions */
84+
#define CPU_FEATURE_LVZ 9 /* CPU has Virtualization extension */
85+
#define CPU_FEATURE_LBT_X86 10 /* CPU has X86 Binary Translation */
86+
#define CPU_FEATURE_LBT_ARM 11 /* CPU has ARM Binary Translation */
87+
#define CPU_FEATURE_LBT_MIPS 12 /* CPU has MIPS Binary Translation */
88+
#define CPU_FEATURE_TLB 13 /* CPU has TLB */
89+
#define CPU_FEATURE_CSR 14 /* CPU has CSR */
90+
#define CPU_FEATURE_WATCH 15 /* CPU has watchpoint registers */
91+
#define CPU_FEATURE_VINT 16 /* CPU has vectored interrupts */
92+
#define CPU_FEATURE_CSRIPI 17 /* CPU has CSR-IPI */
93+
#define CPU_FEATURE_EXTIOI 18 /* CPU has EXT-IOI */
94+
#define CPU_FEATURE_PREFETCH 19 /* CPU has prefetch instructions */
95+
#define CPU_FEATURE_PMP 20 /* CPU has perfermance counter */
96+
#define CPU_FEATURE_SCALEFREQ 21 /* CPU supports cpufreq scaling */
97+
#define CPU_FEATURE_FLATMODE 22 /* CPU has flat mode */
98+
#define CPU_FEATURE_EIODECODE 23 /* CPU has EXTIOI interrupt pin decode mode */
99+
#define CPU_FEATURE_GUESTID 24 /* CPU has GuestID feature */
100+
#define CPU_FEATURE_HYPERVISOR 25 /* CPU has hypervisor (running in VM) */
100101

101102
#define LOONGARCH_CPU_CPUCFG BIT_ULL(CPU_FEATURE_CPUCFG)
102103
#define LOONGARCH_CPU_LAM BIT_ULL(CPU_FEATURE_LAM)
103104
#define LOONGARCH_CPU_UAL BIT_ULL(CPU_FEATURE_UAL)
104105
#define LOONGARCH_CPU_FPU BIT_ULL(CPU_FEATURE_FPU)
105106
#define LOONGARCH_CPU_LSX BIT_ULL(CPU_FEATURE_LSX)
106107
#define LOONGARCH_CPU_LASX BIT_ULL(CPU_FEATURE_LASX)
108+
#define LOONGARCH_CPU_CRC32 BIT_ULL(CPU_FEATURE_CRC32)
107109
#define LOONGARCH_CPU_COMPLEX BIT_ULL(CPU_FEATURE_COMPLEX)
108110
#define LOONGARCH_CPU_CRYPTO BIT_ULL(CPU_FEATURE_CRYPTO)
109111
#define LOONGARCH_CPU_LVZ BIT_ULL(CPU_FEATURE_LVZ)

arch/loongarch/include/asm/io.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
5454
* @offset: bus address of the memory
5555
* @size: size of the resource to map
5656
*/
57+
extern pgprot_t pgprot_wc;
58+
5759
#define ioremap_wc(offset, size) \
58-
ioremap_prot((offset), (size), pgprot_val(PAGE_KERNEL_WUC))
60+
ioremap_prot((offset), (size), pgprot_val(pgprot_wc))
5961

6062
#define ioremap_cache(offset, size) \
6163
ioremap_prot((offset), (size), pgprot_val(PAGE_KERNEL))

arch/loongarch/include/asm/loongarch.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static inline u32 read_cpucfg(u32 reg)
117117
#define CPUCFG1_EP BIT(22)
118118
#define CPUCFG1_RPLV BIT(23)
119119
#define CPUCFG1_HUGEPG BIT(24)
120-
#define CPUCFG1_IOCSRBRD BIT(25)
120+
#define CPUCFG1_CRC32 BIT(25)
121121
#define CPUCFG1_MSGINT BIT(26)
122122

123123
#define LOONGARCH_CPUCFG2 0x2
@@ -423,9 +423,9 @@ static __always_inline void iocsr_write64(u64 val, u32 reg)
423423
#define CSR_ASID_ASID_WIDTH 10
424424
#define CSR_ASID_ASID (_ULCAST_(0x3ff) << CSR_ASID_ASID_SHIFT)
425425

426-
#define LOONGARCH_CSR_PGDL 0x19 /* Page table base address when VA[47] = 0 */
426+
#define LOONGARCH_CSR_PGDL 0x19 /* Page table base address when VA[VALEN-1] = 0 */
427427

428-
#define LOONGARCH_CSR_PGDH 0x1a /* Page table base address when VA[47] = 1 */
428+
#define LOONGARCH_CSR_PGDH 0x1a /* Page table base address when VA[VALEN-1] = 1 */
429429

430430
#define LOONGARCH_CSR_PGD 0x1b /* Page table base */
431431

0 commit comments

Comments
 (0)