Commit f9c25d98 authored by Linus Torvalds's avatar Linus Torvalds

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
parents bd6aabc7 2e34ae02
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org> * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
* Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org> * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
* Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
* Copyright (C) 1999-2014 Helge Deller <deller@gmx.de> * Copyright (C) 1999-2020 Helge Deller <deller@gmx.de>
*/ */
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/utsname.h> #include <linux/utsname.h>
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/random.h> #include <linux/random.h>
#include <linux/compat.h>
/* we construct an artificial offset for the mapping based on the physical /* we construct an artificial offset for the mapping based on the physical
* address of the kernel mapping variable */ * address of the kernel mapping variable */
...@@ -373,3 +374,73 @@ long parisc_personality(unsigned long personality) ...@@ -373,3 +374,73 @@ long parisc_personality(unsigned long personality)
return err; return err;
} }
/*
* Up to kernel v5.9 we defined O_NONBLOCK as 000200004,
* since then O_NONBLOCK is defined as 000200000.
*
* The following wrapper functions mask out the old
* O_NDELAY bit from calls which use O_NONBLOCK.
*
* XXX: Remove those in year 2022 (or later)?
*/
#define O_NONBLOCK_OLD 000200004
#define O_NONBLOCK_MASK_OUT (O_NONBLOCK_OLD & ~O_NONBLOCK)
static int FIX_O_NONBLOCK(int flags)
{
if (flags & O_NONBLOCK_MASK_OUT) {
struct task_struct *tsk = current;
pr_warn_once("%s(%d) uses a deprecated O_NONBLOCK value.\n",
tsk->comm, tsk->pid);
}
return flags & ~O_NONBLOCK_MASK_OUT;
}
asmlinkage long parisc_timerfd_create(int clockid, int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_timerfd_create(clockid, flags);
}
asmlinkage long parisc_signalfd4(int ufd, sigset_t __user *user_mask,
size_t sizemask, int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_signalfd4(ufd, user_mask, sizemask, flags);
}
#ifdef CONFIG_COMPAT
asmlinkage long parisc_compat_signalfd4(int ufd,
compat_sigset_t __user *user_mask,
compat_size_t sizemask, int flags)
{
flags = FIX_O_NONBLOCK(flags);
return compat_sys_signalfd4(ufd, user_mask, sizemask, flags);
}
#endif
asmlinkage long parisc_eventfd2(unsigned int count, int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_eventfd2(count, flags);
}
asmlinkage long parisc_userfaultfd(int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_userfaultfd(flags);
}
asmlinkage long parisc_pipe2(int __user *fildes, int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_pipe2(fildes, flags);
}
asmlinkage long parisc_inotify_init1(int flags)
{
flags = FIX_O_NONBLOCK(flags);
return sys_inotify_init1(flags);
}
...@@ -344,17 +344,17 @@ ...@@ -344,17 +344,17 @@
304 common eventfd sys_eventfd 304 common eventfd sys_eventfd
305 32 fallocate parisc_fallocate 305 32 fallocate parisc_fallocate
305 64 fallocate sys_fallocate 305 64 fallocate sys_fallocate
306 common timerfd_create sys_timerfd_create 306 common timerfd_create parisc_timerfd_create
307 32 timerfd_settime sys_timerfd_settime32 307 32 timerfd_settime sys_timerfd_settime32
307 64 timerfd_settime sys_timerfd_settime 307 64 timerfd_settime sys_timerfd_settime
308 32 timerfd_gettime sys_timerfd_gettime32 308 32 timerfd_gettime sys_timerfd_gettime32
308 64 timerfd_gettime sys_timerfd_gettime 308 64 timerfd_gettime sys_timerfd_gettime
309 common signalfd4 sys_signalfd4 compat_sys_signalfd4 309 common signalfd4 parisc_signalfd4 parisc_compat_signalfd4
310 common eventfd2 sys_eventfd2 310 common eventfd2 parisc_eventfd2
311 common epoll_create1 sys_epoll_create1 311 common epoll_create1 sys_epoll_create1
312 common dup3 sys_dup3 312 common dup3 sys_dup3
313 common pipe2 sys_pipe2 313 common pipe2 parisc_pipe2
314 common inotify_init1 sys_inotify_init1 314 common inotify_init1 parisc_inotify_init1
315 common preadv sys_preadv compat_sys_preadv 315 common preadv sys_preadv compat_sys_preadv
316 common pwritev sys_pwritev compat_sys_pwritev 316 common pwritev sys_pwritev compat_sys_pwritev
317 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo 317 common rt_tgsigqueueinfo sys_rt_tgsigqueueinfo compat_sys_rt_tgsigqueueinfo
...@@ -387,7 +387,7 @@ ...@@ -387,7 +387,7 @@
341 common bpf sys_bpf 341 common bpf sys_bpf
342 common execveat sys_execveat compat_sys_execveat 342 common execveat sys_execveat compat_sys_execveat
343 common membarrier sys_membarrier 343 common membarrier sys_membarrier
344 common userfaultfd sys_userfaultfd 344 common userfaultfd parisc_userfaultfd
345 common mlock2 sys_mlock2 345 common mlock2 sys_mlock2
346 common copy_file_range sys_copy_file_range 346 common copy_file_range sys_copy_file_range
347 common preadv2 sys_preadv2 compat_sys_preadv2 347 common preadv2 sys_preadv2 compat_sys_preadv2
......
...@@ -180,9 +180,16 @@ static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) ...@@ -180,9 +180,16 @@ static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm) static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
{ {
time64_t secs = rtc_tm_to_time64(tm); time64_t secs = rtc_tm_to_time64(tm);
int ret;
if (pdc_tod_set(secs, 0) < 0)
/* hppa has Y2K38 problem: pdc_tod_set() takes an u32 value! */
ret = pdc_tod_set(secs, 0);
if (ret != 0) {
pr_warn("pdc_tod_set(%lld) returned error %d\n", secs, ret);
if (ret == PDC_INVALID_ARG)
return -EINVAL;
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
return 0; return 0;
} }
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* pata_ns87415.c - NS87415 (non PARISC) PATA * pata_ns87415.c - NS87415 (and PARISC SUPERIO 87560) PATA
* *
* (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk> * (C) 2005 Red Hat <alan@lxorguk.ukuu.org.uk>
* *
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
* systems. This has its own special mountain of errata. * systems. This has its own special mountain of errata.
* *
* TODO: * TODO:
* Test PARISC SuperIO
* Get someone to test on SPARC * Get someone to test on SPARC
* Implement lazy pio/dma switching for better performance * Implement lazy pio/dma switching for better performance
* 8bit shared timing. * 8bit shared timing.
......
...@@ -74,7 +74,7 @@ EXPORT_SYMBOL(hil_mlc_unregister); ...@@ -74,7 +74,7 @@ EXPORT_SYMBOL(hil_mlc_unregister);
static LIST_HEAD(hil_mlcs); static LIST_HEAD(hil_mlcs);
static DEFINE_RWLOCK(hil_mlcs_lock); static DEFINE_RWLOCK(hil_mlcs_lock);
static struct timer_list hil_mlcs_kicker; static struct timer_list hil_mlcs_kicker;
static int hil_mlcs_probe; static int hil_mlcs_probe, hil_mlc_stop;
static void hil_mlcs_process(unsigned long unused); static void hil_mlcs_process(unsigned long unused);
static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process); static DECLARE_TASKLET_DISABLED_OLD(hil_mlcs_tasklet, hil_mlcs_process);
...@@ -702,9 +702,13 @@ static int hilse_donode(hil_mlc *mlc) ...@@ -702,9 +702,13 @@ static int hilse_donode(hil_mlc *mlc)
if (!mlc->ostarted) { if (!mlc->ostarted) {
mlc->ostarted = 1; mlc->ostarted = 1;
mlc->opacket = pack; mlc->opacket = pack;
mlc->out(mlc); rc = mlc->out(mlc);
nextidx = HILSEN_DOZE; nextidx = HILSEN_DOZE;
write_unlock_irqrestore(&mlc->lock, flags); write_unlock_irqrestore(&mlc->lock, flags);
if (rc) {
hil_mlc_stop = 1;
return 1;
}
break; break;
} }
mlc->ostarted = 0; mlc->ostarted = 0;
...@@ -715,8 +719,13 @@ static int hilse_donode(hil_mlc *mlc) ...@@ -715,8 +719,13 @@ static int hilse_donode(hil_mlc *mlc)
case HILSE_CTS: case HILSE_CTS:
write_lock_irqsave(&mlc->lock, flags); write_lock_irqsave(&mlc->lock, flags);
nextidx = mlc->cts(mlc) ? node->bad : node->good; rc = mlc->cts(mlc);
nextidx = rc ? node->bad : node->good;
write_unlock_irqrestore(&mlc->lock, flags); write_unlock_irqrestore(&mlc->lock, flags);
if (rc) {
hil_mlc_stop = 1;
return 1;
}
break; break;
default: default:
...@@ -780,6 +789,12 @@ static void hil_mlcs_process(unsigned long unused) ...@@ -780,6 +789,12 @@ static void hil_mlcs_process(unsigned long unused)
static void hil_mlcs_timer(struct timer_list *unused) static void hil_mlcs_timer(struct timer_list *unused)
{ {
if (hil_mlc_stop) {
/* could not send packet - stop immediately. */
pr_warn(PREFIX "HIL seems stuck - Disabling HIL MLC.\n");
return;
}
hil_mlcs_probe = 1; hil_mlcs_probe = 1;
tasklet_schedule(&hil_mlcs_tasklet); tasklet_schedule(&hil_mlcs_tasklet);
/* Re-insert the periodic task. */ /* Re-insert the periodic task. */
......
...@@ -210,7 +210,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc) ...@@ -210,7 +210,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)
priv->tseq[2] = 1; priv->tseq[2] = 1;
priv->tseq[3] = 0; priv->tseq[3] = 0;
priv->tseq[4] = 0; priv->tseq[4] = 0;
__hp_sdc_enqueue_transaction(&priv->trans); return __hp_sdc_enqueue_transaction(&priv->trans);
busy: busy:
return 1; return 1;
done: done:
...@@ -219,7 +219,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc) ...@@ -219,7 +219,7 @@ static int hp_sdc_mlc_cts(hil_mlc *mlc)
return 0; return 0;
} }
static void hp_sdc_mlc_out(hil_mlc *mlc) static int hp_sdc_mlc_out(hil_mlc *mlc)
{ {
struct hp_sdc_mlc_priv_s *priv; struct hp_sdc_mlc_priv_s *priv;
...@@ -234,7 +234,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc) ...@@ -234,7 +234,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)
do_data: do_data:
if (priv->emtestmode) { if (priv->emtestmode) {
up(&mlc->osem); up(&mlc->osem);
return; return 0;
} }
/* Shouldn't be sending commands when loop may be busy */ /* Shouldn't be sending commands when loop may be busy */
BUG_ON(down_trylock(&mlc->csem)); BUG_ON(down_trylock(&mlc->csem));
...@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc) ...@@ -296,7 +296,7 @@ static void hp_sdc_mlc_out(hil_mlc *mlc)
BUG_ON(down_trylock(&mlc->csem)); BUG_ON(down_trylock(&mlc->csem));
} }
enqueue: enqueue:
hp_sdc_enqueue_transaction(&priv->trans); return hp_sdc_enqueue_transaction(&priv->trans);
} }
static int __init hp_sdc_mlc_init(void) static int __init hp_sdc_mlc_init(void)
......
...@@ -103,7 +103,7 @@ struct hilse_node { ...@@ -103,7 +103,7 @@ struct hilse_node {
/* Methods for back-end drivers, e.g. hp_sdc_mlc */ /* Methods for back-end drivers, e.g. hp_sdc_mlc */
typedef int (hil_mlc_cts) (hil_mlc *mlc); typedef int (hil_mlc_cts) (hil_mlc *mlc);
typedef void (hil_mlc_out) (hil_mlc *mlc); typedef int (hil_mlc_out) (hil_mlc *mlc);
typedef int (hil_mlc_in) (hil_mlc *mlc, suseconds_t timeout); typedef int (hil_mlc_in) (hil_mlc *mlc, suseconds_t timeout);
struct hil_mlc_devinfo { struct hil_mlc_devinfo {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment