OSDN Git Service

tomoyo/tomoyo-test1.git
4 years agortc: ds1685: fix build error with make W=1
Alexandre Belloni [Fri, 22 Nov 2019 10:22:08 +0000 (11:22 +0100)]
rtc: ds1685: fix build error with make W=1

Fix the following parsing errors when building with W=1:
drivers/rtc/rtc-ds1685.c:1053: error: Cannot parse struct or union!
drivers/rtc/rtc-ds1685.c:1062: error: Cannot parse struct or union!
drivers/rtc/rtc-ds1685.c:1363: warning: cannot understand function prototype: 'struct platform_driver ds1685_rtc_driver = '

Cc: Joshua Kinard <kumba@gentoo.org>
Link: https://lore.kernel.org/r/20191122102212.400158-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1685: remove set but unused variables
Alexandre Belloni [Fri, 22 Nov 2019 10:22:07 +0000 (11:22 +0100)]
rtc: ds1685: remove set but unused variables

Fix the following warnings:
drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_read_time’:
drivers/rtc/rtc-ds1685.c:264:5: warning: variable ‘ctrlb’ set but not used [-Wunused-but-set-variable]
  264 |  u8 ctrlb, century;
      |     ^~~~~
drivers/rtc/rtc-ds1685.c: In function ‘ds1685_rtc_proc’:
drivers/rtc/rtc-ds1685.c:758:19: warning: variable ‘ctrlc’ set but not used [-Wunused-but-set-variable]
  758 |  u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8];
      |                   ^~~~~
Cc: Joshua Kinard <kumba@gentoo.org>
Acked-By: Joshua Kinard <kumba@gentoo.org>
Link: https://lore.kernel.org/r/20191122102212.400158-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1374: remove unused variable
Alexandre Belloni [Fri, 22 Nov 2019 10:22:06 +0000 (11:22 +0100)]
rtc: ds1374: remove unused variable

Fix warning:

drivers/rtc/rtc-ds1374.c: In function ‘ds1374_wdt_disable’:
drivers/rtc/rtc-ds1374.c:442:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Link: https://lore.kernel.org/r/20191122102212.400158-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: sysfs: fix hctosys_show kerneldoc
Alexandre Belloni [Fri, 22 Nov 2019 10:22:05 +0000 (11:22 +0100)]
rtc: sysfs: fix hctosys_show kerneldoc

Fix undocumented function parameters:
drivers/rtc/sysfs.c:112: warning: Function parameter or member 'dev' not described in 'hctosys_show'
drivers/rtc/sysfs.c:112: warning: Function parameter or member 'attr' not described in 'hctosys_show'
drivers/rtc/sysfs.c:112: warning: Function parameter or member 'buf' not described in 'hctosys_show'

Link: https://lore.kernel.org/r/20191122102212.400158-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: interface: fix kerneldoc comments
Alexandre Belloni [Wed, 27 Nov 2019 08:29:32 +0000 (09:29 +0100)]
rtc: interface: fix kerneldoc comments

Fix kerneldoc warnings:

drivers/rtc/interface.c:619: warning: Function parameter or member 'num' not described in 'rtc_handle_legacy_irq'
drivers/rtc/interface.c:619: warning: Function parameter or member 'mode' not described in 'rtc_handle_legacy_irq'
drivers/rtc/interface.c:804: warning: Function parameter or member 'rtc' not described in 'rtc_timer_enqueue'
drivers/rtc/interface.c:804: warning: Function parameter or member 'timer' not described in 'rtc_timer_enqueue'
drivers/rtc/interface.c:864: warning: Function parameter or member 'rtc' not described in 'rtc_timer_remove'
drivers/rtc/interface.c:864: warning: Function parameter or member 'timer' not described in 'rtc_timer_remove'
drivers/rtc/interface.c:900: warning: Function parameter or member 'work' not described in 'rtc_timer_do_work'
drivers/rtc/interface.c:1035: warning: Function parameter or member 'rtc' not described in 'rtc_read_offset'
drivers/rtc/interface.c:1035: warning: Function parameter or member 'offset' not described in 'rtc_read_offset'
drivers/rtc/interface.c:1070: warning: Function parameter or member 'rtc' not described in 'rtc_set_offset'
drivers/rtc/interface.c:1070: warning: Function parameter or member 'offset' not described in 'rtc_set_offset'

Link: https://lore.kernel.org/r/20191127082932.666869-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions
Kars de Jong [Sat, 16 Nov 2019 11:46:20 +0000 (12:46 +0100)]
rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions

The msm6242_set()/msm6242_clear() functions are used when writing to Control
Register D to set or clear the HOLD bit when reading the current time from
the RTC.

Doing this with a read-modify-write cycle will potentially clear an
interrupt condition which occurs between the read and the write.

The datasheet states the following about this:

  When writing the HOLD or 30 second adjust bits of register D, it is
  necessary to write the IRQ FLAG bit to a "1".

Since the only other bits in the register are the 30 second adjust bit
(which is not used) and the BUSY bit (which is read-only), the
read-modify-write cycle can be replaced by a simple write with the IRQ FLAG
bit set to 1 and the other bits (except HOLD) set to 0.

Tested-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Link: https://lore.kernel.org/r/20191116114620.9193-1-jongk@linux-m68k.org
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: msm6242: Fix reading of 10-hour digit
Kars de Jong [Sat, 16 Nov 2019 11:05:48 +0000 (12:05 +0100)]
rtc: msm6242: Fix reading of 10-hour digit

The driver was reading the wrong register as the 10-hour digit due to
a misplaced ')'. It was in fact reading the 1-second digit register due
to this bug.

Also remove the use of a magic number for the hour mask and use the define
for it which was already present.

Fixes: 4f9b9bba1dd1 ("rtc: Add an RTC driver for the Oki MSM6242")
Tested-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Kars de Jong <jongk@linux-m68k.org>
Link: https://lore.kernel.org/r/20191116110548.8562-1-jongk@linux-m68k.org
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: tps65910: allow using RTC without alarm interrupt
Andrey Skvortsov [Sat, 16 Nov 2019 20:37:48 +0000 (23:37 +0300)]
rtc: tps65910: allow using RTC without alarm interrupt

If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller,
then it can't be used as system wakeup/alarm source,
but it is still possible to read/write time from/to RTC.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Link: https://lore.kernel.org/r/20191116203748.27166-1-andrej.skvortzov@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig
Li Yang [Fri, 8 Nov 2019 22:40:56 +0000 (16:40 -0600)]
rtc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig

The Flextimer alarm is primarily used as a wakeup source for system
power management.  But it shouldn't select the power management driver
as they don't really have dependency of each other.

Also remove the default y as it is not a critical feature for the
systems.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
Link: https://lore.kernel.org/r/1573252856-11759-1-git-send-email-leoyang.li@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: pcf8563: Constify clkout_rates
Nobuhiro Iwamatsu [Fri, 8 Nov 2019 00:24:49 +0000 (09:24 +0900)]
rtc: pcf8563: Constify clkout_rates

The lates of clockout should be marked const. Make that so.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191108002449.15097-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1302: Remove unused DRV_NAME
Nobuhiro Iwamatsu [Fri, 8 Nov 2019 00:23:54 +0000 (09:23 +0900)]
rtc: ds1302: Remove unused DRV_NAME

DRV_NAME is unused, remove it.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191108002354.15016-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: rx6110: Convert to SPDX identifier
Nobuhiro Iwamatsu [Fri, 8 Nov 2019 00:22:50 +0000 (09:22 +0900)]
rtc: rx6110: Convert to SPDX identifier

Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191108002250.14937-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: rx6110: Remove useless rx6110_remove
Nobuhiro Iwamatsu [Fri, 8 Nov 2019 00:21:13 +0000 (09:21 +0900)]
rtc: rx6110: Remove useless rx6110_remove

rx6110_remove is empty, remove it.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191108002113.14791-1-iwamatsu@nigauri.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: Fix the AltCentury value on AMD/Hygon platform
Jinke Fan [Tue, 5 Nov 2019 08:39:43 +0000 (16:39 +0800)]
rtc: Fix the AltCentury value on AMD/Hygon platform

When using following operations:
date -s "21190910 19:20:00"
hwclock -w
to change date from 2019 to 2119 for test, it will fail on Hygon
Dhyana and AMD Zen CPUs, while the same operations run ok on Intel i7
platform.

MC146818 driver use function mc146818_set_time() to set register
RTC_FREQ_SELECT(RTC_REG_A)'s bit4-bit6 field which means divider stage
reset value on Intel platform to 0x7.

While AMD/Hygon RTC_REG_A(0Ah)'s bit4 is defined as DV0 [Reference]:
DV0 = 0 selects Bank 0, DV0 = 1 selects Bank 1. Bit5-bit6 is defined
as reserved.

DV0 is set to 1, it will select Bank 1, which will disable AltCentury
register(0x32) access. As UEFI pass acpi_gbl_FADT.century 0x32
(AltCentury), the CMOS write will be failed on code:
CMOS_WRITE(century, acpi_gbl_FADT.century).

Correct RTC_REG_A bank select bit(DV0) to 0 on AMD/Hygon CPUs, it will
enable AltCentury(0x32) register writing and finally setup century as
expected.

Test results on Intel i7, AMD EPYC(17h) and Hygon machine show that it
works as expected.
Compiling for sparc64 and alpha architectures are passed.

Reference:
https://www.amd.com/system/files/TechDocs/51192_Bolton_FCH_RRG.pdf
section: 3.13 Real Time Clock (RTC)

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Jinke Fan <fanjinke@hygon.cn>
Link: https://lore.kernel.org/r/20191105083943.115320-1-fanjinke@hygon.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: bd70528: fix module alias to autoload module
Colin Ian King [Wed, 6 Nov 2019 08:34:18 +0000 (08:34 +0000)]
rtc: bd70528: fix module alias to autoload module

The module alias platform tag contains a spelling mistake. Fix it.

Fixes: f33506abbcdd ("rtc: bd70528: Add MODULE ALIAS to autoload module")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20191106083418.159045-1-colin.king@canonical.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: bd70528: Add MODULE ALIAS to autoload module
Matti Vaittinen [Wed, 23 Oct 2019 11:47:11 +0000 (14:47 +0300)]
rtc: bd70528: Add MODULE ALIAS to autoload module

The bd70528 RTC driver is probed by MFD driver. Add MODULE_ALIAS
in order to allow udev to load the module when MFD sub-device cell
for RTC is added.

I'm not sure if this is a bugfix or feature addition but I guess
fixes tag won't harm in this case.

Fixes: 32a4a4ebf768 ("rtc: bd70528: Initial support for ROHM bd70528 RTC")
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/20191023114711.GA13954@localhost.localdomain
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: em3027: correct month value
Ilya Ledvich [Fri, 1 Nov 2019 09:54:22 +0000 (11:54 +0200)]
rtc: em3027: correct month value

The RTC month value is 1-indexed, but the kernel assumes it is 0-indexed.
This may result in the RTC not rolling over correctly.

Signed-off-by: Ilya Ledvich <ilya@compulab.co.il>
Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Link: https://lore.kernel.org/r/20191101095422.14787-1-ilya@compulab.co.il
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: brcmstb-waketimer: add missed clk_disable_unprepare
Chuhong Yuan [Tue, 5 Nov 2019 16:00:43 +0000 (00:00 +0800)]
rtc: brcmstb-waketimer: add missed clk_disable_unprepare

This driver forgets to disable and unprepare clock when remove.
Add a call to clk_disable_unprepare to fix it.

Fixes: c4f07ecee22e ("rtc: brcmstb-waketimer: Add Broadcom STB wake-timer")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20191105160043.20018-1-hslester96@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: cros-ec: let the core handle rtc range
Alexandre Belloni [Wed, 16 Oct 2019 20:14:14 +0000 (22:14 +0200)]
rtc: cros-ec: let the core handle rtc range

Let the rtc core check the date/time against the RTC range.

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20191016201414.30934-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: cros-ec: remove superfluous error message
Alexandre Belloni [Wed, 16 Oct 2019 20:14:13 +0000 (22:14 +0200)]
rtc: cros-ec: remove superfluous error message

The RTC core now has error messages in case of registration failure, there
is no need to have other messages in the drivers.

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20191016201414.30934-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: sirfsoc: remove .remove
Alexandre Belloni [Mon, 21 Oct 2019 15:58:05 +0000 (17:58 +0200)]
rtc: sirfsoc: remove .remove

dpm_sysfs_remove() and device_pm_remove() are already called by
device_del() on device removal so there is no need to call
device_init_wakeup(dev, false) from the driver and it allows to remove the
.remove callback.

Link: https://lore.kernel.org/r/20191021155806.3625-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: sc27xx: remove .remove
Alexandre Belloni [Mon, 21 Oct 2019 15:58:06 +0000 (17:58 +0200)]
rtc: sc27xx: remove .remove

dpm_sysfs_remove() and device_pm_remove() are already called by
device_del() on device removal so there is no need to call
device_init_wakeup(dev, false) from the driver and it allows to remove the
.remove callback.

Link: https://lore.kernel.org/r/20191021155806.3625-4-alexandre.belloni@bootlin.com
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: lpc32xx: remove .remove
Alexandre Belloni [Mon, 21 Oct 2019 15:58:04 +0000 (17:58 +0200)]
rtc: lpc32xx: remove .remove

dpm_sysfs_remove() and device_pm_remove() are already called by
device_del() on device removal so there is no need to call
device_init_wakeup(dev, false) from the driver and it allows to remove the
.remove callback.

Link: https://lore.kernel.org/r/20191021155806.3625-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ab-b5ze-s3: remove .remove
Alexandre Belloni [Mon, 21 Oct 2019 15:58:03 +0000 (17:58 +0200)]
rtc: ab-b5ze-s3: remove .remove

dpm_sysfs_remove() and device_pm_remove() are already called by
device_del() on device removal so there is no need to call
device_init_wakeup(dev, false) from the driver and it allows to remove the
.remove callback.

Link: https://lore.kernel.org/r/20191021155806.3625-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: disallow update interrupts when time is invalid
Alexandre Belloni [Mon, 21 Oct 2019 15:56:31 +0000 (17:56 +0200)]
rtc: disallow update interrupts when time is invalid

Never enable update interrupts when the time set on the rtc is invalid.
In that case, also avoid enabling the emulation because it will fail for
the same reason.

Link: https://lore.kernel.org/r/20191021155631.3342-2-alexandre.belloni@bootlin.com
Link: https://lore.kernel.org/r/CA+ASDXMarBG5C1Kz42B9i_iVZ1=i6GgH9Yja2cdmSueKD_As_g@mail.gmail.com
Reported-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reported-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: disable uie before setting time and enable after
Alexandre Belloni [Sun, 20 Oct 2019 23:13:20 +0000 (01:13 +0200)]
rtc: disable uie before setting time and enable after

When setting the time in the future with the uie timer enabled,
rtc_timer_do_work will loop for a while because the expiration of the uie
timer was way before the current RTC time and a new timer will be enqueued
until the current rtc time is reached.

If the uie timer is enabled, disable it before setting the time and enable
it after expiring current timers (which may actually be an alarm).

This is the safest thing to do to ensure the uie timer is still
synchronized with the RTC, especially in the UIE emulation case.

Reported-by: syzbot+08116743f8ad6f9a6de7@syzkaller.appspotmail.com
Fixes: 6610e0893b8b ("RTC: Rework RTC code to use timerqueue for events")
Link: https://lore.kernel.org/r/20191020231320.8191-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: fsl-ftm-alarm: avoid struct rtc_time conversions
Alexandre Belloni [Wed, 16 Oct 2019 20:12:23 +0000 (22:12 +0200)]
rtc: fsl-ftm-alarm: avoid struct rtc_time conversions

Directly call ktime_get_real_seconds instead of converting the result to a
struct rtc_time and then back to a time64_t.

