Commit Graph

902315 Commits

Author SHA1 Message Date
Connor O'Brien
eb8cd4a66a ANDROID: cpufreq: times: Remove /proc/uid_concurrent_{active,policy}_time
This removes the portion of commit 4242998e5b ("ANDROID: cpufreq:
times: add /proc/uid_concurrent_{active,policy}_time") adding new
files for per-UID stats while preserving a change to skip accounting
for idle tasks.

Bug: 127641090
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I1e334dcc71201118aa62115fa5247263e545e8d6
2020-03-06 12:29:41 -08:00
Can Guo
80c662365f FROMGIT: scsi: ufs-qcom: Delay specific time before gate ref clk
After enter hibern8, as UFS JEDEC ver 3.0 requires, a specific gating wait
time is required before disable the device reference clock. If it is not
specified, use the old delay.

Link: https://lore.kernel.org/r/1581392451-28743-8-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I44b3cbe583741fcfadbb9952fad1037e08175555
(cherry picked from commit 1cbadd0c33
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 19:29:10 +00:00
Can Guo
62c8dccca7 FROMGIT: scsi: ufs: Add dev ref clock gating wait time support
In UFS version 3.0, a newly added attribute bRefClkGatingWaitTime defines
the minimum time for which the reference clock is required by device during
transition to LS-MODE or HIBERN8 state. Make this change to reflect the new
requirement by adding delays before turning off the clock.

Link: https://lore.kernel.org/r/1581392451-28743-7-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I33b3c50ae0854621364bb3785c96e951dc7031ef
(cherry picked from commit 09f17791e6
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 19:29:02 +00:00
Can Guo
21b358330a Revert "FROMLIST: scsi: ufs: Add dev ref clock gating wait time support"
Revert commit 1ddc9771d5 ("FROMLIST: scsi: ufs: Add dev ref clock gating
wait time support") due to it has major changes in its latest version.

Bug: 150892981
Change-Id: I582da6b0093e46a10e58f8f6a48448cd7ae36ac4
[can: Resolved minor conflict in drivers/scsi/ufs/ufs.h and drivers/scsi/ufs/ufshcd.c]
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 19:28:54 +00:00
Can Guo
6b481e3fe1 FROMGIT: scsi: ufs-qcom: Adjust bus bandwidth voting and unvoting
The bus bandwidth voting is required to be done before the bus clocks are
enabled, and the unvoting is required to be done only after the bus clocks
are disabled.

Link: https://lore.kernel.org/r/1581392451-28743-4-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Reviewed-by: Hongwu Su <hongwus@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150892981
Change-Id: I27f9a9584fbccbb84231354281f67b67b3d71373
(cherry picked from commit 8240dd97ce
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 19:28:46 +00:00
Can Guo
b6ee4384e1 Revert "FROMLIST: scsi: ufs-qcom: Adjust bus bandwidth voting and unvoting"
Revert commit cfe099a8bd ("FROMLIST: scsi: ufs-qcom: Adjust bus bandwidth
voting and unvoting") due to it has major changes in its latest version.

Bug: 150892981
Change-Id: I5a8a4ba287948dda423f2d7be342d8eed9123857
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-06 19:28:39 +00:00
Hridya Valsaraju
0a6517f730 ANDROID: staging: ion: Add an in-kernel interface to request heap info.
Add an API to allow in-kernel clients to request heap ID info.

Test: make
Bug: 149961819

Change-Id: I59d26355115f100a60bcf8ade0e3afa4b89c5d0a
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-06 00:40:13 +00:00
Ramon Pantin
5ef359df15 ANDROID: CC_FLAGS_CFI add -fno-sanitize-blacklist
Added the clang compiler option -fno-sanitize-blacklist to the
CC_FLAGS_CFI variable.

Without this flag, the make dependecy list files produced by clang,
have the cfi_blacklist.txt as their first dependency.  The dependecy
lists are produced by the -Wp,-MD,filename option (for example:
-Wp,-MD,mm/.mmap.o.d).  The dependency lists are processed by the
scripts/basic/fixdeps.c program, and are transformed into the .o.cmd
files (for example: mm/.mmap.o.cmd).  That file is meant to have the
source code of the file listed in the source_* make variable (for
example: source_mm/mmap.o).  Instead of that that variable refers
to the full pathname to the cfi_blacklist.txt file.  Furthermore, the
deps_* make variable is not supposed to include the source code file
but it does include it.

The cfi_blacklist.txt file is not required by the use of CFI for the
kernel, use of the -fno-sanitize-blacklist causes the .o.cmd file
to have the correct values in its source_* and dep_* variables.

Signed-off-by: Ramon Pantin <pantin@google.com>
Bug: 150504710
Test: interactively
Change-Id: Iac39df3ab74e6d8753a7962925fab0c3854929e4
2020-03-05 22:14:23 +00:00
Kees Cook
af36d264aa FROMLIST: lib: test_stackinit.c: XFAIL switch variable init tests
The tests for initializing a variable defined between a switch
statement's test and its first "case" statement are currently not
initialized in Clang[1] nor the proposed auto-initialization feature in
GCC.

We should retain the test (so that we can evaluate compiler fixes),
but mark it as an "expected fail". The rest of the kernel source will
be adjusted to avoid this corner case.

Also disable -Wswitch-unreachable for the test so that the intentionally
broken code won't trigger warnings for GCC (nor future Clang) when
initialization happens this unhandled place.

[1] https://bugs.llvm.org/show_bug.cgi?id=44916

Suggested-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
[adelva: cherry picking to avoid boot test flakes]
Bug: 144999193
Link: https://lore.kernel.org/lkml/202002191358.2897A07C6@keescook/
Change-Id: I0e691f2299ab42526ea306a92551a1188c469136
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-05 09:54:12 -08:00
Todd Kjos
953d8eab92 ANDROID: gki_defconfig: disable KPROBES
Security teams from Google and Qualcomm request disabling
due to "large attack vector".

Bug: 149659981
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ie0a8e835bca8c7111f74440b1a44680856aae182
2020-03-04 13:44:24 -08:00
Can Guo
82a1b05eaa FROMGIT: scsi: ufs: Select INITIAL ADAPT type for HS Gear4
ADAPT is added specifically for HS Gear4 mode only. Select INITIAL ADAPT
before power mode change to G4 and select NO ADAPT before switch to non-G4
modes.

[mkp: fixed typo in header file]

Link: https://lore.kernel.org/r/1581485910-8307-3-git-send-email-cang@codeaurora.org
Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150731199
Change-Id: I6226b91826e139f9b8e99523da4861b01254fea8
(cherry picked from commit 518b32f1dd
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-04 19:35:02 +00:00
Can Guo
070d717720 FROMLIST: scsi: ufs: Use ufshcd_config_pwr_mode() when scale gear
When scale gear, use ufshcd_config_pwr_mode() instead of
ufshcd_change_power_mode() so that vops_pwr_change_notify(PRE_CHANGE)
can be utilized to allow vendors use customized settings before change
the power mode.

Bug: 150731199
Link: https://lore.kernel.org/linux-scsi/1581485910-8307-2-git-send-email-cang@codeaurora.org/
Change-Id: I8c8602b8ce3fd9fa4644e126fbd84bf564bf11e7
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-04 19:34:53 +00:00
Can Guo
3751d2c97e FROMGIT: scsi: ufs-qcom: Apply QUIRK_HOST_TACTIVATE for WDC UFS devices
Western Digital UFS devices require host's PA_TACTIVATE to be lower than
device's PA_TACTIVATE, otherwise it may get stuck during hibern8 sequence.

Link: https://lore.kernel.org/r/1582517363-11536-3-git-send-email-cang@codeaurora.org
Reviewed-by: Asutosh Das <asutoshd@codeaurora.org>
Acked-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150731199
Change-Id: I3dbe4ff9b452b2ea970af624ca685939c24c2d15
(cherry picked from commit 27ff2c60e0
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-04 19:34:45 +00:00
Can Guo
e163beb50e FROMGIT: scsi: ufs: Allow vendor device quirks to be applied early
Currently ufshcd_vops_apply_dev_quirks() comes after all UniPro parameters
have been tuned. Move it up so that vendors have a chance to apply device
quirks in advance.

Link: https://lore.kernel.org/r/1582517363-11536-2-git-send-email-cang@codeaurora.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Bug: 150731199
Change-Id: Ib4bb3001f253d6f25666b008f9f3072a49c42ac0
(cherry picked from commit e91ed9e0e4
https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git 5.7/scsi-queue)
Signed-off-by: Can Guo <cang@codeaurora.org>
2020-03-04 19:34:34 +00:00
Alistair Delva
843cfc2170 ANDROID: gki_defconfig: Enable MFD_SYSCON on x86
This option was accidentally skipped when it was added on arm64.

Bug: 144867487
Change-Id: Ifa87a894954ec9a26d5ab40e7d18e2f2f5e4f416
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-04 07:51:34 +00:00
Alistair Delva
8219376a12 ANDROID: Unconditionally create bridge tracepoints
Even if the bridge module is not enabled, we may need the tracepoints
downstream in products that enable bridge.ko, so avoid defining the
export of these symbols based on a config option.

Bug: 150625937
Change-Id: Ib961fd6e353fe3bdfde11a38488568f42f1dbe7a
Signed-off-by: Alistair Delva <adelva@google.com>
2020-03-04 07:06:12 +00:00
Todd Kjos
c3691ee373 ANDROID: gki_defconfig: add CONFIG_IIO_BUFFER and CONFIG_IIO_TRIGGER
Add configs to provide framework for partner sensor-hub drivers

Bug: 150277239
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I04a873c249e1871fd8b2c03ee3737bc645888a8f
2020-03-04 01:09:13 +00:00
Orson Zhai
7173420012 ANDROID: gki: set CONFIG_SERIAL_SPRD_CONSOLE for earlycon
Bug: 150653429
Change-Id: I13abca7a9be21efdbb4a158334691c7e33d1d92b
Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
Signed-off-by: Todd Kjos <tkjos@google.com>
2020-03-04 01:09:03 +00:00
Ram Muthiah
8d5b7b69e1 ANDROID: Removed default m for virtual sw crypto device
Goldfish and Cuttlefish already use software encrytion drivers and
don't use this one.

Bug: 150620456
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I72b0155b5db9bc54bfca0ed99734b7c2c513ceac
2020-03-03 14:37:50 -08:00
Ram Muthiah
60404538f6 ANDROID: Remove default y on BRIDGE_IGMP_SNOOPING
This binary module gets enabled if BRIDGE, a tristate config, gets
enabled as either a builtin or y. This dependent config should also
be tristate but it seems like that hasn't been done upstream yet.

Bug: 150620456
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I699b73bfac8a0c6cb5e14fefe56b6c013e2410a8
2020-03-03 14:37:39 -08:00
Ram Muthiah
180e8150bd ANDROID: GKI: build in HVC_DRIVER
Cuttlefish and Goldfish both rely on the virtio console and
HVC_DRIVER is a binary config which is a dep for that driver.

Bug: 150620456
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I54e7d95da4fcddd534d0f0f48b5c546cd2f2718d
2020-03-03 14:37:26 -08:00
Ram Muthiah
1e702f432d ANDROID: GKI: Added missing SND configs
Bug: 150620456
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I809392ffe06327839be7574195b1f080db2d1f2e
2020-03-03 20:55:26 +00:00
Ram Muthiah
759fcb59aa ANDROID: GKI: Add SND_INTEL_NHLT
Test: Treehugger
Bug: 150620456
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I64806866c8a84d8fddb7d44ebe3c9bcf572d5118
2020-03-03 20:55:18 +00:00
Ram Muthiah
62f596614a ANDROID: Re-add default y for VIRTIO_PCI_LEGACY
This is a partial revert of commit 64b9a20673.

Bug: 139431025
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: I2ebbe2f20e318cb01206ccbd8c6a5803f7f503b6
2020-03-03 20:55:03 +00:00
Eric Biggers
8de80df7d7 ANDROID: scsi: ufs: allow ufs variants to override sg entry size
Modify the UFSHCD core to allow 'struct ufshcd_sg_entry' to be
variable-length.  The default is the standard length, but variants can
override ufs_hba::sg_entry_size with a larger value if there are
vendor-specific fields following the standard ones.

This is needed to support inline encryption with ufs-exynos (FMP).

Bug: 129991660
Change-Id: I6ab9458d5c23331013e6b736d6fea378a6b5b86c
Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-03-03 12:47:37 -08:00
Greg Kroah-Hartman
f4bdd2d3e4 Merge 5.6-rc4 into android-mainline
Linux 5.6-rc4

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I578d32be8e67dcc83c260e5e6bf63c493d40735d
2020-03-02 11:56:25 +01:00
John Stultz
89ff7d0c86 ANDROID: ASoC: core: Fix soc_pcm_hw_params crash
In testing some db845c audio patches, I came across a crash (see
below) that I only could reproduce on android-mainline and not
with Linus' tree.

I chased down the issue to a null pointer traversal that was
introduced commit 9cb7ec3e9b ("ANDROID: ASoC: core - add
hostless DAI support").

This patch adds an extra check to avoid the null traversal

[   74.058167] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
...
[   74.130054] Hardware name: Thundercomm Dragonboard 845c (DT)
[   74.135777] pstate: 80400005 (Nzcv daif +PAN -UAO)
[   74.140639] pc : soc_pcm_hw_params+0x194/0x690
[   74.145141] lr : soc_pcm_hw_params+0x88/0x690
[   74.149544] sp : ffffffc01249b9d0
...
[   74.233392] Call trace:
[   74.235878]  soc_pcm_hw_params+0x194/0x690
[   74.240028]  dpcm_fe_dai_hw_params+0xb0/0x130
[   74.244435]  snd_pcm_hw_params+0xf8/0x3f8
[   74.248492]  snd_pcm_ioctl_hw_params_compat+0x148/0x288
[   74.253769]  snd_pcm_ioctl_compat+0x764/0x8c8
[   74.258178]  __arm64_compat_sys_ioctl+0xf4/0x110
[   74.262850]  el0_svc_common.constprop.2+0x78/0x188
[   74.267698]  do_el0_svc_compat+0x2c/0x38
[   74.271666]  el0_sync_compat_handler+0x130/0x180
[   74.276334]  el0_sync_compat+0x144/0x180
[   74.280306] Code: 12000400 7100041f 54002120 f9403420 (f9400802)
[   74.286464] ---[ end trace 3c2126d28e1f9af7 ]---
[   74.291131] Kernel panic - not syncing: Fatal exception

Fixes: 9cb7ec3e9b ("ANDROID: ASoC: core - add hostless DAI support")
Change-Id: Ib7addfee4ac7382824fcc12057b93a956e6ae5f4
Signed-off-by: John Stultz <john.stultz@linaro.org>
2020-03-01 23:10:18 +00:00
Linus Torvalds
98d54f81e3 Linux 5.6-rc4 2020-03-01 16:38:46 -06:00
Linus Torvalds
e70869821a Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o:
 "Two more bug fixes (including a regression) for 5.6"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
  jbd2: fix data races at struct journal_head
2020-03-01 16:35:08 -06:00
Ram Muthiah
4389091ece ANDROID: GKI: Remove CONFIG_BRIDGE from arm64 config
CONFIG_BRIDGE is not needed at boot time and is tristate.
Any GKI device which requires this config can load the bridge module
during init.

Bug: 135666008
Test: Treehugger
Signed-off-by: Ram Muthiah <rammuthiah@google.com>
Change-Id: If22ceac2982a0f6b7a922393fb1dd08c68f6bc70
2020-03-01 21:21:24 +00:00
Linus Torvalds
f853ed90e2 Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM fixes from Paolo Bonzini:
 "More bugfixes, including a few remaining "make W=1" issues such as too
  large frame sizes on some configurations.

  On the ARM side, the compiler was messing up shadow stacks between EL1
  and EL2 code, which is easily fixed with __always_inline"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: VMX: check descriptor table exits on instruction emulation
  kvm: x86: Limit the number of "kvm: disabled by bios" messages
  KVM: x86: avoid useless copy of cpufreq policy
  KVM: allow disabling -Werror
  KVM: x86: allow compiling as non-module with W=1
  KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis
  KVM: Introduce pv check helpers
  KVM: let declaration of kvm_get_running_vcpus match implementation
  KVM: SVM: allocate AVIC data structures based on kvm_amd module parameter
  arm64: Ask the compiler to __always_inline functions used by KVM at HYP
  KVM: arm64: Define our own swab32() to avoid a uapi static inline
  KVM: arm64: Ask the compiler to __always_inline functions used at HYP
  kvm: arm/arm64: Fold VHE entry/exit work into kvm_vcpu_run_vhe()
  KVM: arm/arm64: Fix up includes for trace.h
2020-03-01 15:16:35 -06:00
Oliver Upton
86f7e90ce8 KVM: VMX: check descriptor table exits on instruction emulation
KVM emulates UMIP on hardware that doesn't support it by setting the
'descriptor table exiting' VM-execution control and performing
instruction emulation. When running nested, this emulation is broken as
KVM refuses to emulate L2 instructions by default.

Correct this regression by allowing the emulation of descriptor table
instructions if L1 hasn't requested 'descriptor table exiting'.

Fixes: 07721feee4 ("KVM: nVMX: Don't emulate instructions in guest mode")
Reported-by: Jan Kiszka <jan.kiszka@web.de>
Cc: stable@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-03-01 19:26:31 +01:00
Linus Torvalds
fb279f4e23 Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
 "I2C has three driver bugfixes for you. We agreed on the Mac regression
  to go in via I2C"

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  macintosh: therm_windtunnel: fix regression when instantiating devices
  i2c: altera: Fix potential integer overflow
  i2c: jz4780: silence log flood on txabrt
2020-02-29 19:16:46 -06:00
Dan Carpenter
37b0b6b8b9 ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
If sbi->s_flex_groups_allocated is zero and the first allocation fails
then this code will crash.  The problem is that "i--" will set "i" to
-1 but when we compare "i >= sbi->s_flex_groups_allocated" then the -1
is type promoted to unsigned and becomes UINT_MAX.  Since UINT_MAX
is more than zero, the condition is true so we call kvfree(new_groups[-1]).
The loop will carry on freeing invalid memory until it crashes.

Fixes: 7c990728b9 ("ext4: fix potential race between s_flex_groups online resizing and access")
Reviewed-by: Suraj Jitindar Singh <surajjs@amazon.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20200228092142.7irbc44yaz3by7nb@kili.mountain
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29 17:48:08 -05:00
Wolfram Sang
38b17afb0e macintosh: therm_windtunnel: fix regression when instantiating devices
Removing attach_adapter from this driver caused a regression for at
least some machines. Those machines had the sensors described in their
DT, too, so they didn't need manual creation of the sensor devices. The
old code worked, though, because manual creation came first. Creation of
DT devices then failed later and caused error logs, but the sensors
worked nonetheless because of the manually created devices.

When removing attach_adaper, manual creation now comes later and loses
the race. The sensor devices were already registered via DT, yet with
another binding, so the driver could not be bound to it.

This fix refactors the code to remove the race and only manually creates
devices if there are no DT nodes present. Also, the DT binding is updated
to match both, the DT and manually created devices. Because we don't
know which device creation will be used at runtime, the code to start
the kthread is moved to do_probe() which will be called by both methods.

Fixes: 3e7bed5271 ("macintosh: therm_windtunnel: drop using attach_adapter")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=201723
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Tested-by: Erhard Furtner <erhard_f@mailbox.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org # v4.19+
2020-02-29 21:13:22 +01:00
Qian Cai
6c5d911249 jbd2: fix data races at struct journal_head
journal_head::b_transaction and journal_head::b_next_transaction could
be accessed concurrently as noticed by KCSAN,

 LTP: starting fsync04
 /dev/zero: Can't open blockdev
 EXT4-fs (loop0): mounting ext3 file system using the ext4 subsystem
 EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null)
 ==================================================================
 BUG: KCSAN: data-race in __jbd2_journal_refile_buffer [jbd2] / jbd2_write_access_granted [jbd2]

 write to 0xffff99f9b1bd0e30 of 8 bytes by task 25721 on cpu 70:
  __jbd2_journal_refile_buffer+0xdd/0x210 [jbd2]
  __jbd2_journal_refile_buffer at fs/jbd2/transaction.c:2569
  jbd2_journal_commit_transaction+0x2d15/0x3f20 [jbd2]
  (inlined by) jbd2_journal_commit_transaction at fs/jbd2/commit.c:1034
  kjournald2+0x13b/0x450 [jbd2]
  kthread+0x1cd/0x1f0
  ret_from_fork+0x27/0x50

 read to 0xffff99f9b1bd0e30 of 8 bytes by task 25724 on cpu 68:
  jbd2_write_access_granted+0x1b2/0x250 [jbd2]
  jbd2_write_access_granted at fs/jbd2/transaction.c:1155
  jbd2_journal_get_write_access+0x2c/0x60 [jbd2]
  __ext4_journal_get_write_access+0x50/0x90 [ext4]
  ext4_mb_mark_diskspace_used+0x158/0x620 [ext4]
  ext4_mb_new_blocks+0x54f/0xca0 [ext4]
  ext4_ind_map_blocks+0xc79/0x1b40 [ext4]
  ext4_map_blocks+0x3b4/0x950 [ext4]
  _ext4_get_block+0xfc/0x270 [ext4]
  ext4_get_block+0x3b/0x50 [ext4]
  __block_write_begin_int+0x22e/0xae0
  __block_write_begin+0x39/0x50
  ext4_write_begin+0x388/0xb50 [ext4]
  generic_perform_write+0x15d/0x290
  ext4_buffered_write_iter+0x11f/0x210 [ext4]
  ext4_file_write_iter+0xce/0x9e0 [ext4]
  new_sync_write+0x29c/0x3b0
  __vfs_write+0x92/0xa0
  vfs_write+0x103/0x260
  ksys_write+0x9d/0x130
  __x64_sys_write+0x4c/0x60
  do_syscall_64+0x91/0xb05
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

 5 locks held by fsync04/25724:
  #0: ffff99f9911093f8 (sb_writers#13){.+.+}, at: vfs_write+0x21c/0x260
  #1: ffff99f9db4c0348 (&sb->s_type->i_mutex_key#15){+.+.}, at: ext4_buffered_write_iter+0x65/0x210 [ext4]
  #2: ffff99f5e7dfcf58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
  #3: ffff99f9db4c0168 (&ei->i_data_sem){++++}, at: ext4_map_blocks+0x176/0x950 [ext4]
  #4: ffffffff99086b40 (rcu_read_lock){....}, at: jbd2_write_access_granted+0x4e/0x250 [jbd2]
 irq event stamp: 1407125
 hardirqs last  enabled at (1407125): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
 hardirqs last disabled at (1407124): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
 softirqs last  enabled at (1405528): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
 softirqs last disabled at (1405521): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0

 Reported by Kernel Concurrency Sanitizer on:
 CPU: 68 PID: 25724 Comm: fsync04 Tainted: G L 5.6.0-rc2-next-20200221+ #7
 Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019

The plain reads are outside of jh->b_state_lock critical section which result
in data races. Fix them by adding pairs of READ|WRITE_ONCE().

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Qian Cai <cai@lca.pw>
Link: https://lore.kernel.org/r/20200222043111.2227-1-cai@lca.pw
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-02-29 13:40:02 -05:00
Linus Torvalds
7557c1b3f7 Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley:
 "Four small fixes.

  Three are in drivers for fairly obvious bugs. The fourth is a set of
  regressions introduced by the compat_ioctl changes because some of the
  compat updates wrongly replaced .ioctl instead of .compat_ioctl"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: compat_ioctl: cdrom: Replace .ioctl with .compat_ioctl in four appropriate places
  scsi: zfcp: fix wrong data and display format of SFP+ temperature
  scsi: sd_sbc: Fix sd_zbc_report_zones()
  scsi: libfc: free response frame from GPN_ID
2020-02-29 09:58:47 -06:00
Abhinav Kumar
411ad10903 Revert "ANDROID: drm: edid: add support for additional CEA extension blocks"
Necessary changes to parse required CEA extension EDID blocks
have been made to vendor specific drivers. No need to retain
the block parsing in DRM framework.

This reverts commit 1e3594cbb8.

Bug: 139653858
Change-Id: Ia88ab5ed0314b964ad44556e40c2e4d55e0b181c
Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
2020-02-28 23:22:44 +00:00
Linus Torvalds
29795de0d2 Merge tag 'pci-v5.6-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas:

 - Fix build issue on 32-bit ARM with old compilers (Marek Szyprowski)

 - Update MAINTAINERS for recent Cadence driver file move (Lukas
   Bulwahn)

* tag 'pci-v5.6-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  MAINTAINERS: Correct Cadence PCI driver path
  PCI: brcmstb: Fix build on 32bit ARM platforms with older compilers
2020-02-28 11:51:53 -08:00
Linus Torvalds
2edc78b9a4 Merge tag 'block-5.6-2020-02-28' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:

 - Passthrough insertion fix (Ming)

 - Kill off some unused arguments (John)

 - blktrace RCU fix (Jan)

 - Dead fields removal for null_blk (Dongli)

 - NVMe polled IO fix (Bijan)

* tag 'block-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
  nvme-pci: Hold cq_poll_lock while completing CQEs
  blk-mq: Remove some unused function arguments
  null_blk: remove unused fields in 'nullb_cmd'
  blktrace: Protect q->blk_trace with RCU
  blk-mq: insert passthrough request into hctx->dispatch directly
2020-02-28 11:43:30 -08:00
Linus Torvalds
74dea5d99d Merge tag 'io_uring-5.6-2020-02-28' of git://git.kernel.dk/linux-block
Pull io_uring fixes from Jens Axboe:

 - Fix for a race with IOPOLL used with SQPOLL (Xiaoguang)

 - Only show ->fdinfo if procfs is enabled (Tobias)

 - Fix for a chain with multiple personalities in the SQEs

 - Fix for a missing free of personality idr on exit

 - Removal of the spin-for-work optimization

 - Fix for next work lookup on request completion

 - Fix for non-vec read/write result progation in case of links

 - Fix for a fileset references on switch

 - Fix for a recvmsg/sendmsg 32-bit compatability mode

* tag 'io_uring-5.6-2020-02-28' of git://git.kernel.dk/linux-block:
  io_uring: fix 32-bit compatability with sendmsg/recvmsg
  io_uring: define and set show_fdinfo only if procfs is enabled
  io_uring: drop file set ref put/get on switch
  io_uring: import_single_range() returns 0/-ERROR
  io_uring: pick up link work on submit reference drop
  io-wq: ensure work->task_pid is cleared on init
  io-wq: remove spin-for-work optimization
  io_uring: fix poll_list race for SETUP_IOPOLL|SETUP_SQPOLL
  io_uring: fix personality idr leak
  io_uring: handle multiple personalities in link chains
2020-02-28 11:39:14 -08:00
Jens Axboe
5b8ea58b6a Merge branch 'nvme-5.6-rc4' of git://git.infradead.org/nvme into block-5.6
Pull NVMe fix from Keith.

* 'nvme-5.6-rc4' of git://git.infradead.org/nvme:
  nvme-pci: Hold cq_poll_lock while completing CQEs
2020-02-28 10:02:36 -07:00
Linus Torvalds
c60c040213 Merge tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fixes from Rafael Wysocki:
 "Fix a couple of configuration issues in the ACPI watchdog (WDAT)
  driver (Mika Westerberg) and make it possible to disable that driver
  at boot time in case it still does not work as expected (Jean
  Delvare)"

* tag 'acpi-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: watchdog: Set default timeout in probe
  ACPI: watchdog: Fix gas->access_width usage
  ACPICA: Introduce ACPI_ACCESS_BYTE_WIDTH() macro
  ACPI: watchdog: Allow disabling WDAT at boot
2020-02-28 09:02:18 -08:00
Linus Torvalds
3642859812 Merge tag 'pm-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
 "Fix a recent cpufreq initialization regression (Rafael Wysocki),
  revert a devfreq commit that made incompatible changes and broke user
  land on some systems (Orson Zhai), drop a stale reference to a
  document that has gone away recently (Jonathan Neuschäfer), and fix a
  typo in a hibernation code comment (Alexandre Belloni)"

* tag 'pm-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: Fix policy initialization for internal governor drivers
  Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
  PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
  Documentation: power: Drop reference to interface.rst
2020-02-28 08:49:52 -08:00
Linus Torvalds
bfeb4f9977 Merge tag 'zonefs-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs
Pull zonefs fixes from Damien Le Moal:
 "Two fixes in here:

   - Revert the initial decision to silently ignore IOCB_NOWAIT for
     asynchronous direct IOs to sequential zone files. Instead, return
     an error to the user to signal that the feature is not supported
     (from Christoph)

   - A fix to zonefs Kconfig to select FS_IOMAP to avoid build failures
     if no other file system already selected this option (from
     Johannes)"

* tag 'zonefs-5.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
  zonefs: select FS_IOMAP
  zonefs: fix IOCB_NOWAIT handling
2020-02-28 08:34:47 -08:00
Paolo Bonzini
e951445f4d Merge tag 'kvmarm-fixes-5.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
KVM/arm fixes for 5.6, take #1

- Fix compilation on 32bit
- Move  VHE guest entry/exit into the VHE-specific entry code
- Make sure all functions called by the non-VHE HYP code is tagged as __always_inline
2020-02-28 11:50:06 +01:00
Erwan Velu
ef935c25fd kvm: x86: Limit the number of "kvm: disabled by bios" messages
In older version of systemd(219), at boot time, udevadm is called with :
	/usr/bin/udevadm trigger --type=devices --action=add"

This program generates an echo "add" in /sys/devices/system/cpu/cpu<x>/uevent,
leading to the "kvm: disabled by bios" message in case of your Bios disabled
the virtualization extensions.

On a modern system running up to 256 CPU threads, this pollutes the Kernel logs.

This patch offers to ratelimit this message to avoid any userspace program triggering
this uevent printing this message too often.

This patch is only a workaround but greatly reduce the pollution without
breaking the current behavior of printing a message if some try to instantiate
KVM on a system that doesn't support it.

Note that recent versions of systemd (>239) do not have trigger this behavior.

This patch will be useful at least for some using older systemd with recent Kernels.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-02-28 11:37:20 +01:00
Rafael J. Wysocki
189c6967fe Merge branches 'pm-sleep' and 'pm-devfreq'
* pm-sleep:
  PM / hibernate: fix typo "reserverd_size" -> "reserved_size"
  Documentation: power: Drop reference to interface.rst

* pm-devfreq:
  Revert "PM / devfreq: Modify the device name as devfreq(X) for sysfs"
2020-02-28 11:00:50 +01:00
Paolo Bonzini
aaec7c03de KVM: x86: avoid useless copy of cpufreq policy
struct cpufreq_policy is quite big and it is not a good idea
to allocate one on the stack.  Just use cpufreq_cpu_get and
cpufreq_cpu_put which is even simpler.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-02-28 10:54:50 +01:00
Paolo Bonzini
4f337faf1c KVM: allow disabling -Werror
Restrict -Werror to well-tested configurations and allow disabling it
via Kconfig.

Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-02-28 10:45:28 +01:00