Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'parisc-for-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:
"A bugfix in the LWS code, which used different lock words than the
parisc lightweight spinlock checks. This inconsistency triggered false
positives when the lightweight spinlock checks checked the locks of
mutexes.

The other patches are trivial cleanups and most of them fix sparse
warnings.

Summary:

- Fix LWS code to use same lock words as for the parisc lightweight
spinlocks

- Use PTR_ERR_OR_ZERO() in pdt init code

- Fix lots of sparse warnings"

* tag 'parisc-for-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: perf: Make cpu_device variable static
parisc: ftrace: Add declaration for ftrace_function_trampoline()
parisc: boot: Nuke some sparse warnings in decompressor
parisc: processor: Include asm/smp.h for init_per_cpu()
parisc: unaligned: Include linux/sysctl.h for unaligned_enabled
parisc: Move proc_mckinley_root and proc_runway_root to sba_iommu
parisc: dma: Add prototype for pcxl_dma_start
parisc: parisc_ksyms: Include libgcc.h for libgcc prototypes
parisc: ucmpdi2: Fix no previous prototype for '__ucmpdi2' warning
parisc: firmware: Mark pdc_result buffers local
parisc: firmware: Fix sparse context imbalance warnings
parisc: signal: Fix sparse incorrect type in assignment warning
parisc: ioremap: Fix sparse warnings
parisc: fault: Use C99 arrary initializers
parisc: pdt: Use PTR_ERR_OR_ZERO() to simplify code
parisc: Fix lightweight spinlock checks to not break futexes