Link: https://lore.kernel.org/r/20191016201223.30568-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: fsl-ftm-alarm: switch to rtc_time64_to_tm/rtc_tm_to_time64
Alexandre Belloni [Wed, 16 Oct 2019 20:12:22 +0000 (22:12 +0200)]
rtc: fsl-ftm-alarm: switch to rtc_time64_to_tm/rtc_tm_to_time64

Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue.

Link: https://lore.kernel.org/r/20191016201223.30568-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: fsl-ftm-alarm: switch to ktime_get_real_seconds
Alexandre Belloni [Wed, 16 Oct 2019 20:12:21 +0000 (22:12 +0200)]
rtc: fsl-ftm-alarm: switch to ktime_get_real_seconds

The driver drops the nanoseconds part of the timespec64, there is no need
to call ktime_get_real_ts64.

Link: https://lore.kernel.org/r/20191016201223.30568-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: pcf2127: handle boot-enabled watchdog feature
Martin Hundebøll [Mon, 21 Oct 2019 08:08:38 +0000 (10:08 +0200)]
rtc: pcf2127: handle boot-enabled watchdog feature

Linux should handle when the pcf2127 watchdog feature is enabled by the
bootloader. This is done by checking the watchdog timer value during
init, and set the WDOG_HW_RUNNING flag if the value differs from zero.

Signed-off-by: Martin Hundebøll <martin@geanix.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20191021080838.2789-1-martin@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: rv3028: add clkout support
Parthiban Nallathambi [Fri, 18 Oct 2019 10:04:25 +0000 (12:04 +0200)]
rtc: rv3028: add clkout support

rv3028 provides clkout (enabled by default). Add clkout
to clock framework source and control from device tree for
variable frequency with enable and disable functionality.

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Link: https://lore.kernel.org/r/20191018100425.1687979-1-pn@denx.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: cleanup .remove
Alexandre Belloni [Sat, 19 Oct 2019 20:49:41 +0000 (22:49 +0200)]
rtc: ds1343: cleanup .remove

It is not necessary to call device_init_wakeup(dev, false) in .remove as
device_del will take care of that. It is also not necessary to
devm_free_irq. Finally, dev_pm_clear_wake_irq can be called
unconditionally.

Link: https://lore.kernel.org/r/20191019204941.6203-9-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: rework interrupt handling
Alexandre Belloni [Sat, 19 Oct 2019 20:49:40 +0000 (22:49 +0200)]
rtc: ds1343: rework interrupt handling

Rework the interrupt handling to avoid caching the values as the core is
already doing that. The core also always ensures the rtc_time passed for
the alarm is fully populated.

The only trick is in read_alarm where status needs to be read before the
alarm registers to ensure the potential irq is not cleared.

Link: https://lore.kernel.org/r/20191019204941.6203-8-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: remove unnecessary mutex
Alexandre Belloni [Sat, 19 Oct 2019 20:49:39 +0000 (22:49 +0200)]
rtc: ds1343: remove unnecessary mutex

Use rtc_lock and rtc_unlock to lock the rtc from the interrupt handler.
This removes the need for a driver specific lock.

Link: https://lore.kernel.org/r/20191019204941.6203-7-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: check regmap_read return value
Alexandre Belloni [Sat, 19 Oct 2019 20:49:38 +0000 (22:49 +0200)]
rtc: ds1343: check regmap_read return value

Check whether regmap_read fails before continuing in the sysfs .show
callbacks.

Link: https://lore.kernel.org/r/20191019204941.6203-6-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: use regmap_update_bits for glitch filter
Alexandre Belloni [Sat, 19 Oct 2019 20:49:37 +0000 (22:49 +0200)]
rtc: ds1343: use regmap_update_bits for glitch filter

Use regmap_update_bits to update DS1343_CONTROL_REG in a race free manner
when setting the glitch filter.

Link: https://lore.kernel.org/r/20191019204941.6203-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: use rtc_add_group
Alexandre Belloni [Sat, 19 Oct 2019 20:49:36 +0000 (22:49 +0200)]
rtc: ds1343: use rtc_add_group

Use rtc_add_group to add the sysfs group in a race free manner.
This has the side effect of moving the files to their proper location.

Link: https://lore.kernel.org/r/20191019204941.6203-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: use burst write to set time
Alexandre Belloni [Sat, 19 Oct 2019 20:49:35 +0000 (22:49 +0200)]
rtc: ds1343: use burst write to set time

To avoid possible race condition, use regmap_bulk_write to write all the
date/time registers at once instead of sequentially.

Link: https://lore.kernel.org/r/20191019204941.6203-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: remove dead code
Alexandre Belloni [Sat, 19 Oct 2019 20:49:34 +0000 (22:49 +0200)]
rtc: ds1343: remove dead code

RTC_SET_CHARGE doesn't exist, the ioctl code is never used.

Link: https://lore.kernel.org/r/20191019204941.6203-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1343: set range
Alexandre Belloni [Sat, 19 Oct 2019 20:49:33 +0000 (22:49 +0200)]
rtc: ds1343: set range

This is a standard BCD rtc with a useless century bit (no leap year
correction after 2099).

Link: https://lore.kernel.org/r/20191019204941.6203-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: introduce lock helpers
Alexandre Belloni [Sat, 19 Oct 2019 20:50:34 +0000 (22:50 +0200)]
rtc: introduce lock helpers

Introduce rtc_lock and rtc_unlock to shorten the code when locking and
unlocking ops_lock from drivers.

Link: https://lore.kernel.org/r/20191019205034.6382-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: vt8500: let the core handle rtc range
Alexandre Belloni [Wed, 16 Oct 2019 20:16:26 +0000 (22:16 +0200)]
rtc: vt8500: let the core handle rtc range

Let the rtc core check the date/time against the RTC range.

Link: https://lore.kernel.org/r/20191016201626.31309-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: vt8500: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 16 Oct 2019 20:16:25 +0000 (22:16 +0200)]
rtc: vt8500: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20191016201626.31309-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: vt8500: remove superfluous error message
Alexandre Belloni [Wed, 16 Oct 2019 20:16:24 +0000 (22:16 +0200)]
rtc: vt8500: remove superfluous error message

The RTC core now has error messages in case of registration failure, there
is no need to have other messages in the drivers.

Link: https://lore.kernel.org/r/20191016201626.31309-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: vt8500: remove useless label
Alexandre Belloni [Wed, 16 Oct 2019 20:16:23 +0000 (22:16 +0200)]
rtc: vt8500: remove useless label

err_return doesn't do anything special, simply return instead of goto.

Link: https://lore.kernel.org/r/20191016201626.31309-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: add timestamp for end of 2199
Alexandre Belloni [Wed, 16 Oct 2019 20:16:22 +0000 (22:16 +0200)]
rtc: add timestamp for end of 2199

Some RTCs handle date up to 2199.

Link: https://lore.kernel.org/r/20191016201626.31309-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: s35390a: set range
Alexandre Belloni [Wed, 16 Oct 2019 20:08:48 +0000 (22:08 +0200)]
rtc: s35390a: set range

This is a standard BCD RTC that will fail in 2100.

Link: https://lore.kernel.org/r/20191016200848.30246-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: s35390a: convert to devm_rtc_allocate_device
Alexandre Belloni [Wed, 16 Oct 2019 20:08:47 +0000 (22:08 +0200)]
rtc: s35390a: convert to devm_rtc_allocate_device

This allows further improvement of the driver and removes the need to
forward declare s35390a_driver.

Link: https://lore.kernel.org/r/20191016200848.30246-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: meson-vrtc: move config option to proper location
Alexandre Belloni [Mon, 14 Oct 2019 15:58:40 +0000 (17:58 +0200)]
rtc: meson-vrtc: move config option to proper location

The correct location for this option is under platform driver, not i2c
drivers.

Link: https://lore.kernel.org/r/20191014155840.22554-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1685: add indirect access method and remove plat_read/plat_write
Thomas Bogendoerfer [Mon, 14 Oct 2019 21:46:21 +0000 (23:46 +0200)]
rtc: ds1685: add indirect access method and remove plat_read/plat_write

