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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'parisc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull more parisc updates from Helge Deller:

- During this merge window O_NONBLOCK was changed to become 000200000,
but we missed that the syscalls timerfd_create(), signalfd4(),
eventfd2(), pipe2(), inotify_init1() and userfaultfd() do a strict
bit-wise check of the flags parameter.

To provide backward compatibility with existing userspace we
introduce parisc specific wrappers for those syscalls which filter
out the old O_NONBLOCK value and replaces it with the new one.

- Prevent HIL bus driver to get stuck when keyboard or mouse isn't
attached

- Improve error return codes when setting rtc time

- Minor documentation fix in pata_ns87415.c

* 'parisc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
ata: pata_ns87415.c: Document support on parisc with superio chip
parisc: Add wrapper syscalls to fix O_NONBLOCK flag usage
hil/parisc: Disable HIL driver when it gets stuck
parisc: Improve error return codes when setting rtc time

+110 -18
+72 -1
arch/parisc/kernel/sys_parisc.c
··· 6 6 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org> 7 7 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org> 8 8 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 9 - * Copyright (C) 1999-2014 Helge Deller <deller@gmx.de> 9 + * Copyright (C) 1999-2020 Helge Deller <deller@gmx.de> 10 10 */ 11 11 12 12 #include <linux/uaccess.h> ··· 23 23 #include <linux/utsname.h> 24 24 #include <linux/personality.h> 25 25 #include <linux/random.h> 26 + #include <linux/compat.h> 26 27 27 28 /* we construct an artificial offset for the mapping based on the physical 28 29 * address of the kernel mapping variable */ ··· 373 372 err = (err & ~PER_MASK) | PER_LINUX; 374 373 375 374 return err; 375 + } 376 + 377 + /* 378 + * Up to kernel v5.9 we defined O_NONBLOCK as 000200004, 379 + * since then O_NONBLOCK is defined as 000200000. 380 + * 381 + * The following wrapper functions mask out the old 382 + * O_NDELAY bit from calls which use O_NONBLOCK. 383 + * 384 + * XXX: Remove those in year 2022 (or later)? 385 + */ 386 + 387 + #define O_NONBLOCK_OLD 000200004 388 + #define O_NONBLOCK_MASK_OUT (O_NONBLOCK_OLD & ~O_NONBLOCK) 389 + 390 + static int FIX_O_NONBLOCK(int flags) 391 + { 392 + if (flags & O_NONBLOCK_MASK_OUT) { 393 + struct task_struct *tsk = current; 394 + pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n", 395 + tsk->comm, tsk->pid); 396 + } 397 + return flags & ~O_NONBLOCK_MASK_OUT; 398 + } 399 + 400 + asmlinkage long parisc_timerfd_create(int clockid, int flags) 401 + { 402 + flags = FIX_O_NONBLOCK(flags); 403 + return sys_timerfd_create(clockid, flags); 404 + } 405 + 406 + asmlinkage long parisc_signalfd4(int ufd, sigset_t __user *user_mask, 407 + size_t sizemask, int flags) 408 + { 409 + flags = FIX_O_NONBLOCK(flags); 410 + return sys_signalfd4(ufd, user_mask, sizemask, flags); 411 + } 412 + 413 + #ifdef CONFIG_COMPAT 414 + asmlinkage long parisc_compat_signalfd4(int ufd, 415 + compat_sigset_t __user *user_mask, 416 + compat_size_t sizemask, int flags) 417 + { 418 + flags = FIX_O_NONBLOCK(flags); 419 + return compat_sys_signalfd4(ufd, user_mask, sizemask, flags); 420 + } 421 + #endif 422 + 423 + asmlinkage long parisc_eventfd2(unsigned int count, int flags) 424 + { 425 + flags = FIX_O_NONBLOCK(flags); 426 + return sys_eventfd2(count, flags); 427 + } 428 + 429 + asmlinkage long parisc_userfaultfd(int flags) 430 + { 431 + flags = FIX_O_NONBLOCK(flags); 432 + return sys_userfaultfd(flags); 433 + } 434 + 435 + asmlinkage long parisc_pipe2(int __user *fildes, int flags) 436 + { 437 + flags = FIX_O_NONBLOCK(flags); 438 + return sys_pipe2(fildes, flags); 439 + } 440 + 441 + asmlinkage long parisc_inotify_init1(int flags) 442 + { 443 + flags = FIX_O_NONBLOCK(flags); 444 + return sys_inotify_init1(flags); 376 445 }
+6 -6
arch/parisc/kernel/syscalls/syscall.tbl
··· 344 344 304 common eventfd sys_eventfd 345 345 305 32 fallocate parisc_fallocate 346 346 305 64 fallocate sys_fallocate 347 - 306 common timerfd_create sys_timerfd_create 347 + 306 common timerfd_create parisc_timerfd_create 348 348 307 32 timerfd_settime sys_timerfd_settime32 349 349 307 64 timerfd_settime sys_timerfd_settime 350 350 308 32 timerfd_gettime sys_timerfd_gettime32 351 351 308 64 timerfd_gettime sys_timerfd_gettime 352 - 309 common signalfd4 sys_signalfd4 compat_sys_signalfd4 353 - 310 common eventfd2 sys_eventfd2 352 + 309 common signalfd4 parisc_signalfd4 parisc_compat_signalfd4 353 + 310 common eventfd2 parisc_eventfd2 354 354 311 common epoll_create1 sys_epoll_create1 355 355 312 common dup3 sys_dup3 356 - 313 common pipe2 sys_pipe2 357 - 314 common inotify_init1 sys_inotify_init1 356 + 313 common pipe2 parisc_pipe2 357 + 314 common inotify_init1 parisc_inotify_init1 358 358 315 common preadv sys_preadv compat_sys_preadv 359 359 316 common pwritev sys_pwritev compat_sys_pwritev 360 360 317 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo ··· 387 387 341 common bpf sys_bpf 388 388 342 common execveat sys_execveat compat_sys_execveat 389 389 343 common membarrier sys_membarrier 390 - 344 common userfaultfd sys_userfaultfd 390 + 344 common userfaultfd parisc_userfaultfd 391 391 345 common mlock2 sys_mlock2 392 392 346 common copy_file_range sys_copy_file_range 393 393 347 common preadv2 sys_preadv2 compat_sys_preadv2
+8 -1
arch/parisc/kernel/time.c
··· 180 180 static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) 181 181 { 182 182 time64_t secs = rtc_tm_to_time64(tm); 183 + int ret; 183 184 184 - if (pdc_tod_set(secs, 0) < 0) 185 + /* hppa has Y2K38 problem: pdc_tod_set() takes an u32 value! */ 186 + ret = pdc_tod_set(secs, 0); 187 + if (ret != 0) { 188 + pr_warn("pdc_tod_set(%lld) returned error %d\n", secs, ret); 189 + if (ret == PDC_INVALID_ARG) 190 + return -EINVAL; 185 191 return -EOPNOTSUPP; 192 + } 186 193 187 194 return 0; 188 195 }
+1 -2
drivers/ata/pata_ns87415.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * pata_ns87415.c - NS87415 (non PARISC) PATA 3 + * pata_ns87415.c - NS87415 (and PARISC SUPERIO 87560) PATA 4 4 * 5 5 * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk> 6 6 * ··· 16 16 * systems. This has its own special mountain of errata. 17 17 * 18 18 * TODO: 19 - * Test PARISC SuperIO 20 19 * Get someone to test on SPARC 21 20 * Implement lazy pio/dma switching for better performance 22 21 * 8bit shared timing.
+18 -3
drivers/input/serio/hil_mlc.c
··· 74 74 static LIST_HEAD(hil_mlcs); 75 75 static DEFINE_RWLOCK(hil_mlcs_lock); 76 76 static struct timer_list hil_mlcs_kicker; 77 - static int hil_mlcs_probe; 77 + static int hil_mlcs_probe, hil_mlc_stop; 78 78 79 79 static void hil_mlcs_process(unsigned long unused); 80 80 static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process); ··· 702 702 if (!mlc->ostarted) { 703 703 mlc->ostarted = 1; 704 704 mlc->opacket = pack; 705 - mlc->out(mlc); 705 + rc = mlc->out(mlc); 706 706 nextidx = HILSEN_DOZE; 707 707 write_unlock_irqrestore(&mlc->lock, flags); 708 + if (rc) { 709 + hil_mlc_stop = 1; 710 + return 1; 711 + } 708 712 break; 709 713 } 710 714 mlc->ostarted = 0; ··· 719 715 720 716 case HILSE_CTS: 721 717 write_lock_irqsave(&mlc->lock, flags); 722 - nextidx = mlc->cts(mlc) ? node->bad : node->good; 718 + rc = mlc->cts(mlc); 719 + nextidx = rc ? node->bad : node->good; 723 720 write_unlock_irqrestore(&mlc->lock, flags); 721 + if (rc) { 722 + hil_mlc_stop = 1; 723 + return 1; 724 + } 724 725 break; 725 726 726 727 default: ··· 789 780 790 781 static void hil_mlcs_timer(struct timer_list *unused) 791 782 { 783 + if (hil_mlc_stop) { 784 + /* could not send packet - stop immediately. */ 785 + pr_warn(PREFIX "HIL seems stuck - Disabling HIL MLC.\n"); 786 + return; 787 + } 788 + 792 789 hil_mlcs_probe = 1; 793 790 tasklet_schedule(&hil_mlcs_tasklet); 794 791 /* Re-insert the periodic task. */
+4 -4
drivers/input/serio/hp_sdc_mlc.c
··· 210 210 priv->tseq[2] = 1; 211 211 priv->tseq[3] = 0; 212 212 priv->tseq[4] = 0; 213 - __hp_sdc_enqueue_transaction(&priv->trans); 213 + return __hp_sdc_enqueue_transaction(&priv->trans); 214 214 busy: 215 215 return 1; 216 216 done: ··· 219 219 return 0; 220 220 } 221 221 222 - static void hp_sdc_mlc_out(hil_mlc *mlc) 222 + static int hp_sdc_mlc_out(hil_mlc *mlc) 223 223 { 224 224 struct hp_sdc_mlc_priv_s *priv; 225 225 ··· 234 234 do_data: 235 235 if (priv->emtestmode) { 236 236 up(&mlc->osem); 237 - return; 237 + return 0; 238 238 } 239 239 /* Shouldn't be sending commands when loop may be busy */ 240 240 BUG_ON(down_trylock(&mlc->csem)); ··· 296 296 BUG_ON(down_trylock(&mlc->csem)); 297 297 } 298 298 enqueue: 299 - hp_sdc_enqueue_transaction(&priv->trans); 299 + return hp_sdc_enqueue_transaction(&priv->trans); 300 300 } 301 301 302 302 static int __init hp_sdc_mlc_init(void)
+1 -1
include/linux/hil_mlc.h
··· 103 103 104 104 /* Methods for back-end drivers, e.g. hp_sdc_mlc */ 105 105 typedef int (hil_mlc_cts) (hil_mlc *mlc); 106 - typedef void (hil_mlc_out) (hil_mlc *mlc); 106 + typedef int (hil_mlc_out) (hil_mlc *mlc); 107 107 typedef int (hil_mlc_in) (hil_mlc *mlc, suseconds_t timeout); 108 108 109 109 struct hil_mlc_devinfo {