+88 -112
+1 -1
arch/parisc/Kconfig.debug
··· 2 2 # 3 3 config LIGHTWEIGHT_SPINLOCK_CHECK 4 4 bool "Enable lightweight spinlock checks" 5 - depends on SMP && !DEBUG_SPINLOCK 5 + depends on DEBUG_KERNEL && SMP && !DEBUG_SPINLOCK 6 6 default y 7 7 help 8 8 Add checks with low performance impact to the spinlock functions
+5 -5
arch/parisc/boot/compressed/misc.c
··· 117 117 return NULL; 118 118 } 119 119 120 - int puts(const char *s) 120 + static int puts(const char *s) 121 121 { 122 122 const char *nuline = s; 123 123 ··· 172 172 return 0; 173 173 } 174 174 175 - int printf(const char *fmt, ...) 175 + static int printf(const char *fmt, ...) 176 176 { 177 177 va_list args; 178 178 int i = 0; ··· 204 204 } 205 205 206 206 #undef malloc 207 - void *malloc(size_t size) 207 + static void *malloc(size_t size) 208 208 { 209 209 return malloc_gzip(size); 210 210 } 211 211 212 212 #undef free 213 - void free(void *ptr) 213 + static void free(void *ptr) 214 214 { 215 215 return free_gzip(ptr); 216 216 } ··· 278 278 free(phdrs); 279 279 } 280 280 281 - unsigned long decompress_kernel(unsigned int started_wide, 281 + asmlinkage unsigned long __visible decompress_kernel(unsigned int started_wide, 282 282 unsigned int command_line, 283 283 const unsigned int rd_start, 284 284 const unsigned int rd_end)
+2
arch/parisc/include/asm/dma.h
··· 14 14 #define dma_outb outb 15 15 #define dma_inb inb 16 16 17 + extern unsigned long pcxl_dma_start; 18 + 17 19 /* 18 20 ** DMA_CHUNK_SIZE is used by the SCSI mid-layer to break up 19 21 ** (or rather not merge) DMAs into manageable chunks.
+4
arch/parisc/include/asm/ftrace.h
··· 12 12 extern unsigned long sys_call_table[]; 13 13 14 14 extern unsigned long return_address(unsigned int); 15 + struct ftrace_regs; 16 + extern void ftrace_function_trampoline(unsigned long parent, 17 + unsigned long self_addr, unsigned long org_sp_gr3, 18 + struct ftrace_regs *fregs); 15 19 16 20 #ifdef CONFIG_DYNAMIC_FTRACE 17 21 extern void ftrace_caller(void);
-2
arch/parisc/include/asm/spinlock.h
··· 7 7 #include <asm/processor.h> 8 8 #include <asm/spinlock_types.h> 9 9 10 - #define SPINLOCK_BREAK_INSN 0x0000c006 /* break 6,6 */ 11 - 12 10 static inline void arch_spin_val_check(int lock_val) 13 11 { 14 12 if (IS_ENABLED(CONFIG_LIGHTWEIGHT_SPINLOCK_CHECK))
+6
arch/parisc/include/asm/spinlock_types.h
··· 4 4 5 5 #define __ARCH_SPIN_LOCK_UNLOCKED_VAL 0x1a46 6 6 7 + #define SPINLOCK_BREAK_INSN 0x0000c006 /* break 6,6 */ 8 + 9 + #ifndef __ASSEMBLY__ 10 + 7 11 typedef struct { 8 12 #ifdef CONFIG_PA20 9 13 volatile unsigned int slock; ··· 30 26 arch_spinlock_t lock_mutex; 31 27 volatile unsigned int counter; 32 28 } arch_rwlock_t; 29 + 30 + #endif /* __ASSEMBLY__ */ 33 31 34 32 #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 35 33 #define __ARCH_RW_LOCK_UNLOCKED { .lock_mutex = __ARCH_SPIN_LOCK_UNLOCKED, \
+4 -4
arch/parisc/kernel/firmware.c
··· 74 74 static DEFINE_SPINLOCK(pdc_lock); 75 75 #endif 76 76 77 - unsigned long pdc_result[NUM_PDC_RESULT] __aligned(8); 78 - unsigned long pdc_result2[NUM_PDC_RESULT] __aligned(8); 77 + static unsigned long pdc_result[NUM_PDC_RESULT] __aligned(8); 78 + static unsigned long pdc_result2[NUM_PDC_RESULT] __aligned(8); 79 79 80 80 #ifdef CONFIG_64BIT 81 81 #define WIDE_FIRMWARE 0x1 ··· 334 334 /** 335 335 * pdc_cpu_rendezvous_lock - Lock PDC while transitioning to rendezvous state 336 336 */ 337 - void pdc_cpu_rendezvous_lock(void) 337 + void pdc_cpu_rendezvous_lock(void) __acquires(&pdc_lock) 338 338 { 339 339 spin_lock(&pdc_lock); 340 340 } ··· 342 342 /** 343 343 * pdc_cpu_rendezvous_unlock - Unlock PDC after reaching rendezvous state 344 344 */ 345 - void pdc_cpu_rendezvous_unlock(void) 345 + void pdc_cpu_rendezvous_unlock(void) __releases(&pdc_lock) 346 346 { 347 347 spin_unlock(&pdc_lock); 348 348 }
+1 -1
arch/parisc/kernel/ftrace.c
··· 53 53 54 54 static ftrace_func_t ftrace_func; 55 55 56 - void notrace __hot ftrace_function_trampoline(unsigned long parent, 56 + asmlinkage void notrace __hot ftrace_function_trampoline(unsigned long parent, 57 57 unsigned long self_addr, 58 58 unsigned long org_sp_gr3, 59 59 struct ftrace_regs *fregs)
+1 -6
arch/parisc/kernel/parisc_ksyms.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/kernel.h> 16 16 #include <linux/syscalls.h> 17 + #include <linux/libgcc.h> 17 18 18 19 #include <linux/string.h> 19 20 EXPORT_SYMBOL(memset); ··· 92 91 EXPORT_SYMBOL($$divI_12); 93 92 EXPORT_SYMBOL($$divI_14); 94 93 EXPORT_SYMBOL($$divI_15); 95 - 96 - extern void __ashrdi3(void); 97 - extern void __ashldi3(void); 98 - extern void __lshrdi3(void); 99 - extern void __muldi3(void); 100 - extern void __ucmpdi2(void); 101 94 102 95 EXPORT_SYMBOL(__ashrdi3); 103 96 EXPORT_SYMBOL(__ashldi3);
+2 -2
arch/parisc/kernel/pci-dma.c
··· 39 39 static unsigned long pcxl_used_bytes __read_mostly; 40 40 static unsigned long pcxl_used_pages __read_mostly; 41 41 42 - extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */ 42 + unsigned long pcxl_dma_start __ro_after_init; /* pcxl dma mapping area start */ 43 43 static DEFINE_SPINLOCK(pcxl_res_lock); 44 44 static char *pcxl_res_map; 45 45 static int pcxl_res_hint; ··· 381 381 pcxl_res_map = (char *)__get_free_pages(GFP_KERNEL, 382 382 get_order(pcxl_res_size)); 383 383 memset(pcxl_res_map, 0, pcxl_res_size); 384 - proc_gsc_root = proc_mkdir("gsc", NULL); 384 + proc_gsc_root = proc_mkdir("bus/gsc", NULL); 385 385 if (!proc_gsc_root) 386 386 printk(KERN_WARNING 387 387 "pcxl_dma_init: Unable to create gsc /proc dir entry\n");
+1 -3
arch/parisc/kernel/pdt.c
··· 354 354 return -ENODEV; 355 355 356 356 kpdtd_task = kthread_run(pdt_mainloop, NULL, "kpdtd"); 357 - if (IS_ERR(kpdtd_task)) 358 - return PTR_ERR(kpdtd_task); 359 357 360 - return 0; 358 + return PTR_ERR_OR_ZERO(kpdtd_task); 361 359 } 362 360 363 361 late_initcall(pdt_initcall);
+1 -1
arch/parisc/kernel/perf.c
··· 57 57 static int perf_processor_interface __read_mostly = UNKNOWN_INTF; 58 58 static int perf_enabled __read_mostly; 59 59 static DEFINE_SPINLOCK(perf_lock); 60 - struct parisc_device *cpu_device __read_mostly; 60 + static struct parisc_device *cpu_device __read_mostly; 61 61 62 62 /* RDRs to write for PCX-W */ 63 63 static const int perf_rdrs_W[] =
+1
arch/parisc/kernel/processor.c
··· 26 26 #include <asm/processor.h> 27 27 #include <asm/page.h> 28 28 #include <asm/pdc.h> 29 + #include <asm/smp.h> 29 30 #include <asm/pdcpat.h> 30 31 #include <asm/irq.h> /* for struct irq_region */ 31 32 #include <asm/parisc-device.h>
-48
arch/parisc/kernel/setup.c
··· 40 40 41 41 static char __initdata command_line[COMMAND_LINE_SIZE]; 42 42 43 - /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ 44 - struct proc_dir_entry * proc_runway_root __read_mostly = NULL; 45 - struct proc_dir_entry * proc_gsc_root __read_mostly = NULL; 46 - struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL; 47 - 48 43 static void __init setup_cmdline(char **cmdline_p) 49 44 { 50 45 extern unsigned int boot_args[]; ··· 191 196 .show = show_cpuinfo 192 197 }; 193 198 194 - static void __init parisc_proc_mkdir(void) 195 - { 196 - /* 197 - ** Can't call proc_mkdir() until after proc_root_init() has been 198 - ** called by start_kernel(). In other words, this code can't 199 - ** live in arch/.../setup.c because start_parisc() calls 200 - ** start_kernel(). 201 - */ 202 - switch (boot_cpu_data.cpu_type) { 203 - case pcxl: 204 - case pcxl2: 205 - if (NULL == proc_gsc_root) 206 - { 207 - proc_gsc_root = proc_mkdir("bus/gsc", NULL); 208 - } 209 - break; 210 - case pcxt_: 211 - case pcxu: 212 - case pcxu_: 213 - case pcxw: 214 - case pcxw_: 215 - case pcxw2: 216 - if (NULL == proc_runway_root) 217 - { 218 - proc_runway_root = proc_mkdir("bus/runway", NULL); 219 - } 220 - break; 221 - case mako: 222 - case mako2: 223 - if (NULL == proc_mckinley_root) 224 - { 225 - proc_mckinley_root = proc_mkdir("bus/mckinley", NULL); 226 - } 227 - break; 228 - default: 229 - /* FIXME: this was added to prevent the compiler 230 - * complaining about missing pcx, pcxs and pcxt 231 - * I'm assuming they have neither gsc nor runway */ 232 - break; 233 - } 234 - } 235 - 236 199 static struct resource central_bus = { 237 200 .name = "Central Bus", 238 201 .start = F_EXTEND(0xfff80000), ··· 247 294 { 248 295 u32 osid = (OS_ID_LINUX << 16); 249 296 250 - parisc_proc_mkdir(); 251 297 parisc_init_resources(); 252 298 do_device_inventory(); /* probe for hardware */ 253 299
+1 -1
arch/parisc/kernel/signal.c
··· 423 423 regs->gr[31] -= 8; /* delayed branching */ 424 424 425 425 /* Get assembler opcode of code in delay branch */ 426 - uaddr = (unsigned int *) ((regs->gr[31] & ~3) + 4); 426 + uaddr = (u32 __user *) ((regs->gr[31] & ~3) + 4); 427 427 err = get_user(opcode, uaddr); 428 428 if (err) 429 429 return;
+20 -3
arch/parisc/kernel/syscall.S
··· 39 39 #include <asm/assembly.h> 40 40 #include <asm/processor.h> 41 41 #include <asm/cache.h> 42 + #include <asm/spinlock_types.h> 42 43 43 44 #include <linux/linkage.h> 44 45 ··· 65 64 ldw 0(%sr2,\reg2), \reg1 66 65 ldo -1(\reg1), \reg1 67 66 stw \reg1, 0(%sr2,\reg2) 67 + .endm 68 + 69 + /* raise exception if spinlock content is not zero or 70 + * __ARCH_SPIN_LOCK_UNLOCKED_VAL */ 71 + .macro spinlock_check spin_val,tmpreg 72 + #ifdef CONFIG_LIGHTWEIGHT_SPINLOCK_CHECK 73 + ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, \tmpreg 74 + andcm,= \spin_val, \tmpreg, %r0 75 + .word SPINLOCK_BREAK_INSN 76 + #endif 68 77 .endm 69 78 70 79 .text ··· 519 508 520 509 lws_exit_noerror: 521 510 lws_pagefault_enable %r1,%r21 522 - stw,ma %r20, 0(%sr2,%r20) 511 + ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, %r21 512 + stw,ma %r21, 0(%sr2,%r20) 523 513 ssm PSW_SM_I, %r0 524 514 b lws_exit 525 515 copy %r0, %r21 ··· 533 521 534 522 lws_pagefault: 535 523 lws_pagefault_enable %r1,%r21 536 - stw,ma %r20, 0(%sr2,%r20) 524 + ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, %r21 525 + stw,ma %r21, 0(%sr2,%r20) 537 526 ssm PSW_SM_I, %r0 538 527 ldo 3(%r0),%r28 539 528 b lws_exit ··· 632 619 633 620 /* Try to acquire the lock */ 634 621 LDCW 0(%sr2,%r20), %r28 622 + spinlock_check %r28, %r21 635 623 comclr,<> %r0, %r28, %r0 636 624 b,n lws_wouldblock 637 625 ··· 786 772 787 773 /* Try to acquire the lock */ 788 774 LDCW 0(%sr2,%r20), %r28 775 + spinlock_check %r28, %r21 789 776 comclr,<> %r0, %r28, %r0 790 777 b,n lws_wouldblock 791 778 ··· 1016 1001 1017 1002 /* Try to acquire the lock */ 1018 1003 LDCW 0(%sr2,%r20), %r28 1004 + spinlock_check %r28, %r21 1019 1005 comclr,<> %r0, %r28, %r0 1020 1006 b,n lws_wouldblock 1021 1007 ··· 1215 1199 1216 1200 /* Try to acquire the lock */ 1217 1201 LDCW 0(%sr2,%r20), %r28 1202 + spinlock_check %r28, %r21 1218 1203 comclr,<> %r0, %r28, %r0 1219 1204 b,n lws_wouldblock 1220 1205 ··· 1347 1330 /* lws locks */ 1348 1331 .rept 256 1349 1332 /* Keep locks aligned at 16-bytes */ 1350 - .word 1 1333 + .word __ARCH_SPIN_LOCK_UNLOCKED_VAL 1351 1334 .word 0 1352 1335 .word 0 1353 1336 .word 0
+1
arch/parisc/kernel/unaligned.c
··· 11 11 #include <linux/signal.h> 12 12 #include <linux/ratelimit.h> 13 13 #include <linux/uaccess.h> 14 + #include <linux/sysctl.h> 14 15 #include <asm/unaligned.h> 15 16 #include <asm/hardirq.h> 16 17 #include <asm/traps.h>
+2 -1
arch/parisc/lib/ucmpdi2.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <linux/module.h> 3 + #include <linux/libgcc.h> 3 4 4 5 union ull_union { 5 6 unsigned long long ull; ··· 10 9 } ui; 11 10 }; 12 11 13 - int __ucmpdi2(unsigned long long a, unsigned long long b) 12 + word_type __ucmpdi2(unsigned long long a, unsigned long long b) 14 13 { 15 14 union ull_union au = {.ull = a}; 16 15 union ull_union bu = {.ull = b};
+25 -25
arch/parisc/mm/fault.c
··· 192 192 * For implementation see handle_interruption() in traps.c 193 193 */ 194 194 static const char * const trap_description[] = { 195 - [1] "High-priority machine check (HPMC)", 196 - [2] "Power failure interrupt", 197 - [3] "Recovery counter trap", 198 - [5] "Low-priority machine check", 199 - [6] "Instruction TLB miss fault", 200 - [7] "Instruction access rights / protection trap", 201 - [8] "Illegal instruction trap", 202 - [9] "Break instruction trap", 203 - [10] "Privileged operation trap", 204 - [11] "Privileged register trap", 205 - [12] "Overflow trap", 206 - [13] "Conditional trap", 207 - [14] "FP Assist Exception trap", 208 - [15] "Data TLB miss fault", 209 - [16] "Non-access ITLB miss fault", 210 - [17] "Non-access DTLB miss fault", 211 - [18] "Data memory protection/unaligned access trap", 212 - [19] "Data memory break trap", 213 - [20] "TLB dirty bit trap", 214 - [21] "Page reference trap", 215 - [22] "Assist emulation trap", 216 - [25] "Taken branch trap", 217 - [26] "Data memory access rights trap", 218 - [27] "Data memory protection ID trap", 219 - [28] "Unaligned data reference trap", 195 + [1] = "High-priority machine check (HPMC)", 196 + [2] = "Power failure interrupt", 197 + [3] = "Recovery counter trap", 198 + [5] = "Low-priority machine check", 199 + [6] = "Instruction TLB miss fault", 200 + [7] = "Instruction access rights / protection trap", 201 + [8] = "Illegal instruction trap", 202 + [9] = "Break instruction trap", 203 + [10] = "Privileged operation trap", 204 + [11] = "Privileged register trap", 205 + [12] = "Overflow trap", 206 + [13] = "Conditional trap", 207 + [14] = "FP Assist Exception trap", 208 + [15] = "Data TLB miss fault", 209 + [16] = "Non-access ITLB miss fault", 210 + [17] = "Non-access DTLB miss fault", 211 + [18] = "Data memory protection/unaligned access trap", 212 + [19] = "Data memory break trap", 213 + [20] = "TLB dirty bit trap", 214 + [21] = "Page reference trap", 215 + [22] = "Assist emulation trap", 216 + [25] = "Taken branch trap", 217 + [26] = "Data memory access rights trap", 218 + [27] = "Data memory protection ID trap", 219 + [28] = "Unaligned data reference trap", 220 220 }; 221 221 222 222 const char *trap_name(unsigned long code)
-4
arch/parisc/mm/init.c
··· 523 523 void *parisc_vmalloc_start __ro_after_init; 524 524 EXPORT_SYMBOL(parisc_vmalloc_start); 525 525 526 - #ifdef CONFIG_PA11 527 - unsigned long pcxl_dma_start __ro_after_init; 528 - #endif 529 - 530 526 void __init mem_init(void) 531 527 { 532 528 /* Do sanity checks on IPC (compat) structures */
+4 -5
arch/parisc/mm/ioremap.c
··· 27 27 */ 28 28 void __iomem *ioremap(unsigned long phys_addr, unsigned long size) 29 29 { 30 - void __iomem *addr; 30 + uintptr_t addr; 31 31 struct vm_struct *area; 32 32 unsigned long offset, last_addr; 33 33 pgprot_t pgprot; ··· 79 79 if (!area) 80 80 return NULL; 81 81 82 - addr = (void __iomem *) area->addr; 83 - if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, 84 - phys_addr, pgprot)) { 85 - vunmap(addr); 82 + addr = (uintptr_t) area->addr; 83 + if (ioremap_page_range(addr, addr + size, phys_addr, pgprot)) { 84 + vunmap(area->addr); 86 85 return NULL; 87 86 } 88 87
+6
drivers/parisc/sba_iommu.c
··· 121 121 MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); 122 122 #endif 123 123 124 + struct proc_dir_entry *proc_runway_root __ro_after_init; 125 + struct proc_dir_entry *proc_mckinley_root __ro_after_init; 124 126 125 127 /************************************ 126 128 ** SBA register read and write support ··· 1970 1968 #ifdef CONFIG_PROC_FS 1971 1969 switch (dev->id.hversion) { 1972 1970 case PLUTO_MCKINLEY_PORT: 1971 + if (!proc_mckinley_root) 1972 + proc_mckinley_root = proc_mkdir("bus/mckinley", NULL); 1973 1973 root = proc_mckinley_root; 1974 1974 break; 1975 1975 case ASTRO_RUNWAY_PORT: 1976 1976 case IKE_MERCED_PORT: 1977 1977 default: 1978 + if (!proc_runway_root) 1979 + proc_runway_root = proc_mkdir("bus/runway", NULL); 1978 1980 root = proc_runway_root; 1979 1981 break; 1980 1982 }