SGI Octane (IP30) doesn't have RTC register directly mapped into CPU
address space, but accesses RTC registers with an address and data
register.  This is now supported by additional access functions, which
are selected by a new field in platform data. Removed plat_read/plat_write
since there is no user and their usage could introduce lifetime issue,
when functions are placed in different modules.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Acked-by: Joshua Kinard <kumba@gentoo.org>
Reviewed-by: Joshua Kinard <kumba@gentoo.org>
Link: https://lore.kernel.org/r/20191014214621.25257-1-tbogendoerfer@suse.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1685: use devm_platform_ioremap_resource helper
Thomas Bogendoerfer [Fri, 11 Oct 2019 15:05:44 +0000 (17:05 +0200)]
rtc: ds1685: use devm_platform_ioremap_resource helper

Simplify ioremapping of registers by using devm_platform_ioremap_resource.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Acked-by: Joshua Kinard <kumba@gentoo.org>
Link: https://lore.kernel.org/r/20191011150546.9186-2-tbogendoerfer@suse.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agorts: ds1685: remove not needed fields from private struct
Thomas Bogendoerfer [Fri, 11 Oct 2019 15:05:43 +0000 (17:05 +0200)]
rts: ds1685: remove not needed fields from private struct

A few of the fields in struct ds1685_priv aren't needed at all,
so we can remove it.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Acked-by: Joshua Kinard <kumba@gentoo.org>
Link: https://lore.kernel.org/r/20191011150546.9186-1-tbogendoerfer@suse.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: xilinx: Fix calibval variable type
Srinivas Goud [Tue, 8 Oct 2019 14:25:41 +0000 (16:25 +0200)]
rtc: xilinx: Fix calibval variable type

This patch fixes the warnings reported by static code analysis.
Updated calibval variable type to unsigned type from signed.

Signed-off-by: Srinivas Goud <srinivas.goud@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/20765c4c27aa92c75426b82fd2815ebef6471492.1570544738.git.michal.simek@xilinx.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: wilco-ec: Handle reading invalid times
Nick Crews [Fri, 4 Oct 2019 14:26:08 +0000 (08:26 -0600)]
rtc: wilco-ec: Handle reading invalid times

If the RTC HW returns an invalid time, the rtc_year_days()
call would crash. This patch adds error logging in this
situation, and removes the tm_yday and tm_wday calculations.
These fields should not be relied upon by userspace
according to man rtc, and thus we don't need to calculate
them.

Signed-off-by: Nick Crews <ncrews@chromium.org>
Reviewed-by: Daniel Campello <campello@chromium.org>
Link: https://lore.kernel.org/r/20191004142608.170159-1-ncrews@chromium.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: handle century register
Alexandre Belloni [Mon, 7 Oct 2019 13:47:24 +0000 (15:47 +0200)]
rtc: ds1347: handle century register

The DS1347 can handle years from 0 to 9999, add century register support.

Link: https://lore.kernel.org/r/20191007134724.15505-10-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: use regmap_update_bits
Alexandre Belloni [Mon, 7 Oct 2019 13:47:23 +0000 (15:47 +0200)]
rtc: ds1347: use regmap_update_bits

Use regmap_update_bits instead of open coding. Also add proper error
handling.

Link: https://lore.kernel.org/r/20191007134724.15505-9-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: properly handle oscillator failures
Alexandre Belloni [Mon, 7 Oct 2019 13:47:22 +0000 (15:47 +0200)]
rtc: ds1347: properly handle oscillator failures

The comment in the probe function stating that it disables oscillator stop
detection and glitch filtering is incorrect as it sets bits 3 and 4 while
it should be setting 5 and 6 to achieve that. Then, it is safe to assume
that the oscillator failure detection is actually enabled.

Properly handle oscillator failures by returning -EINVAL when the time and
date are know to be incorrect and reset the flag when the time is set.

Link: https://lore.kernel.org/r/20191007134724.15505-8-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: set range
Alexandre Belloni [Mon, 7 Oct 2019 13:47:21 +0000 (15:47 +0200)]
rtc: ds1347: set range

The DS1347 handle dates from year 0000 to 9999. Leap years are claimed to
be handled correctly in the datasheet.

Link: https://lore.kernel.org/r/20191007134724.15505-7-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: convert to devm_rtc_allocate_device
Alexandre Belloni [Mon, 7 Oct 2019 13:47:20 +0000 (15:47 +0200)]
rtc: ds1347: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Link: https://lore.kernel.org/r/20191007134724.15505-6-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: mask ALM OUT when reading time
Alexandre Belloni [Mon, 7 Oct 2019 13:47:19 +0000 (15:47 +0200)]
rtc: ds1347: mask ALM OUT when reading time

Bit 7 of the minutes registers is ALM OUT. It indicates an alarm fired.
Mask it out when reading the time.

Link: https://lore.kernel.org/r/20191007134724.15505-5-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: simplify getting .driver_data
Alexandre Belloni [Mon, 7 Oct 2019 13:47:18 +0000 (15:47 +0200)]
rtc: ds1347: simplify getting .driver_data

Get 'driver_data' from 'struct device' directly. Going via spi_device is an
unnecessary step.

Link: https://lore.kernel.org/r/20191007134724.15505-4-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: remove useless read
Alexandre Belloni [Mon, 7 Oct 2019 13:47:17 +0000 (15:47 +0200)]
rtc: ds1347: remove useless read

DS1347_SECONDS_REG is read at probe time but the value is simply discarded.
Remove that useless read.

Link: https://lore.kernel.org/r/20191007134724.15505-3-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: ds1347: remove verbose messages
Alexandre Belloni [Mon, 7 Oct 2019 13:47:16 +0000 (15:47 +0200)]
rtc: ds1347: remove verbose messages

Printing debugging (and opaque) information is not useful and only clutters
the boot log. Remove those messages.

Link: https://lore.kernel.org/r/20191007134724.15505-2-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: add a timestamp for year 0
Alexandre Belloni [Mon, 7 Oct 2019 13:47:15 +0000 (15:47 +0200)]
rtc: add a timestamp for year 0

A few RTCs handle dates from year 0 to year 9999. Add a timestamp even if
years before 1970 will probably never be used.

Link: https://lore.kernel.org/r/20191007134724.15505-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: armada38x: Use of_device_get_match_data()
Stephen Boyd [Fri, 4 Oct 2019 21:43:27 +0000 (14:43 -0700)]
rtc: armada38x: Use of_device_get_match_data()

Use the more modern API to get the match data out of the of match table.
This saves some code, lines, and nicely avoids referencing the match
table when it is undefined with configurations where CONFIG_OF=n.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: <linux-rtc@vger.kernel.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20191004214334.149976-4-swboyd@chromium.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: da9063: Handle invalid IRQ from platform_get_irq_byname()
Krzysztof Kozlowski [Fri, 4 Oct 2019 15:05:10 +0000 (17:05 +0200)]
rtc: da9063: Handle invalid IRQ from platform_get_irq_byname()

platform_get_irq_byname() might return -errno which later would be
cast to an unsigned int and used in request_irq().

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20191004150510.6278-1-krzk@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: m41t80: set range
Alexandre Belloni [Thu, 3 Oct 2019 21:35:44 +0000 (23:35 +0200)]
rtc: m41t80: set range

This is a standard BCD RTC that will fail in 2100. The century bits don't
help because 2100 will be considered a leap year while it is not.

Link: https://lore.kernel.org/r/20191003213544.5359-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: use devm_platform_ioremap_resource() to simplify code
YueHaibing [Sun, 6 Oct 2019 10:29:20 +0000 (18:29 +0800)]
rtc: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191006102953.57536-2-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-3-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-4-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-5-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-6-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-7-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-8-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-9-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-10-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-11-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-12-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-13-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-14-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-15-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-16-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-17-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-18-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-19-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-20-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-21-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-22-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-23-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-24-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-25-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-26-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-27-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-28-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-29-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-30-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-31-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-32-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-33-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-34-yuehaibing@huawei.com
Link: https://lore.kernel.org/r/20191006102953.57536-35-yuehaibing@huawei.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: Use devm_platform_ioremap_resource()
Markus Elfring [Sat, 21 Sep 2019 09:49:01 +0000 (11:49 +0200)]
rtc: Use devm_platform_ioremap_resource()

