platform/kernel/linux-starfive.git
3 years agoMerge tag 'omap-for-v5.11/genpd-rest-signed' of git://git.kernel.org/pub/scm/linux...
Arnd Bergmann [Wed, 9 Dec 2020 20:15:50 +0000 (21:15 +0100)]
Merge tag 'omap-for-v5.11/genpd-rest-signed' of git://git./linux/kernel/git/tmlind/linux-omap into arm/omap-genpd

Remaining genpd changes for omaps for v5.11

This series contains the remaining genpd changes for omap4/5,
and dra7 to add the power domain and reset control data to
omap-prm driver. We also update several devices to probe without
platform data to get us closer to booting omap4/5, and dra7
without platform data.

There is also a build fix for the earlier am437x series that
I should have applied into a separate branch on top of the
am437x breaking commit. It ended here as I was originally
planning to send out a single pull request for all the genpd
changes, but then decided to break it down to smaller chunks.
It's all really a larger single git branch though, so this
should be OK and I really did not want to start reorganizing
the branch after testing it and having it sit in Linux next.

The changes done here are:

- Clock driver needs idlest check dropped for IVA for omap4
  and dra7

- Add remaining power domain and reset control data to
  omap-prm driver for omap4/5 and dra7

- Add device tree data for remaining power domains and
  reset control for omap4/5 and dra7 dts files

- Update dss, dsp, iva and gpmc dts files to use genpd
  and to drop the remaining platform data

- Update dss for omap5 to use genpd

- Update dra7 iva to to use genpd and to drop the remaining
  platform data

* tag 'omap-for-v5.11/genpd-rest-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: Fix am4 only build after genpd changes
  ARM: dts: Configure power domain for omap5 dss
  ARM: dts: omap5: add remaining PRM instances
  soc: ti: omap-prm: omap5: add genpd support for remaining PRM instances
  ARM: OMAP2+: Drop legacy platform data for dra7 gpmc
  ARM: dts: Configure interconnect target module for dra7 iva
  ARM: dts: dra7: add remaining PRM instances
  soc: ti: omap-prm: dra7: add genpd support for remaining PRM instances
  clk: ti: dra7: Drop idlest polling from IVA clkctrl clocks
  ARM: OMAP2+: Drop legacy platform data for omap4 gpmc
  ARM: OMAP2+: Drop legacy platform data for omap4 iva
  ARM: dts: Configure power domain for omap4 dsp
  ARM: dts: Configure power domain for omap4 dss
  ARM: dts: omap4: add remaining PRM instances
  soc: ti: omap-prm: omap4: add genpd support for remaining PRM instances
  clk: ti: omap4: Drop idlest polling from IVA clkctrl clocks

Link: https://lore.kernel.org/r/pull-1606806458-694517@atomide.com-4
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 years agoMerge tag 'omap-for-v5.11/genpd-am437x-signed' of git://git.kernel.org/pub/scm/linux...
Arnd Bergmann [Wed, 9 Dec 2020 20:13:41 +0000 (21:13 +0100)]
Merge tag 'omap-for-v5.11/genpd-am437x-signed' of git://git./linux/kernel/git/tmlind/linux-omap into arm/omap-genpd

Update am473x to boot without platform data

Similar to am335x, we can now update am437x dts files to boot
with genpd and simple-pm-bus, and drop the related platform data.

To do that, we need to do the following changes for am437x:

- Update the clock driver to keep the l3_main clock always on for
  suspend and resume to work

- Add power domain and reset controller data to omap-prm driver

- Configure interconnect clocks for system timers as those are
  now managed separately by the drivers/clocksource drivers

- Update control module, wkup_m3, emif, ocmcram, mpuss and l3_noc
  for device tree data and drop the legacy platform data

- Update the interconnect instances to boot with gendp and
  simple-pm-bus

- Drop the remaining platform data for am437x

* tag 'omap-for-v5.11/genpd-am437x-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: Drop legacy remaining legacy platform data for am4
  ARM: dts: Use simple-pm-bus for genpd for am4 l3
  ARM: dts: Move am4 l3 noc to a separate node
  ARM: dts: Use simple-pm-bus for genpd for am4 l4_per
  ARM: dts: Use simple-pm-bus for genpd for am4 l4_fast
  ARM: dts: Use simple-pm-bus for genpd for am4 l4_wkup
  ARM: OMAP2+: Drop legacy platform data for am4 mpuss
  ARM: OMAP2+: Drop legacy platform data for am4 ocmcram
  ARM: OMAP2+: Drop legacy platform data for am4 emif
  ARM: OMAP2+: Drop legacy platform data for am4 wkup_m3
  ARM: dts: Configure interconnect target module for am4 wkup_m3
  ARM: dts: Configure RTC powerdomain for am4
  ARM: OMAP2+: Drop legacy platform data for am4 control module
  ARM: dts: Configure also interconnect clocks for am4 system timer
  ARM: dts: am43xx: add remaining PRM instances
  soc: ti: omap-prm: am4: add genpd support for remaining PRM instances
  clk: ti: am437x: Keep am4 l3 main clock always on for genpd

Link: https://lore.kernel.org/r/pull-1606806458-694517@atomide.com-3
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 years agoMerge tag 'omap-for-v5.11/genpd-am335x-signed' of git://git.kernel.org/pub/scm/linux...
Arnd Bergmann [Wed, 9 Dec 2020 20:12:09 +0000 (21:12 +0100)]
Merge tag 'omap-for-v5.11/genpd-am335x-signed' of git://git./linux/kernel/git/tmlind/linux-omap into arm/omap-genpd

Update am335x to boot without platform data

With the driver updates done for genpd support, we can now update
am335x dts files to boot with genpd and simple-pm-bus, and drop
the related platform data.

To do that, we need to do the following changes for am335x:

- Add the remaining power domain and reset controller instances

- Configure interconnect clocks for system timers as those are
  now managed separately by the drivers/clocksource drivers

- Update control module, RTC, gpmc, debugss, emif, ocmcram,
  instr, and mpuss for device tree data and drop the legacy
  platform data

- Update the interconnect instances to boot with gendp and
  simple-pm-bus

- Drop the remaining platform data for am335x

- Add kconfig option for OMAP_HWMOD to build it only for the
  SoCs that need it

* tag 'omap-for-v5.11/genpd-am335x-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: Build hwmod related code as needed
  ARM: OMAP2+: Drop legacy remaining legacy platform data for am3
  ARM: dts: Use simple-pm-bus for genpd for am3 l3
  ARM: dts: Use simple-pm-bus for genpd for am3 l4_per
  ARM: dts: Use simple-pm-bus for genpd for am3 l4_fast
  ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup
  ARM: OMAP2+: Drop legacy platform data for am3 mpuss
  ARM: OMAP2+: Drop legacy platform data for am3 instr
  ARM: OMAP2+: Drop legacy platform data for am3 ocmcram
  ARM: OMAP2+: Drop legacy platform data for am3 emif
  ARM: OMAP2+: Drop legacy platform data for am3 debugss
  ARM: OMAP2+: Drop legacy platform data for am3 and am4 gpmc
  ARM: OMAP2+: Drop legacy platform data for am3 wkup_m3
  ARM: dts: Configure interconnect target module for am3 wkup_m3
  ARM: dts: Configure RTC powerdomain for am3
  ARM: OMAP2+: Drop legacy platform data for am3 control module
  ARM: dts: Configure also interconnect clocks for am4 system timer
  ARM: dts: am33xx: add remaining PRM instances

