aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-10-20power: supply: cpcap-battery: Add basic coulomb counter calibrate supportTony Lindgren1-8/+88
This patch adds support for the coulomb counter calibration on init. We do this by polling for now, and only add partial calibration done interrupt support. Then later on when we know for sure we have the calibration done interrupt available in the device tree, we can switch to using the calibration done interrupt. Cc: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Read and save integrator register CCITony Lindgren1-1/+9
We can simplify code in the later patches by reading and saving the integrator register CCI. Let's also fix a comment typo for register range naming while at it. Cc: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Simplify short term power average calculationTony Lindgren1-13/+10
We can use sign_extend32() here to simplify things. And let's fix the comment for CCM register, that contains the calibration offset. Cc: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Simplify coulomb counter calculation with div_s64Tony Lindgren1-18/+5
We can simplify cpcap_battery_cc_raw_div() with div_s64. Cc: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Move coulomb counter units per lsb to ddataTony Lindgren1-14/+14
We can simplify cpcap_battery_cc_raw_div() a bit by moving the units per lsb to ddata. Cc: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-charger: Allow changing constant charge voltageTony Lindgren1-0/+83
Let's allow reconfiguring the cpcap-charger max charge voltage and default to 4.2V that should be safe for the known users. This allows the users to use 4.35V for the extra capacity if really needed at a cost of probably shorter battery life. We check the constant charge voltage limit set by the battery. Some pieces of the property setting code is based on an earlier patch from Pavel Machek <[email protected]> but limited to configuring the charge voltage for now. Cc: Merlijn Wajer <[email protected]> Cc: Pavel Machek <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Fix handling of lowered charger voltageTony Lindgren1-7/+78
With cpcap-charger now using 4.2V instead of 4.35V, we never reach POWER_SUPPLY_CAPACITY_LEVEL_FULL unless we handle the lowered charge voltage. Let's do this by implementing POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, and assume anything at that level or higher is a full battery. Let's also make it configurable for users who may still want to reconfigure it, and notify the charger if supported by the charger. Cc: Merlijn Wajer <[email protected]> Cc: Pavel Machek <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-charger: Improve battery detectionTony Lindgren1-3/+4
We are currently using a wrong ADC range for the battery detection. The ADC returns the battery temperature if connected. Cc: Merlijn Wajer <[email protected]> Cc: Pavel Machek <[email protected]> Acked-by: Pavel Machek <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-battery: Check voltage before orderly_poweroffTony Lindgren1-3/+5
We can get the low voltage interrupt trigger sometimes way too early, maybe because of CPU load spikes. This causes orderly_poweroff() be called too easily. Let's check the voltage before orderly_poweroff in case it was not yet a permanent condition. We will be getting more interrupts anyways if the condition persists. Let's also show the measured voltages for low battery and battery empty warnings since we have them. Cc: Merlijn Wajer <[email protected]> Cc: Pavel Machek <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20Merge tag 'psy-cpcap-charge-volt-limit-signed' into psy-nextSebastian Reichel3-7/+140
Immutable branch between arm and power-supply for cpcap-charger This immutable branch contains CPCAP charger changes, which touch ARM and power-supply subsystem. Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: cpcap-charger: Limit voltage to 4.2V for batteryTony Lindgren3-7/+140
There have been some cases of droid4 battery bulging that seem to be related to being left connected to the charger for several weeks. It is suspected that the 4.35V charge voltage configured for the battery is too much in the long run, so lets limit the charge voltage to 4.2V. It could also be that the batteries are just getting old. We don't really want to just change the charge voltage to 4.2V as Android may have charged the battery to 4.35V as pointed out by Pavel Machek. To add checks for battery voltage, the driver needs to understand the voltage it's charging at, and also needs to better understand it's charger state. Right now it only understands connect and disconnect, while now we need to know also a connected state but not charging. So let's add better charger state handling with help of chrgcurr2 interrupt for detecting charge full and retry, and add a check for battery voltage before we start charging. And then we finally can lower the charge voltage to 4.2V. Note that we've been using the same register values as the Android distros on droid4, so it is suspected that the same problem also exists in Android. Cc: Pavel Machek <[email protected]> Cc: Rob Herring <[email protected]> Reported-by: Merlijn Wajer <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: ab8500: Handle invalid IRQ from platform_get_irq_byname()Krzysztof Kozlowski3-0/+20
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 <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: ab8500_fg: Do not free non-requested IRQs in probe's error pathKrzysztof Kozlowski1-3/+5
When requesting interrupt fails, free only interrupts already requested, not all of them. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: ab8500: Cleanup probe in reverse orderKrzysztof Kozlowski2-6/+6
It is logical to cleanup in probe's error path in reverse order to previous actions. It also makes easier to add additional goto labels within this error path. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20Merge remote-tracking branch 'ib-ab8500-5.4-rc1' into for-nextSebastian Reichel16-1939/+1495
Merge immutable branch from IIO subsystem for driver changes in ab8500_btemp, ab8500_charger and ab8500_fg. Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: reset: at91: fix __le32 cast in reset codeBen Dooks (Codethink)1-4/+2
The writel() takes standard integers, not __le32 so fix the following sparse warnings by removing the cpu_to_le32() calls. drivers/power/reset/at91-reset.c:134:9: warning: cast from restricted __le32 drivers/power/reset/at91-reset.c:143:9: warning: cast from restricted __le32 This has made no code changes, the md5sums pre and post applying this patch are the same. The at91 should be natively little endian anyway. Signed-off-by: Ben Dooks <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-20power: supply: abx500_chargalg: Fix code indentationMadhuparna Bhowmik1-4/+4
Fixed Code indentation error caused due to using spaces instead of tabs. The error reported by checkpatch.pl is: ERROR: code indent should use tabs where possible The warning reported by checkpatch.pl is: WARNING: please, no spaces at the start of a line Signed-off-by: Madhuparna Bhowmik <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-18mfd: Switch the AB8500 GPADC to IIOLinus Walleij5-1873/+0
The AB8500 GPADC driver is indeed a "general purpose ADC" driver, and while the IIO subsystem did not exist when the driver was first merged, it is never too late to clean things up and move it to the right place. Nowadays IIO provides the right abstractions and interfaces to do generic ADC work in the kernel. We have to cut a bunch of debugfs luggage to make this transition swift, but all these files to is read out the raw values of the ADC and the IIO subsystem already has a standard sysfs ABI for doing exactly this: no debugfs is needed. Acked-by: Lee Jones <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18iio: adc: New driver for the AB8500 GPADCLinus Walleij4-0/+1230
This is a new driver for the ST-Ericsson AB8500 GPADC, which replaces the old driver in drivers/mfd/ab8500-gpadc.c and thus gets rid of another necessarily different custom driver from the times before IIO existed. The AB8500 GPADC can convert 10 different channels and these are used for monitoring voltages in the U8500 chipset, some are used for battery charging, some for temperature monitoring. As this is very core functionality that a lot of drivers depend on and was formerly compiled in with the AB8500 core driver, we deafault it to 'y' in Kconfig: it can be compiled out but it is really not advisible: the platform can for example overheat if we do. Reviewed-by: Jonathan Cameron <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18mfd: ab8500: Augment DT bindingsLinus Walleij1-0/+119
As we migrate the AB8500 GPADC driver to use IIO, we need to augment the bindings to account for defining the ADC channels in the device tree. Cc: [email protected] Acked-by: Lee Jones <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18hwmon: ab8500: Convert to IIO ADCLinus Walleij2-25/+43
This switches the AB8500 hardware monitor driver to using the standard IIO ADC channel lookup and conversion routines. Acked-by: Guenter Roeck <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18power: supply: ab8500_fg: Convert to IIO ADCLinus Walleij1-8/+15
This switches the AB8500 fuel gauge driver to using the standard IIO ADC channel lookup and conversion routines. Acked-by: Sebastian Reichel <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18power: supply: ab8500_charger: Convert to IIO ADCLinus Walleij1-20/+58
This switches the AB8500 battery charger driver to using the standard IIO ADC channel lookup and conversion routines. Acked-by: Jonathan Cameron <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-18power: supply: ab8500_btemp: Convert to IIO ADCLinus Walleij2-13/+30
This switches the AB8500 battery temperature driver to using the standard IIO ADC channel lookup and conversion routines. Acked-by: Sebastian Reichel <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2019-10-14power: supply: axp20x_usb_power: enable USB BC detection on AXP813Icenowy Zheng1-0/+8
The AXP813 PMIC has support for detection of USB Battery Charging specification, and it will limit the current to 500mA by default when the detection is not enabled or the detection result is SDP. Enable the BC detection to allow correctly selection of the current. Signed-off-by: Icenowy Zheng <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-10power: reset: at91-poweroff: lookup for proper PMC DT nodeClaudiu Beznea1-1/+7
Driver has been enabled also for SAM9X60. At the moment the patch which did this has been sent to mainline the PMC for SAM9X60 wasn't integrated. SAM9X60 has a new PMC compatible (see commit 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver")). Do to this we have to look for proper PMC compatible here, in SHDWC driver. Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-10test_power: Add CURRENT properties[email protected]1-0/+31
CURRENT is really general in other battery drivers, Android also has an interface to monitor CURRENT, so let's add it into test framework. The default value (1.6A) is just a random but reasonable value. Signed-off-by: Lecopzer Chen <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-10-10test_power: Add CHARGE_COUNTER properties[email protected]1-0/+30
CHARGE_COUNTER is really general in other power supply drivers and Android also has an interface to monitor CHARGE_COUNTER, so let's add it into test framework. Set default as -1000 is because the default status is POWER_SUPPLY_STATUS_DISCHARGING, which means the counter should be negative, and 1000 means not zero but small enough. Signed-off-by: Lecopzer Chen <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
2019-09-30Linux 5.4-rc1Linus Torvalds1-2/+2
2019-09-30Merge tag 'for-5.4-rc1-tag' of ↵Linus Torvalds5-18/+58
git://git.kernel.org/pub/scm/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
2019-09-30Merge tag 'csky-for-linus-5.4-rc1' of git://github.com/c-sky/csky-linuxLinus Torvalds17-212/+291
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
2019-09-30Merge tag 'armsoc-fixes' of ↵Linus Torvalds9-81/+66
git://git.kernel.org/pub/scm/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
2019-09-30Merge tag 'trace-v5.4-3' of ↵Linus Torvalds5-11/+30
git://git.kernel.org/pub/scm/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
2019-09-30Merge tag 'mmc-v5.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmcLinus Torvalds9-35/+410
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
2019-09-30csky: Move static keyword to the front of declarationKrzysztof Wilczynski1-1/+1
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 <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2019-09-30csky: entry: Remove unneeded need_resched() loopValentin Schneider1-4/+0
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 <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2019-09-29Merge tag 'char-misc-5.4-rc1' of ↵Linus Torvalds1-8/+34
git://git.kernel.org/pub/scm/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
2019-09-29Merge branch 'work.misc' of ↵Linus Torvalds4-10/+2
git://git.kernel.org/pub/scm/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
2019-09-29Merge tag '5.4-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6Linus Torvalds14-26/+194
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
2019-09-30csky: Fixup csky_pmu.max_period assignmentMao Han1-1/+1
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 <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2019-09-30csky: Fixup add zero_fp fixup perf backtrace panicGuo Ren2-21/+31
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 <[email protected]> Reported-by: Mao Han <[email protected]>
2019-09-30csky: Use generic free_initrd_mem()Mike Rapoport1-16/+0
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 <[email protected]> Signed-off-by: Guo Ren <[email protected]>
2019-09-29Merge branch 'entropy'Linus Torvalds2-1/+64
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
2019-09-29Revert "Revert "ext4: make __ext4_get_inode_loc plug""Linus Torvalds1-0/+3
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 <[email protected]> Cc: Ted Ts'o <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: Alexander E. Patrakov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2019-09-29random: try to actively add entropy rather than passively wait for itLinus Torvalds1-1/+61
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 <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Nicholas Mc Guire <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Kees Cook <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: Alexander E. Patrakov <[email protected]> Cc: Lennart Poettering <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2019-09-29Merge tag 'fixes-5.4-merge-window' of ↵Olof Johansson6-79/+64
git://git.kernel.org/pub/scm/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/[email protected] Signed-off-by: Olof Johansson <[email protected]>
2019-09-29Merge tag 'scmi-fixes-5.4' of ↵Olof Johansson17-202/+982
git://git.kernel.org/pub/scm/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 <[email protected]>
2019-09-29Merge tag 'libnvdimm-fixes-5.4-rc1' of ↵Linus Torvalds15-51/+110
git://git.kernel.org/pub/scm/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.
2019-09-29Merge branch 'linus' of ↵Linus Torvalds5-463/+114
git://git.kernel.org/pub/scm/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
2019-09-29Merge branch 'i2c/for-next' of ↵Linus Torvalds4-7/+21
git://git.kernel.org/pub/scm/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