Simplify probe by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Link: https://lore.kernel.org/r/4552ef52-f218-93b1-6dfa-668d137676f8@web.de
Link: https://lore.kernel.org/r/5ecfcf43-d6b2-1a38-dee8-b8806f30bc83@web.de
Link: https://lore.kernel.org/r/25448e11-c43f-9ae0-4c43-6f789accc026@web.de
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Link: https://lore.kernel.org/r/8c17a59c-82ff-aa6b-5653-a38d786d3e83@web.de
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: interface: use timeu64_t for range_max
Emmanuel Nicolet [Fri, 27 Sep 2019 11:04:46 +0000 (13:04 +0200)]
rtc: interface: use timeu64_t for range_max

For rtc drivers where rtc->range_max is set U64_MAX, like the PS3 rtc,
rtc_valid_range() always returns -ERANGE. This is because the local
variable range_max has type time64_t, so the test
if (time < range_min || time > range_max)
return -ERANGE;
becomes (time < range_min || time > -1), which always evaluates to true.
timeu64_t should be used, since it's the type of rtc->range_max.

Signed-off-by: Emmanuel Nicolet <emmanuel.nicolet@gmail.com>
Link: https://lore.kernel.org/r/20190927110446.GA6289@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agortc: at91rm9200: use of_device_get_match_data()
Claudiu Beznea [Thu, 26 Sep 2019 12:15:32 +0000 (15:15 +0300)]
rtc: at91rm9200: use of_device_get_match_data()

Use of_device_get_match_data() since all platforms should now use DT
bindings. AVR32 architecture has been removed in
commit 26202873bb51 ("avr32: remove support for AVR32 architecture").

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/1569500132-21164-1-git-send-email-claudiu.beznea@microchip.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
4 years agoLinux 5.4-rc1 v5.4-rc1
Linus Torvalds [Mon, 30 Sep 2019 17:35:40 +0000 (10:35 -0700)]
Linux 5.4-rc1

4 years agoMerge tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
Linus Torvalds [Mon, 30 Sep 2019 17:25:24 +0000 (10:25 -0700)]
Merge tag 'for-5.4-rc1-tag' of git://git./linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
 "A bunch of fixes that accumulated in recent weeks, mostly material for
  stable.

  Summary:

   - fix for regression from 5.3 that prevents to use balance convert
     with single profile

   - qgroup fixes: rescan race, accounting leak with multiple writers,
     potential leak after io failure recovery

   - fix for use after free in relocation (reported by KASAN)

   - other error handling fixups"

* tag 'for-5.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: qgroup: Fix reserved data space leak if we have multiple reserve calls
  btrfs: qgroup: Fix the wrong target io_tree when freeing reserved data space
  btrfs: Fix a regression which we can't convert to SINGLE profile
  btrfs: relocation: fix use-after-free on dead relocation roots
  Btrfs: fix race setting up and completing qgroup rescan workers
  Btrfs: fix missing error return if writeback for extent buffer never started
  btrfs: adjust dirty_metadata_bytes after writeback failure of extent buffer
  Btrfs: fix selftests failure due to uninitialized i_mode in test inodes

4 years agoMerge tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux
Linus Torvalds [Mon, 30 Sep 2019 17:16:17 +0000 (10:16 -0700)]
Merge tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux

Pull csky updates from Guo Ren:
 "This round of csky subsystem just some fixups:

   - Fix mb() synchronization problem

   - Fix dma_alloc_coherent with PAGE_SO attribute

   - Fix cache_op failed when cross memory ZONEs

   - Optimize arch_sync_dma_for_cpu/device with dma_inv_range

   - Fix ioremap function losing

   - Fix arch_get_unmapped_area() implementation

   - Fix defer cache flush for 610

   - Support kernel non-aligned access

   - Fix 610 vipt cache flush mechanism

   - Fix add zero_fp fixup perf backtrace panic

   - Move static keyword to the front of declaration

   - Fix csky_pmu.max_period assignment

   - Use generic free_initrd_mem()

   - entry: Remove unneeded need_resched() loop"

* tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linux:
  csky: Move static keyword to the front of declaration
  csky: entry: Remove unneeded need_resched() loop
  csky: Fixup csky_pmu.max_period assignment
  csky: Fixup add zero_fp fixup perf backtrace panic
  csky: Use generic free_initrd_mem()
  csky: Fixup 610 vipt cache flush mechanism
  csky: Support kernel non-aligned access
  csky: Fixup defer cache flush for 610
  csky: Fixup arch_get_unmapped_area() implementation
  csky: Fixup ioremap function losing
  csky: Optimize arch_sync_dma_for_cpu/device with dma_inv_range
  csky/dma: Fixup cache_op failed when cross memory ZONEs
  csky: Fixup dma_alloc_coherent with PAGE_SO attribute
  csky: Fixup mb() synchronization problem

4 years agoMerge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Linus Torvalds [Mon, 30 Sep 2019 17:04:28 +0000 (10:04 -0700)]
Merge tag 'armsoc-fixes' of git://git./linux/kernel/git/soc/soc

Pull ARM SoC fixes from Olof Johansson:
 "A few fixes that have trickled in through the merge window:

   - Video fixes for OMAP due to panel-dpi driver removal

   - Clock fixes for OMAP that broke no-idle quirks + nfsroot on DRA7

   - Fixing arch version on ASpeed ast2500

   - Two fixes for reset handling on ARM SCMI"

* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
  ARM: aspeed: ast2500 is ARMv6K
  reset: reset-scmi: add missing handle initialisation
  firmware: arm_scmi: reset: fix reset_state assignment in scmi_domain_reset
  bus: ti-sysc: Remove unpaired sysc_clkdm_deny_idle()
  ARM: dts: logicpd-som-lv: Fix i2c2 and i2c3 Pin mux
  ARM: dts: am3517-evm: Fix missing video
  ARM: dts: logicpd-torpedo-baseboard: Fix missing video
  ARM: omap2plus_defconfig: Fix missing video
  bus: ti-sysc: Fix handling of invalid clocks
  bus: ti-sysc: Fix clock handling for no-idle quirks

4 years agoMerge tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Mon, 30 Sep 2019 16:29:53 +0000 (09:29 -0700)]
Merge tag 'trace-v5.4-3' of git://git./linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt:
 "A few more tracing fixes:

   - Fix a buffer overflow by checking nr_args correctly in probes

   - Fix a warning that is reported by clang

   - Fix a possible memory leak in error path of filter processing

   - Fix the selftest that checks for failures, but wasn't failing

   - Minor clean up on call site output of a memory trace event"

* tag 'trace-v5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  selftests/ftrace: Fix same probe error test
  mm, tracing: Print symbol name for call_site in trace events
  tracing: Have error path in predicate_parse() free its allocated memory
  tracing: Fix clang -Wint-in-bool-context warnings in IF_ASSIGN macro
  tracing/probe: Fix to check the difference of nr_args before adding probe

4 years agoMerge tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Linus Torvalds [Mon, 30 Sep 2019 16:21:53 +0000 (09:21 -0700)]
Merge tag 'mmc-v5.4-2' of git://git./linux/kernel/git/ulfh/mmc

Pull more MMC updates from Ulf Hansson:
 "A couple more updates/fixes for MMC:

   - sdhci-pci: Add Genesys Logic GL975x support

   - sdhci-tegra: Recover loss in throughput for DMA

   - sdhci-of-esdhc: Fix DMA bug"

* tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: host: sdhci-pci: Add Genesys Logic GL975x support
  mmc: tegra: Implement ->set_dma_mask()
  mmc: sdhci: Let drivers define their DMA mask
  mmc: sdhci-of-esdhc: set DMA snooping based on DMA coherence
  mmc: sdhci: improve ADMA error reporting

4 years agocsky: Move static keyword to the front of declaration
Krzysztof Wilczynski [Tue, 3 Sep 2019 11:36:51 +0000 (13:36 +0200)]
csky: Move static keyword to the front of declaration