Link: https://lore.kernel.org/r/pull-1606806458-694517@atomide.com-2
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 years agoMerge tag 'omap-for-v5.11/genpd-drivers-signed' of git://git.kernel.org/pub/scm/linux...
Arnd Bergmann [Wed, 9 Dec 2020 20:11:35 +0000 (21:11 +0100)]
Merge tag 'omap-for-v5.11/genpd-drivers-signed' of git://git./linux/kernel/git/tmlind/linux-omap into arm/omap-genpd

Driver changes for omaps for genpd for v5.11 merge window

This series of changes allows booting am335x with genpd and
device tree data without the legacy platform data. Also at
least am437x can be booted with gendp with power domain and
dts data. The SoC specific dts changes will be a separate
pull request.

We need the following driver changes merged before the dts
changes can be done:

- platform code needs a few improvments to probe l4_wkup first
  for clocks, and to bail out when there is no platform data

- ti-sysc driver needs a non-urgent fix for asserting rstctrl
  reset only after disabling the clocks, to probe modules with
  no known control registers, and added quirk handling for gpmc
  devices

- omap-prm driver needs a non-urgent fix for reset status bit,
  support added for pm_clk, and then we add the rest of am335x
  power domain data

- clock driver for am335x needs to keep l3_main clock enabled
  with genpd for suspend and resume to work

- wkup_m3 remoteproc driver needs support added for reset
  control if available instead of the legacy pdata callbacks

- pm33xx driver needs PM runtime support added for genpd

The am335x specific driver changes for the clock, wkup_m3,
pm33xx and remoteproc drivers are quite trivial and have not
caused merge conflicts in Linux next. I did not get acks for
these changes except from Santosh but had already pushed out
the branch already at that point. So I've added the related
driver maintainers to Cc.

* tag 'omap-for-v5.11/genpd-drivers-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  remoteproc/wkup_m3: Use reset control driver if available
  soc: ti: pm33xx: Enable basic PM runtime support for genpd
  soc: ti: omap-prm: am3: add genpd support for remaining PRM instances
  soc: ti: omap-prm: Add pm_clk for genpd
  clk: ti: am33xx: Keep am3 l3 main clock always on for genpd
  bus: ti-sysc: Implement GPMC debug quirk to drop platform data
  bus: ti-sysc: Support modules without control registers
  ARM: OMAP2+: Probe PRCM first to probe l4_wkup with simple-pm-bus
  ARM: OMAP2+: Check for inited flag
  bus: ti-sysc: Assert reset only after disabling clocks
  soc: ti: omap-prm: Do not check rstst bit on deassert if already deasserted
  bus: ti-sysc: Fix bogus resetdone warning on enable for cpsw
  bus: ti-sysc: Fix reset status check for modules with quirks
  ARM: OMAP2+: Fix missing select PM_GENERIC_DOMAINS_OF
  ARM: OMAP2+: Fix location for select PM_GENERIC_DOMAINS

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
3 years agoARM: OMAP2+: Fix am4 only build after genpd changes
Tony Lindgren [Fri, 27 Nov 2020 06:13:25 +0000 (08:13 +0200)]
ARM: OMAP2+: Fix am4 only build after genpd changes

