]> Git Repo - linux.git/log
linux.git
3 years agokbuild: parameterize the .o part of suffix-search
Masahiro Yamada [Sun, 2 May 2021 18:09:55 +0000 (03:09 +0900)]
kbuild: parameterize the .o part of suffix-search

The suffix-search macro hard-codes the suffix, '.o'.

Make it a parameter so that the multi-search and real-search macros
can be reused for foo-dtbs syntax introduced by commit 15d16d6dadf6
("kbuild: Add generic rule to apply fdtoverlay").

Signed-off-by: Masahiro Yamada <[email protected]>
3 years agoarm64: entry: always set GIC_PRIO_PSR_I_SET during entry
Mark Rutland [Wed, 28 Apr 2021 11:15:55 +0000 (12:15 +0100)]
arm64: entry: always set GIC_PRIO_PSR_I_SET during entry

Zenghui reports that booting a kernel with "irqchip.gicv3_pseudo_nmi=1"
on the command line hits a warning during kernel entry, due to the way
we manipulate the PMR.

Early in the entry sequence, we call lockdep_hardirqs_off() to inform
lockdep that interrupts have been masked (as the HW sets DAIF wqhen
entering an exception). Architecturally PMR_EL1 is not affected by
exception entry, and we don't set GIC_PRIO_PSR_I_SET in the PMR early in
the exception entry sequence, so early in exception entry the PMR can
indicate that interrupts are unmasked even though they are masked by
DAIF.

If DEBUG_LOCKDEP is selected, lockdep_hardirqs_off() will check that
interrupts are masked, before we set GIC_PRIO_PSR_I_SET in any of the
exception entry paths, and hence lockdep_hardirqs_off() will WARN() that
something is amiss.

We can avoid this by consistently setting GIC_PRIO_PSR_I_SET during
exception entry so that kernel code sees a consistent environment. We
must also update local_daif_inherit() to undo this, as currently only
touches DAIF. For other paths, local_daif_restore() will update both
DAIF and the PMR. With this done, we can remove the existing special
cases which set this later in the entry code.

We always use (GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET) for consistency with
local_daif_save(), as this will warn if it ever encounters
(GIC_PRIO_IRQOFF | GIC_PRIO_PSR_I_SET), and never sets this itself. This
matches the gic_prio_kentry_setup that we have to retain for
ret_to_user.

The original splat from Zenghui's report was:

| DEBUG_LOCKS_WARN_ON(!irqs_disabled())
| WARNING: CPU: 3 PID: 125 at kernel/locking/lockdep.c:4258 lockdep_hardirqs_off+0xd4/0xe8
| Modules linked in:
| CPU: 3 PID: 125 Comm: modprobe Tainted: G        W         5.12.0-rc8+ #463
| Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
| pstate: 604003c5 (nZCv DAIF +PAN -UAO -TCO BTYPE=--)
| pc : lockdep_hardirqs_off+0xd4/0xe8
| lr : lockdep_hardirqs_off+0xd4/0xe8
| sp : ffff80002a39bad0
| pmr_save: 000000e0
| x29: ffff80002a39bad0 x28: ffff0000de214bc0
| x27: ffff0000de1c0400 x26: 000000000049b328
| x25: 0000000000406f30 x24: ffff0000de1c00a0
| x23: 0000000020400005 x22: ffff8000105f747c
| x21: 0000000096000044 x20: 0000000000498ef9
| x19: ffff80002a39bc88 x18: ffffffffffffffff
| x17: 0000000000000000 x16: ffff800011c61eb0
| x15: ffff800011700a88 x14: 0720072007200720
| x13: 0720072007200720 x12: 0720072007200720
| x11: 0720072007200720 x10: 0720072007200720
| x9 : ffff80002a39bad0 x8 : ffff80002a39bad0
| x7 : ffff8000119f0800 x6 : c0000000ffff7fff
| x5 : ffff8000119f07a8 x4 : 0000000000000001
| x3 : 9bcdab23f2432800 x2 : ffff800011730538
| x1 : 9bcdab23f2432800 x0 : 0000000000000000
| Call trace:
|  lockdep_hardirqs_off+0xd4/0xe8
|  enter_from_kernel_mode.isra.5+0x7c/0xa8
|  el1_abort+0x24/0x100
|  el1_sync_handler+0x80/0xd0
|  el1_sync+0x6c/0x100
|  __arch_clear_user+0xc/0x90
|  load_elf_binary+0x9fc/0x1450
|  bprm_execve+0x404/0x880
|  kernel_execve+0x180/0x188
|  call_usermodehelper_exec_async+0xdc/0x158
|  ret_from_fork+0x10/0x18

Fixes: 23529049c684 ("arm64: entry: fix non-NMI user<->kernel transitions")
Fixes: 7cd1ea1010ac ("arm64: entry: fix non-NMI kernel<->kernel transitions")
Fixes: f0cd5ac1e4c5 ("arm64: entry: fix NMI {user, kernel}->kernel transitions")
Fixes: 2a9b3e6ac69a ("arm64: entry: fix EL1 debug transitions")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Rutland <[email protected]>
Reported-by: Zenghui Yu <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Will Deacon <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
3 years agoarch: use cross_compiling to check whether it is a cross build or not
Masahiro Yamada [Sat, 1 May 2021 17:24:36 +0000 (02:24 +0900)]
arch: use cross_compiling to check whether it is a cross build or not

'cross_compiling' is defined by the top Makefile and available for
arch Makefiles to check whether it is a cross build or not. A good
thing is the variable name 'cross_compiling' is self-documenting.

This is a simple replacement for m68k, mips, sh, for which $(ARCH)
and $(SRCARCH) always match.

No functional change is intended for xtensa, either.

This is rather a fix for parisc because arch/parisc/Makefile defines
UTS_MATCHINE depending on CONFIG_64BIT, therefore cc-cross-prefix
is not working in Kconfig time.

Signed-off-by: Masahiro Yamada <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Acked-by: Helge Deller <[email protected]> # parisc
Acked-by: Max Filippov <[email protected]> # xtensa
3 years agoARM: footbridge: remove personal server platform
Russell King [Wed, 5 May 2021 10:23:50 +0000 (11:23 +0100)]
ARM: footbridge: remove personal server platform

Remove the personal server platform, as that has had an array overrun
issue identified. It is believed that no one is using this code.

Signed-off-by: Russell King <[email protected]>
3 years agodocs: vfio: fix typo
Alyssa Ross [Tue, 4 May 2021 21:06:51 +0000 (21:06 +0000)]
docs: vfio: fix typo

Signed-off-by: Alyssa Ross <[email protected]>
Message-Id: <20210504210651.1316078[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
3 years agovfio/pci: Revert nvlink removal uAPI breakage
Alex Williamson [Tue, 4 May 2021 15:52:02 +0000 (09:52 -0600)]
vfio/pci: Revert nvlink removal uAPI breakage

Revert the uAPI changes from the below commit with notice that these
regions and capabilities are no longer provided.

Fixes: b392a1989170 ("vfio/pci: remove vfio_pci_nvlink2")
Reported-by: Greg Kurz <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Tested-by: Greg Kurz <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Message-Id: <162014341432.3807030.11054087109120670135.stgit@omen>

3 years agonetfilter: nfnetlink: add a missing rcu_read_unlock()
Eric Dumazet [Wed, 5 May 2021 07:33:24 +0000 (00:33 -0700)]
netfilter: nfnetlink: add a missing rcu_read_unlock()

Reported by syzbot :
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:201
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 26899, name: syz-executor.5
1 lock held by syz-executor.5/26899:
 #0: ffffffff8bf797a0 (rcu_read_lock){....}-{1:2}, at: nfnetlink_get_subsys net/netfilter/nfnetlink.c:148 [inline]
 #0: ffffffff8bf797a0 (rcu_read_lock){....}-{1:2}, at: nfnetlink_rcv_msg+0x1da/0x1300 net/netfilter/nfnetlink.c:226
Preemption disabled at:
[<ffffffff8917799e>] preempt_schedule_irq+0x3e/0x90 kernel/sched/core.c:5533
CPU: 1 PID: 26899 Comm: syz-executor.5 Not tainted 5.12.0-next-20210504-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 ___might_sleep.cold+0x1f1/0x237 kernel/sched/core.c:8338
 might_alloc include/linux/sched/mm.h:201 [inline]
 slab_pre_alloc_hook mm/slab.h:500 [inline]
 slab_alloc_node mm/slub.c:2845 [inline]
 kmem_cache_alloc_node+0x33d/0x3e0 mm/slub.c:2960
 __alloc_skb+0x20b/0x340 net/core/skbuff.c:413
 alloc_skb include/linux/skbuff.h:1107 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 netlink_ack+0x1ed/0xaa0 net/netlink/af_netlink.c:2437
 netlink_rcv_skb+0x33d/0x420 net/netlink/af_netlink.c:2508
 nfnetlink_rcv+0x1ac/0x420 net/netfilter/nfnetlink.c:650
 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
 sock_sendmsg_nosec net/socket.c:654 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:674
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665f9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa8a03ee188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 00000000004665f9
RDX: 0000000000000000 RSI: 0000000020000480 RDI: 0000000000000004
RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 00007fffe864480f R14: 00007fa8a03ee300 R15: 0000000000022000

================================================
WARNING: lock held when returning to user space!
5.12.0-next-20210504-syzkaller #0 Tainted: G        W
------------------------------------------------
syz-executor.5/26899 is leaving the kernel with locks still held!
1 lock held by syz-executor.5/26899:
 #0: ffffffff8bf797a0 (rcu_read_lock){....}-{1:2}, at: nfnetlink_get_subsys net/netfilter/nfnetlink.c:148 [inline]
 #0: ffffffff8bf797a0 (rcu_read_lock){....}-{1:2}, at: nfnetlink_rcv_msg+0x1da/0x1300 net/netfilter/nfnetlink.c:226
------------[ cut here ]------------
WARNING: CPU: 0 PID: 26899 at kernel/rcu/tree_plugin.h:359 rcu_note_context_switch+0xfd/0x16e0 kernel/rcu/tree_plugin.h:359
Modules linked in:
CPU: 0 PID: 26899 Comm: syz-executor.5 Tainted: G        W         5.12.0-next-20210504-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:rcu_note_context_switch+0xfd/0x16e0 kernel/rcu/tree_plugin.h:359
Code: 48 89 fa 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 2e 0d 00 00 8b bd cc 03 00 00 85 ff 7e 02 <0f> 0b 65 48 8b 2c 25 00 f0 01 00 48 8d bd cc 03 00 00 48 b8 00 00
RSP: 0000:ffffc90002fffdb0 EFLAGS: 00010002
RAX: 0000000000000007 RBX: ffff8880b9c36080 RCX: ffffffff8dc99bac
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000001
RBP: ffff88808b9d1c80 R08: 0000000000000000 R09: ffffffff8dc96917
R10: fffffbfff1b92d22 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88808b9d1c80 R14: ffff88808b9d1c80 R15: ffffc90002ff8000
FS:  00007fa8a03ee700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f09896ed000 CR3: 0000000032070000 CR4: 00000000001526f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __schedule+0x214/0x23e0 kernel/sched/core.c:5044
 schedule+0xcf/0x270 kernel/sched/core.c:5226
 exit_to_user_mode_loop kernel/entry/common.c:162 [inline]
 exit_to_user_mode_prepare+0x13e/0x280 kernel/entry/common.c:208
 irqentry_exit_to_user_mode+0x5/0x40 kernel/entry/common.c:314
 asm_sysvec_reschedule_ipi+0x12/0x20 arch/x86/include/asm/idtentry.h:637
RIP: 0033:0x4665f9

Fixes: 50f2db9e368f ("netfilter: nfnetlink: consolidate callback types")
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: syzbot <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
3 years agoftrace: Handle commands when closing set_ftrace_filter file
Steven Rostedt (VMware) [Wed, 5 May 2021 14:38:24 +0000 (10:38 -0400)]
ftrace: Handle commands when closing set_ftrace_filter file

 # echo switch_mm:traceoff > /sys/kernel/tracing/set_ftrace_filter

will cause switch_mm to stop tracing by the traceoff command.

 # echo -n switch_mm:traceoff > /sys/kernel/tracing/set_ftrace_filter

does nothing.

The reason is that the parsing in the write function only processes
commands if it finished parsing (there is white space written after the
command). That's to handle:

 write(fd, "switch_mm:", 10);
 write(fd, "traceoff", 8);

cases, where the command is broken over multiple writes.

The problem is if the file descriptor is closed, then the write call is
not processed, and the command needs to be processed in the release code.
The release code can handle matching of functions, but does not handle
commands.

Cc: [email protected]
Fixes: eda1e32855656 ("tracing: handle broken names in ftrace filter")
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
3 years agoMerge tag 'nvme-5.13-2021-05-05' of git://git.infradead.org/nvme into block-5.13
Jens Axboe [Wed, 5 May 2021 14:36:55 +0000 (08:36 -0600)]
Merge tag 'nvme-5.13-2021-05-05' of git://git.infradead.org/nvme into block-5.13

Pull NVMe fixes from Christoph:

"nvme updates for Linux 5.13

 - reset the bdev to ns head when failover (Daniel Wagner)
 - remove unsupported command noise (Keith Busch)
 - misc passthrough improvements (Kanchan Joshi)
 - fix controller ioctl through ns_head (Minwoo Im)
 - fix controller timeouts during reset (Tao Chiu)"

* tag 'nvme-5.13-2021-05-05' of git://git.infradead.org/nvme:
  nvmet: remove unsupported command noise
  nvme-multipath: reset bdev to ns head when failover
  nvme-pci: fix controller reset hang when racing with nvme_timeout
  nvme: move the fabrics queue ready check routines to core
  nvme: avoid memset for passthrough requests
  nvme: add nvme_get_ns helper
  nvme: fix controller ioctl through ns_head

3 years agoKVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks
Nicholas Piggin [Wed, 5 May 2021 12:15:09 +0000 (22:15 +1000)]
KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks

Commit b1c5356e873c ("KVM: PPC: Convert to the gfn-based MMU notifier
callbacks") causes unmap_gfn_range and age_gfn callbacks to only work
on the first gfn in the range. It also makes the aging callbacks call
into both radix and hash aging functions for radix guests. Fix this.

Add warnings for the single-gfn calls that have been converted to range
callbacks, in case they ever receieve ranges greater than 1.

Fixes: b1c5356e873c ("KVM: PPC: Convert to the gfn-based MMU notifier callbacks")
Reported-by: Bharata B Rao <[email protected]>
Signed-off-by: Nicholas Piggin <[email protected]>
Tested-by: Bharata B Rao <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
3 years agodt-bindings: gpio: add YAML description for rockchip,gpio-bank
Johan Jonker [Mon, 12 Apr 2021 22:36:15 +0000 (00:36 +0200)]
dt-bindings: gpio: add YAML description for rockchip,gpio-bank

Current dts files with "rockchip,gpio-bank" subnodes
are manually verified. In order to automate this process
the text that describes the compatible in rockchip,pinctrl.txt
is removed and converted to YAML in rockchip,gpio-bank.yaml.

Signed-off-by: Johan Jonker <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: mxs: remove useless function
Jiapeng Chong [Mon, 12 Apr 2021 02:16:21 +0000 (10:16 +0800)]
gpio: mxs: remove useless function

Fix the following gcc warning:

drivers/gpio/gpio-mxs.c:63:19: warning: kernel/sys_ni.cunused function
'is_imx28_gpio'.

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agodt-bindings: gpio: fairchild,74hc595: Convert to json-schema
Geert Uytterhoeven [Fri, 2 Apr 2021 12:19:58 +0000 (14:19 +0200)]
dt-bindings: gpio: fairchild,74hc595: Convert to json-schema

Convert the Generic 8-bit shift register Device Tree binding
documentation to json-schema.

Rename from gpio-74x164 to fairchild,74hc595, as the former refers to
the Linux driver, and not to a hardware name.
Add the missing hog description.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: it87: remove unused code
Jiapeng Chong [Tue, 6 Apr 2021 07:20:39 +0000 (15:20 +0800)]
gpio: it87: remove unused code

Fix the following clang warning:

drivers/gpio/gpio-it87.c:128:20: warning: unused function 'superio_outw'
[-Wunused-function].

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Jiapeng Chong <[email protected]>
Acked-by: Simon Guinot <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: 104-dio-48e: Fix coding style issues
Barney Goette [Thu, 8 Apr 2021 15:53:34 +0000 (10:53 -0500)]
gpio: 104-dio-48e: Fix coding style issues

Fixed multiple bare uses of 'unsigned' without 'int'.
Fixed space around "*" operator.
Fixed function parameter alignment to opening parenthesis.
Reported by checkpatch.

Signed-off-by: Barney Goette <[email protected]>
Acked-by: William Breathitt Gray <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: mpc8xxx: Add ACPI support
Ran Wang [Mon, 22 Mar 2021 03:38:46 +0000 (11:38 +0800)]
gpio: mpc8xxx: Add ACPI support

Current implementation only supports DT, now add ACPI support.

Signed-off-by: Ran Wang <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: ich: Switch to be dependent on LPC_ICH
Andy Shevchenko [Fri, 2 Apr 2021 18:42:25 +0000 (21:42 +0300)]
gpio: ich: Switch to be dependent on LPC_ICH

Driver is neither dependent to PCI nor using MFD_CORE.
Replace those dependency and selection by dependency on LPC_ICH.

Signed-off-by: Andy Shevchenko <[email protected]>
3 years agogpio: sch: Drop MFD_CORE selection
Andy Shevchenko [Fri, 2 Apr 2021 18:21:03 +0000 (21:21 +0300)]
gpio: sch: Drop MFD_CORE selection

Since we are depended on LPC_SCH, which selects MFD_CORE,
we don't need to do it ourselves.

Signed-off-by: Andy Shevchenko <[email protected]>
3 years agogpio: sch: depends on LPC_SCH
Randy Dunlap [Fri, 2 Apr 2021 16:17:51 +0000 (09:17 -0700)]
gpio: sch: depends on LPC_SCH

Since LPC_SCH provides GPIO functionality, GPIO_SCH should depend on
LPC_SCH to prevent kconfig warning and build errors:

WARNING: unmet direct dependencies detected for LPC_SCH
  Depends on [n]: HAS_IOMEM [=y] && PCI [=n]
  Selected by [y]:
  - GPIO_SCH [=y] && GPIOLIB [=y] && X86 [=y] && (X86 [=y] || COMPILE_TEST [=n]) && ACPI [=y]

and

../drivers/mfd/lpc_sch.c:204:1: warning: data definition has no type or storage class
 module_pci_driver(lpc_sch_driver);
 ^~~~~~~~~~~~~~~~~
../drivers/mfd/lpc_sch.c:204:1: error: type defaults to ‘int’ in declaration of ‘module_pci_driver’ [-Werror=implicit-int]
../drivers/mfd/lpc_sch.c:204:1: warning: parameter names (without types) in function declaration
../drivers/mfd/lpc_sch.c:197:26: warning: ‘lpc_sch_driver’ defined but not used [-Wunused-variable]
 static struct pci_driver lpc_sch_driver = {
                          ^~~~~~~~~~~~~~

Fixes: 6c46215d6b62 ("gpio: sch: Hook into ACPI GPE handler to catch GPIO edge events")
Signed-off-by: Randy Dunlap <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: [email protected]
Cc: Bartosz Golaszewski <[email protected]>
Cc: Denis Turischev <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
3 years agogpiolib: acpi: Add quirk to ignore EC wakeups on Dell Venue 10 Pro 5055
Hans de Goede [Thu, 1 Apr 2021 16:27:40 +0000 (18:27 +0200)]
gpiolib: acpi: Add quirk to ignore EC wakeups on Dell Venue 10 Pro 5055

Like some other Bay and Cherry Trail SoC based devices the Dell Venue
10 Pro 5055 has an embedded-controller which uses ACPI GPIO events to
report events instead of using the standard ACPI EC interface for this.

The EC interrupt is only used to report battery-level changes and
it keeps doing this while the system is suspended, causing the system
to not stay suspended.

Add an ignore-wake quirk for the GPIO pin used by the EC to fix the
spurious wakeups from suspend.

Signed-off-by: Hans de Goede <[email protected]>
Acked-by: Andy Shevchenko <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
3 years agogpio: sch: Hook into ACPI GPE handler to catch GPIO edge events
Andy Shevchenko [Wed, 17 Mar 2021 15:19:28 +0000 (17:19 +0200)]
gpio: sch: Hook into ACPI GPE handler to catch GPIO edge events

Neither the ACPI description on Intel Minnowboard (v1) platform provides
the required information to establish a generic handling nor the hardware
capable of doing it. According to the data sheet the hardware can generate
SCI events. Therefore, we need to hook from the driver into GPE handler of
the ACPI subsystem in order to catch and report GPIO-related events.

Validated on the Inlel Minnowboard (v1) platform and Intel Galileo Gen 2.

Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
3 years agogpio: sch: Add edge event support
Jan Kiszka [Wed, 17 Mar 2021 15:19:27 +0000 (17:19 +0200)]
gpio: sch: Add edge event support

Add the required infrastructure to enable and report edge events
of the pins to the GPIO core. The actual hook-up of the event interrupt
will happen separately.

Signed-off-by: Jan Kiszka <[email protected]>
Co-developed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
3 years agogpio: aggregator: Replace custom get_arg() with a generic next_arg()
Andy Shevchenko [Mon, 1 Mar 2021 16:59:32 +0000 (18:59 +0200)]
gpio: aggregator: Replace custom get_arg() with a generic next_arg()

cmdline library provides next_arg() helper to traverse over parameters
and their values given in command line. Replace custom approach in the driver
by it.

Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
3 years agolib/cmdline: Export next_arg() for being used in modules
Andy Shevchenko [Mon, 1 Mar 2021 16:59:31 +0000 (18:59 +0200)]
lib/cmdline: Export next_arg() for being used in modules

At least one module will benefit from using next_arg() helper.
Let's export it for that module and others if they consider it
helpful.

Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
3 years agogpio: omap: Use device_get_match_data() helper
Tian Tao [Wed, 31 Mar 2021 08:19:11 +0000 (16:19 +0800)]
gpio: omap: Use device_get_match_data() helper

Use the device_get_match_data() helper instead of open coding.

Signed-off-by: Tian Tao <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agogpio: Add Realtek Otto GPIO support
Sander Vanheule [Tue, 30 Mar 2021 17:48:43 +0000 (19:48 +0200)]
gpio: Add Realtek Otto GPIO support

Realtek MIPS SoCs (platform name Otto) have GPIO controllers with up to
64 GPIOs, divided over two banks. Each bank has a set of registers for
32 GPIOs, with support for edge-triggered interrupts.

Each GPIO bank consists of four 8-bit GPIO ports (ABCD and EFGH). Most
registers pack one bit per GPIO, except for the IMR register, which
packs two bits per GPIO (AB-CD).

Although the byte order is currently assumed to have port A..D at offset
0x0..0x3, this has been observed to be reversed on other, Lexra-based,
SoCs (e.g. RTL8196E/97D/97F).

Interrupt support is disabled for the fallback devicetree-compatible
'realtek,otto-gpio'. This allows for quick support of GPIO banks in
which the byte order would be unknown. In this case, the port ordering
in the IMR registers may not match the reversed order in the other
registers (DCBA, and BA-DC or DC-BA).

Signed-off-by: Sander Vanheule <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agodt-bindings: gpio: Binding for Realtek Otto GPIO
Sander Vanheule [Tue, 30 Mar 2021 17:48:42 +0000 (19:48 +0200)]
dt-bindings: gpio: Binding for Realtek Otto GPIO

Add a binding description for Realtek's GPIO controller found on several
of their MIPS-based SoCs (codenamed Otto), such as the RTL838x and
RTL839x series of switch SoCs.

A fallback binding 'realtek,otto-gpio' is provided for cases where the
actual port ordering is not known yet, and enabling the interrupt
controller may result in uncaught interrupts.

Signed-off-by: Sander Vanheule <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agodocs: kernel-parameters: Add gpio_mockup_named_lines
Alexander Dahl [Mon, 29 Mar 2021 11:16:48 +0000 (13:16 +0200)]
docs: kernel-parameters: Add gpio_mockup_named_lines

Missing since introduced in the driver.

Fixes: 8a68ea00a62e ("gpio: mockup: implement naming the lines")
Signed-off-by: Alexander Dahl <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agodocs: kernel-parameters: Move gpio-mockup for alphabetic order
Alexander Dahl [Mon, 29 Mar 2021 11:16:47 +0000 (13:16 +0200)]
docs: kernel-parameters: Move gpio-mockup for alphabetic order

All other sections are ordered alphabetically so do the same for
gpio-mockup.

Fixes: 0f98dd1b27d2 ("gpio/mockup: add virtual gpio device")
Signed-off-by: Alexander Dahl <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
3 years agolib: bitmap: provide devm_bitmap_alloc() and devm_bitmap_zalloc()
Bartosz Golaszewski [Mon, 15 Mar 2021 09:13:56 +0000 (10:13 +0100)]
lib: bitmap: provide devm_bitmap_alloc() and devm_bitmap_zalloc()

Provide managed variants of bitmap_alloc() and bitmap_zalloc().

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
3 years agolib: bitmap: order includes alphabetically
Bartosz Golaszewski [Mon, 15 Mar 2021 09:13:55 +0000 (10:13 +0100)]
lib: bitmap: order includes alphabetically

For better readability and maintenance: order the includes in bitmap
source files alphabetically.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
3 years agolib: bitmap: remove the 'extern' keyword from function declarations
Bartosz Golaszewski [Mon, 15 Mar 2021 09:13:54 +0000 (10:13 +0100)]
lib: bitmap: remove the 'extern' keyword from function declarations

The 'extern' keyword doesn't have any benefits for functions in header
files. Remove it.

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
3 years agox86/cpu: Use alternative to generate the TASK_SIZE_MAX constant
Linus Torvalds [Tue, 4 May 2021 21:07:53 +0000 (14:07 -0700)]
x86/cpu: Use alternative to generate the TASK_SIZE_MAX constant

We used to generate this constant with static jumps, which certainly
works, but generates some quite unreadable and horrid code, and extra
jumps.

It's actually much simpler to just use our alternative_asm()
infrastructure to generate a simple alternative constant, making the
generated code much more obvious (and straight-line rather than "jump
around to load the right constant").

Acked-by: Borislav Petkov <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
3 years agoMerge tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Linus Torvalds [Wed, 5 May 2021 01:15:10 +0000 (18:15 -0700)]
Merge tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML updates from Richard Weinberger:

 - Disable CONFIG_GCOV when built with modules

 - Many fixes for W=1 related warnings

 - Code cleanup

* tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  um: Fix W=1 missing-include-dirs warnings
  um: elf.h: Fix W=1 warning for empty body in 'do' statement
  um: pgtable.h: Fix W=1 warning for empty body in 'do' statement
  um: Remove unused including <linux/version.h>
  um: Add 2 missing libs to fix various build errors
  um: Replace if (cond) BUG() with BUG_ON()
  um: Disable CONFIG_GCOV with MODULES
  um: Remove unneeded variable 'ret'
  um: Mark all kernel symbols as local
  um: Fix tag order in stub_32.h

3 years agoMerge tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw...
Linus Torvalds [Wed, 5 May 2021 01:08:40 +0000 (18:08 -0700)]
Merge tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull JFFS2, UBI and UBIFS updates from Richard Weinberger:
 "JFFS2:
   - Use splice_write()
   - Fix for a slab-out-of-bounds bug

  UBI:
   - Fix for clang related warnings
   - Code cleanup

  UBIFS:
   - Fix for inode rebirth at replay
   - Set s_uuid
   - Use zstd for default filesystem"

* tag 'for-linus-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  ubi: Remove unnecessary struct declaration
  jffs2: Hook up splice_write callback
  jffs2: avoid Wempty-body warnings
  jffs2: Fix kasan slab-out-of-bounds problem
  ubi: Fix fall-through warnings for Clang
  ubifs: Report max LEB count at mount time
  ubifs: Set s_uuid in super block to support ima/evm uuid options
  ubifs: Default to zstd compression
  ubifs: Only check replay with inode type to judge if inode linked

3 years agoMerge tag 'f2fs-for-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeu...
Linus Torvalds [Wed, 5 May 2021 01:03:38 +0000 (18:03 -0700)]
Merge tag 'f2fs-for-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs

Pull f2fs updates from Jaegeuk Kim:
 "In this round, we added a new mount option, "checkpoint_merge", which
  introduces a kernel thread dealing with the f2fs checkpoints. Once we
  start to manage the IO priority along with blk-cgroup, the checkpoint
  operation can be processed in a lower priority under the process
  context. Since the checkpoint holds all the filesystem operations, we
  give a higher priority to the checkpoint thread all the time.

  Enhancements:
   - introduce gc_merge mount option to introduce a checkpoint thread
   - improve to run discard thread efficiently
   - allow modular compression algorithms
   - expose # of overprivision segments to sysfs
   - expose runtime compression stat to sysfs

  Bug fixes:
   - fix OOB memory access by the node id lookup
   - avoid touching checkpointed data in the checkpoint-disabled mode
   - fix the resizing flow to avoid kernel panic and race conditions
   - fix block allocation issues on pinned files
   - address some swapfile issues
   - fix hugtask problem and kernel panic during atomic write operations
   - don't start checkpoint thread in RO

  And, we've cleaned up some kernel coding style and build warnings. In
  addition, we fixed some minor race conditions and error handling
  routines"

* tag 'f2fs-for-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (48 commits)
  f2fs: drop inplace IO if fs status is abnormal
  f2fs: compress: remove unneed check condition
  f2fs: clean up left deprecated IO trace codes
  f2fs: avoid using native allocate_segment_by_default()
  f2fs: remove unnecessary struct declaration
  f2fs: fix to avoid NULL pointer dereference
  f2fs: avoid duplicated codes for cleanup
  f2fs: document: add description about compressed space handling
  f2fs: clean up build warnings
  f2fs: fix the periodic wakeups of discard thread
  f2fs: fix to avoid accessing invalid fio in f2fs_allocate_data_block()
  f2fs: fix to avoid GC/mmap race with f2fs_truncate()
  f2fs: set checkpoint_merge by default
  f2fs: Fix a hungtask problem in atomic write
  f2fs: fix to restrict mount condition on readonly block device
  f2fs: introduce gc_merge mount option
  f2fs: fix to cover __allocate_new_section() with curseg_lock
  f2fs: fix wrong alloc_type in f2fs_do_replace_block
  f2fs: delete empty compress.h
  f2fs: fix a typo in inode.c
  ...

3 years agotools/power turbostat: version 2021.05.04
Len Brown [Tue, 4 May 2021 23:58:08 +0000 (19:58 -0400)]
tools/power turbostat: version 2021.05.04

Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Support "turbostat --hide idle"
Len Brown [Tue, 4 May 2021 23:56:17 +0000 (19:56 -0400)]
tools/power turbostat: Support "turbostat --hide idle"

As idle, in particular, can have many columns on some machines...
Make it easy to ignore them all at once.

Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: elevate priority of interval mode
Len Brown [Tue, 4 May 2021 23:27:34 +0000 (19:27 -0400)]
tools/power turbostat: elevate priority of interval mode

This makes interval mode less likely to see delayed
results on a heavily loaded system.

Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: formatting
Len Brown [Tue, 4 May 2021 23:21:34 +0000 (19:21 -0400)]
tools/power turbostat: formatting

Spring is here...
run a long overdue Lendent on turbostat.c

no functional change

Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: rename tcc variables
Zhang Rui [Mon, 26 Apr 2021 10:49:26 +0000 (18:49 +0800)]
tools/power turbostat: rename tcc variables

There are two TCC activation temeprature.
One is the default TCC activation temperature, also known as TJ_MAX.
Another one is the effective TCC activation temperature, which is the
subtraction of default TCC activation temperature and TCC offset.

The name of variable tcc_activation_temp might be misleading here.
Thus rename tcc_activation_temp to tj_max, and use tcc_default and
tcc_offset to calculate the effective TCC activation temperature.

No functional change in this patch.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: add TCC Offset support
Zhang Rui [Wed, 21 Apr 2021 15:22:14 +0000 (23:22 +0800)]
tools/power turbostat: add TCC Offset support

The length of TCC Offset bits varies on different platforms.
Decode TCC Offset bits only for the platforms that we have verified.
For the others, only show default TCC activation temperature.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: save original CPU model
Zhang Rui [Mon, 26 Apr 2021 02:05:27 +0000 (10:05 +0800)]
tools/power turbostat: save original CPU model

CPU model may get changed in intel_model_duplicates() for code reuse.
But there are still some cases we need the original CPU model to handle
minor differences between generations.

Thus save the original CPU model.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Fix Core C6 residency on Atom CPUs
Zhang Rui [Wed, 21 Apr 2021 14:22:47 +0000 (22:22 +0800)]
tools/power turbostat: Fix Core C6 residency on Atom CPUs

For Atom CPUs that have core cstate deeper than C6,
MSR_CORE_C6_RESIDENCY actually returns the residency for both CC6 and
deeper Core cstates.
Thus, the real Core C6 residency should be the subtraction of
MSR_CORE_C6_RESIDENCY return value and MSR_CORE_C6_RESIDENCY return value.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Print the C-state Pre-wake settings
Chen Yu [Wed, 28 Apr 2021 04:18:12 +0000 (12:18 +0800)]
tools/power turbostat: Print the C-state Pre-wake settings

C-state pre-wake setting[1] is an optimization for some Intel CPUs to
be woken up from deep C-states in order to reduce latency. According to
the spec, the BIT30 is the C-state Pre-wake Disable. Expose this setting
accordingly.
Sample output from turbostat:
...
cpu51: MSR_IA32_POWER_CTL: 0x1a00a40059 (C1E auto-promotion: DISabled)
C-state Pre-wake: ENabled
cpu51: MSR_TURBO_RATIO_LIMIT: 0x2021212121212224
...

[1] https://intel.github.io/wult/#c-state-pre-wake

Signed-off-by: Chen Yu <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Enable tsc_tweak for Elkhart Lake and Jasper Lake
Chen Yu [Wed, 28 Apr 2021 02:51:57 +0000 (10:51 +0800)]
tools/power turbostat: Enable tsc_tweak for Elkhart Lake and Jasper Lake

It was found that on Elkhart Lake the TSC frequency is driven by
a separate crystal-clock domain, which is different from the
BCLK domain which includes mperf. This has result in small different
speed thus inconsistence between TSC and the mperf, which caused the
Busy% to be higher than 100%. On this platform it seems that the mperf
runs faster than tsc when the CPU is 100% utilized:
delta tsc(18815473183) < delta mperf(18958403680) for 10 seconds.

To align TSC with mperf, leverage the tsc_tweak mechanism introduced for
cores newer than Skylake, so that TSC and mperf would be calculated in
the same domain.

Reported-by: Zhang Rui <[email protected]>
Signed-off-by: Chen Yu <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: unmark non-kernel-doc comment
Randy Dunlap [Thu, 25 Mar 2021 20:13:33 +0000 (13:13 -0700)]
tools/power turbostat: unmark non-kernel-doc comment

Do not mark a comment as kernel-doc notation when it is not
meant to be in kernel-doc notation.

Signed-off-by: Randy Dunlap <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power/turbostat: Remove Package C6 Retention on Ice Lake Server
Chen Yu [Tue, 4 May 2021 14:52:34 +0000 (17:52 +0300)]
tools/power/turbostat: Remove Package C6 Retention on Ice Lake Server

Currently the turbostat treats ICX the same way as SKX and shares the
code among them. But one difference is that ICX does not support Package
C6 Retention, unlike SKX and CLX.

So this patch:

1. Splitting SKX and ICX in turbostat.
2. Removing Package C6 Rentention for ICX.

And after this split, it would be easier to cutomize Ice Lake Server
in turbostat in the future.

Suggested-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Chen Yu <[email protected]>
Reviewed-by: Artem Bityutskiy <[email protected]>
Tested-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Fix offset overflow issue in index converting
Calvin Walton [Wed, 28 Apr 2021 09:09:16 +0000 (17:09 +0800)]
tools/power turbostat: Fix offset overflow issue in index converting

The idx_to_offset() function returns type int (32-bit signed), but
MSR_PKG_ENERGY_STAT is u32 and would be interpreted as a negative number.
The end result is that it hits the if (offset < 0) check in update_msr_sum()
which prevents the timer callback from updating the stat in the background when
long durations are used. The similar issue exists in offset_to_idx() and
update_msr_sum(). Fix this issue by converting the 'int' to 'off_t' accordingly.

Fixes: 9972d5d84d76 ("tools/power turbostat: Enable accumulate RAPL display")
Signed-off-by: Calvin Walton <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power/turbostat: Fix turbostat for AMD Zen CPUs
Bas Nieuwenhuizen [Wed, 28 Apr 2021 09:09:03 +0000 (17:09 +0800)]
tools/power/turbostat: Fix turbostat for AMD Zen CPUs

It was reported that on Zen+ system turbostat started exiting,
which was tracked down to the MSR_PKG_ENERGY_STAT read failing because
offset_to_idx wasn't returning a non-negative index.

This patch combined the modification from Bingsong Si and
Bas Nieuwenhuizen and addd the MSR to the index system as alternative for
MSR_PKG_ENERGY_STATUS.

Fixes: 9972d5d84d76 ("tools/power turbostat: Enable accumulate RAPL display")
Reported-by: youling257 <[email protected]>
Tested-by: youling257 <[email protected]>
Tested-by: Kurt Garloff <[email protected]>
Tested-by: Bingsong Si <[email protected]>
Tested-by: Artem S. Tashkinov <[email protected]>
Co-developed-by: Bingsong Si <[email protected]>
Co-developed-by: Terry Bowman <[email protected]>
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Chen Yu <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: update version number
Len Brown [Fri, 12 Mar 2021 22:30:30 +0000 (17:30 -0500)]
tools/power turbostat: update version number

3 years agotools/power turbostat: Fix DRAM Energy Unit on SKX
Zhang Rui [Thu, 11 Mar 2021 02:05:13 +0000 (10:05 +0800)]
tools/power turbostat: Fix DRAM Energy Unit on SKX

SKX uses fixed DRAM Energy Unit, just like HSX and BDX.

Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agoRevert "tools/power turbostat: adjust for temperature offset"
Len Brown [Thu, 11 Mar 2021 23:36:35 +0000 (18:36 -0500)]
Revert "tools/power turbostat: adjust for temperature offset"

This reverts commit 6ff7cb371c4bea3dba03a56d774da925e78a5087.

Apparently the TCC offset should not be used to adjust what temperature
we show the user after all.

(on most systems, TCC offset is 0, FWIW)

Fixes: 6ff7cb371c4b
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Support Ice Lake D
Chen Yu [Wed, 3 Feb 2021 08:26:32 +0000 (16:26 +0800)]
tools/power turbostat: Support Ice Lake D

Ice Lake D is low-end server version of Ice Lake X, reuse
the code accordingly.

Tested-by: Wendy Wang <[email protected]>
Signed-off-by: Chen Yu <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: Support Alder Lake Mobile
Chen Yu [Wed, 3 Feb 2021 08:19:59 +0000 (16:19 +0800)]
tools/power turbostat: Support Alder Lake Mobile

Share the code between Alder Lake Mobile and Alder Lake Desktop.

Signed-off-by: Chen Yu <[email protected]>
Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: print microcode patch level
Len Brown [Thu, 4 Feb 2021 19:44:12 +0000 (14:44 -0500)]
tools/power turbostat: print microcode patch level

(also available via "grep microcode /proc/cpuinfo")

Signed-off-by: Len Brown <[email protected]>
3 years agotools/power turbostat: add built-in-counter for IPC -- Instructions per Cycle
Len Brown [Sun, 31 Jan 2021 04:43:10 +0000 (23:43 -0500)]
tools/power turbostat: add built-in-counter for IPC -- Instructions per Cycle

Use linux-perf to access the hardware instructions-retired counter.
This is necessary because the counter is not enabled by default,
and also the counter is prone to roll-over -- both of which
perf manages.

It is not necessary to use perf for the cycle counter,
because turbostat already needs to collect delta-aperf
to calcuate frequency.

Signed-off-by: Len Brown <[email protected]>
3 years agodrm/amd/pm: initialize variable
Tom Rix [Fri, 30 Apr 2021 17:16:54 +0000 (10:16 -0700)]
drm/amd/pm: initialize variable

Static analysis reports this problem

amdgpu_pm.c:478:16: warning: The right operand of '<' is a garbage value
  for (i = 0; i < data.nums; i++) {
                ^ ~~~~~~~~~

In some cases data is not set.  Initialize to 0 and flag not setting
data as an error with the existing check.

Signed-off-by: Tom Rix <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
3 years agodrm/radeon: Avoid power table parsing memory leaks
Kees Cook [Mon, 3 May 2021 05:06:08 +0000 (22:06 -0700)]
drm/radeon: Avoid power table parsing memory leaks

Avoid leaving a hanging pre-allocated clock_info if last mode is
invalid, and avoid heap corruption if no valid modes are found.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211537
Fixes: 6991b8f2a319 ("drm/radeon/kms: fix segfault in pm rework")
Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
3 years agodrm/radeon: Fix off-by-one power_state index heap overwrite
Kees Cook [Mon, 3 May 2021 05:06:07 +0000 (22:06 -0700)]
drm/radeon: Fix off-by-one power_state index heap overwrite

An out of bounds write happens when setting the default power state.
KASAN sees this as:

[drm] radeon: 512M of GTT memory ready.
[drm] GART: num cpu pages 131072, num gpu pages 131072
==================================================================
BUG: KASAN: slab-out-of-bounds in
radeon_atombios_parse_power_table_1_3+0x1837/0x1998 [radeon]
Write of size 4 at addr ffff88810178d858 by task systemd-udevd/157

CPU: 0 PID: 157 Comm: systemd-udevd Not tainted 5.12.0-E620 #50
Hardware name: eMachines        eMachines E620  /Nile       , BIOS V1.03 09/30/2008
Call Trace:
 dump_stack+0xa5/0xe6
 print_address_description.constprop.0+0x18/0x239
 kasan_report+0x170/0x1a8
 radeon_atombios_parse_power_table_1_3+0x1837/0x1998 [radeon]
 radeon_atombios_get_power_modes+0x144/0x1888 [radeon]
 radeon_pm_init+0x1019/0x1904 [radeon]
 rs690_init+0x76e/0x84a [radeon]
 radeon_device_init+0x1c1a/0x21e5 [radeon]
 radeon_driver_load_kms+0xf5/0x30b [radeon]
 drm_dev_register+0x255/0x4a0 [drm]
 radeon_pci_probe+0x246/0x2f6 [radeon]
 pci_device_probe+0x1aa/0x294
 really_probe+0x30e/0x850
 driver_probe_device+0xe6/0x135
 device_driver_attach+0xc1/0xf8
 __driver_attach+0x13f/0x146
 bus_for_each_dev+0xfa/0x146
 bus_add_driver+0x2b3/0x447
 driver_register+0x242/0x2c1
 do_one_initcall+0x149/0x2fd
 do_init_module+0x1ae/0x573
 load_module+0x4dee/0x5cca
 __do_sys_finit_module+0xf1/0x140
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Without KASAN, this will manifest later when the kernel attempts to
allocate memory that was stomped, since it collides with the inline slab
freelist pointer:

invalid opcode: 0000 [#1] SMP NOPTI
CPU: 0 PID: 781 Comm: openrc-run.sh Tainted: G        W 5.10.12-gentoo-E620 #2
Hardware name: eMachines        eMachines E620  /Nile , BIOS V1.03       09/30/2008
RIP: 0010:kfree+0x115/0x230
Code: 89 c5 e8 75 ea ff ff 48 8b 00 0f ba e0 09 72 63 e8 1f f4 ff ff 41 89 c4 48 8b 45 00 0f ba e0 10 72 0a 48 8b 45 08 a8 01 75 02 <0f> 0b 44 89 e1 48 c7 c2 00 f0 ff ff be 06 00 00 00 48 d3 e2 48 c7
RSP: 0018:ffffb42f40267e10 EFLAGS: 00010246
RAX: ffffd61280ee8d88 RBX: 0000000000000004 RCX: 000000008010000d
RDX: 4000000000000000 RSI: ffffffffba1360b0 RDI: ffffd61280ee8d80
RBP: ffffd61280ee8d80 R08: ffffffffb91bebdf R09: 0000000000000000
R10: ffff8fe2c1047ac8 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000100
FS:  00007fe80eff6b68(0000) GS:ffff8fe339c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe80eec7bc0 CR3: 0000000038012000 CR4: 00000000000006f0
Call Trace:
 __free_fdtable+0x16/0x1f
 put_files_struct+0x81/0x9b
 do_exit+0x433/0x94d
 do_group_exit+0xa6/0xa6
 __x64_sys_exit_group+0xf/0xf
 do_syscall_64+0x33/0x40
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fe80ef64bea
Code: Unable to access opcode bytes at RIP 0x7fe80ef64bc0.
RSP: 002b:00007ffdb1c47528 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fe80ef64bea
RDX: 00007fe80ef64f60 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 00007fe80ee2c620 R11: 0000000000000246 R12: 00007fe80eff41e0
R13: 00000000ffffffff R14: 0000000000000024 R15: 00007fe80edf9cd0
Modules linked in: radeon(+) ath5k(+) snd_hda_codec_realtek ...

Use a valid power_state index when initializing the "flags" and "misc"
and "misc2" fields.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=211537
Reported-by: Erhard F. <[email protected]>
Fixes: a48b9b4edb8b ("drm/radeon/kms/pm: add asic specific callbacks for getting power state (v2)")
Fixes: 79daedc94281 ("drm/radeon/kms: minor pm cleanups")
Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
3 years agodrm/amd/display: Fix two cursor duplication when using overlay
Rodrigo Siqueira [Wed, 14 Apr 2021 00:06:04 +0000 (20:06 -0400)]
drm/amd/display: Fix two cursor duplication when using overlay

Our driver supports overlay planes, and as expected, some userspace
compositor takes advantage of these features. If the userspace is not
enabling the cursor, they can use multiple planes as they please.
Nevertheless, we start to have constraints when userspace tries to
enable hardware cursor with various planes. Basically, we cannot draw
the cursor at the same size and position on two separated pipes since it
uses extra bandwidth and DML only run with one cursor.

For those reasons, when we enable hardware cursor and multiple planes,
our driver should accept variations like the ones described below:

  +-------------+   +--------------+
  | +---------+ |   |              |
  | |Primary  | |   | Primary      |
  | |         | |   | Overlay      |
  | +---------+ |   |              |
  |Overlay      |   |              |
  +-------------+   +--------------+

In this scenario, we can have the desktop UI in the overlay and some
other framebuffer attached to the primary plane (e.g., video). However,
userspace needs to obey some rules and avoid scenarios like the ones
described below (when enabling hw cursor):

                                      +--------+
                                      |Overlay |
 +-------------+    +-----+-------+ +-|        |--+
 | +--------+  | +--------+       | | +--------+  |
 | |Overlay |  | |Overlay |       | |             |
 | |        |  | |        |       | |             |
 | +--------+  | +--------+       | |             |
 | Primary     |    | Primary     | | Primary     |
 +-------------+    +-------------+ +-------------+

 +-------------+   +-------------+
 |     +--------+  |  Primary    |
 |     |Overlay |  |             |
 |     |        |  |             |
 |     +--------+  | +--------+  |
 | Primary     |   | |Overlay |  |
 +-------------+   +-|        |--+
                     +--------+

If the userspace violates some of the above scenarios, our driver needs
to reject the commit; otherwise, we can have unexpected behavior. Since
we don't have a proper driver validation for the above case, we can see
some problems like a duplicate cursor in applications that use multiple
planes. This commit fixes the cursor issue and others by adding adequate
verification for multiple planes.

Change since V1 (Harry and Sean):
- Remove cursor verification from the equation.

Cc: Louis Li <[email protected]>
Cc: Nicholas Kazlauskas <[email protected]>
Cc: Harry Wentland <[email protected]>
Cc: Hersen Wu <[email protected]>
Cc: Sean Paul <[email protected]>
Signed-off-by: Rodrigo Siqueira <[email protected]>
Reviewed-by: Harry Wentland <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
3 years agodrm/amdgpu: add new MC firmware for Polaris12 32bit ASIC
Evan Quan [Wed, 28 Apr 2021 04:00:20 +0000 (12:00 +0800)]
drm/amdgpu: add new MC firmware for Polaris12 32bit ASIC

Polaris12 32bit ASIC needs a special MC firmware.

Signed-off-by: Evan Quan <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Cc: [email protected]
3 years agonet: stmmac: Clear receive all(RA) bit when promiscuous mode is off
Ramesh Babu B [Tue, 4 May 2021 15:42:41 +0000 (21:12 +0530)]
net: stmmac: Clear receive all(RA) bit when promiscuous mode is off

In promiscuous mode Receive All bit is set in GMAC packet filter register,
but outside promiscuous mode Receive All bit is not cleared,
which resulted in all network packets are received when toggle (ON/OFF)
the promiscuous mode.

Fixes: e0f9956a3862 ("net: stmmac: Add option for VLAN filter fail queue enable")
Signed-off-by: Ramesh Babu B <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
3 years agonet/nfc: fix use-after-free llcp_sock_bind/connect
Or Cohen [Tue, 4 May 2021 07:16:46 +0000 (10:16 +0300)]
net/nfc: fix use-after-free llcp_sock_bind/connect

Commits 8a4cd82d ("nfc: fix refcount leak in llcp_sock_connect()")
and c33b1cc62 ("nfc: fix refcount leak in llcp_sock_bind()")
fixed a refcount leak bug in bind/connect but introduced a
use-after-free if the same local is assigned to 2 different sockets.

This can be triggered by the following simple program:
    int sock1 = socket( AF_NFC, SOCK_STREAM, NFC_SOCKPROTO_LLCP );
    int sock2 = socket( AF_NFC, SOCK_STREAM, NFC_SOCKPROTO_LLCP );
    memset( &addr, 0, sizeof(struct sockaddr_nfc_llcp) );
    addr.sa_family = AF_NFC;
    addr.nfc_protocol = NFC_PROTO_NFC_DEP;
    bind( sock1, (struct sockaddr*) &addr, sizeof(struct sockaddr_nfc_llcp) )
    bind( sock2, (struct sockaddr*) &addr, sizeof(struct sockaddr_nfc_llcp) )
    close(sock1);
    close(sock2);

Fix this by assigning NULL to llcp_sock->local after calling
nfc_llcp_local_put.

This addresses CVE-2021-23134.

Reported-by: Or Cohen <[email protected]>
Reported-by: Nadav Markus <[email protected]>
Fixes: c33b1cc62 ("nfc: fix refcount leak in llcp_sock_bind()")
Signed-off-by: Or Cohen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
3 years agonet: Only allow init netns to set default tcp cong to a restricted algo
Jonathon Reinhart [Sat, 1 May 2021 08:28:22 +0000 (04:28 -0400)]
net: Only allow init netns to set default tcp cong to a restricted algo

tcp_set_default_congestion_control() is netns-safe in that it writes
to &net->ipv4.tcp_congestion_control, but it also sets
ca->flags |= TCP_CONG_NON_RESTRICTED which is not namespaced.
This has the unintended side-effect of changing the global
net.ipv4.tcp_allowed_congestion_control sysctl, despite the fact that it
is read-only: 97684f0970f6 ("net: Make tcp_allowed_congestion_control
readonly in non-init netns")

Resolve this netns "leak" by only allowing the init netns to set the
default algorithm to one that is restricted. This restriction could be
removed if tcp_allowed_congestion_control were namespace-ified in the
future.

This bug was uncovered with
https://github.com/JonathonReinhart/linux-netns-sysctl-verify

Fixes: 6670e1524477 ("tcp: Namespace-ify sysctl_tcp_default_congestion_control")
Signed-off-by: Jonathon Reinhart <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
3 years agoMerge branch 'next' into for-linus
Dmitry Torokhov [Tue, 4 May 2021 18:46:00 +0000 (11:46 -0700)]
Merge branch 'next' into for-linus

Prepare input updates for 5.13 merge window.

3 years agoMerge tag 'dmaengine-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
Linus Torvalds [Tue, 4 May 2021 18:24:46 +0000 (11:24 -0700)]
Merge tag 'dmaengine-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine

Pull dmaengine updates from Vinod Koul:
 "New drivers/devices:

   - Support for QCOM SM8150 GPI DMA

  Updates:

   - Big pile of idxd updates including support for performance
     monitoring

   - Support in dw-edma for interleaved dma

   - Support for synchronize() in Xilinx driver"

* tag 'dmaengine-5.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: (42 commits)
  dmaengine: idxd: Enable IDXD performance monitor support
  dmaengine: idxd: Add IDXD performance monitor support
  dmaengine: idxd: remove MSIX masking for interrupt handlers
  dmaengine: idxd: device cmd should use dedicated lock
  dmaengine: idxd: support reporting of halt interrupt
  dmaengine: idxd: enable SVA feature for IOMMU
  dmaengine: idxd: convert sprintf() to sysfs_emit() for all usages
  dmaengine: idxd: add interrupt handle request and release support
  dmaengine: idxd: add support for readonly config mode
  dmaengine: idxd: add percpu_ref to descriptor submission path
  dmaengine: idxd: remove detection of device type
  dmaengine: idxd: iax bus removal
  dmaengine: idxd: fix cdev setup and free device lifetime issues
  dmaengine: idxd: fix group conf_dev lifetime
  dmaengine: idxd: fix engine conf_dev lifetime
  dmaengine: idxd: fix wq conf_dev 'struct device' lifetime
  dmaengine: idxd: fix idxd conf_dev 'struct device' lifetime
  dmaengine: idxd: use ida for device instance enumeration
  dmaengine: idxd: removal of pcim managed mmio mapping
  dmaengine: idxd: cleanup pci interrupt vector allocation management
  ...

3 years agoMerge tag 'rproc-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson...
Linus Torvalds [Tue, 4 May 2021 18:13:33 +0000 (11:13 -0700)]
Merge tag 'rproc-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc

Pull remoteproc updates from Bjorn Andersson:
 "This adds support to the remoteproc core for detaching Linux from a
  running remoteproc, e.g. to reboot Linux while leaving the remoteproc
  running, and it enable this support in the stm32 remoteproc driver.

  It also introduces a property for memory carveouts to track if they
  are iomem or system ram, to enable proper handling of the differences.

  The imx_rproc received a number of fixes and improvements, in
  particular support for attaching to already running remote processors
  and i.MX8MQ and i.MX8MM support.

  The Qualcomm wcss driver gained support for starting and stopping the
  wireless subsystem on QCS404, when not using the TrustZone-based
  validator/loader.

  Finally it brings a few fixes to the TI PRU and to the firmware loader
  for the Qualcomm modem subsystem drivers"

* tag 'rproc-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc: (53 commits)
  remoteproc: stm32: add capability to detach
  dt-bindings: remoteproc: stm32-rproc: add new mailbox channel for detach
  remoteproc: imx_rproc: support remote cores booted before Linux Kernel
  remoteproc: imx_rproc: move memory parsing to rproc_ops
  remoteproc: imx_rproc: enlarge IMX7D_RPROC_MEM_MAX
  remoteproc: imx_rproc: add missing of_node_put
  remoteproc: imx_rproc: fix build error without CONFIG_MAILBOX
  remoteproc: qcom: wcss: Remove unnecessary PTR_ERR()
  remoteproc: qcom: wcss: Fix wrong pointer passed to PTR_ERR()
  remoteproc: qcom: pas: Add modem support for SDX55
  dt-bindings: remoteproc: qcom: pas: Add binding for SDX55
  remoteproc: qcom: wcss: Fix return value check in q6v5_wcss_init_mmio()
  remoteproc: pru: Fix and cleanup firmware interrupt mapping logic
  remoteproc: pru: Fix wrong success return value for fw events
  remoteproc: pru: Fixup interrupt-parent logic for fw events
  remoteproc: qcom: wcnss: Allow specifying firmware-name
  remoteproc: qcom: wcss: explicitly request exclusive reset control
  remoteproc: qcom: wcss: Add non pas wcss Q6 support for QCS404
  dt-bindings: remoteproc: qcom: Add Q6V5 Modem PIL binding for QCS404
  remoteproc: qcom: wcss: populate hardcoded param using driver data
  ...

3 years agoMerge tag 'rpmsg-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson...
Linus Torvalds [Tue, 4 May 2021 18:08:51 +0000 (11:08 -0700)]
Merge tag 'rpmsg-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:
 "In addition to some bug fixes and cleanups this adds support for
  exposing the virtio based transport to user space using the rpmsg_char
  driver"

* tag 'rpmsg-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc:
  rpmsg: qcom_glink_native: fix error return code of qcom_glink_rx_data()
  rpmsg: char: Return an error if device already open
  rpmsg: virtio: Register the rpmsg_char device
  rpmsg: char: Use rpmsg_sendto to specify the message destination address
  rpmsg: Add short description of the IOCTL defined in UAPI.
  rpmsg: Move RPMSG_ADDR_ANY in user API
  rpmsg: char: Rename rpmsg_char_init to rpmsg_chrdev_init

3 years agoMerge tag 'hwlock-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson...
Linus Torvalds [Tue, 4 May 2021 18:04:35 +0000 (11:04 -0700)]
Merge tag 'hwlock-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc

Pull hwspinlock udpates from Bjorn Andersson:
 "This removes the SIRF hardware spinlock driver, as the platform is
  being removed"

* tag 'hwlock-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc:
  hwspinlock: remove sirf driver

3 years agoMerge branch 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Tue, 4 May 2021 17:58:49 +0000 (10:58 -0700)]
Merge branch 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb

Pull swiotlb updates from Konrad Rzeszutek Wilk:
 "Christoph Hellwig has taken a cleaver and trimmed off the not-needed
  code and nicely folded duplicate code in the generic framework.

  This lays the groundwork for more work to add extra DMA-backend-ish in
  the future. Along with that some bug-fixes to make this a nice working
  package"

* 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
  swiotlb: don't override user specified size in swiotlb_adjust_size
  swiotlb: Fix the type of index
  swiotlb: Make SWIOTLB_NO_FORCE perform no allocation
  ARM: Qualify enabling of swiotlb_init()
  swiotlb: remove swiotlb_nr_tbl
  swiotlb: dynamically allocate io_tlb_default_mem
  swiotlb: move global variables into a new io_tlb_mem structure
  xen-swiotlb: remove the unused size argument from xen_swiotlb_fixup
  xen-swiotlb: split xen_swiotlb_init
  swiotlb: lift the double initialization protection from xen-swiotlb
  xen-swiotlb: remove xen_io_tlb_start and xen_io_tlb_nslabs
  xen-swiotlb: remove xen_set_nslabs
  xen-swiotlb: use io_tlb_end in xen_swiotlb_dma_supported
  xen-swiotlb: use is_swiotlb_buffer in is_xen_swiotlb_buffer
  swiotlb: split swiotlb_tbl_sync_single
  swiotlb: move orig addr and size validation into swiotlb_bounce
  swiotlb: remove the alloc_size parameter to swiotlb_tbl_unmap_single
  powerpc/svm: stop using io_tlb_start

3 years agoMerge tag 'dma-mapping-5.13' of git://git.infradead.org/users/hch/dma-mapping
Linus Torvalds [Tue, 4 May 2021 17:52:09 +0000 (10:52 -0700)]
Merge tag 'dma-mapping-5.13' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping updates from Christoph Hellwig:

 - add a new dma_alloc_noncontiguous API (me, Ricardo Ribalda)

 - fix a copyright notice (Hao Fang)

 - add an unlikely annotation to dma_mapping_error (Heiner Kallweit)

 - remove a pointless empty line (Wang Qing)

 - add support for multi-pages map/unmap bencharking (Xiang Chen)

* tag 'dma-mapping-5.13' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: add unlikely hint to error path in dma_mapping_error
  dma-mapping: benchmark: Add support for multi-pages map/unmap
  dma-mapping: benchmark: use the correct HiSilicon copyright
  dma-mapping: remove a pointless empty line in dma_alloc_coherent
  media: uvcvideo: Use dma_alloc_noncontiguous API
  dma-iommu: implement ->alloc_noncontiguous
  dma-iommu: refactor iommu_dma_alloc_remap
  dma-mapping: add a dma_alloc_noncontiguous API
  dma-mapping: refactor dma_{alloc,free}_pages
  dma-mapping: add a dma_mmap_pages helper

3 years agoMerge tag 'm68knommu-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 4 May 2021 17:48:05 +0000 (10:48 -0700)]
Merge tag 'm68knommu-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

Pull m68knommu updates from Greg Ungerer:

 - a fix for interrupt number range checking for the ColdFire SIMR
   interrupt controller.

 - changes for the binfmt_flat binary loader to allow RISC-V nommu
   support it needs to be able to accept flat binaries that have no gap
   between the text and data sections.

* tag 'm68knommu-for-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: coldfire: fix irq ranges
  riscv: Disable data start offset in flat binaries
  binfmt_flat: allow not offsetting data start

3 years agos390: fix detection of vector enhancements facility 1 vs. vector packed decimal facility
David Hildenbrand [Mon, 3 May 2021 12:12:44 +0000 (14:12 +0200)]
s390: fix detection of vector enhancements facility 1 vs. vector packed decimal facility

The PoP documents:
134: The vector packed decimal facility is installed in the
     z/Architecture architectural mode. When bit 134 is
     one, bit 129 is also one.
135: The vector enhancements facility 1 is installed in
     the z/Architecture architectural mode. When bit 135
     is one, bit 129 is also one.

Looks like we confuse the vector enhancements facility 1 ("EXT") with the
Vector packed decimal facility ("BCD"). Let's fix the facility checks.

Detected while working on QEMU/tcg z14 support and only unlocking
the vector enhancements facility 1, but not the vector packed decimal
facility.

Fixes: 2583b848cad0 ("s390: report new vector facilities")
Cc: Vasily Gorbik <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
Reviewed-by: Christian Borntraeger <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
Reviewed-by: Janosch Frank <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Heiko Carstens <[email protected]>
3 years agofs/cifs: Fix resource leak
Khaled ROMDHANI [Tue, 4 May 2021 15:38:55 +0000 (16:38 +0100)]
fs/cifs: Fix resource leak

The -EIO error return path is leaking memory allocated
to page. Fix this by moving the allocation block after
the check of cifs_forced_shutdown.

Addresses-Coverity: ("Resource leak")
Fixes: 087f757b0129 ("cifs: add shutdown support")
Signed-off-by: Khaled ROMDHANI <[email protected]>
Reviewed-by: Dan Carpenter <[email protected]>
Signed-off-by: Steve French <[email protected]>
3 years agoCifs: Fix kernel oops caused by deferred close for files.
Rohith Surabattula [Mon, 19 Apr 2021 19:02:03 +0000 (19:02 +0000)]
Cifs: Fix kernel oops caused by deferred close for files.

Fix regression issue caused by deferred close for files.

Signed-off-by: Rohith Surabattula <[email protected]>
Reviewed-by: Shyam Prasad N <[email protected]>
Signed-off-by: Steve French <[email protected]>
3 years agocifs: fix regression when mounting shares with prefix paths
Paulo Alcantara [Mon, 3 May 2021 14:55:26 +0000 (11:55 -0300)]
cifs: fix regression when mounting shares with prefix paths

The commit 315db9a05b7a ("cifs: fix leak in cifs_smb3_do_mount() ctx")
revealed an existing bug when mounting shares that contain a prefix
path or DFS links.

cifs_setup_volume_info() requires the @devname to contain the full
path (UNC + prefix) to update the fs context with the new UNC and
prepath values, however we were passing only the UNC
path (old_ctx->UNC) in @device thus discarding any prefix paths.

Instead of concatenating both old_ctx->{UNC,prepath} and pass it in
@devname, just keep the dup'ed values of UNC and prepath in
cifs_sb->ctx after calling smb3_fs_context_dup(), and fix
smb3_parse_devname() to correctly parse and not leak the new UNC and
prefix paths.

Cc: <[email protected]> # v5.11+
Fixes: 315db9a05b7a ("cifs: fix leak in cifs_smb3_do_mount() ctx")
Signed-off-by: Paulo Alcantara (SUSE) <[email protected]>
Acked-by: David Disseldorp <[email protected]>
Signed-off-by: Steve French <[email protected]>
3 years agovfio/mdev: remove unnecessary NULL check in mbochs_create()
Dan Carpenter [Thu, 29 Apr 2021 09:53:27 +0000 (12:53 +0300)]
vfio/mdev: remove unnecessary NULL check in mbochs_create()

Originally "type" could be NULL and these checks were required, but we
recently changed how "type" is assigned and that's no longer the case.
Now "type" points to an element in the middle of a non-NULL array.

Removing the checks does not affect runtime at all, but it makes the
code a little bit simpler to read.

Fixes: 3d3a360e570616 ("vfio/mbochs: Use mdev_get_type_group_id()")
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Message-Id: <20210429095327.GY1981@kadam>
Signed-off-by: Alex Williamson <[email protected]>
3 years agoiomap: remove unused private field from ioend
Brian Foster [Tue, 4 May 2021 15:54:29 +0000 (08:54 -0700)]
iomap: remove unused private field from ioend

The only remaining user of ->io_private is the generic ioend merging
infrastructure. The only user of that is XFS, which no longer sets
->io_private or passes an associated merge callback. Remove the
unused parameter and the ->io_private field.

CC: [email protected]
Signed-off-by: Brian Foster <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
3 years agoMerge branch 'pci/tegra'
Bjorn Helgaas [Tue, 4 May 2021 15:43:32 +0000 (10:43 -0500)]
Merge branch 'pci/tegra'

- Add MCFG quirks for Tegra194 ECAM errata (Vidya Sagar)

* pci/tegra:
  PCI: tegra: Add Tegra194 MCFG quirks for ECAM errata

3 years agoMerge branch 'pci/brcmstb'
Bjorn Helgaas [Tue, 4 May 2021 15:43:31 +0000 (10:43 -0500)]
Merge branch 'pci/brcmstb'

- Add reset_control_rearm() stub for !CONFIG_RESET_CONTROLLER (Jim Quinlan)

- Fix use of BCM7216 reset controller (Jim Quinlan)

- Use reset/rearm for Broadcom STB pulse reset instead of deassert/assert
  (Jim Quinlan)

* pci/brcmstb:
  PCI: brcmstb: Use reset/rearm instead of deassert/assert
  ata: ahci_brcm: Fix use of BCM7216 reset controller
  reset: add missing empty function reset_control_rearm()

3 years agoMerge branch 'remotes/lorenzo/pci/misc'
Bjorn Helgaas [Tue, 4 May 2021 15:43:31 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/misc'

- Remove layerscape-gen4 dependencies on OF and ARM64, add dependency on
  ARCH_LAYERSCAPE (Geert Uytterhoeven)

- Remove obsolete HiSilicon PCIe DT description (Dongdong Liu)

* remotes/lorenzo/pci/misc:
  dt-bindings: PCI: hisi: Delete the obsolete HiSilicon PCIe file
  PCI: mobiveil: Improve PCIE_LAYERSCAPE_GEN4 dependencies

3 years agoMerge branch 'remotes/lorenzo/pci/msi'
Bjorn Helgaas [Tue, 4 May 2021 15:43:30 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/msi'

- Convert tegra to MSI domains (Marc Zyngier)

- Use rcar controller address as MSI doorbell instead of allocating a page
  (Marc Zyngier)

- Convert rcar to MSI domains (Marc Zyngier)

- Use xilinx port structure as MSI doorbell instead of allocating a page
  (Marc Zyngier)

- Convert xilinx to MSI domains (Marc Zyngier)

- Remove unused Hyper-V msi_controller structure (Marc Zyngier)

- Remove unused PCI core msi_controller support (Marc Zyngier)

- Remove struct msi_controller (Marc Zyngier)

- Remove unused default_teardown_msi_irqs() (Marc Zyngier)

- Let host bridges declare their reliance on MSI domains (Marc Zyngier)

- Make pci_host_common_probe() declare its reliance on MSI domains (Marc
  Zyngier)

- Advertise mediatek lack of built-in MSI handling (Thomas Gleixner)

- Document ways of ending up with NO_MSI (Marc Zyngier)

- Refactor HT advertising of NO_MSI flag (Marc Zyngier)

* remotes/lorenzo/pci/msi:
  PCI: Refactor HT advertising of NO_MSI flag
  PCI/MSI: Document the various ways of ending up with NO_MSI
  PCI: mediatek: Advertise lack of built-in MSI handling
  PCI/MSI: Make pci_host_common_probe() declare its reliance on MSI domains
  PCI/MSI: Let PCI host bridges declare their reliance on MSI domains
  PCI/MSI: Kill default_teardown_msi_irqs()
  PCI/MSI: Kill msi_controller structure
  PCI/MSI: Drop use of msi_controller from core code
  PCI: hv: Drop msi_controller structure
  PCI: xilinx: Convert to MSI domains
  PCI: xilinx: Don't allocate extra memory for the MSI capture address
  PCI: rcar: Convert to MSI domains
  PCI: rcar: Don't allocate extra memory for the MSI capture address
  PCI: tegra: Convert to MSI domains

3 years agoMerge branch 'remotes/lorenzo/pci/xilinx'
Bjorn Helgaas [Tue, 4 May 2021 15:43:30 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/xilinx'

- Add support for coherent PCIe DMA traffic using CCI (Bharat Kumar Gogada)

- Add optional "dma-coherent" DT property (Bharat Kumar Gogada)

* remotes/lorenzo/pci/xilinx:
  PCI: xilinx-nwl: Add optional "dma-coherent" property
  PCI: xilinx-nwl: Enable coherent PCIe DMA traffic using CCI

3 years agoMerge branch 'remotes/lorenzo/pci/xgene'
Bjorn Helgaas [Tue, 4 May 2021 15:43:30 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/xgene'

- Fix cfg resource mapping regression (Dejin Zheng)

* remotes/lorenzo/pci/xgene:
  PCI: xgene: Fix cfg resource mapping

3 years agoMerge branch 'remotes/lorenzo/pci/vmd'
Bjorn Helgaas [Tue, 4 May 2021 15:43:29 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/vmd'

- Program IRTE with Requester ID of VMD endpoint, not child device (Jon
  Derrick)

- Disable VMD MSI-X remapping when possible so children can use more MSI-X
  vectors (Jon Derrick)

* remotes/lorenzo/pci/vmd:
  PCI: vmd: Disable MSI-X remapping when possible
  iommu/vt-d: Use Real PCI DMA device for IRTE

3 years agoMerge branch 'remotes/lorenzo/pci/tegra'
Bjorn Helgaas [Tue, 4 May 2021 15:43:29 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/tegra'

- Make several tegra symbols const (Rikard Falkeborn)

- Fix tegra Kconfig host/endpoint typo (Wesley Sheng)

- Fix runtime PM imbalance (Dinghao Liu)

* remotes/lorenzo/pci/tegra:
  PCI: tegra: Fix runtime PM imbalance in pex_ep_event_pex_rst_deassert()
  PCI: tegra: Fix typo for PCIe endpoint mode in Tegra194
  PCI: tegra: Constify static structs

3 years agoMerge branch 'remotes/lorenzo/pci/risc-v'
Bjorn Helgaas [Tue, 4 May 2021 15:43:28 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/risc-v'

- sifive: Add pcie_aux clock to prci driver (Greentime Hu)

- sifive: Use reset-simple in prci driver for PCIe (Greentime Hu)

- Add SiFive FU740 PCIe host controller driver and DT binding (Paul
  Walmsley, Greentime Hu)

* remotes/lorenzo/pci/risc-v:
  riscv: dts: Add PCIe support for the SiFive FU740-C000 SoC
  PCI: fu740: Add SiFive FU740 PCIe host controller driver
  dt-bindings: PCI: Add SiFive FU740 PCIe host controller
  MAINTAINERS: Add maintainers for SiFive FU740 PCIe driver
  clk: sifive: Use reset-simple in prci driver for PCIe driver
  clk: sifive: Add pcie_aux clock in prci driver for PCIe driver

3 years agoMerge branch 'remotes/lorenzo/pci/microchip'
Bjorn Helgaas [Tue, 4 May 2021 15:43:28 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/microchip'

- Make several microchip symbols static (Wei Yongjun)

- Drop redundant dev_err() for platform_get_irq() errors (Krzysztof
  Wilczyński)

* remotes/lorenzo/pci/microchip:
  PCI: microchip: Remove dev_err() when handing an error from platform_get_irq()
  PCI: microchip: Make some symbols static

3 years agoMerge branch 'remotes/lorenzo/pci/mediatek'
Bjorn Helgaas [Tue, 4 May 2021 15:43:28 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/mediatek'

- Configure FC and FTS for functions other than 0 (Ryder Lee)

- Add missing MODULE_DEVICE_TABLE (Qiheng Lin)

- Add YAML schema for MediaTek (Jianjun Wang)

- Export pci_pio_to_address() for module use (Jianjun Wang)

- Add MediaTek MT8192 PCIe controller driver (Jianjun Wang)

- Add MediaTek MT8192 INTx support (Jianjun Wang)

- Add MediaTek MT8192 MSI support (Jianjun Wang)

- Add MediaTek MT8192 system power management support (Jianjun Wang)

* remotes/lorenzo/pci/mediatek:
  MAINTAINERS: Add Jianjun Wang as MediaTek PCI co-maintainer
  PCI: mediatek-gen3: Add system PM support
  PCI: mediatek-gen3: Add MSI support
  PCI: mediatek-gen3: Add INTx support
  PCI: mediatek-gen3: Add MediaTek Gen3 driver for MT8192
  PCI: Export pci_pio_to_address() for module use
  dt-bindings: PCI: mediatek-gen3: Add YAML schema
  PCI: mediatek: Add missing MODULE_DEVICE_TABLE
  PCI: mediatek: Configure FC and FTS for functions other than 0

3 years agoxfs: don't allow log writes if the data device is readonly
Darrick J. Wong [Thu, 29 Apr 2021 21:39:33 +0000 (14:39 -0700)]
xfs: don't allow log writes if the data device is readonly

While running generic/050 with an external log, I observed this warning
in dmesg:

Trying to write to read-only block-device sda4 (partno 4)
WARNING: CPU: 2 PID: 215677 at block/blk-core.c:704 submit_bio_checks+0x256/0x510
Call Trace:
 submit_bio_noacct+0x2c/0x430
 _xfs_buf_ioapply+0x283/0x3c0 [xfs]
 __xfs_buf_submit+0x6a/0x210 [xfs]
 xfs_buf_delwri_submit_buffers+0xf8/0x270 [xfs]
 xfsaild+0x2db/0xc50 [xfs]
 kthread+0x14b/0x170

I think this happened because we tried to cover the log after a readonly
mount, and the AIL tried to write the primary superblock to the data
device.  The test marks the data device readonly, but it doesn't do the
same to the external log device.  Therefore, XFS thinks that the log is
writable, even though AIL writes whine to dmesg because the data device
is read only.

Fix this by amending xfs_log_writable to prevent writes when the AIL
can't possible write anything into the filesystem.

Note: As for the external log or the rt devices being readonly--
xfs_blkdev_get will complain about that if we aren't doing a norecovery
mount.

Signed-off-by: Darrick J. Wong <[email protected]>
Reviewed-by: Brian Foster <[email protected]>
3 years agoMerge branch 'remotes/lorenzo/pci/layerscape'
Bjorn Helgaas [Tue, 4 May 2021 15:43:27 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/layerscape'

- Fix ls_pcie_ep_probe() syntax error (comma for semicolon) (Krzysztof
  Wilczyński)

* remotes/lorenzo/pci/layerscape:
  PCI: layerscape: Correct syntax by changing comma to semicolon

3 years agoMerge branch 'remotes/lorenzo/pci/iproc'
Bjorn Helgaas [Tue, 4 May 2021 15:43:27 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/iproc'

- Return zero for success of iproc_msi_irq_domain_alloc() (Pali Rohár)

* remotes/lorenzo/pci/iproc:
  PCI: iproc: Fix return value of iproc_msi_irq_domain_alloc()

3 years agoMerge branch 'remotes/lorenzo/pci/endpoint'
Bjorn Helgaas [Tue, 4 May 2021 15:43:27 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/endpoint'

- Fix NULL pointer dereference when epc_features not implemented (Shradha
  Todi)

- Remove redundant initialization (Colin Ian King)

- Add missing destroy_workqueue() in endpoint test (Yang Yingliang)

* remotes/lorenzo/pci/endpoint:
  PCI: endpoint: Fix missing destroy_workqueue()
  PCI: endpoint: Remove redundant initialization of pointer dev
  PCI: endpoint: Fix NULL pointer dereference for ->get_features()

3 years agoMerge branch 'remotes/lorenzo/pci/dwc'
Bjorn Helgaas [Tue, 4 May 2021 15:43:26 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/dwc'

- Use generic config accessors for TI AM65x (K3) to fix regression (Kishon
  Vijay Abraham I)

- Move MSI Receiver init to dw_pcie_host_init() so it is re-initialized
  along with the RC in resume (Jisheng Zhang)

- Remove unused pcie_app_rd() (Jiapeng Chong)

- Move iATU detection earlier to fix regression (Hou Zhiqiang)

* remotes/lorenzo/pci/dwc:
  PCI: dwc: Move iATU detection earlier
  PCI: dwc/intel-gw: Remove unused function
  PCI: dwc: Move dw_pcie_msi_init() to dw_pcie_setup_rc()
  PCI: keystone: Let AM65 use the pci_ops defined in pcie-designware-host.c

3 years agoMerge branch 'remotes/lorenzo/pci/cadence'
Bjorn Helgaas [Tue, 4 May 2021 15:43:26 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/cadence'

- Add DT binding and TI j721e support for refclk to PCIe connector (Kishon
  Vijay Abraham I)

- Add host mode and endpoint mode DT bindings for TI AM64 SoC (Kishon Vijay
  Abraham I)

* remotes/lorenzo/pci/cadence:
  PCI: j721e: Add support to provide refclk to PCIe connector
  dt-bindings: PCI: ti,j721e: Add endpoint mode dt-bindings for TI's AM64 SoC
  dt-bindings: PCI: ti,j721e: Add host mode dt-bindings for TI's AM64 SoC
  dt-bindings: PCI: ti,j721e: Add binding to represent refclk to the connector

3 years agoMerge branch 'remotes/lorenzo/pci/brcmstb'
Bjorn Helgaas [Tue, 4 May 2021 15:43:25 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/brcmstb'

- Fix brcm_pcie_probe() error return for unsupported revision (Wei Yongjun)

* remotes/lorenzo/pci/brcmstb:
  PCI: brcmstb: Fix error return code in brcm_pcie_probe()

3 years agoMerge branch 'remotes/lorenzo/pci/altera-msi'
Bjorn Helgaas [Tue, 4 May 2021 15:43:25 +0000 (10:43 -0500)]
Merge branch 'remotes/lorenzo/pci/altera-msi'

- Remove redundant dev_err() for devm_ioremap_resource() failure (Chen Hui)

* remotes/lorenzo/pci/altera-msi:
  PCI: altera-msi: Remove redundant dev_err call in altera_msi_probe()

3 years agoMerge branch 'pci/misc'
Bjorn Helgaas [Tue, 4 May 2021 15:43:25 +0000 (10:43 -0500)]
Merge branch 'pci/misc'

- Fix compile testing of al driver without CONFIG_PCI_ECAM (Arnd Bergmann)

- Fix compile testing of thunder drivers (Arnd Bergmann)

- Fix "no symbols" warnings when compile testing al, thunder driver with
  CONFIG_TRIM_UNUSED_KSYMS (Arnd Bergmann)

- Remove unused MicroGate SyncLink device IDs (Jiri Slaby)

- Remove unused alloc_pci_root_info() return value (Krzysztof Wilczyński)

* pci/misc:
  x86/PCI: Remove unused alloc_pci_root_info() return value
  PCI: Remove MicroGate SyncLink device IDs
  PCI: Avoid building empty drivers
  PCI: thunder: Fix compile testing
  PCI: al: Select CONFIG_PCI_ECAM

3 years agoMerge branch 'pci/virtualization'
Bjorn Helgaas [Tue, 4 May 2021 15:43:24 +0000 (10:43 -0500)]
Merge branch 'pci/virtualization'

- Increase delay after FLR to work around Intel DC P4510 NVMe erratum
  (Raphael Norwitz)

* pci/virtualization:
  PCI: Delay after FLR of Intel DC P4510 NVMe

This page took 0.135945 seconds and 4 git commands to generate.