Move the static keyword to the front of declaration of
csky_pmu_of_device_ids, and resolve the following compiler
warning that can be seen when building with warnings
enabled (W=1):

arch/csky/kernel/perf_event.c:1340:1: warning:
  ‘static’ is not at beginning of declaration [-Wold-style-declaration]

Signed-off-by: Krzysztof Wilczynski <kw@linux.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
4 years agocsky: entry: Remove unneeded need_resched() loop
Valentin Schneider [Mon, 23 Sep 2019 14:36:14 +0000 (15:36 +0100)]
csky: entry: Remove unneeded need_resched() loop

Since the enabling and disabling of IRQs within preempt_schedule_irq()
is contained in a need_resched() loop, we don't need the outer arch
code loop.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
4 years agoMerge tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Mon, 30 Sep 2019 02:52:52 +0000 (19:52 -0700)]
Merge tag 'char-misc-5.4-rc1' of git://git./linux/kernel/git/gregkh/char-misc

Pull Documentation/process update from Greg KH:
 "Here are two small Documentation/process/embargoed-hardware-issues.rst
  file updates that missed my previous char/misc pull request.

  The first one adds an Intel representative for the process, and the
  second one cleans up the text a bit more when it comes to how the
  disclosure rules work, as it was a bit confusing to some companies"

* tag 'char-misc-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  Documentation/process: Clarify disclosure rules
  Documentation/process: Volunteer as the ambassador for Intel

4 years agoMerge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Mon, 30 Sep 2019 02:42:07 +0000 (19:42 -0700)]
Merge branch 'work.misc' of git://git./linux/kernel/git/viro/vfs

Pull more vfs updates from Al Viro:
 "A couple of misc patches"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  afs dynroot: switch to simple_dir_operations
  fs/handle.c - fix up kerneldoc

4 years agoMerge tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Mon, 30 Sep 2019 02:37:32 +0000 (19:37 -0700)]
Merge tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull more cifs updates from Steve French:
 "Fixes from the recent SMB3 Test events and Storage Developer
  Conference (held the last two weeks).

  Here are nine smb3 patches including an important patch for debugging
  traces with wireshark, with three patches marked for stable.

  Additional fixes from last week to better handle some newly discovered
  reparse points, and a fix the create/mkdir path for setting the mode
  more atomically (in SMB3 Create security descriptor context), and one
  for path name processing are still being tested so are not included
  here"

* tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  CIFS: Fix oplock handling for SMB 2.1+ protocols
  smb3: missing ACL related flags
  smb3: pass mode bits into create calls
  smb3: Add missing reparse tags
  CIFS: fix max ea value size
  fs/cifs/sess.c: Remove set but not used variable 'capabilities'
  fs/cifs/smb2pdu.c: Make SMB2_notify_init static
  smb3: fix leak in "open on server" perf counter
  smb3: allow decryption keys to be dumped by admin for debugging

4 years agocsky: Fixup csky_pmu.max_period assignment
Mao Han [Wed, 25 Sep 2019 09:23:02 +0000 (17:23 +0800)]
csky: Fixup csky_pmu.max_period assignment

The csky_pmu.max_period has type u64, and BIT() can only return
32 bits unsigned long on C-SKY. The initialization for max_period
will be incorrect when count_width is bigger than 32.

Use BIT_ULL()

Signed-off-by: Mao Han <han_mao@c-sky.com>
Signed-off-by: Guo Ren <ren_guo@c-sky.com>
4 years agocsky: Fixup add zero_fp fixup perf backtrace panic
Guo Ren [Wed, 25 Sep 2019 11:56:16 +0000 (19:56 +0800)]
csky: Fixup add zero_fp fixup perf backtrace panic

We need set fp zero to let backtrace know the end. The patch fixup perf
callchain panic problem, because backtrace didn't know what is the end
of fp.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Reported-by: Mao Han <han_mao@c-sky.com>
4 years agocsky: Use generic free_initrd_mem()
Mike Rapoport [Wed, 28 Aug 2019 13:35:19 +0000 (16:35 +0300)]
csky: Use generic free_initrd_mem()

The csky implementation of free_initrd_mem() is an open-coded version of
free_reserved_area() without poisoning.

Remove it and make csky use the generic version of free_initrd_mem().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
4 years agoMerge branch 'entropy'
Linus Torvalds [Mon, 30 Sep 2019 02:25:39 +0000 (19:25 -0700)]
Merge branch 'entropy'

Merge active entropy generation updates.

This is admittedly partly "for discussion".  We need to have a way
forward for the boot time deadlocks where user space ends up waiting for
more entropy, but no entropy is forthcoming because the system is
entirely idle just waiting for something to happen.

While this was triggered by what is arguably a user space bug with
GDM/gnome-session asking for secure randomness during early boot, when
they didn't even need any such truly secure thing, the issue ends up
being that our "getrandom()" interface is prone to that kind of
confusion, because people don't think very hard about whether they want
to block for sufficient amounts of entropy.

The approach here-in is to decide to not just passively wait for entropy
to happen, but to start actively collecting it if it is missing.  This
is not necessarily always possible, but if the architecture has a CPU
cycle counter, there is a fair amount of noise in the exact timings of
reasonably complex loads.

We may end up tweaking the load and the entropy estimates, but this
should be at least a reasonable starting point.

As part of this, we also revert the revert of the ext4 IO pattern
improvement that ended up triggering the reported lack of external
entropy.

* getrandom() active entropy waiting:
  Revert "Revert "ext4: make __ext4_get_inode_loc plug""
  random: try to actively add entropy rather than passively wait for it

4 years agoRevert "Revert "ext4: make __ext4_get_inode_loc plug""
Linus Torvalds [Mon, 30 Sep 2019 00:59:23 +0000 (17:59 -0700)]
Revert "Revert "ext4: make __ext4_get_inode_loc plug""

This reverts commit 72dbcf72156641fde4d8ea401e977341bfd35a05.

Instead of waiting forever for entropy that may just not happen, we now
try to actively generate entropy when required, and are thus hopefully
avoiding the problem that caused the nice ext4 IO pattern fix to be
reverted.

So revert the revert.

Cc: Ahmed S. Darwish <darwish.07@gmail.com>
Cc: Ted Ts'o <tytso@mit.edu>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4 years agorandom: try to actively add entropy rather than passively wait for it
Linus Torvalds [Sat, 28 Sep 2019 23:53:52 +0000 (16:53 -0700)]
random: try to actively add entropy rather than passively wait for it

For 5.3 we had to revert a nice ext4 IO pattern improvement, because it
caused a bootup regression due to lack of entropy at bootup together
with arguably broken user space that was asking for secure random
numbers when it really didn't need to.

See commit 72dbcf721566 (Revert "ext4: make __ext4_get_inode_loc plug").

This aims to solve the issue by actively generating entropy noise using
the CPU cycle counter when waiting for the random number generator to
initialize.  This only works when you have a high-frequency time stamp
counter available, but that's the case on all modern x86 CPU's, and on
most other modern CPU's too.

What we do is to generate jitter entropy from the CPU cycle counter
under a somewhat complex load: calling the scheduler while also
guaranteeing a certain amount of timing noise by also triggering a
timer.

I'm sure we can tweak this, and that people will want to look at other
alternatives, but there's been a number of papers written on jitter
entropy, and this should really be fairly conservative by crediting one
bit of entropy for every timer-induced jump in the cycle counter.  Not
because the timer itself would be all that unpredictable, but because
the interaction between the timer and the loop is going to be.

Even if (and perhaps particularly if) the timer actually happens on
another CPU, the cacheline interaction between the loop that reads the
cycle counter and the timer itself firing is going to add perturbations
to the cycle counter values that get mixed into the entropy pool.

As Thomas pointed out, with a modern out-of-order CPU, even quite simple
loops show a fair amount of hard-to-predict timing variability even in
the absense of external interrupts.  But this tries to take that further
by actually having a fairly complex interaction.

This is not going to solve the entropy issue for architectures that have
no CPU cycle counter, but it's not clear how (and if) that is solvable,
and the hardware in question is largely starting to be irrelevant.  And
by doing this we can at least avoid some of the even more contentious
approaches (like making the entropy waiting time out in order to avoid
the possibly unbounded waiting).