With commit df6c2ec872a6 ("ARM: OMAP2+: Drop legacy remaining legacy
platform data for am4") we moved am4 to boot with simple-pm-bus using
genpd and devicetree based data. But I forgot to test am4 only build
that still has few references to the old platform data left, and cause
undefined reference errors with omap_hwmod_set_postsetup_state and
omap_hwmod_for_each. We can just drop the related calls for am4 now,
and also drop the references to unused struct wkup_m3_platform_data.

Reported-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure power domain for omap5 dss
Tony Lindgren [Thu, 19 Nov 2020 12:50:46 +0000 (14:50 +0200)]
ARM: dts: Configure power domain for omap5 dss

This allows shutting down dss domain when the screen blanks.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: omap5: add remaining PRM instances
Tero Kristo [Thu, 12 Nov 2020 08:59:11 +0000 (10:59 +0200)]
ARM: dts: omap5: add remaining PRM instances

Add remaining PRM instances for the omap5 SoC. Additionally enable the
genpd support for them.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: omap5: add genpd support for remaining PRM instances
Tero Kristo [Fri, 21 Aug 2020 12:53:32 +0000 (15:53 +0300)]
soc: ti: omap-prm: omap5: add genpd support for remaining PRM instances

Add genpd support for mpu, dsp, coreaon, core, iva, cam, dss, gpu,
l3init, custefuse, wkupaon and emu instances.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for dra7 gpmc
Tony Lindgren [Mon, 19 Oct 2020 07:45:58 +0000 (10:45 +0300)]
ARM: OMAP2+: Drop legacy platform data for dra7 gpmc

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure interconnect target module for dra7 iva
Tony Lindgren [Thu, 12 Nov 2020 09:57:03 +0000 (11:57 +0200)]
ARM: dts: Configure interconnect target module for dra7 iva

We can now probe devices with device tree only configuration using
ti-sysc interconnect target module driver.

Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: dra7: add remaining PRM instances
Tero Kristo [Wed, 11 Nov 2020 13:57:20 +0000 (15:57 +0200)]
ARM: dts: dra7: add remaining PRM instances

Add remaining PRM instances for the dra7 SoC. Additionally enable the
genpd support for them.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: dra7: add genpd support for remaining PRM instances
Tero Kristo [Wed, 11 Nov 2020 13:13:54 +0000 (15:13 +0200)]
soc: ti: omap-prm: dra7: add genpd support for remaining PRM instances

Add genpd support for mpu, dsp, ipu, coreaon, core, iva, cam, dss, gpu,
l3init, l4per, custefuse, wkupaon, emu, eve, rtc and vpe instances.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoclk: ti: dra7: Drop idlest polling from IVA clkctrl clocks
Tony Lindgren [Thu, 19 Nov 2020 12:24:29 +0000 (14:24 +0200)]
clk: ti: dra7: Drop idlest polling from IVA clkctrl clocks

Similar to what we've done for IPU and DSP let's ignore the status bit
for the IVA clkctrl register.

The clkctrl status won't change unless the related rstctrl is deasserted,
and the rstctrl status won't change unless the clkctrl is enabled.

Cc: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Suman Anna <s-anna@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for omap4 gpmc
Tony Lindgren [Thu, 19 Nov 2020 12:19:01 +0000 (14:19 +0200)]
ARM: OMAP2+: Drop legacy platform data for omap4 gpmc

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for omap4 iva
Tony Lindgren [Thu, 19 Nov 2020 12:18:54 +0000 (14:18 +0200)]
ARM: OMAP2+: Drop legacy platform data for omap4 iva

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure power domain for omap4 dsp
Tony Lindgren [Thu, 19 Nov 2020 12:18:45 +0000 (14:18 +0200)]
ARM: dts: Configure power domain for omap4 dsp

This allows shutting down the dsp domain when not in use.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure power domain for omap4 dss
Tony Lindgren [Thu, 19 Nov 2020 12:18:08 +0000 (14:18 +0200)]
ARM: dts: Configure power domain for omap4 dss

This allows shutting down dss domain when the screen blanks.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: omap4: add remaining PRM instances
Tero Kristo [Thu, 12 Nov 2020 12:21:52 +0000 (14:21 +0200)]
ARM: dts: omap4: add remaining PRM instances

Add remaining PRM instances for the omap4 SoC. Additionally enable the
genpd support for them.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: omap4: add genpd support for remaining PRM instances
Tero Kristo [Wed, 30 Sep 2020 10:48:46 +0000 (13:48 +0300)]
soc: ti: omap-prm: omap4: add genpd support for remaining PRM instances

Add genpd support for mpu, tesla, always_on_core, core, ivahd, cam, dss,
gfx, l3init, l4per, cefuse, wkup and emu instances.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoclk: ti: omap4: Drop idlest polling from IVA clkctrl clocks
Tony Lindgren [Thu, 19 Nov 2020 12:18:17 +0000 (14:18 +0200)]
clk: ti: omap4: Drop idlest polling from IVA clkctrl clocks

Similar to what we've done for IPU and DSP let's ignore the status bit
for the IVA clkctrl register.

The clkctrl status won't change unless the related rstctrl is deasserted,
and the rstctrl status won't change unless the clkctrl is enabled.

Cc: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Suman Anna <s-anna@ti.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy remaining legacy platform data for am4
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy remaining legacy platform data for am4

We can now drop the remaining legacy platform data as we are
probing devices with device tree data.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am4 l3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am4 l3

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Move am4 l3 noc to a separate node
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Move am4 l3 noc to a separate node

In preparation for probing l3 with simple-pm-bus and genpd, we must move
l3 noc to a separate node to prevent omap_l3_noc.c driver from claiming
the whole l3 instance before simple-pm-bus has a chance to probe.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am4 l4_per
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am4 l4_per

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am4 l4_fast
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am4 l4_fast

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am4 l4_wkup
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am4 l4_wkup

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am4 mpuss
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am4 mpuss

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am4 ocmcram
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am4 ocmcram

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Note that we need to use "ti,no-idle" here.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am4 emif
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am4 emif

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am4 wkup_m3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am4 wkup_m3

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

As we're just dropping data, and the early platform data init
is based on the custom ti,hwmods property, we want to drop both
the platform data and ti,hwmods property in a single patch.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure interconnect target module for am4 wkup_m3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure interconnect target module for am4 wkup_m3

We can now probe devices with device tree only configuration using
ti-sysc interconnect target module driver.

Note that we no longer need ti,no-reset-on-init as the rstctrl resets
are properly handled by the reset driver and claimed by the RTC driver.
And we need to squash together the module ranges for driver compability.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure RTC powerdomain for am4
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure RTC powerdomain for am4

For genpd we need the RTC powerdomain configured.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am4 control module
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am4 control module

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

To drop the legacy platform data for am3 control module, we need
to configure the missing functional clock and tag the module to
not idle as platform data also had it configured with
HWMOD_INIT_NO_IDLE.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure also interconnect clocks for am4 system timer
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure also interconnect clocks for am4 system timer

We now manage clocksource and clockevent clocks directly with
timer-ti-dm-systimer. In order to use genpd with prm_omap,
GENPD_FLAG_PM_CLK and simple-pm-bus, we need to keep the system
timer related interconnect clocks enabled until clocksource suspend
is done.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: am43xx: add remaining PRM instances
Tero Kristo [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: am43xx: add remaining PRM instances

Add remaining PRM instances for the am43xx SoC. Additionally enable the
genpd support for them.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: am4: add genpd support for remaining PRM instances
Tero Kristo [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
soc: ti: omap-prm: am4: add genpd support for remaining PRM instances

Add genpd support for mpu, rtc, tamper, cefuse, per and wkup instances.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoclk: ti: am437x: Keep am4 l3 main clock always on for genpd
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
clk: ti: am437x: Keep am4 l3 main clock always on for genpd

In order for suspend and resume to work with genpd on am4, we must keep
l3 main clock always on. Otherwise prm_omap driver will shut down the l3
main clock on suspend when simple-pm-bus and GENPD_FLAG_PM_CLK are used.
Note that we already keep the l3 main clock always on with the legacy
platform code.

Later on we may want to start managing the l3 main clock with a dedicated
interconnect driver instead of using simple-pm-bus and GENPD_FLAG_PM_CLK.

Cc: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Build hwmod related code as needed
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Build hwmod related code as needed

If we have only am3 selected, there's no need to build the
hwmod related code as we are probing devices with device tree
data.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy remaining legacy platform data for am3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy remaining legacy platform data for am3

We can now drop the remaining legacy platform data as we are
probing devices with device tree data.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am3 l3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am3 l3

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am3 l4_per
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am3 l4_per

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am3 l4_fast
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am3 l4_fast

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Use simple-pm-bus for genpd for am3 l4_wkup

We can now enable simple-pm-bus to use genpd.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 mpuss
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 mpuss

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

As we're just dropping data, and the early platform data init
is based on the custom ti,hwmods property, we want to drop both
the platform data and ti,hwmods property in a single patch.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 instr
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 instr

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 ocmcram
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 ocmcram

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Note that we need to use "ti,no-idle" here.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 emif
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 emif

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 debugss
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 debugss

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 and am4 gpmc
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 and am4 gpmc

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

As we're just dropping data, and the early platform data init
is based on the custom ti,hwmods property, we want to drop both
the platform data and ti,hwmods property in a single patch.

Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 wkup_m3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 wkup_m3

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

As we're just dropping data, and the early platform data init
is based on the custom ti,hwmods property, we want to drop both
the platform data and ti,hwmods property in a single patch.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure interconnect target module for am3 wkup_m3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure interconnect target module for am3 wkup_m3

We can now probe devices with device tree only configuration using
ti-sysc interconnect target module driver.

Note that we no longer need ti,no-reset-on-init as the rstctrl resets
are properly handled by the reset driver and claimed by the RTC driver.
And we need to squash together the module ranges for driver compability.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure RTC powerdomain for am3
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure RTC powerdomain for am3

For genpd we need the RTC powerdomain configured.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Drop legacy platform data for am3 control module
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Drop legacy platform data for am3 control module

We can now probe devices with ti-sysc interconnect driver and dts
data. Let's drop the related platform data and custom ti,hwmods
dts property.

To drop the legacy platform data for am3 control module, we need
to configure the missing functional clock and tag the module to
not idle as platform data also had it configured with
HWMOD_INIT_NO_IDLE.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: Configure also interconnect clocks for am4 system timer
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: Configure also interconnect clocks for am4 system timer

We now manage clocksource and clockevent clocks directly with
timer-ti-dm-systimer. In order to use genpd with prm_omap,
GENPD_FLAG_PM_CLK and simple-pm-bus, we need to keep the system
timer related interconnect clocks enabled until clocksource suspend
is done.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: dts: am33xx: add remaining PRM instances
Tero Kristo [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: dts: am33xx: add remaining PRM instances

Add remaining PRM instances for the am33xx SoC. Additionally, enable the
genpd support for them.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
[tony@atomide.com: fixed a typo for #power-domain-cells]
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoremoteproc/wkup_m3: Use reset control driver if available
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
remoteproc/wkup_m3: Use reset control driver if available

In order to move wkup_m3 to probe without platform data, let's add
support for using optional reset control driver if configured in the
dts. With this change and the related dts change, we can start
dropping the platform data for am335x.

And once wkup_m3 no longer needs platform data, we can simply drop the
related legacy reset platform data callbacks from wkup_m3 driver later
on after also am437x no longer depends on it.

Cc: linux-remoteproc@vger.kernel.org
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: pm33xx: Enable basic PM runtime support for genpd
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
soc: ti: pm33xx: Enable basic PM runtime support for genpd

To prepare for moving to use genpd, let's enable basic PM
runtime support.

Cc: Dave Gerlach <d-gerlach@ti.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Suman Anna <s-anna@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: am3: add genpd support for remaining PRM instances
Tero Kristo [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
soc: ti: omap-prm: am3: add genpd support for remaining PRM instances

Add genpd support for per, wkup, mpu, rtc and cefuse instances.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: Add pm_clk for genpd
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
soc: ti: omap-prm: Add pm_clk for genpd

In order to probe l3 and l4 interconnects with simple-pm-bus, we want
genpd to manage the clocks for the interconnects. For interconnect target
modules, we already have ti-sysc manage the clocks so let's skipe managing
clocks for ti-sysc modules.

Cc: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoclk: ti: am33xx: Keep am3 l3 main clock always on for genpd
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
clk: ti: am33xx: Keep am3 l3 main clock always on for genpd

In order for suspend and resume to work with genpd on am3, we must keep
l3 main clock always on. Otherwise prm_omap driver will shut down the l3
main clock on suspend when simple-pm-bus and GENPD_FLAG_PM_CLK are used.
Note that we already keep the l3 main clock always on with the legacy
platform code.

Later on we may want to start managing the l3 main clock with a dedicated
interconnect driver instead of using simple-pm-bus and GENPD_FLAG_PM_CLK.

Cc: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agobus: ti-sysc: Implement GPMC debug quirk to drop platform data
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
bus: ti-sysc: Implement GPMC debug quirk to drop platform data

We need to enable no-reset-on-init quirk for GPMC if the config
option for CONFIG_OMAP_GPMC_DEBUG is set. Otherwise the GPMC
driver code is unable to show the bootloader configured timings.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agobus: ti-sysc: Support modules without control registers
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
bus: ti-sysc: Support modules without control registers

Some modules like MPU have a powerdomain and functional clock but not
necessarily any control registers. Let's allow configuring interconnect
target modules with no control registers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Probe PRCM first to probe l4_wkup with simple-pm-bus
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Probe PRCM first to probe l4_wkup with simple-pm-bus

In preparation for probing the interconnects with simple-pm-bus to
make use of genpd, we need to probe the always-on PRCM first for the
clocks needed by l4_wkup instance.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Check for inited flag
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
ARM: OMAP2+: Check for inited flag

If we have no hwmods configured and omap_hwmod_init() is not called,
we don't want to call omap_hwmod_setup_all() as it will fail with
checks for configured MPU at least.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agobus: ti-sysc: Assert reset only after disabling clocks
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
bus: ti-sysc: Assert reset only after disabling clocks

The rstctrl reset must be asserted after gating the module clock as
described in the TRM at least for IVA. Otherwise the rstctrl reset
done with module clock enabled can hang the system.

Note that this issue is has been only seen with related IVA changes
that we do not currently have merged. So probably no need to apply
this patch as a fix.

Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agosoc: ti: omap-prm: Do not check rstst bit on deassert if already deasserted
Tony Lindgren [Mon, 16 Nov 2020 10:57:13 +0000 (12:57 +0200)]
soc: ti: omap-prm: Do not check rstst bit on deassert if already deasserted

If a rstctrl reset bit is already deasserted, we can just bail out early
not wait for rstst to clear. Otherwise we can have deassert fail for
already deasserted resets.

Fixes: c5117a78dd88 ("soc: ti: omap-prm: poll for reset complete during de-assert")
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agobus: ti-sysc: Fix bogus resetdone warning on enable for cpsw
Tony Lindgren [Mon, 26 Oct 2020 08:08:47 +0000 (10:08 +0200)]
bus: ti-sysc: Fix bogus resetdone warning on enable for cpsw

Bail out early from sysc_wait_softreset() just like we do in sysc_reset()
if there's no sysstatus srst_shift to fix a bogus resetdone warning on
enable as suggested by Grygorii Strashko <grygorii.strashko@ti.com>.

We do not currently handle resets for modules that need writing to the
sysstatus register. If we at some point add that, we also need to add
SYSS_QUIRK_RESETDONE_INVERTED flag for cpsw as the sysstatus bit is low
when reset is done as described in the am335x TRM "Table 14-202
SOFT_RESET Register Field Descriptions"

Fixes: d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit")
Suggested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agobus: ti-sysc: Fix reset status check for modules with quirks
Tony Lindgren [Mon, 26 Oct 2020 08:08:47 +0000 (10:08 +0200)]
bus: ti-sysc: Fix reset status check for modules with quirks

Commit d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and
wait for softreset bit") started showing a "OCP softreset timed out"
warning on enable if the interconnect target module is not out of reset.
This caused the warning to be often triggered for i2c and hdq while the
devices are working properly.

Turns out that some interconnect target modules seem to have an unusable
reset status bits unless the module specific reset quirks are activated.

Let's just skip the reset status check for those modules as we only want
to activate the reset quirks when doing a reset, and not on enable. This
way we don't see the bogus "OCP softreset timed out" warnings during boot.

Fixes: d46f9fbec719 ("bus: ti-sysc: Use optional clocks on for enable and wait for softreset bit")
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Fix missing select PM_GENERIC_DOMAINS_OF
Tony Lindgren [Mon, 26 Oct 2020 08:08:47 +0000 (10:08 +0200)]
ARM: OMAP2+: Fix missing select PM_GENERIC_DOMAINS_OF

We should select also PM_GENERIC_DOMAINS_OF in addition to
PM_GENERIC_DOMAINS to have device tree based PM domain providers
enabled.

Fixes: 58cbff023bfa ("soc: ti: omap-prm: Add basic power domain support")
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoARM: OMAP2+: Fix location for select PM_GENERIC_DOMAINS
Tony Lindgren [Mon, 26 Oct 2020 08:08:47 +0000 (10:08 +0200)]
ARM: OMAP2+: Fix location for select PM_GENERIC_DOMAINS

I accidentally misplaced select PM_GENERIC_DOMAINS, it should be
selected for all the SoCs instead.

Fixes: 58cbff023bfa ("soc: ti: omap-prm: Add basic power domain support")
Signed-off-by: Tony Lindgren <tony@atomide.com>
3 years agoLinux 5.10-rc1
Linus Torvalds [Sun, 25 Oct 2020 22:14:11 +0000 (15:14 -0700)]
Linux 5.10-rc1

3 years agotreewide: Convert macro and uses of __section(foo) to __section("foo")
Joe Perches [Thu, 22 Oct 2020 02:36:07 +0000 (19:36 -0700)]
treewide: Convert macro and uses of __section(foo) to __section("foo")

Use a more generic form for __section that requires quotes to avoid
complications with clang and gcc differences.

Remove the quote operator # from compiler_attributes.h __section macro.

Convert all unquoted __section(foo) uses to quoted __section("foo").
Also convert __attribute__((section("foo"))) uses to __section("foo")
even if the __attribute__ has multiple list entry forms.

Conversion done using the script at:

    https://lore.kernel.org/lkml/75393e5ddc272dc7403de74d645e6c6e0f4e70eb.camel@perches.com/2-convert_section.pl

Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@gooogle.com>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agokernel/sys.c: fix prototype of prctl_get_tid_address()
Rasmus Villemoes [Sat, 24 Oct 2020 01:04:26 +0000 (03:04 +0200)]
kernel/sys.c: fix prototype of prctl_get_tid_address()

tid_addr is not a "pointer to (pointer to int in userspace)"; it is in
fact a "pointer to (pointer to int in userspace) in userspace".  So
sparse rightfully complains about passing a kernel pointer to
put_user().

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agomm: remove kzfree() compatibility definition
Eric Biggers [Fri, 23 Oct 2020 23:27:16 +0000 (16:27 -0700)]
mm: remove kzfree() compatibility definition

Commit 453431a54934 ("mm, treewide: rename kzfree() to
kfree_sensitive()") renamed kzfree() to kfree_sensitive(),
but it left a compatibility definition of kzfree() to avoid
being too disruptive.

Since then a few more instances of kzfree() have slipped in.

Just get rid of them and remove the compatibility definition
once and for all.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agocheckpatch: enable GIT_DIR environment use to set git repository location
Joe Perches [Sat, 24 Oct 2020 23:59:04 +0000 (16:59 -0700)]
checkpatch: enable GIT_DIR environment use to set git repository location

If set, use the environment variable GIT_DIR to change the default .git
location of the kernel git tree.

If GIT_DIR is unset, keep using the current ".git" default.

Link: https://lkml.kernel.org/r/c5e23b45562373d632fccb8bc04e563abba4dd1d.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agoMerge tag 'timers-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Oct 2020 18:28:49 +0000 (11:28 -0700)]
Merge tag 'timers-urgent-2020-10-25' of git://git./linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
 "A time namespace fix and a matching selftest. The futex absolute
  timeouts which are based on CLOCK_MONOTONIC require time namespace
  corrected. This was missed in the original time namesapce support"

* tag 'timers-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  selftests/timens: Add a test for futex()
  futex: Adjust absolute futex timeouts with per time namespace offset

3 years agoMerge tag 'sched-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Oct 2020 18:25:16 +0000 (11:25 -0700)]
Merge tag 'sched-urgent-2020-10-25' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Thomas Gleixner:
 "Two scheduler fixes:

   - A trivial build fix for sched_feat() to compile correctly with
     CONFIG_JUMP_LABEL=n

   - Replace a zero lenght array with a flexible array"

* tag 'sched-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/features: Fix !CONFIG_JUMP_LABEL case
  sched: Replace zero-length array with flexible-array

3 years agoMerge tag 'perf-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 25 Oct 2020 18:22:59 +0000 (11:22 -0700)]
Merge tag 'perf-urgent-2020-10-25' of git://git./linux/kernel/git/tip/tip

Pull perf fix from Thomas Gleixner:
 "A single fix to compute the field offset of the SNOOPX bit in the data
  source bitmask of perf events correctly"

* tag 'perf-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf: correct SNOOPX field offset

3 years agoMerge tag 'locking-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Oct 2020 18:14:54 +0000 (11:14 -0700)]
Merge tag 'locking-urgent-2020-10-25' of git://git./linux/kernel/git/tip/tip

Pull locking fix from Thomas Gleixner:
 "Just a trivial fix for kernel-doc warnings"

* tag 'locking-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/seqlocks: Fix kernel-doc warnings

3 years agoMerge tag 'ntb-5.10' of git://github.com/jonmason/ntb
Linus Torvalds [Sun, 25 Oct 2020 18:12:31 +0000 (11:12 -0700)]
Merge tag 'ntb-5.10' of git://github.com/jonmason/ntb

Pull NTB fixes from Jon Mason.

* tag 'ntb-5.10' of git://github.com/jonmason/ntb:
  NTB: Use struct_size() helper in devm_kzalloc()
  ntb: intel: Fix memleak in intel_ntb_pci_probe
  NTB: hw: amd: fix an issue about leak system resources

3 years agoMerge branch 'i2c/for-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 25 Oct 2020 18:10:23 +0000 (11:10 -0700)]
Merge branch 'i2c/for-5.10' of git://git./linux/kernel/git/wsa/linux

Pull i2c fix from Wolfram Sang:
 "Regression fix for rc1 and stable kernels as well"

* 'i2c/for-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs

3 years agoMerge tag '5.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Sun, 25 Oct 2020 18:05:04 +0000 (11:05 -0700)]
Merge tag '5.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull more cifs updates from Steve French:
 "Add support for stat of various special file types (WSL reparse points
  for char, block, fifo)"

* tag '5.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: update internal module version number
  smb3: add some missing definitions from MS-FSCC
  smb3: remove two unused variables
  smb3: add support for stat of WSL reparse points for special file types

3 years agoMerge branch 'parisc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 25 Oct 2020 17:59:34 +0000 (10:59 -0700)]
Merge branch 'parisc-5.10-2' of git://git./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

3 years agoMerge tag 'for-linus-5.10b-rc1c-tag' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 25 Oct 2020 17:55:35 +0000 (10:55 -0700)]
Merge tag 'for-linus-5.10b-rc1c-tag' of git://git./linux/kernel/git/xen/tip

Pull more xen updates from Juergen Gross:

 - a series for the Xen pv block drivers adding module parameters for
   better control of resource usge

 - a cleanup series for the Xen event driver

* tag 'for-linus-5.10b-rc1c-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  Documentation: add xen.fifo_events kernel parameter description
  xen/events: unmask a fifo event channel only if it was masked
  xen/events: only register debug interrupt for 2-level events
  xen/events: make struct irq_info private to events_base.c
  xen: remove no longer used functions
  xen-blkfront: Apply changed parameter name to the document
  xen-blkfront: add a parameter for disabling of persistent grants
  xen-blkback: add a parameter for disabling of persistent grants

3 years agoMerge tag 'safesetid-5.10' of git://github.com/micah-morton/linux
Linus Torvalds [Sun, 25 Oct 2020 17:45:26 +0000 (10:45 -0700)]
Merge tag 'safesetid-5.10' of git://github.com/micah-morton/linux

Pull SafeSetID updates from Micah Morton:
 "The changes are mostly contained to within the SafeSetID LSM, with the
  exception of a few 1-line changes to change some ns_capable() calls to
  ns_capable_setid() -- causing a flag (CAP_OPT_INSETID) to be set that
  is examined by SafeSetID code and nothing else in the kernel.

  The changes to SafeSetID internally allow for setting up GID
  transition security policies, as already existed for UIDs"

* tag 'safesetid-5.10' of git://github.com/micah-morton/linux:
  LSM: SafeSetID: Fix warnings reported by test bot
  LSM: SafeSetID: Add GID security policy handling
  LSM: Signal to SafeSetID when setting group IDs

3 years agoMerge tag '20201024-v4-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/wtarrea...
Linus Torvalds [Sun, 25 Oct 2020 17:40:08 +0000 (10:40 -0700)]
Merge tag '20201024-v4-5.10' of git://git./linux/kernel/git/wtarreau/prandom

Pull random32 updates from Willy Tarreau:
 "Make prandom_u32() less predictable.

  This is the cleanup of the latest series of prandom_u32
  experimentations consisting in using SipHash instead of Tausworthe to
  produce the randoms used by the network stack.

  The changes to the files were kept minimal, and the controversial
  commit that used to take noise from the fast_pool (f227e3ec3b5c) was
  reverted. Instead, a dedicated "net_rand_noise" per_cpu variable is
  fed from various sources of activities (networking, scheduling) to
  perturb the SipHash state using fast, non-trivially predictable data,
  instead of keeping it fully deterministic. The goal is essentially to
  make any occasional memory leakage or brute-force attempt useless.

  The resulting code was verified to be very slightly faster on x86_64
  than what is was with the controversial commit above, though this
  remains barely above measurement noise. It was also tested on i386 and
  arm, and build- tested only on arm64"

Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
* tag '20201024-v4-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/prandom:
  random32: add a selftest for the prandom32 code
  random32: add noise from network and scheduling activity
  random32: make prandom_u32() output unpredictable

3 years agoi2c: core: Restore acpi_walk_dep_device_list() getting called after registering the...
Hans de Goede [Wed, 14 Oct 2020 14:41:58 +0000 (16:41 +0200)]
i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs

Commit 21653a4181ff ("i2c: core: Call i2c_acpi_install_space_handler()
before i2c_acpi_register_devices()")'s intention was to only move the
acpi_install_address_space_handler() call to the point before where
the ACPI declared i2c-children of the adapter where instantiated by
i2c_acpi_register_devices().

But i2c_acpi_install_space_handler() had a call to
acpi_walk_dep_device_list() hidden (that is I missed it) at the end
of it, so as an unwanted side-effect now acpi_walk_dep_device_list()
was also being called before i2c_acpi_register_devices().

Move the acpi_walk_dep_device_list() call to the end of
i2c_acpi_register_devices(), so that it is once again called *after*
the i2c_client-s hanging of the adapter have been created.

This fixes the Microsoft Surface Go 2 hanging at boot.

Fixes: 21653a4181ff ("i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=209627
Reported-by: Rainer Finke <rainer@finke.cc>
Reported-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Suggested-by: Maximilian Luz <luzmaximilian@gmail.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
3 years agoMerge tag 'block-5.10-2020-10-24' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 24 Oct 2020 19:46:42 +0000 (12:46 -0700)]
Merge tag 'block-5.10-2020-10-24' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - NVMe pull request from Christoph
     - rdma error handling fixes (Chao Leng)
     - fc error handling and reconnect fixes (James Smart)
     - fix the qid displace when tracing ioctl command (Keith Busch)
     - don't use BLK_MQ_REQ_NOWAIT for passthru (Chaitanya Kulkarni)
     - fix MTDT for passthru (Logan Gunthorpe)
     - blacklist Write Same on more devices (Kai-Heng Feng)
     - fix an uninitialized work struct (zhenwei pi)"

 - lightnvm out-of-bounds fix (Colin)

 - SG allocation leak fix (Doug)

 - rnbd fixes (Gioh, Guoqing, Jack)

 - zone error translation fixes (Keith)

 - kerneldoc markup fix (Mauro)

 - zram lockdep fix (Peter)

 - Kill unused io_context members (Yufen)

 - NUMA memory allocation cleanup (Xianting)

 - NBD config wakeup fix (Xiubo)

* tag 'block-5.10-2020-10-24' of git://git.kernel.dk/linux-block: (27 commits)
  block: blk-mq: fix a kernel-doc markup
  nvme-fc: shorten reconnect delay if possible for FC
  nvme-fc: wait for queues to freeze before calling update_hr_hw_queues
  nvme-fc: fix error loop in create_hw_io_queues
  nvme-fc: fix io timeout to abort I/O
  null_blk: use zone status for max active/open
  nvmet: don't use BLK_MQ_REQ_NOWAIT for passthru
  nvmet: cleanup nvmet_passthru_map_sg()
  nvmet: limit passthru MTDS by BIO_MAX_PAGES
  nvmet: fix uninitialized work for zero kato
  nvme-pci: disable Write Zeroes on Sandisk Skyhawk
  nvme: use queuedata for nvme_req_qid
  nvme-rdma: fix crash due to incorrect cqe
  nvme-rdma: fix crash when connect rejected
  block: remove unused members for io_context
  blk-mq: remove the calling of local_memory_node()
  zram: Fix __zram_bvec_{read,write}() locking order
  skd_main: remove unused including <linux/version.h>
  sgl_alloc_order: fix memory leak
  lightnvm: fix out-of-bounds write to array devices->info[]
  ...

3 years agoMerge tag 'io_uring-5.10-2020-10-24' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 24 Oct 2020 19:40:18 +0000 (12:40 -0700)]
Merge tag 'io_uring-5.10-2020-10-24' of git://git.kernel.dk/linux-block

Pull io_uring fixes from Jens Axboe:

 - fsize was missed in previous unification of work flags

 - Few fixes cleaning up the flags unification creds cases (Pavel)

 - Fix NUMA affinities for completely unplugged/replugged node for io-wq

 - Two fallout fixes from the set_fs changes. One local to io_uring, one
   for the splice entry point that io_uring uses.

 - Linked timeout fixes (Pavel)

 - Removal of ->flush() ->files work-around that we don't need anymore
   with referenced files (Pavel)

 - Various cleanups (Pavel)

* tag 'io_uring-5.10-2020-10-24' of git://git.kernel.dk/linux-block:
  splice: change exported internal do_splice() helper to take kernel offset
  io_uring: make loop_rw_iter() use original user supplied pointers
  io_uring: remove req cancel in ->flush()
  io-wq: re-set NUMA node affinities if CPUs come online
  io_uring: don't reuse linked_timeout
  io_uring: unify fsize with def->work_flags
  io_uring: fix racy REQ_F_LINK_TIMEOUT clearing
  io_uring: do poll's hash_node init in common code
  io_uring: inline io_poll_task_handler()
  io_uring: remove extra ->file check in poll prep
  io_uring: make cached_cq_overflow non atomic_t
  io_uring: inline io_fail_links()
  io_uring: kill ref get/drop in personality init
  io_uring: flags-based creds init in queue

3 years agoMerge tag 'libata-5.10-2020-10-24' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 24 Oct 2020 19:36:24 +0000 (12:36 -0700)]
Merge tag 'libata-5.10-2020-10-24' of git://git.kernel.dk/linux-block

Pull libata fixes from Jens Axboe:
 "Two minor libata fixes:

   - Fix a DMA boundary mask regression for sata_rcar (Geert)

   - kerneldoc markup fix (Mauro)"

* tag 'libata-5.10-2020-10-24' of git://git.kernel.dk/linux-block:
  ata: fix some kernel-doc markups
  ata: sata_rcar: Fix DMA boundary mask

3 years agoMerge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Sat, 24 Oct 2020 19:26:05 +0000 (12:26 -0700)]
Merge branch 'work.misc' of git://git./linux/kernel/git/viro/vfs

Pull misc vfs updates from Al Viro:
 "Assorted stuff all over the place (the largest group here is
  Christoph's stat cleanups)"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  fs: remove KSTAT_QUERY_FLAGS
  fs: remove vfs_stat_set_lookup_flags
  fs: move vfs_fstatat out of line
  fs: implement vfs_stat and vfs_lstat in terms of vfs_fstatat
  fs: remove vfs_statx_fd
  fs: omfs: use kmemdup() rather than kmalloc+memcpy
  [PATCH] reduce boilerplate in fsid handling
  fs: Remove duplicated flag O_NDELAY occurring twice in VALID_OPEN_FLAGS
  selftests: mount: add nosymfollow tests
  Add a "nosymfollow" mount option.

3 years agoMerge tag 'dma-mapping-5.10-1' of git://git.infradead.org/users/hch/dma-mapping
Linus Torvalds [Sat, 24 Oct 2020 19:17:05 +0000 (12:17 -0700)]
Merge tag 'dma-mapping-5.10-1' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping fixes from Christoph Hellwig:

 - document the new dma_{alloc,free}_pages() API

 - two fixups for the dma-mapping.h split

* tag 'dma-mapping-5.10-1' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: document dma_{alloc,free}_pages
  dma-mapping: move more functions to dma-map-ops.h
  ARM/sa1111: add a missing include of dma-map-ops.h

3 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sat, 24 Oct 2020 19:09:22 +0000 (12:09 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull KVM fixes from Paolo Bonzini:
 "Two fixes for this merge window, and an unrelated bugfix for a host
  hang"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: ioapic: break infinite recursion on lazy EOI
  KVM: vmx: rename pi_init to avoid conflict with paride
  KVM: x86/mmu: Avoid modulo operator on 64-bit value to fix i386 build

3 years agoMerge tag 'x86_seves_fixes_for_v5.10_rc1' of git://git.kernel.org/pub/scm/linux/kerne...
Linus Torvalds [Sat, 24 Oct 2020 18:49:32 +0000 (11:49 -0700)]
Merge tag 'x86_seves_fixes_for_v5.10_rc1' of git://git./linux/kernel/git/tip/tip

Pull x86 SEV-ES fixes from Borislav Petkov:
 "Three fixes to SEV-ES to correct setting up the new early pagetable on
  5-level paging machines, to always map boot_params and the kernel
  cmdline, and disable stack protector for ../compressed/head{32,64}.c.
  (Arvind Sankar)"

* tag 'x86_seves_fixes_for_v5.10_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/boot/64: Explicitly map boot_params and command line
  x86/head/64: Disable stack protection for head$(BITS).o
  x86/boot/64: Initialize 5-level paging variables earlier

3 years agorandom32: add a selftest for the prandom32 code
Willy Tarreau [Sat, 24 Oct 2020 16:36:27 +0000 (18:36 +0200)]
random32: add a selftest for the prandom32 code

Given that this code is new, let's add a selftest for it as well.
It doesn't rely on fixed sets, instead it picks 1024 numbers and
verifies that they're not more correlated than desired.

Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
Cc: George Spelvin <lkml@sdf.org>
Cc: Amit Klein <aksecurity@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: tytso@mit.edu
Cc: Florian Westphal <fw@strlen.de>
Cc: Marc Plumb <lkml.mplumb@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
3 years agorandom32: add noise from network and scheduling activity
Willy Tarreau [Mon, 10 Aug 2020 08:27:42 +0000 (10:27 +0200)]
random32: add noise from network and scheduling activity

With the removal of the interrupt perturbations in previous random32
change (random32: make prandom_u32() output unpredictable), the PRNG
has become 100% deterministic again. While SipHash is expected to be
way more robust against brute force than the previous Tausworthe LFSR,
there's still the risk that whoever has even one temporary access to
the PRNG's internal state is able to predict all subsequent draws till
the next reseed (roughly every minute). This may happen through a side
channel attack or any data leak.

This patch restores the spirit of commit f227e3ec3b5c ("random32: update
the net random state on interrupt and activity") in that it will perturb
the internal PRNG's statee using externally collected noise, except that
it will not pick that noise from the random pool's bits nor upon
interrupt, but will rather combine a few elements along the Tx path
that are collectively hard to predict, such as dev, skb and txq
pointers, packet length and jiffies values. These ones are combined
using a single round of SipHash into a single long variable that is
mixed with the net_rand_state upon each invocation.

The operation was inlined because it produces very small and efficient
code, typically 3 xor, 2 add and 2 rol. The performance was measured
to be the same (even very slightly better) than before the switch to
SipHash; on a 6-core 12-thread Core i7-8700k equipped with a 40G NIC
(i40e), the connection rate dropped from 556k/s to 555k/s while the
SYN cookie rate grew from 5.38 Mpps to 5.45 Mpps.

Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
Cc: George Spelvin <lkml@sdf.org>
Cc: Amit Klein <aksecurity@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: tytso@mit.edu
Cc: Florian Westphal <fw@strlen.de>
Cc: Marc Plumb <lkml.mplumb@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
3 years agorandom32: make prandom_u32() output unpredictable
George Spelvin [Sun, 9 Aug 2020 06:57:44 +0000 (06:57 +0000)]
random32: make prandom_u32() output unpredictable

Non-cryptographic PRNGs may have great statistical properties, but
are usually trivially predictable to someone who knows the algorithm,
given a small sample of their output.  An LFSR like prandom_u32() is
particularly simple, even if the sample is widely scattered bits.

It turns out the network stack uses prandom_u32() for some things like
random port numbers which it would prefer are *not* trivially predictable.
Predictability led to a practical DNS spoofing attack.  Oops.

This patch replaces the LFSR with a homebrew cryptographic PRNG based
on the SipHash round function, which is in turn seeded with 128 bits
of strong random key.  (The authors of SipHash have *not* been consulted
about this abuse of their algorithm.)  Speed is prioritized over security;
attacks are rare, while performance is always wanted.

Replacing all callers of prandom_u32() is the quick fix.
Whether to reinstate a weaker PRNG for uses which can tolerate it
is an open question.

Commit f227e3ec3b5c ("random32: update the net random state on interrupt
and activity") was an earlier attempt at a solution.  This patch replaces
it.

Reported-by: Amit Klein <aksecurity@gmail.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: tytso@mit.edu
Cc: Florian Westphal <fw@strlen.de>
Cc: Marc Plumb <lkml.mplumb@gmail.com>
Fixes: f227e3ec3b5c ("random32: update the net random state on interrupt and activity")
Signed-off-by: George Spelvin <lkml@sdf.org>
Link: https://lore.kernel.org/netdev/20200808152628.GA27941@SDF.ORG/
[ willy: partial reversal of f227e3ec3b5c; moved SIPROUND definitions
  to prandom.h for later use; merged George's prandom_seed() proposal;
  inlined siprand_u32(); replaced the net_rand_state[] array with 4
  members to fix a build issue; cosmetic cleanups to make checkpatch
  happy; fixed RANDOM32_SELFTEST build ]
Signed-off-by: Willy Tarreau <w@1wt.eu>
3 years agoMerge tag 'powerpc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sat, 24 Oct 2020 18:09:13 +0000 (11:09 -0700)]
Merge tag 'powerpc-5.10-2' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - A fix for undetected data corruption on Power9 Nimbus <= DD2.1 in the
   emulation of VSX loads. The affected CPUs were not widely available.

 - Two fixes for machine check handling in guests under PowerVM.

 - A fix for our recent changes to SMP setup, when
   CONFIG_CPUMASK_OFFSTACK=y.

 - Three fixes for races in the handling of some of our powernv sysfs
   attributes.

 - One change to remove TM from the set of Power10 CPU features.

 - A couple of other minor fixes.

Thanks to: Aneesh Kumar K.V, Christophe Leroy, Ganesh Goudar, Jordan
Niethe, Mahesh Salgaonkar, Michael Neuling, Oliver O'Halloran, Qian Cai,
Srikar Dronamraju, Vasant Hegde.

* tag 'powerpc-5.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  powerpc/pseries: Avoid using addr_to_pfn in real mode
  powerpc/uaccess: Don't use "m<>" constraint with GCC 4.9
  powerpc/eeh: Fix eeh_dev_check_failure() for PE#0
  powerpc/64s: Remove TM from Power10 features
  selftests/powerpc: Make alignment handler test P9N DD2.1 vector CI load workaround
  powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
  powerpc/powernv/dump: Handle multiple writes to ack attribute
  powerpc/powernv/dump: Fix race while processing OPAL dump
  powerpc/smp: Use GFP_ATOMIC while allocating tmp mask
  powerpc/smp: Remove unnecessary variable
  powerpc/mce: Avoid nmi_enter/exit in real mode on pseries hash
  powerpc/opal_elog: Handle multiple writes to ack attribute

3 years agoMerge tag 'riscv-for-linus-5.10-mw1' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 24 Oct 2020 17:57:57 +0000 (10:57 -0700)]
Merge tag 'riscv-for-linus-5.10-mw1' of git://git./linux/kernel/git/riscv/linux

Pull more RISC-V updates from Palmer Dabbelt:
 "Just a single patch set: the remainder of Christoph's work to remove
  set_fs, including the RISC-V portion"

* tag 'riscv-for-linus-5.10-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: remove address space overrides using set_fs()
  riscv: implement __get_kernel_nofault and __put_user_nofault
  riscv: refactor __get_user and __put_user
  riscv: use memcpy based uaccess for nommu again
  asm-generic: make the set_fs implementation optional
  asm-generic: add nommu implementations of __{get,put}_kernel_nofault
  asm-generic: improve the nommu {get,put}_user handling
  uaccess: provide a generic TASK_SIZE_MAX definition

3 years agoMerge tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Linus Torvalds [Sat, 24 Oct 2020 17:53:04 +0000 (10:53 -0700)]
Merge tag 'armsoc-defconfig' of git://git./linux/kernel/git/soc/soc

Pull ARM SoC defconfig updates from Olof Johansson:
 "We keep this in a separate branch to avoid cross-branch conflicts, but
  most of the material here is fairly boring -- some new drivers turned
  on for hardware since they were merged, and some refreshed files due
  to time having moved a lot of entries around"

* tag 'armsoc-defconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (33 commits)
  ARM: multi_v7_defconfig: add FMC2 EBI controller support
  arm64: defconfig: enable Qualcomm ASoC modules
  arm64: defconfig: qcom: enable GPU clock controller for SM8[12]50
  arm64: defconfig: enable INTERCONNECT for Qualcomm chipsets
  arm64: defconfig: enable the sl28cpld board management controller
  arm64: defconfig: Enable the eLCDIF and Raydium RM67191 drivers
  arm64: defconfig: Enable Qcom SNPS Femto PHY
  ARM: configs: Update Realview defconfig
  ARM: configs: Update Versatile defconfig
  ARM: config: aspeed_g5: Enable IBM OP Panel driver
  ARM: config: aspeed-g5: Enable I2C GPIO mux driver
  ARM: config: aspeed: Fix selection of media drivers
  arm64: defconfig: Enable Samsung S3FWRN5 NFC driver
  ARM: omap2plus_defconfig: enable generic net options
  ARM: omap2plus_defconfig: enable twl4030_madc as a loadable module
  arm64: defconfig: Enable clock driver for ROHM BD718x7 PMIC
  arm64: defconfig: Build ADMA and ACONNECT driver
  arm64: defconfig: Build AHUB component drivers
  arm64: defconfig: Enable Lontium LT9611 driver
  arm64: defcondfig: Enable USB ACM and FTDI drivers
  ...