Cc: Ahmed Darwish <darwish.07@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Nicholas Mc Guire <hofrat@opentech.at>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Alexander E. Patrakov <patrakov@gmail.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4 years agoMerge tag 'fixes-5.4-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git...
Olof Johansson [Sun, 29 Sep 2019 18:19:25 +0000 (11:19 -0700)]
Merge tag 'fixes-5.4-merge-window' of git://git./linux/kernel/git/tmlind/linux-omap into arm/fixes

Fixes for omap variants

Few fixes for ti-sysc interconnect target module driver for no-idle
quirks that caused nfsroot to fail on some dra7 boards.

And let's fixes to get LCD working again for logicpd board that got
broken a while back with removal of panel-dpi driver. We need to now
use generic CONFIG_DRM_PANEL_SIMPLE instead.

* tag 'fixes-5.4-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  bus: ti-sysc: Remove unpaired sysc_clkdm_deny_idle()
  ARM: dts: logicpd-som-lv: Fix i2c2 and i2c3 Pin mux
  ARM: dts: am3517-evm: Fix missing video
  ARM: dts: logicpd-torpedo-baseboard: Fix missing video
  ARM: omap2plus_defconfig: Fix missing video
  bus: ti-sysc: Fix handling of invalid clocks
  bus: ti-sysc: Fix clock handling for no-idle quirks

Link: https://lore.kernel.org/r/pull-1568819401-72461@atomide.com
Signed-off-by: Olof Johansson <olof@lixom.net>
4 years agoMerge tag 'scmi-fixes-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep...
Olof Johansson [Sun, 29 Sep 2019 18:19:18 +0000 (11:19 -0700)]
Merge tag 'scmi-fixes-5.4' of git://git./linux/kernel/git/sudeep.holla/linux into arm/fixes

ARM SCMI fixes for v5.4

Couple of fixes: one in scmi reset driver initialising missed scmi handle
and an other in scmi reset API implementation fixing the assignment of
reset state

* tag 'scmi-fixes-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  reset: reset-scmi: add missing handle initialisation
  firmware: arm_scmi: reset: fix reset_state assignment in scmi_domain_reset

Link: https://lore.kernel.org/r/20190918142139.GA4370@bogus
Signed-off-by: Olof Johansson <olof@lixom.net>
4 years agoMerge tag 'libnvdimm-fixes-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 29 Sep 2019 17:33:41 +0000 (10:33 -0700)]
Merge tag 'libnvdimm-fixes-5.4-rc1' of git://git./linux/kernel/git/nvdimm/nvdimm

More libnvdimm updates from Dan Williams:

 - Complete the reworks to interoperate with powerpc dynamic huge page
   sizes

 - Fix a crash due to missed accounting for the powerpc 'struct
   page'-memmap mapping granularity

 - Fix badblock initialization for volatile (DRAM emulated) pmem ranges

 - Stop triggering request_key() notifications to userspace when
   NVDIMM-security is disabled / not present

 - Miscellaneous small fixups

* tag 'libnvdimm-fixes-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm/region: Enable MAP_SYNC for volatile regions
  libnvdimm: prevent nvdimm from requesting key when security is disabled
  libnvdimm/region: Initialize bad block for volatile namespaces
  libnvdimm/nfit_test: Fix acpi_handle redefinition
  libnvdimm/altmap: Track namespace boundaries in altmap
  libnvdimm: Fix endian conversion issues 
  libnvdimm/dax: Pick the right alignment default when creating dax devices
  powerpc/book3s64: Export has_transparent_hugepage() related functions.

4 years agoMerge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
Linus Torvalds [Sun, 29 Sep 2019 17:24:23 +0000 (10:24 -0700)]
Merge branch 'linus' of git://git./linux/kernel/git/evalenti/linux-soc-thermal

Pull thermal SoC updates from Eduardo Valentin:
 "This is a really small pull in the midst of a lot of pending patches.

  We are in the middle of restructuring how we are maintaining the
  thermal subsystem, as per discussion in our last LPC. For now, I am
  sending just some changes that were pending in my tree. Looking
  forward to get a more streamlined process in the next merge window"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  thermal: db8500: Rewrite to be a pure OF sensor
  thermal: db8500: Use dev helper variable
  thermal: db8500: Finalize device tree conversion
  thermal: thermal_mmio: remove some dead code

4 years agoMerge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 29 Sep 2019 17:20:16 +0000 (10:20 -0700)]
Merge branch 'i2c/for-next' of git://git./linux/kernel/git/wsa/linux

Pull  more i2c updates from Wolfram Sang:

 - make Lenovo Yoga C630 boot now that the dependencies are merged

 - restore BlockProcessCall for i801, accidently removed in this merge
   window

 - a bugfix for the riic driver

 - an improvement to the slave-eeprom driver which should have been in
   the first pull request but sadly got lost in the process

* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: slave-eeprom: Add read only mode
  i2c: i801: Bring back Block Process Call support for certain platforms
  i2c: riic: Clear NACK in tend isr
  i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630

4 years agoMerge tag 'iommu-fixes-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 29 Sep 2019 17:00:14 +0000 (10:00 -0700)]
Merge tag 'iommu-fixes-5.4-rc1' of git://git./linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:
 "A couple of fixes for the AMD IOMMU driver have piled up:

   - Some fixes for the reworked IO page-table which caused memory leaks
     or did not allow to downgrade mappings under some conditions.

   - Locking fixes to fix a couple of possible races around accessing
     'struct protection_domain'. The races got introduced when the
     dma-ops path became lock-less in the fast-path"

* tag 'iommu-fixes-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/amd: Lock code paths traversing protection_domain->dev_list
  iommu/amd: Lock dev_data in attach/detach code paths
  iommu/amd: Check for busy devices earlier in attach_device()
  iommu/amd: Take domain->lock for complete attach/detach path
  iommu/amd: Remove amd_iommu_devtable_lock
  iommu/amd: Remove domain->updated
  iommu/amd: Wait for completion of IOTLB flush in attach_device
  iommu/amd: Unmap all L7 PTEs when downgrading page-sizes
  iommu/amd: Introduce first_pte_l7() helper
  iommu/amd: Fix downgrading default page-sizes in alloc_pte()
  iommu/amd: Fix pages leak in free_pagetable()

4 years agoDocumentation/process: Clarify disclosure rules
Thomas Gleixner [Wed, 25 Sep 2019 08:29:49 +0000 (10:29 +0200)]
Documentation/process: Clarify disclosure rules

The role of the contact list provided by the disclosing party and how it
affects the disclosure process and the ability to include experts into
the development process is not really well explained.

Neither is it entirely clear when the disclosing party will be informed
about the fact that a developer who is not covered by an employer NDA needs
to be brought in and disclosed.

Explain the role of the contact list and the information policy along with
an eventual conflict resolution better.

Reported-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.1909251028390.10825@nanos.tec.linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Linus Torvalds [Sun, 29 Sep 2019 00:47:33 +0000 (17:47 -0700)]
Merge git://git./linux/kernel/git/netdev/net

Pull networking fixes from David Miller:

 1) Sanity check URB networking device parameters to avoid divide by
    zero, from Oliver Neukum.

 2) Disable global multicast filter in NCSI, otherwise LLDP and IPV6
    don't work properly. Longer term this needs a better fix tho. From
    Vijay Khemka.

 3) Small fixes to selftests (use ping when ping6 is not present, etc.)
    from David Ahern.

 4) Bring back rt_uses_gateway member of struct rtable, it's semantics
    were not well understood and trying to remove it broke things. From
    David Ahern.

 5) Move usbnet snaity checking, ignore endpoints with invalid
    wMaxPacketSize. From Bjørn Mork.

 6) Missing Kconfig deps for sja1105 driver, from Mao Wenan.

 7) Various small fixes to the mlx5 DR steering code, from Alaa Hleihel,
    Alex Vesker, and Yevgeny Kliteynik

 8) Missing CAP_NET_RAW checks in various places, from Ori Nimron.

 9) Fix crash when removing sch_cbs entry while offloading is enabled,
    from Vinicius Costa Gomes.

10) Signedness bug fixes, generally in looking at the result given by
    of_get_phy_mode() and friends. From Dan Crapenter.

11) Disable preemption around BPF_PROG_RUN() calls, from Eric Dumazet.

12) Don't create VRF ipv6 rules if ipv6 is disabled, from David Ahern.

13) Fix quantization code in tcp_bbr, from Kevin Yang.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (127 commits)
  net: tap: clean up an indentation issue
  nfp: abm: fix memory leak in nfp_abm_u32_knode_replace
  tcp: better handle TCP_USER_TIMEOUT in SYN_SENT state
  sk_buff: drop all skb extensions on free and skb scrubbing
  tcp_bbr: fix quantization code to not raise cwnd if not probing bandwidth
  mlxsw: spectrum_flower: Fail in case user specifies multiple mirror actions
  Documentation: Clarify trap's description
  mlxsw: spectrum: Clear VLAN filters during port initialization
  net: ena: clean up indentation issue
  NFC: st95hf: clean up indentation issue
  net: phy: micrel: add Asym Pause workaround for KSZ9021
  net: socionext: ave: Avoid using netdev_err() before calling register_netdev()
  ptp: correctly disable flags on old ioctls
  lib: dimlib: fix help text typos
  net: dsa: microchip: Always set regmap stride to 1
  nfp: flower: fix memory leak in nfp_flower_spawn_vnic_reprs
  nfp: flower: prevent memory leak in nfp_flower_spawn_phy_reprs
  net/sched: Set default of CONFIG_NET_TC_SKB_EXT to N
  vrf: Do not attempt to create IPv6 mcast rule if IPv6 is disabled
  net: sched: sch_sfb: don't call qdisc_put() while holding tree lock
  ...

4 years agoMerge branch 'hugepage-fallbacks' (hugepatch patches from David Rientjes)
Linus Torvalds [Sat, 28 Sep 2019 21:26:47 +0000 (14:26 -0700)]
Merge branch 'hugepage-fallbacks' (hugepatch patches from David Rientjes)

Merge hugepage allocation updates from David Rientjes:
 "We (mostly Linus, Andrea, and myself) have been discussing offlist how
  to implement a sane default allocation strategy for hugepages on NUMA
  platforms.

  With these reverts in place, the page allocator will happily allocate
  a remote hugepage immediately rather than try to make a local hugepage
  available. This incurs a substantial performance degradation when
  memory compaction would have otherwise made a local hugepage
  available.

  This series reverts those reverts and attempts to propose a more sane
  default allocation strategy specifically for hugepages. Andrea
  acknowledges this is likely to fix the swap storms that he originally
  reported that resulted in the patches that removed __GFP_THISNODE from
  hugepage allocations.

  The immediate goal is to return 5.3 to the behavior the kernel has
  implemented over the past several years so that remote hugepages are
  not immediately allocated when local hugepages could have been made
  available because the increased access latency is untenable.

  The next goal is to introduce a sane default allocation strategy for
  hugepages allocations in general regardless of the configuration of
  the system so that we prevent thrashing of local memory when
  compaction is unlikely to succeed and can prefer remote hugepages over
  remote native pages when the local node is low on memory."

Note on timing: this reverts the hugepage VM behavior changes that got
introduced fairly late in the 5.3 cycle, and that fixed a huge
performance regression for certain loads that had been around since
4.18.

Andrea had this note:

 "The regression of 4.18 was that it was taking hours to start a VM
  where 3.10 was only taking a few seconds, I reported all the details
  on lkml when it was finally tracked down in August 2018.

     https://lore.kernel.org/linux-mm/20180820032640.9896-2-aarcange@redhat.com/

  __GFP_THISNODE in MADV_HUGEPAGE made the above enterprise vfio
  workload degrade like in the "current upstream" above. And it still
  would have been that bad as above until 5.3-rc5"

where the bad behavior ends up happening as you fill up a local node,
and without that change, you'd get into the nasty swap storm behavior
due to compaction working overtime to make room for more memory on the
nodes.

As a result 5.3 got the two performance fix reverts in rc5.

However, David Rientjes then noted that those performance fixes in turn
regressed performance for other loads - although not quite to the same
degree.  He suggested reverting the reverts and instead replacing them
with two small changes to how hugepage allocations are done (patch
descriptions rephrased by me):

 - "avoid expensive reclaim when compaction may not succeed": just admit
   that the allocation failed when you're trying to allocate a huge-page
   and compaction wasn't successful.

 - "allow hugepage fallback to remote nodes when madvised": when that
   node-local huge-page allocation failed, retry without forcing the
   local node.

but by then I judged it too late to replace the fixes for a 5.3 release.
So 5.3 was released with behavior that harked back to the pre-4.18 logic.

But now we're in the merge window for 5.4, and we can see if this
alternate model fixes not just the horrendous swap storm behavior, but
also restores the performance regression that the late reverts caused.

Fingers crossed.

* emailed patches from David Rientjes <rientjes@google.com>:
  mm, page_alloc: allow hugepage fallback to remote nodes when madvised
  mm, page_alloc: avoid expensive reclaim when compaction may not succeed
  Revert "Revert "Revert "mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask""
  Revert "Revert "mm, thp: restore node-local hugepage allocations""

4 years agoselftests/ftrace: Fix same probe error test
Steven Rostedt (VMware) [Fri, 27 Sep 2019 15:10:22 +0000 (11:10 -0400)]
selftests/ftrace: Fix same probe error test

The "same probe" selftest that tests that adding the same probe fails
doesn't add the same probe and passes, which fails the test.

Fixes: b78b94b82122 ("selftests/ftrace: Update kprobe event error testcase")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
4 years agomm, tracing: Print symbol name for call_site in trace events
Changbin Du [Sat, 14 Sep 2019 10:32:15 +0000 (18:32 +0800)]
mm, tracing: Print symbol name for call_site in trace events

To improve the readability of raw slab trace points, print the call_site ip
using '%pS'. Then we can grep events with function names.

[002] ....   808.188897: kmem_cache_free: call_site=putname+0x47/0x50 ptr=00000000cef40c80
[002] ....   808.188898: kfree: call_site=security_cred_free+0x42/0x50 ptr=0000000062400820
[002] ....   808.188904: kmem_cache_free: call_site=put_cred_rcu+0x88/0xa0 ptr=0000000058d74ef8
[002] ....   808.188913: kmem_cache_alloc: call_site=prepare_creds+0x26/0x100 ptr=0000000058d74ef8 bytes_req=168 bytes_alloc=576 gfp_flags=GFP_KERNEL
[002] ....   808.188917: kmalloc: call_site=security_prepare_creds+0x77/0xa0 ptr=0000000062400820 bytes_req=8 bytes_alloc=336 gfp_flags=GFP_KERNEL|__GFP_ZERO
[002] ....   808.188920: kmem_cache_alloc: call_site=getname_flags+0x4f/0x1e0 ptr=00000000cef40c80 bytes_req=4096 bytes_alloc=4480 gfp_flags=GFP_KERNEL
[002] ....   808.188925: kmem_cache_free: call_site=putname+0x47/0x50 ptr=00000000cef40c80
[002] ....   808.188926: kfree: call_site=security_cred_free+0x42/0x50 ptr=0000000062400820
[002] ....   808.188931: kmem_cache_free: call_site=put_cred_rcu+0x88/0xa0 ptr=0000000058d74ef8

Link: http://lkml.kernel.org/r/20190914103215.23301-1-changbin.du@gmail.com
Signed-off-by: Changbin Du <changbin.du@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
4 years agotracing: Have error path in predicate_parse() free its allocated memory
Navid Emamdoost [Fri, 20 Sep 2019 22:57:59 +0000 (17:57 -0500)]
tracing: Have error path in predicate_parse() free its allocated memory

In predicate_parse, there is an error path that is not going to
out_free instead it returns directly which leads to a memory leak.

Link: http://lkml.kernel.org/r/20190920225800.3870-1-navid.emamdoost@gmail.com
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>