[GIT PULL] SCSI fixes for 5.8-rc5

2020-07-25 Thread James Bottomley
Small core patch to fix a corner case bug: we forgot to run the queues
to handle starvation in the error exit from the scsi_queue_rq routine,
which can lead to hangs on error conditions.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Ming Lei (1):
  scsi: core: Run queue in case of I/O resource contention failure

And the diffstat:

 drivers/scsi/scsi_lib.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

With full diff below.

James

---

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 0ba7a65e7c8d..06056e9ec333 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -547,6 +547,15 @@ static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd)
scsi_uninit_cmd(cmd);
 }
 
+static void scsi_run_queue_async(struct scsi_device *sdev)
+{
+   if (scsi_target(sdev)->single_lun ||
+   !list_empty(>host->starved_list))
+   kblockd_schedule_work(>requeue_work);
+   else
+   blk_mq_run_hw_queues(sdev->request_queue, true);
+}
+
 /* Returns false when no more bytes to process, true if there are more */
 static bool scsi_end_request(struct request *req, blk_status_t error,
unsigned int bytes)
@@ -591,11 +600,7 @@ static bool scsi_end_request(struct request *req, 
blk_status_t error,
 
__blk_mq_end_request(req, error);
 
-   if (scsi_target(sdev)->single_lun ||
-   !list_empty(>host->starved_list))
-   kblockd_schedule_work(>requeue_work);
-   else
-   blk_mq_run_hw_queues(q, true);
+   scsi_run_queue_async(sdev);
 
percpu_ref_put(>q_usage_counter);
return false;
@@ -1702,6 +1707,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx 
*hctx,
 */
if (req->rq_flags & RQF_DONTPREP)
scsi_mq_uninit_cmd(cmd);
+   scsi_run_queue_async(sdev);
break;
}
return ret;


[PATCH] MAINTAINERS: adjust kprobes.rst entry to new location

2020-07-25 Thread Lukas Bulwahn
Commit 2165b82fde82 ("docs: Move kprobes.rst from staging/ to trace/")
moved kprobes.rst, but missed to adjust the MAINTAINERS entry.

Hence, ./scripts/get_maintainer.pl --self-test=patterns complains:

  warning: no file matchesF:Documentation/staging/kprobes.rst

Adjust the entry to the new file location.

Signed-off-by: Lukas Bulwahn 
---
Naveen, Masami-san, please ack.
Jonathan, please pick this minor non-urgent patch into docs-next.

applies cleanly on next-20200724

 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 960f7d43f9d7..416fc4555834 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9676,7 +9676,7 @@ M:Anil S Keshavamurthy 

 M: "David S. Miller" 
 M: Masami Hiramatsu 
 S: Maintained
-F: Documentation/staging/kprobes.rst
+F: Documentation/trace/kprobes.rst
 F: include/asm-generic/kprobes.h
 F: include/linux/kprobes.h
 F: kernel/kprobes.c
-- 
2.17.1



Re: [PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup

2020-07-25 Thread Cong Wang
On Sat, Jul 25, 2020 at 8:09 PM B K Karthik  wrote:
> @@ -103,10 +103,10 @@ static int __xfrm6_tunnel_spi_check(struct net *net, 
> u32 spi)
>  {
> struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net);
> struct xfrm6_tunnel_spi *x6spi;
> -   int index = xfrm6_tunnel_spi_hash_byspi(spi);
> +   int index = xfrm6_tunnel_spi_hash_byaddr((const xfrm_address_t *)spi);
>
> hlist_for_each_entry(x6spi,
> -_tn->spi_byspi[index],
> +_tn->spi_byaddr[index],
>  list_byspi) {
> if (x6spi->spi == spi)

How did you convince yourself this is correct? This lookup is still
using spi. :)

More importantly, can you explain how UAF happens? Apparently
the syzbot stack traces you quote make no sense at all. I also
looked at other similar reports, none of them makes sense to me.

Thanks.


Re: [PATCH] scsi: iscsi: Do not put host in iscsi_set_flashnode_param()

2020-07-25 Thread Mike Christie
On 6/15/20 3:12 AM, Jing Xiangfeng wrote:
> If scsi_host_lookup() failes we will jump to put_host, which may
> cause panic. Jump to exit_set_fnode to fix it.
> 
> Signed-off-by: Jing Xiangfeng 
> ---
>  drivers/scsi/scsi_transport_iscsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_transport_iscsi.c 
> b/drivers/scsi/scsi_transport_iscsi.c
> index f4cc08e..c5e99f9 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -3291,7 +3291,7 @@ static int iscsi_set_flashnode_param(struct 
> iscsi_transport *transport,
>   pr_err("%s could not find host no %u\n",
>  __func__, ev->u.set_flashnode.host_no);
>   err = -ENODEV;
> - goto put_host;
> + goto exit_set_fnode;
>   }
>  
>   idx = ev->u.set_flashnode.flashnode_idx;
> 

Reviewed-by: Mike Christie 


[PATCH] tty: fix pid refcount leak in tty_signal_session_leader

2020-07-25 Thread Xin Xiong
In the loop, every time when p->signal->leader is true, the function
tty_signal_session_leader() will invoke get_pid() and return a
reference of tty->pgrp with increased refcount to the local variable
tty_pgrp or return NULL if it fails. After finishing the loop, the
function invokes put_pid() for only once, decreasing the refcount that
tty_pgrp keeps.

Refcount leaks may occur when the scenario that p->signal->leader is
true happens more than once. In this assumption, if the above scenario
happens n times in the loop, the function forgets to decrease the
refcount for n-1 times, which causes refcount leaks.

Fix the issue by decreasing the current refcount of the local variable
tty_pgrp before assigning new objects to it.

Signed-off-by: Xiyu Yang 
Signed-off-by: Xin Tan 
Signed-off-by: Xin Xiong 
---
 drivers/tty/tty_jobctrl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
index f8ed50a16848..9e6bf693ade1 100644
--- a/drivers/tty/tty_jobctrl.c
+++ b/drivers/tty/tty_jobctrl.c
@@ -212,6 +212,8 @@ int tty_signal_session_leader(struct tty_struct *tty, int 
exit_session)
__group_send_sig_info(SIGCONT, SEND_SIG_PRIV, p);
put_pid(p->signal->tty_old_pgrp);  /* A noop */
spin_lock(>ctrl_lock);
+   if (tty_pgrp)
+   put_pid(tty_pgrp);
tty_pgrp = get_pid(tty->pgrp);
if (tty->pgrp)
p->signal->tty_old_pgrp = get_pid(tty->pgrp);
-- 
2.25.1



[PATCH] [video/fbdev] mbxfb_remove: fix null pointer dereference

2020-07-25 Thread Gaurav Singh
Function mbxfb_debugfs_remove() accesses fbi->par without NULL check,
hence do the NULL check in the caller mbxfb_remove().

Signed-off-by: Gaurav Singh 
---
 drivers/video/fbdev/mbx/mbxfb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 6dc287c819cb..515c0cda1994 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -1012,11 +1012,10 @@ static int mbxfb_remove(struct platform_device *dev)
 
write_reg_dly(SYSRST_RST, SYSRST);
 
-   mbxfb_debugfs_remove(fbi);
-
if (fbi) {
struct mbxfb_info *mfbi = fbi->par;
 
+   mbxfb_debugfs_remove(fbi);
unregister_framebuffer(fbi);
if (mfbi) {
if (mfbi->platform_remove)
-- 
2.17.1



Re: [PATCH v6 3/4] RISC-V: Remove CLINT related code from timer and arch

2020-07-25 Thread Anup Patel
On Sat, Jul 25, 2020 at 10:46 AM Atish Patra  wrote:
>
> On Fri, Jul 24, 2020 at 12:19 AM Anup Patel  wrote:
> >
> > Right now the RISC-V timer driver is convoluted to support:
> > 1. Linux RISC-V S-mode (with MMU) where it will use TIME CSR for
> >clocksource and SBI timer calls for clockevent device.
> > 2. Linux RISC-V M-mode (without MMU) where it will use CLINT MMIO
> >counter register for clocksource and CLINT MMIO compare register
> >for clockevent device.
> >
> > We now have a separate CLINT timer driver which also provide CLINT
> > based IPI operations so let's remove CLINT MMIO related code from
> > arch/riscv directory and RISC-V timer driver.
> >
> > Signed-off-by: Anup Patel 
> > Tested-by: Emil Renner Berhing 
> > Acked-by: Daniel Lezcano 
> > ---
> >  arch/riscv/Kconfig  |  2 +-
> >  arch/riscv/Kconfig.socs |  2 +
> >  arch/riscv/configs/nommu_virt_defconfig |  7 +--
> >  arch/riscv/include/asm/clint.h  | 14 --
> >  arch/riscv/include/asm/timex.h  | 28 +++
> >  arch/riscv/kernel/Makefile  |  2 +-
> >  arch/riscv/kernel/clint.c   | 63 -
> >  arch/riscv/kernel/setup.c   |  2 -
> >  arch/riscv/kernel/smp.c |  1 -
> >  arch/riscv/kernel/smpboot.c |  1 -
> >  drivers/clocksource/Kconfig |  3 +-
> >  drivers/clocksource/timer-riscv.c   | 17 +--
> >  12 files changed, 16 insertions(+), 126 deletions(-)
> >  delete mode 100644 arch/riscv/include/asm/clint.h
> >  delete mode 100644 arch/riscv/kernel/clint.c
> >
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index fedb4a72b29a..57a72ae23d10 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -74,7 +74,7 @@ config RISCV
> > select PCI_DOMAINS_GENERIC if PCI
> > select PCI_MSI if PCI
> > select RISCV_INTC
> > -   select RISCV_TIMER
> > +   select RISCV_TIMER if RISCV_SBI
> > select SPARSEMEM_STATIC if 32BIT
> > select SPARSE_IRQ
> > select SYSCTL_EXCEPTION_TRACE
> > diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
> > index 6c88148f1b9b..8a55f6156661 100644
> > --- a/arch/riscv/Kconfig.socs
> > +++ b/arch/riscv/Kconfig.socs
> > @@ -12,6 +12,7 @@ config SOC_SIFIVE
> >
> >  config SOC_VIRT
> > bool "QEMU Virt Machine"
> > +   select CLINT_TIMER if RISCV_M_MODE
> > select POWER_RESET
> > select POWER_RESET_SYSCON
> > select POWER_RESET_SYSCON_POWEROFF
> > @@ -24,6 +25,7 @@ config SOC_VIRT
> >  config SOC_KENDRYTE
> > bool "Kendryte K210 SoC"
> > depends on !MMU
> > +   select CLINT_TIMER if RISCV_M_MODE
> > select SERIAL_SIFIVE if TTY
> > select SERIAL_SIFIVE_CONSOLE if TTY
> > select SIFIVE_PLIC
> > diff --git a/arch/riscv/configs/nommu_virt_defconfig 
> > b/arch/riscv/configs/nommu_virt_defconfig
> > index cf74e179bf90..cf9388184aa3 100644
> > --- a/arch/riscv/configs/nommu_virt_defconfig
> > +++ b/arch/riscv/configs/nommu_virt_defconfig
> > @@ -26,6 +26,7 @@ CONFIG_EXPERT=y
> >  CONFIG_SLOB=y
> >  # CONFIG_SLAB_MERGE_DEFAULT is not set
> >  # CONFIG_MMU is not set
> > +CONFIG_SOC_VIRT=y
> >  CONFIG_MAXPHYSMEM_2GB=y
> >  CONFIG_SMP=y
> >  CONFIG_CMDLINE="root=/dev/vda rw 
> > earlycon=uart8250,mmio,0x1000,115200n8 console=ttyS0"
> > @@ -48,7 +49,6 @@ CONFIG_VIRTIO_BLK=y
> >  # CONFIG_SERIO is not set
> >  # CONFIG_LEGACY_PTYS is not set
> >  # CONFIG_LDISC_AUTOLOAD is not set
> > -# CONFIG_DEVMEM is not set
> >  CONFIG_SERIAL_8250=y
> >  # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
> >  CONFIG_SERIAL_8250_CONSOLE=y
> > @@ -56,16 +56,13 @@ CONFIG_SERIAL_8250_NR_UARTS=1
> >  CONFIG_SERIAL_8250_RUNTIME_UARTS=1
> >  CONFIG_SERIAL_OF_PLATFORM=y
> >  # CONFIG_HW_RANDOM is not set
> > +# CONFIG_DEVMEM is not set
> >  # CONFIG_HWMON is not set
> > -# CONFIG_LCD_CLASS_DEVICE is not set
> > -# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
>
> Why these changes are in the diff ?

These are generated by "make savedefconfig".

To preserve bisectability, I have enabled CONFIG_SOC_VIRT
in nommu_virt_defconfig and I have used "make savedefconfig"
to update nommu_virt_defconfig.

>
> >  # CONFIG_VGA_CONSOLE is not set
> >  # CONFIG_HID is not set
> >  # CONFIG_USB_SUPPORT is not set
> >  CONFIG_VIRTIO_MMIO=y
> >  CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
> > -CONFIG_SIFIVE_PLIC=y
> > -# CONFIG_VALIDATE_FS_PARSER is not set
> >  CONFIG_EXT2_FS=y
> >  # CONFIG_DNOTIFY is not set
> >  # CONFIG_INOTIFY_USER is not set
> > diff --git a/arch/riscv/include/asm/clint.h b/arch/riscv/include/asm/clint.h
> > deleted file mode 100644
> > index adaba98a7d6c..
> > --- a/arch/riscv/include/asm/clint.h
> > +++ /dev/null
> > @@ -1,14 +0,0 @@
> > -/* SPDX-License-Identifier: GPL-2.0 */
> > -#ifndef _ASM_RISCV_CLINT_H
> > -#define _ASM_RISCV_CLINT_H 1
> > -
> > -#include 
> > -#include 
> > -
> > -#ifdef 

[PATCH] [video/fbdev] fb_flashcursor: Remove redundant null check

2020-07-25 Thread Gaurav Singh
ops cannot be NULL as its being accessed later without
checks. Remove the redundant NULL check. 

Signed-off-by: Gaurav Singh 
---
 drivers/video/fbdev/core/fbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index e2a490c5ae08..9551f40c6d14 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -401,7 +401,7 @@ static void fb_flashcursor(struct work_struct *work)
if (ret == 0)
return;
 
-   if (ops && ops->currcon != -1)
+   if (ops->currcon != -1)
vc = vc_cons[ops->currcon].d;
 
if (!vc || !con_is_visible(vc) ||
-- 
2.17.1



[PATCH] fork: fix pid refcount leaks when destroying file

2020-07-25 Thread Xin Xiong
When clone_flags & CLONE_PIDFD is true,the function creates a new file
object called pidfile,and invokes get_pid(),which increases the refcnt
of pid for pidfile to hold.

The reference counting issues take place in the error handling paths.
When error occurs after the construction of pidfile, the function only
invokes fput() to destroy pidfile, in which the increased refcount
won't be decreased, resulting in a refcount leak.

Fix this issue by adding put_pid() in the error handling path
bad_fork_put_pidfd.

Signed-off-by: Xiyu Yang 
Signed-off-by: Xin Tan 
Signed-off-by: Xin Xiong 
---
 kernel/fork.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/fork.c b/kernel/fork.c
index 142b23645d82..7cbfb2c4fce3 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2319,6 +2319,7 @@ static __latent_entropy struct task_struct *copy_process(
 bad_fork_put_pidfd:
if (clone_flags & CLONE_PIDFD) {
fput(pidfile);
+   put_pid(pid);
put_unused_fd(pidfd);
}
 bad_fork_free_pid:
-- 
2.25.1



[PATCH 7/7] ARM:mstar: Add reboot support

2020-07-25 Thread Daniel Palmer
MStar v7 SoCs support reset by writing a magic value to a register
in the "pmsleep" area.

This adds a node for using the syscon reboot driver to trigger a reset.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/mstar-v7.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi
index c8b192569d05..7ac7e649189f 100644
--- a/arch/arm/boot/dts/mstar-v7.dtsi
+++ b/arch/arm/boot/dts/mstar-v7.dtsi
@@ -78,6 +78,13 @@ pmsleep: syscon@1c00 {
reg = <0x1c00 0x100>;
};
 
+   reboot {
+   compatible = "syscon-reboot";
+   regmap = <>;
+   offset = <0xb8>;
+   mask = <0x79>;
+   };
+
l3bridge: l3bridge@204400 {
compatible = "mstar,l3bridge";
reg = <0x204400 0x200>;
-- 
2.27.0



[PATCH 0/7] ARM:mstar: DT filling out

2020-07-25 Thread Daniel Palmer
This series adds a few low hanging fruit that are purely DT changes to
keep the ball rolling while I work on series for more complicated things
like the interrupt controllers.

Summary of changes:

- Adds the IMI SRAM region and sets the right size for each family
- Adds the ARM PMU
- Adds a syscon for a lump of registers called "pmsleep"
- Uses the pmsleep syscon to enable reboot

Daniel Palmer (7):
  ARM:mstar: Add IMI SRAM region
  ARM:mstar: Adjust IMI size of infinity
  ARM:mstar: Adjust IMI size for mercury5
  ARM:mstar: Adjust IMI size for infinity3
  ARM:mstar: Add PMU
  ARM:mstar: Add syscon node for "pmsleep" area
  ARM:mstar: Add reboot support

 arch/arm/boot/dts/infinity.dtsi  |  4 
 arch/arm/boot/dts/infinity3.dtsi |  4 
 arch/arm/boot/dts/mercury5.dtsi  |  4 
 arch/arm/boot/dts/mstar-v7.dtsi  | 26 +-
 4 files changed, 37 insertions(+), 1 deletion(-)

-- 
2.27.0



[PATCH 2/7] ARM:mstar: Adjust IMI size of infinity

2020-07-25 Thread Daniel Palmer
infinity has 88KB of SRAM at the IMI region.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/infinity.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/infinity.dtsi b/arch/arm/boot/dts/infinity.dtsi
index f68e6d59c328..cd911adef014 100644
--- a/arch/arm/boot/dts/infinity.dtsi
+++ b/arch/arm/boot/dts/infinity.dtsi
@@ -5,3 +5,7 @@
  */
 
 #include "mstar-v7.dtsi"
+
+ {
+   reg = <0xa000 0x16000>;
+};
-- 
2.27.0



[PATCH 6/7] ARM:mstar: Add syscon node for "pmsleep" area

2020-07-25 Thread Daniel Palmer
MStar v7 SoCs contain a region of registers that are in the always on
domain that the vendor code calls the "pmsleep" area.

This area contains registers for a broad range of functionality and
needs to be shared between drivers.

This patch adds a syscon node for the pmsleep area so that other
drivers can access registers in the area.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/mstar-v7.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi
index a73b1d162dfd..c8b192569d05 100644
--- a/arch/arm/boot/dts/mstar-v7.dtsi
+++ b/arch/arm/boot/dts/mstar-v7.dtsi
@@ -73,6 +73,11 @@ riu: bus@1f00 {
#size-cells = <1>;
ranges = <0x0 0x1f00 0x0040>;
 
+   pmsleep: syscon@1c00 {
+   compatible = "syscon";
+   reg = <0x1c00 0x100>;
+   };
+
l3bridge: l3bridge@204400 {
compatible = "mstar,l3bridge";
reg = <0x204400 0x200>;
-- 
2.27.0



[PATCH 4/7] ARM:mstar: Adjust IMI size for infinity3

2020-07-25 Thread Daniel Palmer
infinity3 has 128KB of SRAM at the IMI region.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/infinity3.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/infinity3.dtsi b/arch/arm/boot/dts/infinity3.dtsi
index 2830d064c07d..9b918c802654 100644
--- a/arch/arm/boot/dts/infinity3.dtsi
+++ b/arch/arm/boot/dts/infinity3.dtsi
@@ -5,3 +5,7 @@
  */
 
 #include "infinity.dtsi"
+
+ {
+   reg = <0xa000 0x2>;
+};
-- 
2.27.0



[PATCH 3/7] ARM:mstar: Adjust IMI size for mercury5

2020-07-25 Thread Daniel Palmer
mercury5 family chips have 128KB of SRAM in the IMI region.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/mercury5.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/mercury5.dtsi b/arch/arm/boot/dts/mercury5.dtsi
index f68e6d59c328..a7d0dd9d6132 100644
--- a/arch/arm/boot/dts/mercury5.dtsi
+++ b/arch/arm/boot/dts/mercury5.dtsi
@@ -5,3 +5,7 @@
  */
 
 #include "mstar-v7.dtsi"
+
+ {
+   reg = <0xa000 0x2>;
+};
-- 
2.27.0



[PATCH 1/7] ARM:mstar: Add IMI SRAM region

2020-07-25 Thread Daniel Palmer
All MStar v7 SoCs have an internal SRAM region that is between 64KB
(infinity2m) and 128KB(infinity3, mercury5).

The region is always at the same base address and is used for the
second stage loader (MStar IPL or u-boot SPL) and will be used for
the DDR self-refresh entry code within the kernel eventually.

This patch adds a 128KB region to the SoC and the minimum 64KB SRAM
region to the base dtsi. Families with more SRAM will override the
size in their family level dtsi.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/mstar-v7.dtsi | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi
index 3b99bb435bb5..6bc55fdbee04 100644
--- a/arch/arm/boot/dts/mstar-v7.dtsi
+++ b/arch/arm/boot/dts/mstar-v7.dtsi
@@ -45,7 +45,8 @@ soc: soc {
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x16001000 0x16001000 0x7000>,
-<0x1f00 0x1f00 0x0040>;
+<0x1f00 0x1f00 0x0040>,
+<0xa000 0xa000 0x2>;
 
gic: interrupt-controller@16001000 {
compatible = "arm,cortex-a7-gic";
@@ -78,6 +79,11 @@ pm_uart: uart@221000 {
clock-frequency = <17200>;
status = "disabled";
};
+};
+
+   imi: sram@a000 {
+   compatible = "mmio-sram";
+   reg = <0xa000 0x1>;
};
};
 };
-- 
2.27.0



[PATCH 5/7] ARM:mstar: Add PMU

2020-07-25 Thread Daniel Palmer
Adds the ARM PMU to the base MStar v7 dtsi.

Signed-off-by: Daniel Palmer 
---
 arch/arm/boot/dts/mstar-v7.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi
index 6bc55fdbee04..a73b1d162dfd 100644
--- a/arch/arm/boot/dts/mstar-v7.dtsi
+++ b/arch/arm/boot/dts/mstar-v7.dtsi
@@ -40,6 +40,12 @@ arch_timer {
clock-frequency = <600>;
};
 
+   pmu: pmu {
+   compatible = "arm,cortex-a7-pmu";
+   interrupts = ;
+   interrupt-affinity = <>;
+   };
+
soc: soc {
compatible = "simple-bus";
#address-cells = <1>;
-- 
2.27.0



Re: Re: checkpatch: support deprecated terms checking

2020-07-25 Thread Joe Perches
On Sun, 2020-07-26 at 01:35 +0200, SeongJae Park wrote:
> On Sat, 25 Jul 2020 10:29:23 -0700 Joe Perches  wrote:
> 
> > On Sat, 2020-07-25 at 15:02 +0200, Michał Mirosław wrote:
> > > Hello,
> > > 
> > > I see that this patch went into next and is already inciting people to
> > > do wrong things [1]. Can you please fix it to require '--subjective'
> > > switch or otherwise mark it clearly as suggestion-only?
> > > 
> > > The coding-style as in Linus' master says about *NEW* uses of the words
> > > listed (those introductions I expect to be actually rare) and not about
> > > existing use in the code or industry. Making a noise about all uses
> > > found surely will generate a lot more irrelevant patches.
> > > 
> > > [1] https://www.spinics.net/lists/linux-tegra/msg51849.html
> > 
> > And if not reverted, perhaps do not check existing files
> > at all but only check patches and change the message to
> > show only suggestions not from a specification.
> 
> Agreed for this case.  However, excluding existing file check doesn't fully
> avoid this problem.  Also, more terms having different deprecation rules might
> be added in future.  How about allowing file check but show reference in the
> suggestion message as below?

The general problem is that drivers/staging, net/ and drivers/net
all have --strict on by default.

Emitting these deprecated terms messages with -f --file uses for
files in those directories isn't a great idea.

> diff --git a/scripts/deprecated_terms.txt b/scripts/deprecated_terms.txt
[]
> @@ -3,8 +3,10 @@
>  # The format of each line is:
>  # deprecated||suggested
>  #
> +# If special rules are applied on the terms, please comment those.

Disagree.  Comments about these existing uses aren't helpful.

> +#
> +# Refer to "4) Naming" section of Documentation/process/coding-style.rst for
> +# below three terms.
>  blacklist||(denylist|blocklist)
> -# For other alternatives of 'slave', Please refer to
> -# Documentation/process/coding-style.rst
>  slave||(secondary|target|...)
>  whitelist||(allowlist|passlist)




Re: [RFC PATCH] mm: silence soft lockups from unlock_page

2020-07-25 Thread Hugh Dickins
On Sat, 25 Jul 2020, Hugh Dickins wrote:
> On Sat, 25 Jul 2020, Linus Torvalds wrote:
> > On Sat, Jul 25, 2020 at 3:14 AM Oleg Nesterov  wrote:
> > >
> > > Heh. I too thought about this. And just in case, your patch looks correct
> > > to me. But I can't really comment this behavioural change. Perhaps it
> > > should come in a separate patch?
> > 
> > We could do that. At the same time, I think both parts change how the
> > waitqueue works that it might as well just be one "fix page_bit_wait
> > waitqueue usage".
> > 
> > But let's wait to see what Hugh's numbers say.
> 
> Oh no, no no: sorry for getting your hopes up there, I won't come up
> with any numbers more significant than "0 out of 10" machines crashed.
> I know it would be *really* useful if I could come up with performance
> comparisons, or steer someone else to do so: but I'm sorry, cannot.
> 
> Currently it's actually 1 out of 10 machines crashed, for the same
> driverland issue seen last time, maybe it's a bad machine; and another
> 1 out of the 10 machines went AWOL for unknown reasons, but probably
> something outside the kernel got confused by the stress.  No reason
> to suspect your changes at all (but some unanalyzed "failure"s, of
> dubious significance, accumulating like last time).
> 
> I'm optimistic: nothing has happened to warn us off your changes.

Less optimistic now, I'm afraid.

The machine I said had (twice) crashed coincidentally in driverland
(some USB completion thing): that machine I set running a comparison
kernel without your changes this morning, while the others still
running with your changes; and it has now passed the point where it
twice crashed before (the most troublesome test), without crashing.

Surprising: maybe still just coincidence, but I must look closer at
the crashes.

The others have now completed, and one other crashed in that
troublesome test, but sadly without yielding any crash info.

I've just set comparison runs going on them all, to judge whether
to take the "failure"s seriously; and I'll look more closely at them.

But hungry and tired now: unlikely to have more to say tonight.

> 
> And on Fri, 24 Jul 2020, Linus Torvalds had written:
> > So the loads you are running are known to have sensitivity to this
> > particular area, and are why you've done your patches to the page wait
> > bit code?
> 
> Yes. It's a series of nineteen ~hour-long tests, of which about five
> exhibited wake_up_page_bit problems in the past, and one has remained
> intermittently troublesome that way.  Intermittently: usually it does
> get through, so getting through yesterday and today won't even tell
> us that your changes fixed it - that we shall learn over time later.
> 
> Hugh


[PATCH 2/2] MIPS: BCM47xx: Include bcm47xx_sprom.h

2020-07-25 Thread Florian Fainelli
Now that bcm47xx_sprom.h contains a prototype for bcm47xx_fill_sprom,
include that header file directly from bcm47xx.h.

Signed-off-by: Florian Fainelli 
---
 arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h 
b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index d7f1ef246d5c..93817bfb7fb2 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 enum bcm47xx_bus_type {
 #ifdef CONFIG_BCM47XX_SSB
@@ -32,9 +33,6 @@ union bcm47xx_bus {
 extern union bcm47xx_bus bcm47xx_bus;
 extern enum bcm47xx_bus_type bcm47xx_bus_type;
 
-void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
-   bool fallback);
-
 void bcm47xx_set_system_type(u16 chip_id);
 
 #endif /* __ASM_BCM47XX_H */
-- 
2.17.1



Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state

2020-07-25 Thread Nicholas Piggin
Excerpts from Peter Zijlstra's message of July 26, 2020 6:26 am:
> On Thu, Jul 23, 2020 at 08:56:14PM +1000, Nicholas Piggin wrote:
>> diff --git a/arch/powerpc/include/asm/hw_irq.h 
>> b/arch/powerpc/include/asm/hw_irq.h
>> index 3a0db7b0b46e..35060be09073 100644
>> --- a/arch/powerpc/include/asm/hw_irq.h
>> +++ b/arch/powerpc/include/asm/hw_irq.h
>> @@ -200,17 +200,14 @@ static inline bool arch_irqs_disabled(void)
>>  #define powerpc_local_irq_pmu_save(flags)   \
>>   do {   \
>>  raw_local_irq_pmu_save(flags);  \
>> -trace_hardirqs_off();   \
>> +if (!raw_irqs_disabled_flags(flags))\
>> +trace_hardirqs_off();   \
>>  } while(0)
> 
> So one problem with the above is something like this:
> 
>   raw_local_irq_save();
>   
> powerpc_local_irq_pmu_save();
> 
> that would now no longer call into tracing/lockdep at all. As a
> consequence, lockdep and tracing would show the NMI ran with IRQs
> enabled, which is exceptionally weird..

powerpc perf NMIs will trace_hardirqs_off() if they were enabled,
and trace_hardirqs_on() at exit in that case too.

Machine check and system reset (like x86's "nmi") don't, but that's
deliberate to avoid any tracing in those cases which often causes
more problems than it's worth (and we have flags to prevent ftrace,
etc too for those cases).

> Similar problem with:
> 
>   raw_local_irq_disable();
>   local_irq_save()
> 
> Now, most architectures today seem to do what x86 also did:
> 
>   
> trace_hardirqs_off()
> ...
> if (irqs_unmasked(regs))
>   trace_hardirqs_on()
>   
> 
> Which is 'funny' when it interleaves like:
> 
>   local_irq_disable();
>   ...
>   local_irq_enable()
> trace_hardirqs_on();
> 
> raw_local_irq_enable();
> 
> Because then it will undo the trace_hardirqs_on() we just did. With the
> result that both tracing and lockdep will see a hardirqs-disable without
> a matching enable, while the hardware state is enabled.

Seems like an arch problem -- why not disable if it was enabled only?
I guess the local_irq tracing calls are a mess so maybe they copied 
those.

> Which is exactly the state Alexey seems to have ran into.

No his was what I said, the interruptee's trace_hardirqs_on() in
local_irq_enable getting lost because the NMI's local_irq_disable
always disables, but the enable doesn't re-enable.

It's all just weird asymmetrical special case hacks AFAIKS, the
code should just be symmetric and lockdep handle it's own weirdness.

> 
> Now, x86, and at least arm64 call nmi_enter() before
> trace_hardirqs_off(), but AFAICT Power never did that, and that's part
> of the problem. nmi_enter() does lockdep_off() and that _used_ to also
> kill IRQ tracking.

Power does do nmi_enter -- __perf_event_interrupt()

nmi = perf_intr_is_nmi(regs);
if (nmi)
nmi_enter();
else
irq_enter();

Thanks,
Nick

> Now, my patch changed that, it makes IRQ tracking not respect
> lockdep_off(). And that exposed x86 (and everybody else :/) to the same
> problem you have.
> 
> And this is why I made x86 look at software state in NMIs. Because then
> it all works out. For bonus points, trace_hardirqs_*() also has some
> do-it-once logic for tracing.
> 
> 
> 
> Anyway, it's Saturday evening, time for a beer. I'll stare at this more
> later.
> 


[PATCH 0/2] firmware: bcm47xx_sprom: Fix -Wmissing-prototypes warnings

2020-07-25 Thread Florian Fainelli
Hi Thomas,

This patch series fixes W=1 -Wmissing-prototypes warnings for the
bcm47xx_sprom.c firmware file.

Thanks!

Florian Fainelli (2):
  firmware: bcm47xx_sprom: Fix -Wmissing-prototypes warnings
  MIPS: BCM47xx: Include bcm47xx_sprom.h

 arch/mips/include/asm/mach-bcm47xx/bcm47xx.h |  4 +---
 drivers/firmware/broadcom/bcm47xx_sprom.c|  1 +
 include/linux/bcm47xx_sprom.h| 10 ++
 3 files changed, 12 insertions(+), 3 deletions(-)

-- 
2.17.1



[PATCH 1/2] firmware: bcm47xx_sprom: Fix -Wmissing-prototypes warnings

2020-07-25 Thread Florian Fainelli
bcm47xx_sprom.h did not include a prototype for bcm47xx_fill_sprom()
therefore add one, and make sure we do include that header to fix
-Wmissing-prototypes warnings.

Reported-by: kernel test robot 
Signed-off-by: Florian Fainelli 
---
 drivers/firmware/broadcom/bcm47xx_sprom.c |  1 +
 include/linux/bcm47xx_sprom.h | 10 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/firmware/broadcom/bcm47xx_sprom.c 
b/drivers/firmware/broadcom/bcm47xx_sprom.c
index 4787f86c8ac1..14fbcd11657c 100644
--- a/drivers/firmware/broadcom/bcm47xx_sprom.c
+++ b/drivers/firmware/broadcom/bcm47xx_sprom.c
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/linux/bcm47xx_sprom.h b/include/linux/bcm47xx_sprom.h
index b0f4424f34fc..f8254fd53e15 100644
--- a/include/linux/bcm47xx_sprom.h
+++ b/include/linux/bcm47xx_sprom.h
@@ -9,9 +9,19 @@
 #include 
 #include 
 
+struct ssb_sprom;
+
 #ifdef CONFIG_BCM47XX_SPROM
+void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
+   bool fallback);
 int bcm47xx_sprom_register_fallbacks(void);
 #else
+static inline void bcm47xx_fill_sprom(struct ssb_sprom *sprom,
+ const char *prefix,
+ bool fallback)
+{
+}
+
 static inline int bcm47xx_sprom_register_fallbacks(void)
 {
return -ENOTSUPP;
-- 
2.17.1



Re: [PATCH v3 0/4] irqchip: Add IRQCHIP_PLATFORM_DRIVER helper macros

2020-07-25 Thread Saravana Kannan
On Sat, Jul 25, 2020 at 7:23 AM Marc Zyngier  wrote:
>
> On Fri, 17 Jul 2020 17:06:33 -0700, Saravana Kannan wrote:
> > Made a series out of the previous v2 patch + some example uses of the
> > macros.
> >
> > Not sure if the MTK changes work (just compile tested), but saw that
> > Hanks was trying to make those drivers into tristate. So I assume
> > they'll work as platform drivers. Please wait for MTK Ack before picking
> > up patches 3 and 4.
> >
> > [...]
>
> Applied to irq/irqchip-5.9, thanks!
>
> [1/4] irqchip: Add IRQCHIP_PLATFORM_DRIVER_BEGIN/END and IRQCHIP_MATCH helper 
> macros
>   commit: f3b5e608ed6d17bdf04dacbf2374f10d51fe9b09
> [2/4] irqchip/qcom-pdc: Switch to using IRQCHIP_PLATFORM_DRIVER helper macros
>   commit: 04741740254cd83fb4f2b7747aeb35202104f8fe
> [3/4] irqchip/mtk-sysirq: Convert to a platform driver
>   commit: 3ae3022690e6787839dafa8ea3496450248b53e1
> [4/4] irqchip/mtk-cirq: Convert to a platform driver
>   commit: 538b63351607960ff2249460089daa31337ddeba

Thanks!

-Saravana


hi

2020-07-25 Thread Mrs.Nancy Christopher
-- 
Dear Beloved,

I’m Mrs.Nancy Christopher, 69years old affected with breast cancer,
the wife of late Brown Christopher,  the Director of High River Gold
Mines Ltd Burkina Faso West Africa. I am contacting you because of my
health condition,i need a reliable person, who will handle this
project accordingly, accomplish my heart desire and utilize this fund.
I have decided to donate the sum Twenty-Five Million Two Hundred
Thousand United State Dollars Only ($25,200,000.00) to Charity
Organizations or to support the Orphans, Motherless Babies,Less
privileged and free Medical & Medicine Poor People's around the World
since I don t have any child and do not want the bank take over the
fund. I don't really know if i am going to survive this stage,
therefore if you ready to handle this project, kindly response so that
i will instruct the bank to transfer the fund to your account.

Contact my private email only if you are interested
(mrsnancychristoph...@gmail.com)

Remain blessed in the name of the Lord.


Regards

Mrs.Nancy Christopher,


[rcu:dev.2020.07.14a 64/73] include/linux/rculist.h:727:30: error: left-hand operand of comma expression has no effect

2020-07-25 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
dev.2020.07.14a
head:   aace6daf32cce6b644083754c7be6260aae439db
commit: 93d62a873f87bf69209a5c29d62b9497888de6d6 [64/73] kvm: mmu: page_track: 
Fix RCU list API usage
config: i386-randconfig-a006-20200726 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
git checkout 93d62a873f87bf69209a5c29d62b9497888de6d6
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

Note: the rcu/dev.2020.07.14a HEAD aace6daf32cce6b644083754c7be6260aae439db 
builds fine.
  It only hurts bisectibility.

All errors (new ones prefixed by >>):

   In file included from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/kvm_host.h:12,
from arch/x86/kvm/mmu/page_track.c:14:
   arch/x86/kvm/mmu/page_track.c: In function 'kvm_page_track_write':
>> include/linux/rculist.h:727:30: error: left-hand operand of comma expression 
>> has no effect [-Werror=unused-value]
 727 |  for (__list_check_srcu(cond), \
 |  ^
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 
'hlist_for_each_entry_srcu'
 232 |  hlist_for_each_entry_srcu(n, >track_notifier_list, node,
 |  ^
   arch/x86/kvm/mmu/page_track.c: In function 'kvm_page_track_flush_slot':
>> include/linux/rculist.h:727:30: error: left-hand operand of comma expression 
>> has no effect [-Werror=unused-value]
 727 |  for (__list_check_srcu(cond), \
 |  ^
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 
'hlist_for_each_entry_srcu'
 258 |  hlist_for_each_entry_srcu(n, >track_notifier_list, node,
 |  ^
   cc1: all warnings being treated as errors

vim +727 include/linux/rculist.h

82524746c27fa41 Franck Bui-Huu  2008-05-12  688  
1cc523271ef0b63 stephen hemminger   2010-02-22  689  #define 
__hlist_for_each_rcu(pos, head)\
67bdbffd696f29a Arnd Bergmann   2010-02-25  690 for (pos = 
rcu_dereference(hlist_first_rcu(head));  \
75d65a425c0163d Linus Torvalds  2011-05-19  691  pos;   
\
67bdbffd696f29a Arnd Bergmann   2010-02-25  692  pos = 
rcu_dereference(hlist_next_rcu(pos)))
1cc523271ef0b63 stephen hemminger   2010-02-22  693  
82524746c27fa41 Franck Bui-Huu  2008-05-12  694  /**
82524746c27fa41 Franck Bui-Huu  2008-05-12  695   * 
hlist_for_each_entry_rcu - iterate over rcu list of given type
b67bfe0d42cac56 Sasha Levin 2013-02-27  696   * @pos:   the 
type * to use as a loop cursor.
82524746c27fa41 Franck Bui-Huu  2008-05-12  697   * @head:  the 
head for your list.
82524746c27fa41 Franck Bui-Huu  2008-05-12  698   * @member:the 
name of the hlist_node within the struct.
ddc465936643108 Jonathan Neuschäfer 2020-03-05  699   * @cond:  
optional lockdep expression if called from non-RCU protection.
82524746c27fa41 Franck Bui-Huu  2008-05-12  700   *
82524746c27fa41 Franck Bui-Huu  2008-05-12  701   * This list-traversal 
primitive may safely run concurrently with
82524746c27fa41 Franck Bui-Huu  2008-05-12  702   * the _rcu 
list-mutation primitives such as hlist_add_head_rcu()
82524746c27fa41 Franck Bui-Huu  2008-05-12  703   * as long as the 
traversal is guarded by rcu_read_lock().
82524746c27fa41 Franck Bui-Huu  2008-05-12  704   */
28875945ba98d1b Joel Fernandes (Google  2019-07-16  705) #define 
hlist_for_each_entry_rcu(pos, head, member, cond...)   \
28875945ba98d1b Joel Fernandes (Google  2019-07-16  706)for 
(__list_check_rcu(dummy, ## cond, 0),   \
28875945ba98d1b Joel Fernandes (Google  2019-07-16  707) pos = 
hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
b67bfe0d42cac56 Sasha Levin 2013-02-27  708 
typeof(*(pos)), member);\
b67bfe0d42cac56 Sasha Levin 2013-02-27  709 pos;
\
b67bfe0d42cac56 Sasha Levin 2013-02-27  710 pos = 
hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
bdc47de914a Madhuparna Bhowmik  2020-07-12  711 
&(pos)->member)), typeof(*(pos)), member))
bdc47de914a Madhuparna Bhowmik  2020-07-12  712  
bdc47de914a Madhuparna Bhowmik  2020-07-12  713  /**
bdc47de914a Madhuparna Bhowmik  2020-07-12  714   * 
hlist_for_each_entry_srcu - iterate over rcu list of given type
bdc47de914a Madhuparna Bhowmik  

Re: [PATCH v2 05/18] gpiolib: cdev: support GPIO_GET_LINE_IOCTL and GPIOLINE_GET_VALUES_IOCTL

2020-07-25 Thread Kent Gibson
On Sun, Jul 26, 2020 at 09:12:44AM +0800, Kent Gibson wrote:
> On Sat, Jul 25, 2020 at 11:51:54PM +0300, Andy Shevchenko wrote:
> > On Sat, Jul 25, 2020 at 7:24 AM Kent Gibson  wrote:
> > >

[ snip ]
> > 
> > > +static bool padding_not_zeroed(__u32 *padding, int pad_size)
> > > +{
> > > +   int i, sum = 0;
> > > +
> > > +   for (i = 0; i < pad_size; i++)
> > > +   sum |= padding[i];
> > > +
> > > +   return sum;
> > > +}
> > 
> > Reimplementation of memchr_inv() ?
> > 
> 
> I was hoping to find an existing function, surely checking a region is
> zeroed is a common thing, right?, so this was a place holder as much
> as anything.  Not sure memchr_inv fits the bill, but I'll give it a
> try...
> 

I gave it a try.  It is a good fit functionally, but in my build it
results in a larger object by ~104 bytes.  I assume that is because 
padding_not_zeroed is being inlined, and otherwise optimized, while
memchr_inv calls aren't.

As such I'm inclined to leave it as is - unless there are other
objections.

Cheers,
Kent.



Re: WARNING in delete_node (2)

2020-07-25 Thread Matthew Wilcox
On Sat, Jul 25, 2020 at 10:04:15AM -0700, syzbot wrote:
> [ cut here ]
> WARNING: CPU: 1 PID: 17410 at lib/radix-tree.c:571 delete_node+0x1e7/0x8a0 
> lib/radix-tree.c:571

Umm.  Interesting.  That's
WARN_ON_ONCE(!list_empty(>private_list));
That list_head is only used by the page cache, and this node is part of
the radix tree of mounts.  So it should have been initialised to empty
and remained empty the entire time it was in use.  It'd be interesting
to get the object file that syzbot ran (at least lib/radix-tree.o) so I
could see from the register dump below what was in node->private_list.
The 'Code' snippet below is, alas, not very interesting because it's
the ud2 instruction, which gcc has correctly shuffled off to the end of
the function.

Or it's a random scribble, or it's bad ram.

> RIP: 0010:delete_node+0x1e7/0x8a0 lib/radix-tree.c:571
> Code: e2 48 c7 43 48 00 00 00 00 48 c1 ea 03 42 80 3c 2a 00 0f 85 bb 05 00 00 
> 48 8b 55 18 49 39 d4 0f 84 8b 03 00 00 e8 e9 6c c3 fd <0f> 0b 48 c7 c6 d0 a6 
> b0 83 4c 89 e7 e8 b8 d7 b0 fd 4d 85 f6 0f 85
> RSP: 0018:c900078afd08 EFLAGS: 00010246
> RAX: 0004 RBX: 89d2df00 RCX: c90013fcd000
> RDX: 0004 RSI: 83b0d377 RDI: 8880a9c90842
> RBP: 88808a91ab40 R08:  R09: 8880a9c90a6f
> R10:  R11:  R12: 88808a91ab58
> R13: dc00 R14: 8880a9c90840 R15: 000a
>  __radix_tree_delete+0x190/0x370 lib/radix-tree.c:1378
>  radix_tree_delete_item+0xe7/0x230 lib/radix-tree.c:1429
>  mnt_free_id fs/namespace.c:131 [inline]


[PATCH] io: Fix return type of _inb and _inl

2020-07-25 Thread Stafford Horne
The return type of functions _inb, _inw and _inl are all u16 which looks
wrong.  This patch makes them u8, u16 and u32 respectively.

The original commit text for these does not indicate that these should
be all forced to u16.

Fixes: f009c89df79a ("io: Provide _inX() and _outX()")
Signed-off-by: Stafford Horne 
---
 include/asm-generic/io.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 8b1e020e9a03..30a3aab312e6 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -456,7 +456,7 @@ static inline void writesq(volatile void __iomem *addr, 
const void *buffer,
 
 #if !defined(inb) && !defined(_inb)
 #define _inb _inb
-static inline u16 _inb(unsigned long addr)
+static inline u8 _inb(unsigned long addr)
 {
u8 val;
 
@@ -482,7 +482,7 @@ static inline u16 _inw(unsigned long addr)
 
 #if !defined(inl) && !defined(_inl)
 #define _inl _inl
-static inline u16 _inl(unsigned long addr)
+static inline u32 _inl(unsigned long addr)
 {
u32 val;
 
-- 
2.26.2



[PATCH v2] net: ipv6: fix use-after-free Read in __xfrm6_tunnel_spi_lookup

2020-07-25 Thread B K Karthik
__xfrm_tunnel_spi_check used xfrm6_tunnel_spi_has_byspi
which returns spi % XFRM6_TUNNEL_SPI_BYSPI_HSIZE.
whereas xfrm6_tunnel_spi_hash_byaddr makes a call to
ipv6_addr_hash.

netdevsim netdevsim0 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim0 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0
==
BUG: KASAN: use-after-free in __xfrm6_tunnel_spi_lookup+0x3a9/0x3b0 
net/ipv6/xfrm6_tunnel.c:79
Read of size 8 at addr 8880934578a8 by task syz-executor437/6811
CPU: 0 PID: 6811 Comm: syz-executor437 Not tainted 
5.8.0-rc5-next-20200715-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 __xfrm6_tunnel_spi_lookup+0x3a9/0x3b0 net/ipv6/xfrm6_tunnel.c:79
 xfrm6_tunnel_spi_lookup+0x8a/0x1d0 net/ipv6/xfrm6_tunnel.c:95
 xfrmi6_rcv_tunnel+0xb9/0x100 net/xfrm/xfrm_interface.c:824
 tunnel6_rcv+0xef/0x2b0 net/ipv6/tunnel6.c:148
 ip6_protocol_deliver_rcu+0x2e8/0x1670 net/ipv6/ip6_input.c:433
 ip6_input_finish+0x7f/0x160 net/ipv6/ip6_input.c:474
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:483
 dst_input include/net/dst.h:449 [inline]
 ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ipv6_rcv+0x28e/0x3c0 net/ipv6/ip6_input.c:307
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5287
 __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5401
 netif_receive_skb_internal net/core/dev.c:5503 [inline]
 netif_receive_skb+0x159/0x990 net/core/dev.c:5562
 tun_rx_batched.isra.0+0x460/0x720 drivers/net/tun.c:1518
 tun_get_user+0x23b2/0x35b0 drivers/net/tun.c:1972
 tun_chr_write_iter+0xba/0x151 drivers/net/tun.c:2001
 call_write_iter include/linux/fs.h:1879 [inline]
 new_sync_write+0x422/0x650 fs/read_write.c:515
 vfs_write+0x59d/0x6b0 fs/read_write.c:595
 ksys_write+0x12d/0x250 fs/read_write.c:648
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x403d50
Code: Bad RIP value.
RSP: 002b:7ffe8fe93368 EFLAGS: 0246 ORIG_RAX: 0001
RAX: ffda RBX: 0003 RCX: 00403d50
RDX: 005e RSI: 27c0 RDI: 00f0
RBP: 7ffe8fe93390 R08:  R09: 
R10:  R11: 0246 R12: 7ffe8fe93380
R13:  R14:  R15: 
Allocated by task 6811:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 __do_kmalloc mm/slab.c:3655 [inline]
 __kmalloc+0x1a8/0x320 mm/slab.c:3664
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 tomoyo_init_log+0x1335/0x1e50 security/tomoyo/audit.c:275
 tomoyo_supervisor+0x32f/0xeb0 security/tomoyo/common.c:2097
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x3ed/0x4d0 security/tomoyo/file.c:734
 security_file_ioctl+0x50/0xb0 security/security.c:1489
 ksys_ioctl+0x50/0x180 fs/ioctl.c:747
 __do_sys_ioctl fs/ioctl.c:762 [inline]
 __se_sys_ioctl fs/ioctl.c:760 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:760
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 6811:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3756
 tomoyo_supervisor+0x350/0xeb0 security/tomoyo/common.c:2149
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x3ed/0x4d0 security/tomoyo/file.c:734
 security_file_ioctl+0x50/0xb0 security/security.c:1489
 ksys_ioctl+0x50/0x180 fs/ioctl.c:747
 __do_sys_ioctl fs/ioctl.c:762 [inline]
 __se_sys_ioctl fs/ioctl.c:760 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:760
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
The buggy address belongs to the object at 888093457800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 168 bytes inside of
 512-byte region [888093457800, 888093457a00)
The buggy address belongs to the page:
page:5c2b5911 refcount:1 mapcount:0 mapping: index:0x0 
pfn:0x93457
flags: 0xfffe000200(slab)

[tip:x86/timers] BUILD SUCCESS 898ec52d2ba05915aaedcdb21bff2e944c883cb8

2020-07-25 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git  
x86/timers
branch HEAD: 898ec52d2ba05915aaedcdb21bff2e944c883cb8  x86/xen/time: Set the 
X86_FEATURE_TSC_KNOWN_FREQ flag in xen_tsc_khz()

elapsed time: 721m

configs tested: 10
configs skipped: 70

The following configs have been built successfully.
More configs may be tested in the coming days.

i386 allyesconfig
i386defconfig
i386  debian-10.3
i386  allnoconfig
x86_64   rhel
x86_64lkp
x86_64  fedora-25
x86_64rhel-7.6-kselftests
x86_64   rhel-8.3
x86_64  kexec

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


[PATCH v2 5/6] stm class: ftrace: enable supported trace export flag

2020-07-25 Thread Tingwei Zhang
Set flags for trace_export. Export function trace, event trace
and trace marker to stm.

Signed-off-by: Tingwei Zhang 
---
 drivers/hwtracing/stm/ftrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hwtracing/stm/ftrace.c b/drivers/hwtracing/stm/ftrace.c
index ce868e095410..c694a6e692d1 100644
--- a/drivers/hwtracing/stm/ftrace.c
+++ b/drivers/hwtracing/stm/ftrace.c
@@ -46,6 +46,8 @@ static int stm_ftrace_link(struct stm_source_data *data)
struct stm_ftrace *sf = container_of(data, struct stm_ftrace, data);
 
sf->ftrace.write = stm_ftrace_write;
+   sf->ftrace.flags = TRACE_EXPORT_FUNCTION | TRACE_EXPORT_EVENT
+   | TRACE_EXPORT_MARKER;
 
return register_ftrace_export(>ftrace);
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 2/6] tracing: add flag to control different traces

2020-07-25 Thread Tingwei Zhang
More traces like event trace or trace marker will be supported.
Add flag for difference traces, so that they can be controlled
separately. Move current function trace to it's own flag
instead of global ftrace enable flag.

Signed-off-by: Tingwei Zhang 
---
 include/linux/trace.h |  5 +
 kernel/trace/trace.c  | 36 +++-
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/include/linux/trace.h b/include/linux/trace.h
index 7fd86d3c691f..d2fdf9be84b5 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -3,6 +3,9 @@
 #define _LINUX_TRACE_H
 
 #ifdef CONFIG_TRACING
+
+#define TRACE_EXPORT_FUNCTION  BIT_ULL(0)
+
 /*
  * The trace export - an export of Ftrace output. The trace_export
  * can process traces and export them to a registered destination as
@@ -15,10 +18,12 @@
  * next- pointer to the next trace_export
  * write   - copy traces which have been delt with ->commit() to
  *   the destination
+ * flags   - which ftrace to be exported
  */
 struct trace_export {
struct trace_export __rcu   *next;
void (*write)(struct trace_export *, const void *, unsigned int);
+   int flags;
 };
 
 int register_ftrace_export(struct trace_export *export);
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index bb62269724d5..8f1e66831e9e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2747,33 +2747,37 @@ trace_buffer_unlock_commit_nostack(struct trace_buffer 
*buffer,
 
 static void
 trace_process_export(struct trace_export *export,
-  struct ring_buffer_event *event)
+  struct ring_buffer_event *event, int flag)
 {
struct trace_entry *entry;
unsigned int size = 0;
 
-   entry = ring_buffer_event_data(event);
-   size = ring_buffer_event_length(event);
-   export->write(export, entry, size);
+   if (export->flags & flag) {
+   entry = ring_buffer_event_data(event);
+   size = ring_buffer_event_length(event);
+   export->write(export, entry, size);
+   }
 }
 
 static DEFINE_MUTEX(ftrace_export_lock);
 
 static struct trace_export __rcu *ftrace_exports_list __read_mostly;
 
-static DEFINE_STATIC_KEY_FALSE(ftrace_exports_enabled);
+static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled);
 
-static inline void ftrace_exports_enable(void)
+static inline void ftrace_exports_enable(struct trace_export *export)
 {
-   static_branch_enable(_exports_enabled);
+   if (export->flags & TRACE_EXPORT_FUNCTION)
+   static_branch_inc(_function_exports_enabled);
 }
 
-static inline void ftrace_exports_disable(void)
+static inline void ftrace_exports_disable(struct trace_export *export)
 {
-   static_branch_disable(_exports_enabled);
+   if (export->flags & TRACE_EXPORT_FUNCTION)
+   static_branch_dec(_function_exports_enabled);
 }
 
-static void ftrace_exports(struct ring_buffer_event *event)
+static void ftrace_exports(struct ring_buffer_event *event, int flag)
 {
struct trace_export *export;
 
@@ -2781,7 +2785,7 @@ static void ftrace_exports(struct ring_buffer_event 
*event)
 
export = rcu_dereference_raw_check(ftrace_exports_list);
while (export) {
-   trace_process_export(export, event);
+   trace_process_export(export, event, flag);
export = rcu_dereference_raw_check(export->next);
}
 
@@ -2821,8 +2825,7 @@ rm_trace_export(struct trace_export **list, struct 
trace_export *export)
 static inline void
 add_ftrace_export(struct trace_export **list, struct trace_export *export)
 {
-   if (*list == NULL)
-   ftrace_exports_enable();
+   ftrace_exports_enable(export);
 
add_trace_export(list, export);
 }
@@ -2833,8 +2836,7 @@ rm_ftrace_export(struct trace_export **list, struct 
trace_export *export)
int ret;
 
ret = rm_trace_export(list, export);
-   if (*list == NULL)
-   ftrace_exports_disable();
+   ftrace_exports_disable(export);
 
return ret;
 }
@@ -2887,8 +2889,8 @@ trace_function(struct trace_array *tr,
entry->parent_ip= parent_ip;
 
if (!call_filter_check_discard(call, entry, buffer, event)) {
-   if (static_branch_unlikely(_exports_enabled))
-   ftrace_exports(event);
+   if (static_branch_unlikely(_function_exports_enabled))
+   ftrace_exports(event, TRACE_EXPORT_FUNCTION);
__buffer_unlock_commit(buffer, event);
}
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 3/6] tracing: add trace_export support for event trace

2020-07-25 Thread Tingwei Zhang
Only function traces can be exported to other destinations currently.
This patch exports event trace as well. Move trace export related
function to the beginning of file so other trace can call
trace_process_export() to export.

Signed-off-by: Tingwei Zhang 
---
 include/linux/trace.h |   1 +
 kernel/trace/trace.c  | 259 ++
 2 files changed, 135 insertions(+), 125 deletions(-)

diff --git a/include/linux/trace.h b/include/linux/trace.h
index d2fdf9be84b5..91f6f1c0f2db 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -5,6 +5,7 @@
 #ifdef CONFIG_TRACING
 
 #define TRACE_EXPORT_FUNCTION  BIT_ULL(0)
+#define TRACE_EXPORT_EVENT BIT_ULL(1)
 
 /*
  * The trace export - an export of Ftrace output. The trace_export
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8f1e66831e9e..2f9302a8b322 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -251,6 +251,138 @@ unsigned long long ns2usecs(u64 nsec)
return nsec;
 }
 
+static void
+trace_process_export(struct trace_export *export,
+  struct ring_buffer_event *event, int flag)
+{
+   struct trace_entry *entry;
+   unsigned int size = 0;
+
+   if (export->flags & flag) {
+   entry = ring_buffer_event_data(event);
+   size = ring_buffer_event_length(event);
+   export->write(export, entry, size);
+   }
+}
+
+static DEFINE_MUTEX(ftrace_export_lock);
+
+static struct trace_export __rcu *ftrace_exports_list __read_mostly;
+
+static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled);
+static DEFINE_STATIC_KEY_FALSE(trace_event_exports_enabled);
+
+static inline void ftrace_exports_enable(struct trace_export *export)
+{
+   if (export->flags & TRACE_EXPORT_FUNCTION)
+   static_branch_inc(_function_exports_enabled);
+
+   if (export->flags & TRACE_EXPORT_EVENT)
+   static_branch_inc(_event_exports_enabled);
+}
+
+static inline void ftrace_exports_disable(struct trace_export *export)
+{
+   if (export->flags & TRACE_EXPORT_FUNCTION)
+   static_branch_dec(_function_exports_enabled);
+
+   if (export->flags & TRACE_EXPORT_EVENT)
+   static_branch_dec(_event_exports_enabled);
+}
+
+static void ftrace_exports(struct ring_buffer_event *event, int flag)
+{
+   struct trace_export *export;
+
+   preempt_disable_notrace();
+
+   export = rcu_dereference_raw_check(ftrace_exports_list);
+   while (export) {
+   trace_process_export(export, event, flag);
+   export = rcu_dereference_raw_check(export->next);
+   }
+
+   preempt_enable_notrace();
+}
+
+static inline void
+add_trace_export(struct trace_export **list, struct trace_export *export)
+{
+   rcu_assign_pointer(export->next, *list);
+   /*
+* We are entering export into the list but another
+* CPU might be walking that list. We need to make sure
+* the export->next pointer is valid before another CPU sees
+* the export pointer included into the list.
+*/
+   rcu_assign_pointer(*list, export);
+}
+
+static inline int
+rm_trace_export(struct trace_export **list, struct trace_export *export)
+{
+   struct trace_export **p;
+
+   for (p = list; *p != NULL; p = &(*p)->next)
+   if (*p == export)
+   break;
+
+   if (*p != export)
+   return -1;
+
+   rcu_assign_pointer(*p, (*p)->next);
+
+   return 0;
+}
+
+static inline void
+add_ftrace_export(struct trace_export **list, struct trace_export *export)
+{
+   ftrace_exports_enable(export);
+
+   add_trace_export(list, export);
+}
+
+static inline int
+rm_ftrace_export(struct trace_export **list, struct trace_export *export)
+{
+   int ret;
+
+   ret = rm_trace_export(list, export);
+   ftrace_exports_disable(export);
+
+   return ret;
+}
+
+int register_ftrace_export(struct trace_export *export)
+{
+   if (WARN_ON_ONCE(!export->write))
+   return -1;
+
+   mutex_lock(_export_lock);
+
+   add_ftrace_export(_exports_list, export);
+
+   mutex_unlock(_export_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(register_ftrace_export);
+
+int unregister_ftrace_export(struct trace_export *export)
+{
+   int ret;
+
+   mutex_lock(_export_lock);
+
+   ret = rm_ftrace_export(_exports_list, export);
+
+   mutex_unlock(_export_lock);
+
+   return ret;
+}
+EXPORT_SYMBOL_GPL(unregister_ftrace_export);
+
 /* trace_flags holds trace_options default values */
 #define TRACE_DEFAULT_FLAGS\
(FUNCTION_DEFAULT_FLAGS |   \
@@ -2702,6 +2834,8 @@ void trace_event_buffer_commit(struct trace_event_buffer 
*fbuffer)
if (static_key_false(_printk_key.key))
output_printk(fbuffer);
 
+   if (static_branch_unlikely(_event_exports_enabled))
+ 

[PATCH v2 6/6] stm class: ftrace: use different channel accroding to CPU

2020-07-25 Thread Tingwei Zhang
To avoid mixup of packets from differnt ftrace packets simultaneously,
use different channel for packets from different CPU.

Signed-off-by: Tingwei Zhang 
---
 drivers/hwtracing/stm/ftrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwtracing/stm/ftrace.c b/drivers/hwtracing/stm/ftrace.c
index c694a6e692d1..9893a0e8eced 100644
--- a/drivers/hwtracing/stm/ftrace.c
+++ b/drivers/hwtracing/stm/ftrace.c
@@ -37,8 +37,9 @@ static void notrace
 stm_ftrace_write(struct trace_export *export, const void *buf, unsigned int 
len)
 {
struct stm_ftrace *stm = container_of(export, struct stm_ftrace, 
ftrace);
+   unsigned int cpu = smp_processor_id();
 
-   stm_source_write(>data, STM_FTRACE_CHAN, buf, len);
+   stm_source_write(>data, STM_FTRACE_CHAN + cpu, buf, len);
 }
 
 static int stm_ftrace_link(struct stm_source_data *data)
@@ -63,6 +64,7 @@ static int __init stm_ftrace_init(void)
 {
int ret;
 
+   stm_ftrace.data.nr_chans = num_possible_cpus();
ret = stm_source_register_device(NULL, _ftrace.data);
if (ret)
pr_err("Failed to register stm_source - ftrace.\n");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 4/6] tracing: add trace_export support for trace_marker

2020-07-25 Thread Tingwei Zhang
Add the support to route trace_marker buffer to other destination
via trace_export.

Signed-off-by: Tingwei Zhang 
---
 include/linux/trace.h | 1 +
 kernel/trace/trace.c  | 9 +
 2 files changed, 10 insertions(+)

diff --git a/include/linux/trace.h b/include/linux/trace.h
index 91f6f1c0f2db..4bb6918fbf44 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -6,6 +6,7 @@
 
 #define TRACE_EXPORT_FUNCTION  BIT_ULL(0)
 #define TRACE_EXPORT_EVENT BIT_ULL(1)
+#define TRACE_EXPORT_MARKERBIT_ULL(2)
 
 /*
  * The trace export - an export of Ftrace output. The trace_export
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2f9302a8b322..67993abda394 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -271,6 +271,7 @@ static struct trace_export __rcu *ftrace_exports_list 
__read_mostly;
 
 static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled);
 static DEFINE_STATIC_KEY_FALSE(trace_event_exports_enabled);
+static DEFINE_STATIC_KEY_FALSE(trace_marker_exports_enabled);
 
 static inline void ftrace_exports_enable(struct trace_export *export)
 {
@@ -279,6 +280,9 @@ static inline void ftrace_exports_enable(struct 
trace_export *export)
 
if (export->flags & TRACE_EXPORT_EVENT)
static_branch_inc(_event_exports_enabled);
+
+   if (export->flags & TRACE_EXPORT_MARKER)
+   static_branch_inc(_marker_exports_enabled);
 }
 
 static inline void ftrace_exports_disable(struct trace_export *export)
@@ -288,6 +292,9 @@ static inline void ftrace_exports_disable(struct 
trace_export *export)
 
if (export->flags & TRACE_EXPORT_EVENT)
static_branch_dec(_event_exports_enabled);
+
+   if (export->flags & TRACE_EXPORT_MARKER)
+   static_branch_dec(_marker_exports_enabled);
 }
 
 static void ftrace_exports(struct ring_buffer_event *event, int flag)
@@ -6648,6 +6655,8 @@ tracing_mark_write(struct file *filp, const char __user 
*ubuf,
} else
entry->buf[cnt] = '\0';
 
+   if (static_branch_unlikely(_marker_exports_enabled))
+   ftrace_exports(event, TRACE_EXPORT_MARKER);
__buffer_unlock_commit(buffer, event);
 
if (tt)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 1/6] stm class: ftrace: change dependency to TRACING

2020-07-25 Thread Tingwei Zhang
We will support copying event trace to STM. Change
STM_SOURCE_FTRACE to depend on TRACING since we will
support multiple tracers.

Signed-off-by: Tingwei Zhang 
---
 drivers/hwtracing/stm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwtracing/stm/Kconfig b/drivers/hwtracing/stm/Kconfig
index d0e92a8a045c..aad594fe79cc 100644
--- a/drivers/hwtracing/stm/Kconfig
+++ b/drivers/hwtracing/stm/Kconfig
@@ -71,7 +71,7 @@ config STM_SOURCE_HEARTBEAT
 
 config STM_SOURCE_FTRACE
tristate "Copy the output from kernel Ftrace to STM engine"
-   depends on FUNCTION_TRACER
+   depends on TRACING
help
  This option can be used to copy the output from kernel Ftrace
  to STM engine. Enabling this option will introduce a slight
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 0/6] tracing: export event trace and trace_marker

2020-07-25 Thread Tingwei Zhang
Ftrace has ability to export trace packets to other destionation. Currently,
only function trace can be exported. This series extends the support to
event trace and trace_maker. STM is one possible destination to export ftrace.
Use seperate channel for each CPU to avoid mixing up packets from different
CPUs together.

Change from v1:
All changes are suggested by Steven Rostedt.
User seperate flag to control function trace, event trace and trace mark.
Allocate channels according to num_possible_cpu() dynamically.
Move ftrace_exports routines up so all ftrace can use them.

Tingwei Zhang (6):
  stm class: ftrace: change dependency to TRACING
  tracing: add flag to control different traces
  tracing: add trace_export support for event trace
  tracing: add trace_export support for trace_marker
  stm class: ftrace: enable supported trace export flag
  stm class: ftrace: use different channel accroding to CPU

 drivers/hwtracing/stm/Kconfig  |   2 +-
 drivers/hwtracing/stm/ftrace.c |   6 +-
 include/linux/trace.h  |   7 +
 kernel/trace/trace.c   | 270 ++---
 4 files changed, 158 insertions(+), 127 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v2 4/8] ASoC: sun50i-codec-analog: Make headphone routes stereo

2020-07-25 Thread Samuel Holland
This matches the hardware more accurately, and is necessary for
including the (stereo) headphone mute switch in the DAPM graph.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 28 +++
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index 17165f1ddb63..f98851067f97 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -311,9 +311,15 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 */
 
SND_SOC_DAPM_REGULATOR_SUPPLY("cpvdd", 0, 0),
-   SND_SOC_DAPM_MUX("Headphone Source Playback Route",
+   SND_SOC_DAPM_MUX("Left Headphone Source",
 SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src),
-   SND_SOC_DAPM_OUT_DRV("Headphone Amp", SUN50I_ADDA_HP_CTRL,
+   SND_SOC_DAPM_MUX("Right Headphone Source",
+SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src),
+   SND_SOC_DAPM_OUT_DRV("Left Headphone Amp",
+SND_SOC_NOPM, 0, 0, NULL, 0),
+   SND_SOC_DAPM_OUT_DRV("Right Headphone Amp",
+SND_SOC_NOPM, 0, 0, NULL, 0),
+   SND_SOC_DAPM_SUPPLY("Headphone Amp", SUN50I_ADDA_HP_CTRL,
 SUN50I_ADDA_HP_CTRL_HPPA_EN, 0, NULL, 0),
SND_SOC_DAPM_OUTPUT("HP"),
 
@@ -405,13 +411,19 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
{ "Right ADC", NULL, "Right ADC Mixer" },
 
/* Headphone Routes */
-   { "Headphone Source Playback Route", "DAC", "Left DAC" },
-   { "Headphone Source Playback Route", "DAC", "Right DAC" },
-   { "Headphone Source Playback Route", "Mixer", "Left Mixer" },
-   { "Headphone Source Playback Route", "Mixer", "Right Mixer" },
-   { "Headphone Amp", NULL, "Headphone Source Playback Route" },
+   { "Left Headphone Source", "DAC", "Left DAC" },
+   { "Left Headphone Source", "Mixer", "Left Mixer" },
+   { "Left Headphone Amp", NULL, "Left Headphone Source" },
+   { "Left Headphone Amp", NULL, "Headphone Amp" },
+   { "HP", NULL, "Left Headphone Amp" },
+
+   { "Right Headphone Source", "DAC", "Right DAC" },
+   { "Right Headphone Source", "Mixer", "Right Mixer" },
+   { "Right Headphone Amp", NULL, "Right Headphone Source" },
+   { "Right Headphone Amp", NULL, "Headphone Amp" },
+   { "HP", NULL, "Right Headphone Amp" },
+
{ "Headphone Amp", NULL, "cpvdd" },
-   { "HP", NULL, "Headphone Amp" },
 
/* Microphone Routes */
{ "Mic1 Amplifier", NULL, "MIC1"},
-- 
2.26.2



[PATCH v2 0/8] ASoC: sun50i-codec-analog: Cleanup and power management

2020-07-25 Thread Samuel Holland
This series performs some minor cleanup on the driver for the analog
codec in the Allwinner A64, and hooks up the existing mute switches to
DAPM widgets, in order to provide improved power management.

Changes since v1:
  - Collected Acked-by/Reviewed-by tags
  - Used SOC_MIXER_NAMED_CTL_ARRAY to avoid naming a widget "Earpiece"

Samuel Holland (8):
  ASoC: sun50i-codec-analog: Fix duplicate use of ADC enable bits
  ASoC: sun50i-codec-analog: Gate the amplifier clock during suspend
  ASoC: sun50i-codec-analog: Group and sort mixer routes
  ASoC: sun50i-codec-analog: Make headphone routes stereo
  ASoC: sun50i-codec-analog: Enable DAPM for headphone switch
  ASoC: sun50i-codec-analog: Make line out routes stereo
  ASoC: sun50i-codec-analog: Enable DAPM for line out switch
  ASoC: sun50i-codec-analog: Enable DAPM for earpiece switch

 sound/soc/sunxi/sun50i-codec-analog.c | 176 --
 1 file changed, 111 insertions(+), 65 deletions(-)

-- 
2.26.2



[PATCH v2 5/8] ASoC: sun50i-codec-analog: Enable DAPM for headphone switch

2020-07-25 Thread Samuel Holland
By including the headphone mute switch to the DAPM graph, both the
headphone amplifier and the Mixer/DAC inputs can be powered off when
the headphones are muted.

The mute switch is between the source selection and the amplifier,
as per the diagram in the SoC manual.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index f98851067f97..176d6658d099 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -193,11 +193,6 @@ static const struct snd_kcontrol_new 
sun50i_a64_codec_controls[] = {
   SUN50I_ADDA_HP_CTRL_HPVOL, 0x3f, 0,
   sun50i_codec_hp_vol_scale),
 
-   SOC_DOUBLE("Headphone Playback Switch",
-  SUN50I_ADDA_MIX_DAC_CTRL,
-  SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE,
-  SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE, 1, 0),
-
/* Mixer pre-gain */
SOC_SINGLE_TLV("Mic1 Playback Volume", SUN50I_ADDA_MIC1_CTRL,
   SUN50I_ADDA_MIC1_CTRL_MIC1G,
@@ -264,6 +259,12 @@ static const struct snd_kcontrol_new sun50i_codec_hp_src[] 
= {
  sun50i_codec_hp_src_enum),
 };
 
+static const struct snd_kcontrol_new sun50i_codec_hp_switch =
+   SOC_DAPM_DOUBLE("Headphone Playback Switch",
+   SUN50I_ADDA_MIX_DAC_CTRL,
+   SUN50I_ADDA_MIX_DAC_CTRL_LHPPAMUTE,
+   SUN50I_ADDA_MIX_DAC_CTRL_RHPPAMUTE, 1, 0);
+
 static const char * const sun50i_codec_lineout_src_enum_text[] = {
"Stereo", "Mono Differential",
 };
@@ -315,6 +316,10 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src),
SND_SOC_DAPM_MUX("Right Headphone Source",
 SND_SOC_NOPM, 0, 0, sun50i_codec_hp_src),
+   SND_SOC_DAPM_SWITCH("Left Headphone Switch",
+   SND_SOC_NOPM, 0, 0, _codec_hp_switch),
+   SND_SOC_DAPM_SWITCH("Right Headphone Switch",
+   SND_SOC_NOPM, 0, 0, _codec_hp_switch),
SND_SOC_DAPM_OUT_DRV("Left Headphone Amp",
 SND_SOC_NOPM, 0, 0, NULL, 0),
SND_SOC_DAPM_OUT_DRV("Right Headphone Amp",
@@ -413,13 +418,15 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
/* Headphone Routes */
{ "Left Headphone Source", "DAC", "Left DAC" },
{ "Left Headphone Source", "Mixer", "Left Mixer" },
-   { "Left Headphone Amp", NULL, "Left Headphone Source" },
+   { "Left Headphone Switch", "Headphone Playback Switch", "Left Headphone 
Source" },
+   { "Left Headphone Amp", NULL, "Left Headphone Switch" },
{ "Left Headphone Amp", NULL, "Headphone Amp" },
{ "HP", NULL, "Left Headphone Amp" },
 
{ "Right Headphone Source", "DAC", "Right DAC" },
{ "Right Headphone Source", "Mixer", "Right Mixer" },
-   { "Right Headphone Amp", NULL, "Right Headphone Source" },
+   { "Right Headphone Switch", "Headphone Playback Switch", "Right 
Headphone Source" },
+   { "Right Headphone Amp", NULL, "Right Headphone Switch" },
{ "Right Headphone Amp", NULL, "Headphone Amp" },
{ "HP", NULL, "Right Headphone Amp" },
 
-- 
2.26.2



[PATCH v2 8/8] ASoC: sun50i-codec-analog: Enable DAPM for earpiece switch

2020-07-25 Thread Samuel Holland
By including the earpiece mute switch in the DAPM graph, both the
earpiece amplifier and the Mixer/DAC inputs can be powered off when
the earpiece is muted.

While the widget is really just a simple switch, it is represented
as a "mixer with named controls" to avoid including the widget name
in the kcontrol name. Otherwise, it is not possible to give the widget
an accurate, descriptive name without changing the kcontrol name
seen by userspace (which should be stable).

The mute switch is between the source selection and the amplifier,
as per the diagram in the SoC manual.

Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index 84bb76cad74f..a41e25ad0aaf 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -232,11 +232,6 @@ static const struct snd_kcontrol_new 
sun50i_a64_codec_controls[] = {
   SUN50I_ADDA_EARPIECE_CTRL1,
   SUN50I_ADDA_EARPIECE_CTRL1_ESP_VOL, 0x1f, 0,
   sun50i_codec_earpiece_vol_scale),
-
-   SOC_SINGLE("Earpiece Playback Switch",
-  SUN50I_ADDA_EARPIECE_CTRL1,
-  SUN50I_ADDA_EARPIECE_CTRL1_ESPPA_MUTE, 1, 0),
-
 };
 
 static const char * const sun50i_codec_hp_src_enum_text[] = {
@@ -295,6 +290,12 @@ static const struct snd_kcontrol_new 
sun50i_codec_earpiece_src[] = {
  sun50i_codec_earpiece_src_enum),
 };
 
+static const struct snd_kcontrol_new sun50i_codec_earpiece_switch[] = {
+   SOC_DAPM_SINGLE("Earpiece Playback Switch",
+   SUN50I_ADDA_EARPIECE_CTRL1,
+   SUN50I_ADDA_EARPIECE_CTRL1_ESPPA_MUTE, 1, 0),
+};
+
 static const struct snd_soc_dapm_widget sun50i_a64_codec_widgets[] = {
/* DAC */
SND_SOC_DAPM_DAC("Left DAC", NULL, SUN50I_ADDA_MIX_DAC_CTRL,
@@ -341,6 +342,9 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 
SND_SOC_DAPM_MUX("Earpiece Source Playback Route",
 SND_SOC_NOPM, 0, 0, sun50i_codec_earpiece_src),
+   SOC_MIXER_NAMED_CTL_ARRAY("Earpiece Switch",
+ SND_SOC_NOPM, 0, 0,
+ sun50i_codec_earpiece_switch),
SND_SOC_DAPM_OUT_DRV("Earpiece Amp", SUN50I_ADDA_EARPIECE_CTRL1,
 SUN50I_ADDA_EARPIECE_CTRL1_ESPPA_EN, 0, NULL, 0),
SND_SOC_DAPM_OUTPUT("EARPIECE"),
@@ -462,7 +466,8 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
{ "Earpiece Source Playback Route", "DACR", "Right DAC" },
{ "Earpiece Source Playback Route", "Left Mixer", "Left Mixer" },
{ "Earpiece Source Playback Route", "Right Mixer", "Right Mixer" },
-   { "Earpiece Amp", NULL, "Earpiece Source Playback Route" },
+   { "Earpiece Switch", "Earpiece Playback Switch", "Earpiece Source 
Playback Route" },
+   { "Earpiece Amp", NULL, "Earpiece Switch" },
{ "EARPIECE", NULL, "Earpiece Amp" },
 };
 
-- 
2.26.2



[PATCH v2 1/8] ASoC: sun50i-codec-analog: Fix duplicate use of ADC enable bits

2020-07-25 Thread Samuel Holland
The same enable bits are currently used for both the "Left/Right ADC"
and the "Left/Right ADC Mixer" widgets. This happens to work in practice
because the widgets are always enabled/disabled at the same time, but
each register bit should only be associated with a single widget.

To keep symmetry with the DAC widgets, keep the bits on the ADC widgets,
and remove them from the ADC Mixer widgets.

Fixes: 42371f327df0 ("ASoC: sunxi: Add new driver for Allwinner A64 codec's 
analog path controls")
Reported-by: Ondrej Jirman 
Acked-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index f5b7069bcca2..cbdb31c3b7bd 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -363,12 +363,10 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
   SUN50I_ADDA_MIX_DAC_CTRL_RMIXEN, 0,
   sun50i_a64_codec_mixer_controls,
   ARRAY_SIZE(sun50i_a64_codec_mixer_controls)),
-   SND_SOC_DAPM_MIXER("Left ADC Mixer", SUN50I_ADDA_ADC_CTRL,
-  SUN50I_ADDA_ADC_CTRL_ADCLEN, 0,
+   SND_SOC_DAPM_MIXER("Left ADC Mixer", SND_SOC_NOPM, 0, 0,
   sun50i_codec_adc_mixer_controls,
   ARRAY_SIZE(sun50i_codec_adc_mixer_controls)),
-   SND_SOC_DAPM_MIXER("Right ADC Mixer", SUN50I_ADDA_ADC_CTRL,
-  SUN50I_ADDA_ADC_CTRL_ADCREN, 0,
+   SND_SOC_DAPM_MIXER("Right ADC Mixer", SND_SOC_NOPM, 0, 0,
   sun50i_codec_adc_mixer_controls,
   ARRAY_SIZE(sun50i_codec_adc_mixer_controls)),
 };
-- 
2.26.2



[PATCH v2 3/8] ASoC: sun50i-codec-analog: Group and sort mixer routes

2020-07-25 Thread Samuel Holland
Sort the controls in the same order as the bits in the register. Then
group the routes by sink, and sort them in the same order as the
controls. This makes it much easier to verify that all mixer inputs are
accounted for.

Acked-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 58 +--
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index 4ad262c2e59b..17165f1ddb63 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -121,50 +121,50 @@
 
 /* mixer controls */
 static const struct snd_kcontrol_new sun50i_a64_codec_mixer_controls[] = {
-   SOC_DAPM_DOUBLE_R("DAC Playback Switch",
+   SOC_DAPM_DOUBLE_R("Mic1 Playback Switch",
  SUN50I_ADDA_OL_MIX_CTRL,
  SUN50I_ADDA_OR_MIX_CTRL,
- SUN50I_ADDA_OL_MIX_CTRL_DACL, 1, 0),
-   SOC_DAPM_DOUBLE_R("DAC Reversed Playback Switch",
+ SUN50I_ADDA_OL_MIX_CTRL_MIC1, 1, 0),
+   SOC_DAPM_DOUBLE_R("Mic2 Playback Switch",
  SUN50I_ADDA_OL_MIX_CTRL,
  SUN50I_ADDA_OR_MIX_CTRL,
- SUN50I_ADDA_OL_MIX_CTRL_DACR, 1, 0),
+ SUN50I_ADDA_OL_MIX_CTRL_MIC2, 1, 0),
SOC_DAPM_DOUBLE_R("Line In Playback Switch",
  SUN50I_ADDA_OL_MIX_CTRL,
  SUN50I_ADDA_OR_MIX_CTRL,
  SUN50I_ADDA_OL_MIX_CTRL_LINEINL, 1, 0),
-   SOC_DAPM_DOUBLE_R("Mic1 Playback Switch",
+   SOC_DAPM_DOUBLE_R("DAC Playback Switch",
  SUN50I_ADDA_OL_MIX_CTRL,
  SUN50I_ADDA_OR_MIX_CTRL,
- SUN50I_ADDA_OL_MIX_CTRL_MIC1, 1, 0),
-   SOC_DAPM_DOUBLE_R("Mic2 Playback Switch",
+ SUN50I_ADDA_OL_MIX_CTRL_DACL, 1, 0),
+   SOC_DAPM_DOUBLE_R("DAC Reversed Playback Switch",
  SUN50I_ADDA_OL_MIX_CTRL,
  SUN50I_ADDA_OR_MIX_CTRL,
- SUN50I_ADDA_OL_MIX_CTRL_MIC2, 1, 0),
+ SUN50I_ADDA_OL_MIX_CTRL_DACR, 1, 0),
 };
 
 /* ADC mixer controls */
 static const struct snd_kcontrol_new sun50i_codec_adc_mixer_controls[] = {
-   SOC_DAPM_DOUBLE_R("Mixer Capture Switch",
+   SOC_DAPM_DOUBLE_R("Mic1 Capture Switch",
  SUN50I_ADDA_L_ADCMIX_SRC,
  SUN50I_ADDA_R_ADCMIX_SRC,
- SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL, 1, 0),
-   SOC_DAPM_DOUBLE_R("Mixer Reversed Capture Switch",
+ SUN50I_ADDA_L_ADCMIX_SRC_MIC1, 1, 0),
+   SOC_DAPM_DOUBLE_R("Mic2 Capture Switch",
  SUN50I_ADDA_L_ADCMIX_SRC,
  SUN50I_ADDA_R_ADCMIX_SRC,
- SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR, 1, 0),
+ SUN50I_ADDA_L_ADCMIX_SRC_MIC2, 1, 0),
SOC_DAPM_DOUBLE_R("Line In Capture Switch",
  SUN50I_ADDA_L_ADCMIX_SRC,
  SUN50I_ADDA_R_ADCMIX_SRC,
  SUN50I_ADDA_L_ADCMIX_SRC_LINEINL, 1, 0),
-   SOC_DAPM_DOUBLE_R("Mic1 Capture Switch",
+   SOC_DAPM_DOUBLE_R("Mixer Capture Switch",
  SUN50I_ADDA_L_ADCMIX_SRC,
  SUN50I_ADDA_R_ADCMIX_SRC,
- SUN50I_ADDA_L_ADCMIX_SRC_MIC1, 1, 0),
-   SOC_DAPM_DOUBLE_R("Mic2 Capture Switch",
+ SUN50I_ADDA_L_ADCMIX_SRC_OMIXRL, 1, 0),
+   SOC_DAPM_DOUBLE_R("Mixer Reversed Capture Switch",
  SUN50I_ADDA_L_ADCMIX_SRC,
  SUN50I_ADDA_R_ADCMIX_SRC,
- SUN50I_ADDA_L_ADCMIX_SRC_MIC2, 1, 0),
+ SUN50I_ADDA_L_ADCMIX_SRC_OMIXRR, 1, 0),
 };
 
 static const DECLARE_TLV_DB_SCALE(sun50i_codec_out_mixer_pregain_scale,
@@ -373,24 +373,32 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 
 static const struct snd_soc_dapm_route sun50i_a64_codec_routes[] = {
/* Left Mixer Routes */
+   { "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
+   { "Left Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+   { "Left Mixer", "Line In Playback Switch", "LINEIN" },
{ "Left Mixer", "DAC Playback Switch", "Left DAC" },
{ "Left Mixer", "DAC Reversed Playback Switch", "Right DAC" },
-   { "Left Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
 
/* Right Mixer Routes */
+   { "Right Mixer", "Mic1 Playback Switch", "Mic1 Amplifier" },
+   { "Right Mixer", "Mic2 Playback Switch", "Mic2 Amplifier" },
+   { "Right Mixer", "Line In Playback Switch", "LINEIN" },
{ "Right Mixer", "DAC Playback Switch", "Right DAC" },
{ "Right Mixer", "DAC Reversed 

[PATCH v2 6/8] ASoC: sun50i-codec-analog: Make line out routes stereo

2020-07-25 Thread Samuel Holland
This matches the hardware more accurately, and is necessary for
including the (stereo) line out mute switch in the DAPM graph.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index 176d6658d099..df39f6ffe25a 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -328,7 +328,9 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 SUN50I_ADDA_HP_CTRL_HPPA_EN, 0, NULL, 0),
SND_SOC_DAPM_OUTPUT("HP"),
 
-   SND_SOC_DAPM_MUX("Line Out Source Playback Route",
+   SND_SOC_DAPM_MUX("Left Line Out Source",
+SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
+   SND_SOC_DAPM_MUX("Right Line Out Source",
 SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
SND_SOC_DAPM_OUTPUT("LINEOUT"),
 
@@ -439,12 +441,14 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
{ "Mic2 Amplifier", NULL, "MIC2"},
 
/* Line-out Routes */
-   { "Line Out Source Playback Route", "Stereo", "Left Mixer" },
-   { "Line Out Source Playback Route", "Stereo", "Right Mixer" },
-   { "Line Out Source Playback Route", "Mono Differential", "Left Mixer" },
-   { "Line Out Source Playback Route", "Mono Differential",
-   "Right Mixer" },
-   { "LINEOUT", NULL, "Line Out Source Playback Route" },
+   { "Left Line Out Source", "Stereo", "Left Mixer" },
+   { "Left Line Out Source", "Mono Differential", "Left Mixer" },
+   { "Left Line Out Source", "Mono Differential", "Right Mixer" },
+   { "LINEOUT", NULL, "Left Line Out Source" },
+
+   { "Right Line Out Source", "Stereo", "Right Mixer" },
+   { "Right Line Out Source", "Mono Differential", "Left Line Out Source" 
},
+   { "LINEOUT", NULL, "Right Line Out Source" },
 
/* Earpiece Routes */
{ "Earpiece Source Playback Route", "DACL", "Left DAC" },
-- 
2.26.2



[PATCH v2 7/8] ASoC: sun50i-codec-analog: Enable DAPM for line out switch

2020-07-25 Thread Samuel Holland
By including the line out mute switch in the DAPM graph, the
Mixer/DAC inputs can be powered off when the line output is muted.

The line outputs have an unusual routing scheme. The left side mute
switch is between the source selection and the amplifier, as usual.
The right side source selection comes *after* its amplifier (and
after the left side amplifier), and its mute switch controls
whichever source is currently selected. This matches the diagram in
the SoC manual.

Reviewed-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index df39f6ffe25a..84bb76cad74f 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -228,11 +228,6 @@ static const struct snd_kcontrol_new 
sun50i_a64_codec_controls[] = {
   SUN50I_ADDA_LINEOUT_CTRL1_VOL, 0x1f, 0,
   sun50i_codec_lineout_vol_scale),
 
-   SOC_DOUBLE("Line Out Playback Switch",
-  SUN50I_ADDA_LINEOUT_CTRL0,
-  SUN50I_ADDA_LINEOUT_CTRL0_LEN,
-  SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0),
-
SOC_SINGLE_TLV("Earpiece Playback Volume",
   SUN50I_ADDA_EARPIECE_CTRL1,
   SUN50I_ADDA_EARPIECE_CTRL1_ESP_VOL, 0x1f, 0,
@@ -280,6 +275,12 @@ static const struct snd_kcontrol_new 
sun50i_codec_lineout_src[] = {
  sun50i_codec_lineout_src_enum),
 };
 
+static const struct snd_kcontrol_new sun50i_codec_lineout_switch =
+   SOC_DAPM_DOUBLE("Line Out Playback Switch",
+   SUN50I_ADDA_LINEOUT_CTRL0,
+   SUN50I_ADDA_LINEOUT_CTRL0_LEN,
+   SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0);
+
 static const char * const sun50i_codec_earpiece_src_enum_text[] = {
"DACR", "DACL", "Right Mixer", "Left Mixer",
 };
@@ -332,6 +333,10 @@ static const struct snd_soc_dapm_widget 
sun50i_a64_codec_widgets[] = {
 SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
SND_SOC_DAPM_MUX("Right Line Out Source",
 SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
+   SND_SOC_DAPM_SWITCH("Left Line Out Switch",
+   SND_SOC_NOPM, 0, 0, _codec_lineout_switch),
+   SND_SOC_DAPM_SWITCH("Right Line Out Switch",
+   SND_SOC_NOPM, 0, 0, _codec_lineout_switch),
SND_SOC_DAPM_OUTPUT("LINEOUT"),
 
SND_SOC_DAPM_MUX("Earpiece Source Playback Route",
@@ -444,10 +449,12 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
{ "Left Line Out Source", "Stereo", "Left Mixer" },
{ "Left Line Out Source", "Mono Differential", "Left Mixer" },
{ "Left Line Out Source", "Mono Differential", "Right Mixer" },
-   { "LINEOUT", NULL, "Left Line Out Source" },
+   { "Left Line Out Switch", "Line Out Playback Switch", "Left Line Out 
Source" },
+   { "LINEOUT", NULL, "Left Line Out Switch" },
 
-   { "Right Line Out Source", "Stereo", "Right Mixer" },
-   { "Right Line Out Source", "Mono Differential", "Left Line Out Source" 
},
+   { "Right Line Out Switch", "Line Out Playback Switch", "Right Mixer" },
+   { "Right Line Out Source", "Stereo", "Right Line Out Switch" },
+   { "Right Line Out Source", "Mono Differential", "Left Line Out Switch" 
},
{ "LINEOUT", NULL, "Right Line Out Source" },
 
/* Earpiece Routes */
-- 
2.26.2



[PATCH v2 2/8] ASoC: sun50i-codec-analog: Gate the amplifier clock during suspend

2020-07-25 Thread Samuel Holland
The clock must be running for the zero-crossing mute functionality.
However, it must be gated for VDD-SYS to be turned off during system
suspend. Disable it in the suspend callback, after everything has
already been muted, to avoid pops when muting/unmuting outputs.

Acked-by: Chen-Yu Tsai 
Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun50i-codec-analog.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/sound/soc/sunxi/sun50i-codec-analog.c 
b/sound/soc/sunxi/sun50i-codec-analog.c
index cbdb31c3b7bd..4ad262c2e59b 100644
--- a/sound/soc/sunxi/sun50i-codec-analog.c
+++ b/sound/soc/sunxi/sun50i-codec-analog.c
@@ -438,6 +438,19 @@ static const struct snd_soc_dapm_route 
sun50i_a64_codec_routes[] = {
{ "EARPIECE", NULL, "Earpiece Amp" },
 };
 
+static int sun50i_a64_codec_suspend(struct snd_soc_component *component)
+{
+   return regmap_update_bits(component->regmap, SUN50I_ADDA_HP_CTRL,
+ BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE),
+ BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE));
+}
+
+static int sun50i_a64_codec_resume(struct snd_soc_component *component)
+{
+   return regmap_update_bits(component->regmap, SUN50I_ADDA_HP_CTRL,
+ BIT(SUN50I_ADDA_HP_CTRL_PA_CLK_GATE), 0);
+}
+
 static const struct snd_soc_component_driver sun50i_codec_analog_cmpnt_drv = {
.controls   = sun50i_a64_codec_controls,
.num_controls   = ARRAY_SIZE(sun50i_a64_codec_controls),
@@ -445,6 +458,8 @@ static const struct snd_soc_component_driver 
sun50i_codec_analog_cmpnt_drv = {
.num_dapm_widgets   = ARRAY_SIZE(sun50i_a64_codec_widgets),
.dapm_routes= sun50i_a64_codec_routes,
.num_dapm_routes= ARRAY_SIZE(sun50i_a64_codec_routes),
+   .suspend= sun50i_a64_codec_suspend,
+   .resume = sun50i_a64_codec_resume,
 };
 
 static const struct of_device_id sun50i_codec_analog_of_match[] = {
-- 
2.26.2



[Linux-kernel-mentees] [PATCH v2] infiniband: Prevent uninit-value in ucma_accept()

2020-07-25 Thread Peilin Ye
ucma_accept() is reading uninitialized memory when `in_len` is
less than `offsetof(struct rdma_ucm_accept, ece)`. Fix it.

Reported-and-tested-by: syzbot+086ab5ca9eafd2379...@syzkaller.appspotmail.com
Link: 
https://syzkaller.appspot.com/bug?id=0bce3bb68cb383fce92f78444e3ef77c764b60ad
Signed-off-by: Peilin Ye 
---
Change in v2:
- syzbot has reported this bug as "KMSAN: uninit-value in xa_load".
  Add "Reported-and-tested-by:" and "Link:" tags for it.

 drivers/infiniband/core/ucma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index a591fdccdce0..842d297903c0 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1134,7 +1134,7 @@ static ssize_t ucma_listen(struct ucma_file *file, const 
char __user *inbuf,
 static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf,
   int in_len, int out_len)
 {
-   struct rdma_ucm_accept cmd;
+   struct rdma_ucm_accept cmd = {};
struct rdma_conn_param conn_param;
struct rdma_ucm_ece ece = {};
struct ucma_context *ctx;
-- 
2.25.1



Re: [PATCH v3] This command attaches a description to a file descriptor for troubleshooting purposes. The free string is displayed in the process fdinfo file for that fd /proc/pid/fdinfo/fd.

2020-07-25 Thread Pascal Bouchareine
Sorry about all the noise, please disregard this one.


On Sat, Jul 25, 2020 at 7:04 PM Pascal Bouchareine  wrote:
>
> One intended usage is to allow processes to self-document sockets
> for netstat and friends to report
>
> Signed-off-by: Pascal Bouchareine 
> ---
>  Documentation/filesystems/proc.rst |  3 +++
>  fs/fcntl.c | 19 +++
>  fs/file_table.c|  2 ++
>  fs/proc/fd.c   |  5 +
>  include/linux/fs.h |  3 +++
>  include/uapi/linux/fcntl.h |  5 +
>  6 files changed, 37 insertions(+)
>
> diff --git a/Documentation/filesystems/proc.rst 
> b/Documentation/filesystems/proc.rst
> index 996f3cfe7030..ae8045650836 100644
> --- a/Documentation/filesystems/proc.rst
> +++ b/Documentation/filesystems/proc.rst
> @@ -1918,6 +1918,9 @@ A typical output is::
> flags:  012
> mnt_id: 19
>
> +An optional 'desc' is set if the process documented its usage of
> +the file via the fcntl command F_SET_DESCRIPTION.
> +
>  All locks associated with a file descriptor are shown in its fdinfo too::
>
>  lock:   1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
> diff --git a/fs/fcntl.c b/fs/fcntl.c
> index 2e4c0fa2074b..c1ef724a906e 100644
> --- a/fs/fcntl.c
> +++ b/fs/fcntl.c
> @@ -319,6 +319,22 @@ static long fcntl_rw_hint(struct file *file, unsigned 
> int cmd,
> }
>  }
>
> +static long fcntl_set_description(struct file *file, char __user *desc)
> +{
> +   char *d;
> +
> +   d = strndup_user(desc, MAX_FILE_DESC_SIZE);
> +   if (IS_ERR(d))
> +   return PTR_ERR(d);
> +
> +   spin_lock(>f_lock);
> +   kfree(file->f_description);
> +   file->f_description = d;
> +   spin_unlock(>f_lock);
> +
> +   return 0;
> +}
> +
>  static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
> struct file *filp)
>  {
> @@ -426,6 +442,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned 
> long arg,
> case F_SET_FILE_RW_HINT:
> err = fcntl_rw_hint(filp, cmd, arg);
> break;
> +   case F_SET_DESCRIPTION:
> +   err = fcntl_set_description(filp, argp);
> +   break;
> default:
> break;
> }
> diff --git a/fs/file_table.c b/fs/file_table.c
> index 656647f9575a..6673a48d2ea1 100644
> --- a/fs/file_table.c
> +++ b/fs/file_table.c
> @@ -272,6 +272,8 @@ static void __fput(struct file *file)
> eventpoll_release(file);
> locks_remove_file(file);
>
> +   kfree(file->f_description);
> +
> ima_file_free(file);
> if (unlikely(file->f_flags & FASYNC)) {
> if (file->f_op->fasync)
> diff --git a/fs/proc/fd.c b/fs/proc/fd.c
> index 81882a13212d..60b3ff971b2b 100644
> --- a/fs/proc/fd.c
> +++ b/fs/proc/fd.c
> @@ -57,6 +57,11 @@ static int seq_show(struct seq_file *m, void *v)
>(long long)file->f_pos, f_flags,
>real_mount(file->f_path.mnt)->mnt_id);
>
> +   spin_lock(>f_lock);
> +   if (file->f_description)
> +   seq_printf(m, "desc:\t%s\n", file->f_description);
> +   spin_unlock(>f_lock);
> +
> show_fd_locks(m, file, files);
> if (seq_has_overflowed(m))
> goto out;
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index f5abba86107d..09717bfa4e3b 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -980,6 +980,9 @@ struct file {
> struct address_space*f_mapping;
> errseq_tf_wb_err;
> errseq_tf_sb_err; /* for syncfs */
> +
> +#define MAX_FILE_DESC_SIZE 256
> +   char*f_description;
>  } __randomize_layout
>__attribute__((aligned(4))); /* lest something weird decides that 2 is OK 
> */
>
> diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
> index 2f86b2ad6d7e..f86ff6dc45c7 100644
> --- a/include/uapi/linux/fcntl.h
> +++ b/include/uapi/linux/fcntl.h
> @@ -55,6 +55,11 @@
>  #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
>  #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
>
> +/*
> + * Set file description
> + */
> +#define F_SET_DESCRIPTION  (F_LINUX_SPECIFIC_BASE + 15)
> +
>  /*
>   * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
>   * used to clear any hints previously set.
> --
> 2.25.1
>


[PATCH v3] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
This command attaches a description to a file descriptor for
troubleshooting purposes. The free string is displayed in the
process fdinfo file for that fd /proc/pid/fdinfo/fd.

One intended usage is to allow processes to self-document sockets
for netstat and friends to report

Signed-off-by: Pascal Bouchareine 
---
 Documentation/filesystems/proc.rst |  3 +++
 fs/fcntl.c | 19 +++
 fs/file_table.c|  2 ++
 fs/proc/fd.c   |  5 +
 include/linux/fs.h |  3 +++
 include/uapi/linux/fcntl.h |  5 +
 6 files changed, 37 insertions(+)

diff --git a/Documentation/filesystems/proc.rst 
b/Documentation/filesystems/proc.rst
index 996f3cfe7030..ae8045650836 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -1918,6 +1918,9 @@ A typical output is::
flags:  012
mnt_id: 19
 
+An optional 'desc' is set if the process documented its usage of
+the file via the fcntl command F_SET_DESCRIPTION.
+
 All locks associated with a file descriptor are shown in its fdinfo too::
 
 lock:   1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 2e4c0fa2074b..c1ef724a906e 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -319,6 +319,22 @@ static long fcntl_rw_hint(struct file *file, unsigned int 
cmd,
}
 }
 
+static long fcntl_set_description(struct file *file, char __user *desc)
+{
+   char *d;
+
+   d = strndup_user(desc, MAX_FILE_DESC_SIZE);
+   if (IS_ERR(d))
+   return PTR_ERR(d);
+
+   spin_lock(>f_lock);
+   kfree(file->f_description);
+   file->f_description = d;
+   spin_unlock(>f_lock);
+
+   return 0;
+}
+
 static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
struct file *filp)
 {
@@ -426,6 +442,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned 
long arg,
case F_SET_FILE_RW_HINT:
err = fcntl_rw_hint(filp, cmd, arg);
break;
+   case F_SET_DESCRIPTION:
+   err = fcntl_set_description(filp, argp);
+   break;
default:
break;
}
diff --git a/fs/file_table.c b/fs/file_table.c
index 656647f9575a..6673a48d2ea1 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -272,6 +272,8 @@ static void __fput(struct file *file)
eventpoll_release(file);
locks_remove_file(file);
 
+   kfree(file->f_description);
+
ima_file_free(file);
if (unlikely(file->f_flags & FASYNC)) {
if (file->f_op->fasync)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 81882a13212d..60b3ff971b2b 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -57,6 +57,11 @@ static int seq_show(struct seq_file *m, void *v)
   (long long)file->f_pos, f_flags,
   real_mount(file->f_path.mnt)->mnt_id);
 
+   spin_lock(>f_lock);
+   if (file->f_description)
+   seq_printf(m, "desc:\t%s\n", file->f_description);
+   spin_unlock(>f_lock);
+
show_fd_locks(m, file, files);
if (seq_has_overflowed(m))
goto out;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f5abba86107d..09717bfa4e3b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -980,6 +980,9 @@ struct file {
struct address_space*f_mapping;
errseq_tf_wb_err;
errseq_tf_sb_err; /* for syncfs */
+
+#define MAX_FILE_DESC_SIZE 256
+   char*f_description;
 } __randomize_layout
   __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
 
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
index 2f86b2ad6d7e..f86ff6dc45c7 100644
--- a/include/uapi/linux/fcntl.h
+++ b/include/uapi/linux/fcntl.h
@@ -55,6 +55,11 @@
 #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
 #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
 
+/*
+ * Set file description
+ */
+#define F_SET_DESCRIPTION  (F_LINUX_SPECIFIC_BASE + 15)
+
 /*
  * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
  * used to clear any hints previously set.
-- 
2.25.1



Re: process '/usr/bin/rsync' started with executable stack

2020-07-25 Thread Kees Cook
On Sat, Jul 25, 2020 at 10:27:56PM +0100, Ben Hutchings wrote:
> On Thu, 2020-06-25 at 13:20 -0700, Kees Cook wrote:
> > On Thu, Jun 25, 2020 at 01:04:29PM +0300, Dan Carpenter wrote:
> > > On Wed, Jun 24, 2020 at 12:39:24PM -0700, Kees Cook wrote:
> > > > On Wed, Jun 24, 2020 at 07:51:48PM +0300, Dan Carpenter wrote:
> > > > > In Debian testing the initrd triggers the warning.
> > > > > 
> > > > > [   34.529809] process '/usr/bin/fstype' started with executable stack
> > > > 
> > > > Where does fstype come from there? I am going to guess it is either
> > > > busybox or linked against klibc?
> > > > 
> > > > klibc has known problems with executable stacks due to its trampoline
> > > > implementation:
> > > > https://wiki.ubuntu.com/SecurityTeam/Roadmap/ExecutableStacks
> > > 
> > > Yeah.  It comes from klibc-utils.
> > 
> > This is exactly what I was worried about back in Feb:
> > https://lore.kernel.org/lkml/202002251341.48BC06E@keescook/
> > 
> > This warning, combined with klibc-based initrds, makes the whole thing
> > pointless because it will always warn once on boot for the klibc stack,
> > and then not warn about anything else after that.
> > 
> > It looks like upstream klibc hasn't been touched in about 4 years, and
> > it's been up to Ben to keep it alive in Debian.
> > 
> > A couple ideas, in order of my preference:
> > 
> > 1) stop using klibc-utils[1]. initramfs-tools-core is the only thing with a
> >dependency on klibc-utils. Only a few things are missing from busybox.
> > 
> > 2) make the warning rate-limited instead?
> > 
> > 3) fix the use of trampolines in klibc
> 
> It only uses trampolines on alpha, m68k, parisc, s390, and sparc32.  As
> of today, the master branch should correctly enable executable stacks
> on these and only these architecture.
> 
> I have a development branch that sets sa_restorer and disables
> executable stacks on alpha, s390, and sparc32:
> 
> https://git.kernel.org/pub/scm/libs/klibc/klibc.git/log/?h=execstack-fixes

Awesome! Thanks for tackling this. :)

-- 
Kees Cook


[PATCH v3] This command attaches a description to a file descriptor for troubleshooting purposes. The free string is displayed in the process fdinfo file for that fd /proc/pid/fdinfo/fd.

2020-07-25 Thread Pascal Bouchareine
One intended usage is to allow processes to self-document sockets
for netstat and friends to report

Signed-off-by: Pascal Bouchareine 
---
 Documentation/filesystems/proc.rst |  3 +++
 fs/fcntl.c | 19 +++
 fs/file_table.c|  2 ++
 fs/proc/fd.c   |  5 +
 include/linux/fs.h |  3 +++
 include/uapi/linux/fcntl.h |  5 +
 6 files changed, 37 insertions(+)

diff --git a/Documentation/filesystems/proc.rst 
b/Documentation/filesystems/proc.rst
index 996f3cfe7030..ae8045650836 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -1918,6 +1918,9 @@ A typical output is::
flags:  012
mnt_id: 19
 
+An optional 'desc' is set if the process documented its usage of
+the file via the fcntl command F_SET_DESCRIPTION.
+
 All locks associated with a file descriptor are shown in its fdinfo too::
 
 lock:   1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 2e4c0fa2074b..c1ef724a906e 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -319,6 +319,22 @@ static long fcntl_rw_hint(struct file *file, unsigned int 
cmd,
}
 }
 
+static long fcntl_set_description(struct file *file, char __user *desc)
+{
+   char *d;
+
+   d = strndup_user(desc, MAX_FILE_DESC_SIZE);
+   if (IS_ERR(d))
+   return PTR_ERR(d);
+
+   spin_lock(>f_lock);
+   kfree(file->f_description);
+   file->f_description = d;
+   spin_unlock(>f_lock);
+
+   return 0;
+}
+
 static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
struct file *filp)
 {
@@ -426,6 +442,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned 
long arg,
case F_SET_FILE_RW_HINT:
err = fcntl_rw_hint(filp, cmd, arg);
break;
+   case F_SET_DESCRIPTION:
+   err = fcntl_set_description(filp, argp);
+   break;
default:
break;
}
diff --git a/fs/file_table.c b/fs/file_table.c
index 656647f9575a..6673a48d2ea1 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -272,6 +272,8 @@ static void __fput(struct file *file)
eventpoll_release(file);
locks_remove_file(file);
 
+   kfree(file->f_description);
+
ima_file_free(file);
if (unlikely(file->f_flags & FASYNC)) {
if (file->f_op->fasync)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 81882a13212d..60b3ff971b2b 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -57,6 +57,11 @@ static int seq_show(struct seq_file *m, void *v)
   (long long)file->f_pos, f_flags,
   real_mount(file->f_path.mnt)->mnt_id);
 
+   spin_lock(>f_lock);
+   if (file->f_description)
+   seq_printf(m, "desc:\t%s\n", file->f_description);
+   spin_unlock(>f_lock);
+
show_fd_locks(m, file, files);
if (seq_has_overflowed(m))
goto out;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f5abba86107d..09717bfa4e3b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -980,6 +980,9 @@ struct file {
struct address_space*f_mapping;
errseq_tf_wb_err;
errseq_tf_sb_err; /* for syncfs */
+
+#define MAX_FILE_DESC_SIZE 256
+   char*f_description;
 } __randomize_layout
   __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
 
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
index 2f86b2ad6d7e..f86ff6dc45c7 100644
--- a/include/uapi/linux/fcntl.h
+++ b/include/uapi/linux/fcntl.h
@@ -55,6 +55,11 @@
 #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
 #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
 
+/*
+ * Set file description
+ */
+#define F_SET_DESCRIPTION  (F_LINUX_SPECIFIC_BASE + 15)
+
 /*
  * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
  * used to clear any hints previously set.
-- 
2.25.1



[PATCH v2] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
This command attaches a description to a file descriptor for
troubleshooting purposes. The free string is displayed in the
process fdinfo file for that fd /proc/pid/fdinfo/fd.

One intended usage is to allow processes to self-document sockets
for netstat and friends to report

Signed-off-by: Pascal Bouchareine 
---
 Documentation/filesystems/proc.rst |  3 +++
 fs/fcntl.c | 19 +++
 fs/file_table.c|  3 +++
 fs/proc/fd.c   |  5 +
 include/linux/fs.h |  3 +++
 include/uapi/linux/fcntl.h |  5 +
 scripts/get_maintainer.pl  |  2 ++
 7 files changed, 40 insertions(+)

diff --git a/Documentation/filesystems/proc.rst 
b/Documentation/filesystems/proc.rst
index 996f3cfe7030..ae8045650836 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -1918,6 +1918,9 @@ A typical output is::
flags:  012
mnt_id: 19
 
+An optional 'desc' is set if the process documented its usage of
+the file via the fcntl command F_SET_DESCRIPTION.
+
 All locks associated with a file descriptor are shown in its fdinfo too::
 
 lock:   1: FLOCK  ADVISORY  WRITE 359 00:13:11691 0 EOF
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 2e4c0fa2074b..c1ef724a906e 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -319,6 +319,22 @@ static long fcntl_rw_hint(struct file *file, unsigned int 
cmd,
}
 }
 
+static long fcntl_set_description(struct file *file, char __user *desc)
+{
+   char *d;
+
+   d = strndup_user(desc, MAX_FILE_DESC_SIZE);
+   if (IS_ERR(d))
+   return PTR_ERR(d);
+
+   spin_lock(>f_lock);
+   kfree(file->f_description);
+   file->f_description = d;
+   spin_unlock(>f_lock);
+
+   return 0;
+}
+
 static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
struct file *filp)
 {
@@ -426,6 +442,9 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned 
long arg,
case F_SET_FILE_RW_HINT:
err = fcntl_rw_hint(filp, cmd, arg);
break;
+   case F_SET_DESCRIPTION:
+   err = fcntl_set_description(filp, argp);
+   break;
default:
break;
}
diff --git a/fs/file_table.c b/fs/file_table.c
index 656647f9575a..f2d9be7b6459 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -272,6 +272,9 @@ static void __fput(struct file *file)
eventpoll_release(file);
locks_remove_file(file);
 
+   if (file->f_description)
+   kfree(file->f_description);
+
ima_file_free(file);
if (unlikely(file->f_flags & FASYNC)) {
if (file->f_op->fasync)
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 81882a13212d..60b3ff971b2b 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -57,6 +57,11 @@ static int seq_show(struct seq_file *m, void *v)
   (long long)file->f_pos, f_flags,
   real_mount(file->f_path.mnt)->mnt_id);
 
+   spin_lock(>f_lock);
+   if (file->f_description)
+   seq_printf(m, "desc:\t%s\n", file->f_description);
+   spin_unlock(>f_lock);
+
show_fd_locks(m, file, files);
if (seq_has_overflowed(m))
goto out;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f5abba86107d..09717bfa4e3b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -980,6 +980,9 @@ struct file {
struct address_space*f_mapping;
errseq_tf_wb_err;
errseq_tf_sb_err; /* for syncfs */
+
+#define MAX_FILE_DESC_SIZE 256
+   char*f_description;
 } __randomize_layout
   __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
 
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
index 2f86b2ad6d7e..f86ff6dc45c7 100644
--- a/include/uapi/linux/fcntl.h
+++ b/include/uapi/linux/fcntl.h
@@ -55,6 +55,11 @@
 #define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
 #define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
 
+/*
+ * Set file description
+ */
+#define F_SET_DESCRIPTION  (F_LINUX_SPECIFIC_BASE + 15)
+
 /*
  * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
  * used to clear any hints previously set.
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 484d2fbf5921..2e7c434b2b2d 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -2309,6 +2309,8 @@ sub vcs_file_blame {
my @commit_signers = ();
my $cmd;
 
+   print STDERR "checking commit $commit\n";
+
$cmd = $VCS_cmds{"find_commit_signers_cmd"};
$cmd =~ s/(\$\w+)/$1/eeg;   #substitute variables in $cmd
 
-- 
2.25.1



Re: [PATCH] proc,fcntl: introduce F_SET_DESCRIPTION

2020-07-25 Thread Pascal Bouchareine
On Sat, Jul 25, 2020 at 3:10 PM Al Viro  wrote:
> Have you even tried to test it?  When will it ever free those things?

Thanks for pointing that out, I'll try to address that in the thread

I did basic tests against 5.4: set a description, concurrently set it
from multiple child processes, read, demo with ss/netstat.

However I rebased against master and have not tested the build after
rebase, is that broken?
Should I use a different target for tests?

Thanks for your help


[PATCH] [cgroup/testing] cg_read_strcmp: Fix null pointer dereference

2020-07-25 Thread Gaurav Singh
Haven't reproduced this issue. This PR is does a minor code cleanup. 

Signed-off-by: Gaurav Singh 
---
 tools/testing/selftests/cgroup/cgroup_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/cgroup_util.c 
b/tools/testing/selftests/cgroup/cgroup_util.c
index 8a637ca7d73a..05853b0b8831 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -106,7 +106,7 @@ int cg_read_strcmp(const char *cgroup, const char *control,
 
/* Handle the case of comparing against empty string */
if (!expected)
-   size = 32;
+   return -1;
else
size = strlen(expected) + 1;
 
-- 
2.17.1



[PATCH 2/7] ASoC: sun8i-codec: Fix DAPM to match the hardware topology

2020-07-25 Thread Samuel Holland
The A33/A64 digital codec has 4 physical inputs and 4 physical outputs:
3 AIFs/DAIs and one ADC/DAC pair. Internal routing is accomplished by
a 4-channel mixer connected to each output.

The analog and digital sides of the ADC/DAC are in separate ASoC
components, so card-level DAPM routes (provided in the device tree) are
necessary to connect them together. Currently, these routes are wrong.

For AIF1 Playback, the correct topology is:

 ||<< sun8i-codec ===>>||
 ||||
 CPU DAI -> AIF1 DA0 -> DAC Mixer -> DAC (digital) -> DAC (analog)
 ||||

but the driver and device trees currently describe:

 ||||
 CPU DAI -> AIF1 DA0 ---> DAC (analog)
 || \--> DAC Mixer -> ??? [dead end]   ||

For AIF1 Capture, there is an additional problem, because the Mixer
route is backward. The topology should be:

  || ||
 ADC (analog) -> ADC (digital) -> AIF1 AD0 Mixer -> AIF1 AD0 -> CPU DAI
  || ||

but the driver and device trees currently describe:

  || ||
 ADC (analog) -> AIF1 AD0 > CPU DAI
  || \--> ADC Mixer -> ??? [dead end]||

The ADC/DAC are only powered because AIF1 AD0 (capture) has supply
routes from the ADC, and AIF1 DA0 (playback) has supply routes from the
DAC. However, neither set of supply routes matches the hardware
topology. Audio can be routed among AIF1/2/3 without using the ADC or
DAC at all; and audio can be routed from the ADC to the DAC without
using any AIFs (via the "ADC Digital DAC Playback Switch"). Because the
DAPM routes are wrong, both of these use cases are currently broken.

This commit adds the necessary widgets and routes to represent the real
hardware topology, with functionality equivalent to the current driver.

For the existing "allwinner,sun8i-a33-codec" compatible, widgets with
the old names are kept as wrappers around the new widgets, so existing
device trees will continue to work. For "allwinner,sun50i-a64-codec",
the old widgets can be omitted, because no device trees yet use that
compatible.

Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun8i-codec.c | 120 +++---
 1 file changed, 95 insertions(+), 25 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index ca51af114419..ffeac150c086 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -85,10 +86,15 @@
 #define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK  GENMASK(8, 6)
 #define SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK  GENMASK(12, 9)
 
+struct sun8i_codec_quirks {
+   bool legacy_widgets : 1;
+};
+
 struct sun8i_codec {
-   struct regmap   *regmap;
-   struct clk  *clk_module;
-   struct clk  *clk_bus;
+   struct regmap   *regmap;
+   struct clk  *clk_module;
+   struct clk  *clk_bus;
+   const struct sun8i_codec_quirks *quirks;
 };
 
 static int sun8i_codec_runtime_resume(struct device *dev)
@@ -388,22 +394,30 @@ static const struct snd_soc_dapm_widget 
sun8i_codec_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("ADC", SUN8I_ADC_DIG_CTRL, SUN8I_ADC_DIG_CTRL_ENDA,
0, NULL, 0),
 
-   /* Analog DAC AIF */
-   SND_SOC_DAPM_AIF_IN("AIF1 Slot 0 Left", "Playback", 0,
+   /* AIF "DAC" Inputs */
+   SND_SOC_DAPM_AIF_IN("AIF1 DA0L", "Playback", 0,
SUN8I_AIF1_DACDAT_CTRL,
SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0L_ENA, 0),
-   SND_SOC_DAPM_AIF_IN("AIF1 Slot 0 Right", "Playback", 0,
+   SND_SOC_DAPM_AIF_IN("AIF1 DA0R", "Playback", 0,
SUN8I_AIF1_DACDAT_CTRL,
SUN8I_AIF1_DACDAT_CTRL_AIF1_DA0R_ENA, 0),
 
-   /* Analog ADC AIF */
-   SND_SOC_DAPM_AIF_IN("AIF1 Slot 0 Left ADC", "Capture", 0,
+   /* AIF "ADC" Outputs */
+   SND_SOC_DAPM_AIF_IN("AIF1 AD0L", "Capture", 0,
SUN8I_AIF1_ADCDAT_CTRL,
SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0L_ENA, 0),
-   SND_SOC_DAPM_AIF_IN("AIF1 Slot 0 Right ADC", "Capture", 0,
+   SND_SOC_DAPM_AIF_IN("AIF1 AD0R", "Capture", 0,
SUN8I_AIF1_ADCDAT_CTRL,
SUN8I_AIF1_ADCDAT_CTRL_AIF1_DA0R_ENA, 0),
 
+   /* ADC Inputs (connected to analog codec DAPM context) */
+   SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 0, 0),
+   SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0),
+
+   /* DAC Outputs (connected to analog codec DAPM 

[PATCH 3/7] ASoC: sun8i-codec: Add missing mixer routes

2020-07-25 Thread Samuel Holland
The sun8i-codec driver provides ALSA controls for enabling/disabling
each of the inputs to the AIF1 Slot 0 and DAC mixers. For two of these
inputs (ADC->DAC and AIF1 DA0->AIF1 AD0), the audio source is
implemented, so the mixer inputs can be used.

However, because the DAPM routes are missing, these mixer inputs only
work when both the source and the mixer happen to be part of other
active audio paths. Adding the appropriate routes makes these ALSA
controls function all of the time.

Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun8i-codec.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index ffeac150c086..a75be9e82d22 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -490,14 +490,20 @@ static const struct snd_soc_dapm_route 
sun8i_codec_dapm_routes[] = {
 
/* DAC Mixer Routes */
{ "Left Digital DAC Mixer", "AIF1 Slot 0 Digital DAC Playback Switch", 
"AIF1 DA0L" },
+   { "Left Digital DAC Mixer", "ADC Digital DAC Playback Switch", "ADCL" },
+
{ "Right Digital DAC Mixer", "AIF1 Slot 0 Digital DAC Playback Switch", 
"AIF1 DA0R" },
+   { "Right Digital DAC Mixer", "ADC Digital DAC Playback Switch", "ADCR" 
},
 
/* ADC Routes */
{ "AIF1 AD0L", NULL, "Left Digital ADC Mixer" },
{ "AIF1 AD0R", NULL, "Right Digital ADC Mixer" },
 
/* ADC Mixer Routes */
+   { "Left Digital ADC Mixer", "AIF1 Slot 0 Digital ADC Capture Switch", 
"AIF1 DA0L" },
{ "Left Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", 
"ADCL" },
+
+   { "Right Digital ADC Mixer", "AIF1 Slot 0 Digital ADC Capture Switch", 
"AIF1 DA0R" },
{ "Right Digital ADC Mixer", "AIF1 Data Digital ADC Capture Switch", 
"ADCR" },
 };
 
-- 
2.26.2



[PATCH 1/7] ASoC: dt-bindings: Add a new compatible for the A64 codec

2020-07-25 Thread Samuel Holland
The audio codecs in the A33 and A64 are both integrated variants of the
X-Powers AC100 codec. However, there are some differences between them
that merit having a separate compatible:
 - The A64 has a second DRC block, not present in the AC100 or A33.
 - The A33 has some extra muxing options for AIF1/2/3 in the
   AIF3_SGP_CTRL register, which are not present in the AC100 or A64.
 - The A33 is missing registers providing jack detection functionality.
 - The A33 is claimed to invert LRCK, but this is not seen on A64.

Since the driver will continue to work on the A64 using the A33
compatible, albeit without jack detection functionality and with
possibly inverted channels, as it does now, allow the A33 compatible
to be used as a fallback.

Signed-off-by: Samuel Holland 
---
 .../bindings/sound/allwinner,sun8i-a33-codec.yaml   | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml 
b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
index 55d28268d2f4..67405e6d8168 100644
--- a/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
+++ b/Documentation/devicetree/bindings/sound/allwinner,sun8i-a33-codec.yaml
@@ -15,7 +15,11 @@ properties:
 const: 0
 
   compatible:
-const: allwinner,sun8i-a33-codec
+oneOf:
+  - items:
+  - const: allwinner,sun50i-a64-codec
+  - const: allwinner,sun8i-a33-codec
+  - const: allwinner,sun8i-a33-codec
 
   reg:
 maxItems: 1
-- 
2.26.2



[PATCH 5/7] ARM: dts: sun8i: a33: Update codec widget names

2020-07-25 Thread Samuel Holland
The sun8i-codec driver introduced a new set of DAPM widgets that more
accurately describe the hardware topology. Update the various device
trees to use the new widget names.

Signed-off-by: Samuel Holland 
---
 arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 4 ++--
 arch/arm/boot/dts/sun8i-a33.dtsi  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts 
b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
index 3d78169cdeed..a1953b2872d0 100644
--- a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
+++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts
@@ -194,8 +194,8 @@  {
"Headphone", "Headphone Jack";
/* Board level routing. First 2 routes copied from SoC level */
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right",
+   "Left DAC", "DACL",
+   "Right DAC", "DACR",
"HP", "HPCOM",
"Headphone Jack", "HP",
"MIC1", "Microphone Jack",
diff --git a/arch/arm/boot/dts/sun8i-a33.dtsi b/arch/arm/boot/dts/sun8i-a33.dtsi
index cfd3858afb3e..c458f5fb124f 100644
--- a/arch/arm/boot/dts/sun8i-a33.dtsi
+++ b/arch/arm/boot/dts/sun8i-a33.dtsi
@@ -189,8 +189,8 @@ sound: sound {
simple-audio-card,mclk-fs = <128>;
simple-audio-card,aux-devs = <_analog>;
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right";
+   "Left DAC", "DACL",
+   "Right DAC", "DACR";
status = "disabled";
 
simple-audio-card,cpu {
-- 
2.26.2



[PATCH 6/7] arm64: dts: allwinner: a64: Update codec widget names

2020-07-25 Thread Samuel Holland
The sun8i-codec driver introduced a new set of DAPM widgets that more
accurately describe the hardware topology. Update the various device
trees to use the new widget names.

Signed-off-by: Samuel Holland 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts   | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi   | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts  | 8 
 .../boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts| 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts  | 8 
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 8 
 9 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
index 883f217efb81..3ea5182ca489 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
@@ -331,10 +331,10 @@  {
"Microphone", "Microphone Jack",
"Microphone", "Onboard Microphone";
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right",
-   "AIF1 Slot 0 Left ADC", "Left ADC",
-   "AIF1 Slot 0 Right ADC", "Right ADC",
+   "Left DAC", "DACL",
+   "Right DAC", "DACR",
+   "ADCL", "Left ADC",
+   "ADCR", "Right ADC",
"Headphone Jack", "HP",
"MIC2", "Microphone Jack",
"Onboard Microphone", "MBIAS",
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
index fde9c7a99b17..d894ec5fa8a1 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
@@ -330,10 +330,10 @@  {
"Microphone", "Microphone Jack",
"Microphone", "Onboard Microphone";
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right",
-   "AIF1 Slot 0 Left ADC", "Left ADC",
-   "AIF1 Slot 0 Right ADC", "Right ADC",
+   "Left DAC", "DACL",
+   "Right DAC", "DACR",
+   "ADCL", "Left ADC",
+   "ADCR", "Right ADC",
"Headphone Jack", "HP",
"MIC2", "Microphone Jack",
"Onboard Microphone", "MBIAS",
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
index 2165f238af13..329cf276561e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
@@ -261,11 +261,11 @@  {
simple-audio-card,widgets = "Microphone", "Microphone Jack",
"Headphone", "Headphone Jack";
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right",
+   "Left DAC", "DACL",
+   "Right DAC", "DACR",
"Headphone Jack", "HP",
-   "AIF1 Slot 0 Left ADC", "Left ADC",
-   "AIF1 Slot 0 Right ADC", "Right ADC",
+   "ADCL", "Left ADC",
+   "ADCR", "Right ADC",
"MIC2", "Microphone Jack";
status = "okay";
 };
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index 64b1c54f87c0..896f34fd9fc3 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -374,15 +374,15 @@  {
"Headphone", "Headphone Jack",
"Speaker", "Internal Speaker";
simple-audio-card,routing =
-   "Left DAC", "AIF1 Slot 0 Left",
-   "Right DAC", "AIF1 Slot 0 Right",
+   "Left DAC", "DACL",
+   "Right DAC", "DACR",
"Speaker Amp INL", "LINEOUT",
"Speaker Amp INR", "LINEOUT",
"Internal Speaker", "Speaker Amp OUTL",
"Internal Speaker", "Speaker Amp OUTR",
   

[PATCH 4/7] ASoC: sun8i-codec: Add a quirk for LRCK inversion

2020-07-25 Thread Samuel Holland
On the A64, as tested using the PinePhone, the current code causes the
left/right channels to be swapped during I2S playback from the CPU on
AIF1, and breaks DSP_A communication with the modem on AIF2. Both of
these are fixed when LRCK is no longer inverted.

Trusting that the comment in the code is correct, the existing behavior
is kept for the A33.

Signed-off-by: Samuel Holland 
---
 sound/soc/sunxi/sun8i-codec.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index a75be9e82d22..304683a71acd 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -88,6 +88,7 @@
 
 struct sun8i_codec_quirks {
bool legacy_widgets : 1;
+   bool lrck_inversion : 1;
 };
 
 struct sun8i_codec {
@@ -215,18 +216,19 @@ static int sun8i_set_fmt(struct snd_soc_dai *dai, 
unsigned int fmt)
   value << SUN8I_AIF1CLK_CTRL_AIF1_BCLK_INV);
 
/*
-* It appears that the DAI and the codec don't share the same
-* polarity for the LRCK signal when they mean 'normal' and
-* 'inverted' in the datasheet.
+* It appears that the DAI and the codec in the A33 SoC don't
+* share the same polarity for the LRCK signal when they mean
+* 'normal' and 'inverted' in the datasheet.
 *
 * Since the DAI here is our regular i2s driver that have been
 * tested with way more codecs than just this one, it means
 * that the codec probably gets it backward, and we have to
 * invert the value here.
 */
+   value ^= scodec->quirks->lrck_inversion;
regmap_update_bits(scodec->regmap, SUN8I_AIF1CLK_CTRL,
   BIT(SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV),
-  !value << SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV);
+  value << SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV);
 
/* DAI format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -673,6 +675,7 @@ static int sun8i_codec_remove(struct platform_device *pdev)
 
 static const struct sun8i_codec_quirks sun8i_a33_quirks = {
.legacy_widgets = true,
+   .lrck_inversion = true,
 };
 
 static const struct sun8i_codec_quirks sun50i_a64_quirks = {
-- 
2.26.2



[PATCH 0/7] Allwinner A64 digital audio codec fixes

2020-07-25 Thread Samuel Holland
This series fixes a couple of issues with the digital audio codec in the
Allwinner A64 SoC:
  1) Left/right channels were swapped when playing/recording audio
  2) DAPM topology was wrong, breaking some kcontrols

This is the minimum set of changes necessary to fix these issues in a
backward-compatible way. For that reason, some DAPM widgets still have
incorrect or confusing names; those and other issues will be fixed in
later patch sets.

Samuel Holland (7):
  ASoC: dt-bindings: Add a new compatible for the A64 codec
  ASoC: sun8i-codec: Fix DAPM to match the hardware topology
  ASoC: sun8i-codec: Add missing mixer routes
  ASoC: sun8i-codec: Add a quirk for LRCK inversion
  ARM: dts: sun8i: a33: Update codec widget names
  arm64: dts: allwinner: a64: Update codec widget names
  arm64: dts: allwinner: a64: Update the audio codec compatible

 .../sound/allwinner,sun8i-a33-codec.yaml  |   6 +-
 arch/arm/boot/dts/sun8i-a33-olinuxino.dts |   4 +-
 arch/arm/boot/dts/sun8i-a33.dtsi  |   4 +-
 .../dts/allwinner/sun50i-a64-bananapi-m64.dts |   8 +-
 .../dts/allwinner/sun50i-a64-orangepi-win.dts |   8 +-
 .../boot/dts/allwinner/sun50i-a64-pine64.dts  |   8 +-
 .../dts/allwinner/sun50i-a64-pinebook.dts |   8 +-
 .../dts/allwinner/sun50i-a64-pinephone.dtsi   |   8 +-
 .../boot/dts/allwinner/sun50i-a64-pinetab.dts |   8 +-
 .../allwinner/sun50i-a64-sopine-baseboard.dts |   8 +-
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts |   8 +-
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |  11 +-
 sound/soc/sunxi/sun8i-codec.c | 137 ++
 13 files changed, 155 insertions(+), 71 deletions(-)

-- 
2.26.2



[PATCH 7/7] arm64: dts: allwinner: a64: Update the audio codec compatible

2020-07-25 Thread Samuel Holland
The audio codec in the A64 has some differences from the A33 codec, so
it needs its own compatible. Since the two codecs are similar, the A33
codec compatible is kept as a fallback.

Using the correct compatible fixes a channel inversion issue and cleans
up some DAPM widgets that are no longer used.

Signed-off-by: Samuel Holland 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 73ae7656e0f3..26df6278dfb7 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -860,7 +860,8 @@ dai: dai@1c22c00 {
 
codec: codec@1c22e00 {
#sound-dai-cells = <0>;
-   compatible = "allwinner,sun8i-a33-codec";
+   compatible = "allwinner,sun50i-a64-codec",
+"allwinner,sun8i-a33-codec";
reg = <0x01c22e00 0x600>;
interrupts = ;
clocks = < CLK_BUS_CODEC>, < CLK_AC_DIG>;
-- 
2.26.2



drivers/firmware/broadcom/bcm47xx_sprom.c:563:6: warning: no previous prototype for 'bcm47xx_fill_sprom'

2020-07-25 Thread kernel test robot
Hi Florian,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   04300d66f0a06d572d9f2ad6768c38cabde22179
commit: 5699ad0aaf1091824f22492a708478912c38c7d2 firmware: bcm47xx_nvram: Allow 
COMPILE_TEST
date:   11 months ago
config: i386-randconfig-r003-20200726 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
git checkout 5699ad0aaf1091824f22492a708478912c38c7d2
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/firmware/broadcom/bcm47xx_sprom.c:563:6: warning: no previous 
>> prototype for 'bcm47xx_fill_sprom' [-Wmissing-prototypes]
 563 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
 |  ^~
>> drivers/firmware/broadcom/bcm47xx_sprom.c:705:5: warning: no previous 
>> prototype for 'bcm47xx_sprom_register_fallbacks' [-Wmissing-prototypes]
 705 | int bcm47xx_sprom_register_fallbacks(void)
 | ^~~~

vim +/bcm47xx_fill_sprom +563 drivers/firmware/broadcom/bcm47xx_sprom.c

5d24ceab4eaf0d arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  562  
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03 @563  void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char 
*prefix,
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  564bool fallback)
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  565  {
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  566bcm47xx_fill_sprom_ethernet(sprom, prefix, fallback);
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  567bcm47xx_fill_board_data(sprom, prefix, fallback);
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  568  
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  569nvram_read_u8(prefix, NULL, "sromrev", >revision, 
0, fallback);
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  570  
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  571/* Entries requiring custom functions */
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  572nvram_read_alpha2(prefix, "ccode", sprom->alpha2, 
fallback);
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  573if (sprom->revision >= 3)
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  574nvram_read_leddc(prefix, "leddc", 
>leddc_on_time,
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  575 >leddc_off_time, 
fallback);
590605c6bc31d5 arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-06-21  576  
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  577switch (sprom->revision) {
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  578case 4:
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  579case 5:
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  580bcm47xx_fill_sprom_path_r4589(sprom, prefix, 
fallback);
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  581bcm47xx_fill_sprom_path_r45(sprom, prefix, 
fallback);
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  582break;
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  583case 8:
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  584case 9:
b8ebbaff037981 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-10-03  585bcm47xx_fill_sprom_path_r4589(sprom, prefix, 
fallback);
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  586break;
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  587}
d55a52ccf8f80c arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-04-02  588  
d55a52ccf8f80c arch/mips/bcm47xx/sprom.c Rafał Miłecki   
2015-04-02  589bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
019eee2e34e2d1 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-02-28  590  }
a9bba182a1f3f3 arch/mips/bcm47xx/sprom.c Hauke Mehrtens  
2012-04-29  

[tip:core/headers] BUILD SUCCESS d19e789f068b3d633cbac430764962f404198022

2020-07-25 Thread kernel test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git  
core/headers
branch HEAD: d19e789f068b3d633cbac430764962f404198022  compiler.h: Move 
instrumentation_begin()/end() to new  header

elapsed time: 2216m

configs tested: 104
configs skipped: 1

The following configs have been built successfully.
More configs may be tested in the coming days.

arm defconfig
arm  allyesconfig
arm  allmodconfig
arm   allnoconfig
arm64allyesconfig
arm64   defconfig
arm64allmodconfig
arm64 allnoconfig
i386  allnoconfig
i386 allyesconfig
i386defconfig
i386  debian-10.3
ia64 allmodconfig
ia64defconfig
ia64  allnoconfig
ia64 allyesconfig
m68k allmodconfig
m68k  allnoconfig
m68k   sun3_defconfig
m68kdefconfig
m68k allyesconfig
nios2   defconfig
nios2allyesconfig
openriscdefconfig
c6x  allyesconfig
c6x   allnoconfig
openrisc allyesconfig
nds32   defconfig
nds32 allnoconfig
csky allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
xtensa   allyesconfig
h8300allyesconfig
h8300allmodconfig
xtensa  defconfig
arc defconfig
arc  allyesconfig
sh   allmodconfig
shallnoconfig
microblazeallnoconfig
mips allyesconfig
mips  allnoconfig
mips allmodconfig
pariscallnoconfig
parisc  defconfig
parisc   allyesconfig
parisc   allmodconfig
powerpc  allyesconfig
powerpc  rhel-kconfig
powerpc  allmodconfig
powerpc   allnoconfig
powerpc defconfig
i386 randconfig-a003-20200724
i386 randconfig-a005-20200724
i386 randconfig-a004-20200724
i386 randconfig-a006-20200724
i386 randconfig-a002-20200724
i386 randconfig-a001-20200724
i386 randconfig-a003-20200725
i386 randconfig-a005-20200725
i386 randconfig-a004-20200725
i386 randconfig-a006-20200725
i386 randconfig-a002-20200725
i386 randconfig-a001-20200725
x86_64   randconfig-a014-20200724
x86_64   randconfig-a016-20200724
x86_64   randconfig-a015-20200724
x86_64   randconfig-a012-20200724
x86_64   randconfig-a013-20200724
x86_64   randconfig-a011-20200724
i386 randconfig-a016-20200725
i386 randconfig-a013-20200725
i386 randconfig-a012-20200725
i386 randconfig-a015-20200725
i386 randconfig-a014-20200725
i386 randconfig-a011-20200725
i386 randconfig-a016-20200724
i386 randconfig-a013-20200724
i386 randconfig-a012-20200724
i386 randconfig-a015-20200724
i386 randconfig-a014-20200724
i386 randconfig-a011-20200724
riscvallyesconfig
riscv allnoconfig
riscv   defconfig
riscvallmodconfig
s390 allyesconfig
s390  allnoconfig
s390 allmodconfig
s390defconfig
sparcallyesconfig
sparc   defconfig
sparc64 defconfig
sparc64   allnoconfig
sparc64  allyesconfig
sparc64  allmodconfig
x86_64rhel-7.6-kselftests
x86_64   rhel-8.3
x86_64

Re: [PATCH v2 05/18] gpiolib: cdev: support GPIO_GET_LINE_IOCTL and GPIOLINE_GET_VALUES_IOCTL

2020-07-25 Thread Kent Gibson
On Sat, Jul 25, 2020 at 11:51:54PM +0300, Andy Shevchenko wrote:
> On Sat, Jul 25, 2020 at 7:24 AM Kent Gibson  wrote:
> >
> > Add support for requesting lines using the GPIO_GET_LINE_IOCTL, and
> > returning their current values using GPIOLINE_GET_VALUES_IOCTL.
> 
> ...
> 
> > +struct line {
> > +   struct gpio_device *gdev;
> > +   const char *label;
> > +   u32 num_descs;
> 
> > +   /* descs must be last so it can be dynamically sized */
> 
> I guess [] implies above comment and thus comment can be dropped.
> 
> > +   struct gpio_desc *descs[];
> > +};
> 
> ...
> 
> > +static bool padding_not_zeroed(__u32 *padding, int pad_size)
> > +{
> > +   int i, sum = 0;
> > +
> > +   for (i = 0; i < pad_size; i++)
> > +   sum |= padding[i];
> > +
> > +   return sum;
> > +}
> 
> Reimplementation of memchr_inv() ?
> 

I was hoping to find an existing function, surely checking a region is
zeroed is a common thing, right?, so this was a place holder as much
as anything.  Not sure memchr_inv fits the bill, but I'll give it a
try...

> ...
> 
> > +static u64 gpioline_config_flags(struct gpioline_config *lc, int line_idx)
> > +{
> > +   int i;
> > +
> > +   for (i = lc->num_attrs - 1; i >= 0; i--) {
> 
> Much better to read is
> 
> unsigned int i = lc->num_attrs;
> 
> while (i--) {
>  ...
> }
> 

Really? I find that the post-decrement in the while makes determining the
bounds of the loop more confusing.

> > +   if ((lc->attrs[i].attr.id == GPIOLINE_ATTR_ID_FLAGS) &&
> 
> > +   test_bit(line_idx, (unsigned long *)lc->attrs[i].mask))
> 
> This casting is not good. What about BE 32-bit architecture?
> 

I agree the casting is hideous, but I thought the outcome was correct
as it is manipulating addresses, not data.
You think the address of a 64-bit differs based on endian??
Happy to change it - but not sure what to.

> > +   return lc->attrs[i].attr.flags;
> > +   }
> > +   return lc->flags;
> > +}
> > +
> > +static int gpioline_config_output_value(struct gpioline_config *lc,
> > +   int line_idx)
> > +{
> 
> Same comments as per above.
> 
> > +}
> 
> ...
> 
> > +static long line_get_values(struct line *line, void __user *ip)
> > +{
> > +   struct gpioline_values lv;
> 
> > +   unsigned long *vals = (unsigned long *)lv.bits;
> 
> Casting u64 to unsigned long is not good.
> 

Same comments as per above.

> > +}
> 
> ...
> 
> > +static void line_free(struct line *line)
> > +{
> > +   int i;
> > +
> > +   for (i = 0; i < line->num_descs; i++) {
> 
> > +   if (line->descs[i])
> 
> Redundant?
> 

Actually, no.  The line_free is also used to clean up construction
failures, so the line may be partially constructed.  num_descs is set
first, but the descs themselves may have failed to allocate.
And gpiod_free throws a warning if you pass a NULL, hence the extra check here.

> > +   gpiod_free(line->descs[i]);
> > +   }
> > +   kfree(line->label);
> > +   put_device(>gdev->dev);
> > +   kfree(line);
> > +}
> 
> ...
> 
> > +   /* Make sure this is terminated */
> > +   linereq.consumer[sizeof(linereq.consumer)-1] = '\0';
> > +   if (strlen(linereq.consumer)) {
> > +   line->label = kstrdup(linereq.consumer, GFP_KERNEL);
> 
> kstrndup() ?
> 

That was a cut-and-paste from V1...

> > +   if (!line->label) {
> > +   ret = -ENOMEM;
> > +   goto out_free_line;
> > +   }
> > +   }
> 

... and changing it would result in this logic behaving differently.
You couldn't distinguish between consumer not being set, and
so label not being set, and kstrndup returning NULL due to no mem.

> ...
> 
> > +   struct gpio_desc *desc = gpiochip_get_desc(gdev->chip, 
> > offset);
> 
> I prefer to see this split, but it's minor.
> 
> > +   if (IS_ERR(desc)) {
> > +   ret = PTR_ERR(desc);
> > +   goto out_free_line;
> > +   }
> 
> ...
> 
> > +   dev_dbg(>dev, "registered chardev handle for line 
> > %d\n",
> > +   offset);
> 
> Perhaps tracepoint / event?
> 

Again, a cut-and-paste from V1, and I have no experience with
tracepoints or events, so I have no opinion on that.

So, yeah - perhaps?

Cheers,
Kent.


drivers/net/dsa/microchip/ksz9477_i2c.c:77:34: warning: unused variable 'ksz9477_dt_ids'

2020-07-25 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   04300d66f0a06d572d9f2ad6768c38cabde22179
commit: 20e03777d70923fe7eae0d7f043ef9488393ab95 net: dsa: microchip: add 
KSZ9477 I2C driver
date:   11 months ago
config: x86_64-randconfig-r006-20200726 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
8bf4c1f4fb257774f66c8cda07adc6c5e8668326)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 20e03777d70923fe7eae0d7f043ef9488393ab95
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   ^
   include/linux/jhash.h:95:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 6:  b += (u32)k[5]<<8; /* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:95:2: note: insert 'break;' to avoid fall-through
   case 6:  b += (u32)k[5]<<8; /* fall through */
   ^
   break; 
   include/linux/jhash.h:96:2: warning: unannotated fall-through between switch 
labels [-Wimplicit-fallthrough]
   case 5:  b += k[4]; /* fall through */
   ^
   include/linux/jhash.h:96:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 5:  b += k[4]; /* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:96:2: note: insert 'break;' to avoid fall-through
   case 5:  b += k[4]; /* fall through */
   ^
   break; 
   include/linux/jhash.h:97:2: warning: unannotated fall-through between switch 
labels [-Wimplicit-fallthrough]
   case 4:  a += (u32)k[3]<<24;/* fall through */
   ^
   include/linux/jhash.h:97:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 4:  a += (u32)k[3]<<24;/* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:97:2: note: insert 'break;' to avoid fall-through
   case 4:  a += (u32)k[3]<<24;/* fall through */
   ^
   break; 
   include/linux/jhash.h:98:2: warning: unannotated fall-through between switch 
labels [-Wimplicit-fallthrough]
   case 3:  a += (u32)k[2]<<16;/* fall through */
   ^
   include/linux/jhash.h:98:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 3:  a += (u32)k[2]<<16;/* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:98:2: note: insert 'break;' to avoid fall-through
   case 3:  a += (u32)k[2]<<16;/* fall through */
   ^
   break; 
   include/linux/jhash.h:99:2: warning: unannotated fall-through between switch 
labels [-Wimplicit-fallthrough]
   case 2:  a += (u32)k[1]<<8; /* fall through */
   ^
   include/linux/jhash.h:99:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 2:  a += (u32)k[1]<<8; /* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:99:2: note: insert 'break;' to avoid fall-through
   case 2:  a += (u32)k[1]<<8; /* fall through */
   ^
   break; 
   include/linux/jhash.h:100:2: warning: unannotated fall-through between 
switch labels [-Wimplicit-fallthrough]
   case 1:  a += k[0];
   ^
   include/linux/jhash.h:100:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 1:  a += k[0];
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:100:2: note: insert 'break;' to avoid fall-through
   case 1:  a += k[0];
   ^
   break; 
   include/linux/jhash.h:102:2: warning: unannotated fall-through between 
switch labels [-Wimplicit-fallthrough]
   case 0: /* Nothing left to add */
   ^
   include/linux/jhash.h:102:2: note: insert 'break;' to avoid fall-through
   case 0: /* Nothing left to add */
   ^
   break; 
   include/linux/jhash.h:136:2: warning: unannotated fall-through between 
switch labels [-Wimplicit-fallthrough]
   case 2: b += k[1];  /* fall through */
   ^
   include/linux/jhash.h:136:2: note: insert '__attribute__((fallthrough));' to 
silence this warning
   case 2: b += k[1];  /* fall through */
   ^
   __attribute__((fallthrough)); 
   include/linux/jhash.h:136:2: note: insert 

[ANNOUNCE] 4.14.189-rt88

2020-07-25 Thread Clark Williams
Hello RT-list!

I'm pleased to announce the 4.14.189-rt88 stable release. This is strictly
a backport of the stable update with no changes to PREEMPT_RT code.

You can get this release via the git tree at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git

  branch: v4.14-rt
  Head SHA1: 4fcad0d130e25a099cc998dd2101d6e0f4288eaf

Or to build 4.14.189-rt88 directly, the following patches should be applied:

  https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.14.tar.xz

  https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.14.189.xz

  
https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/patch-4.14.189-rt88.patch.xz


You can also build from 4.14.188-rt87 by applying the incremental patch:

  
https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/incr/patch-4.14.188-rt87-rt88.patch.xz

Enjoy!
Clark


[PATCH 0/3] x86: delete duplicated words

2020-07-25 Thread Randy Dunlap
Drop repeated words in arch/x86/ header files.

Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: x...@kernel.org

 arch/x86/include/asm/cmpxchg_32.h |2 +-
 arch/x86/include/asm/uv/uv_hub.h  |2 +-
 arch/x86/include/uapi/asm/bootparam.h |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


[PATCH 3/3] x86: uv: uv_hub.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: x...@kernel.org
---
 arch/x86/include/asm/uv/uv_hub.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/x86/include/asm/uv/uv_hub.h
+++ linux-next-20200720/arch/x86/include/asm/uv/uv_hub.h
@@ -682,7 +682,7 @@ static inline int uv_node_to_blade_id(in
return nid;
 }
 
-/* Convert a cpu number to the the UV blade number */
+/* Convert a cpu number to the UV blade number */
 static inline int uv_cpu_to_blade_id(int cpu)
 {
return uv_node_to_blade_id(cpu_to_node(cpu));


[PATCH 1/3] x86: bootparam.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "for".

Signed-off-by: Randy Dunlap 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: x...@kernel.org
---
 arch/x86/include/uapi/asm/bootparam.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/x86/include/uapi/asm/bootparam.h
+++ linux-next-20200720/arch/x86/include/uapi/asm/bootparam.h
@@ -255,7 +255,7 @@ struct boot_params {
  * currently supportd through this PV boot path.
  * @X86_SUBARCH_INTEL_MID: Used for Intel MID (Mobile Internet Device) platform
  * systems which do not have the PCI legacy interfaces.
- * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC for
+ * @X86_SUBARCH_CE4100: Used for Intel CE media processor (CE4100) SoC
  * for settop boxes and media devices, the use of a subarch for CE4100
  * is more of a hack...
  */


[PATCH 2/3] x86: cmpxchg_32.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "you".

Signed-off-by: Randy Dunlap 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: x...@kernel.org
---
 arch/x86/include/asm/cmpxchg_32.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/x86/include/asm/cmpxchg_32.h
+++ linux-next-20200720/arch/x86/include/asm/cmpxchg_32.h
@@ -3,7 +3,7 @@
 #define _ASM_X86_CMPXCHG_32_H
 
 /*
- * Note: if you use set64_bit(), __cmpxchg64(), or their variants, you
+ * Note: if you use set64_bit(), __cmpxchg64(), or their variants,
  *   you need to test for the feature in boot_cpu_data.
  */
 


[PATCH 2/5] ia64: perfmon.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "of".

Signed-off-by: Randy Dunlap 
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/include/asm/perfmon.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/ia64/include/asm/perfmon.h
+++ linux-next-20200720/arch/ia64/include/asm/perfmon.h
@@ -53,7 +53,7 @@ typedef struct {
unsigned short  active_set; /* event set active at 
the time of the overflow */
pfm_ovfl_ctrl_t ovfl_ctrl;  /* return: perfmon 
controls to set by handler */
 
-   unsigned long   pmd_last_reset; /* last reset value of 
of the PMD */
+   unsigned long   pmd_last_reset; /* last reset value of 
the PMD */
unsigned long   smpl_pmds[4];   /* bitmask of other PMD 
of interest on overflow */
unsigned long   smpl_pmds_values[PMU_MAX_PMDS]; /* values for the other 
PMDs of interest */
unsigned long   pmd_value;  /* current 64-bit value 
of the PMD */


[PATCH 1/5] ia64: pal.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "to".

Signed-off-by: Randy Dunlap 
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/include/asm/pal.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/ia64/include/asm/pal.h
+++ linux-next-20200720/arch/ia64/include/asm/pal.h
@@ -1086,7 +1086,7 @@ static inline long ia64_pal_freq_base(un
 
 /*
  * Get the ratios for processor frequency, bus frequency and interval timer to
- * to base frequency of the platform
+ * the base frequency of the platform
  */
 static inline s64
 ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio 
*bus_ratio,


[PATCH 5/5] ia64: kernel: perfmon_m*.h: delete duplicated words

2020-07-25 Thread Randy Dunlap
Delete the repeated word "the" in two places.

Signed-off-by: Randy Dunlap 
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/kernel/perfmon_mckinley.h  |2 +-
 arch/ia64/kernel/perfmon_montecito.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20200720.orig/arch/ia64/kernel/perfmon_mckinley.h
+++ linux-next-20200720/arch/ia64/kernel/perfmon_mckinley.h
@@ -92,7 +92,7 @@ pfm_mck_pmc_check(struct task_struct *ta
/*
 * we must clear the debug registers if pmc13 has a value which enable
 * memory pipeline event constraints. In this case we need to clear the
-* the debug registers if they have not yet been accessed. This is 
required
+* debug registers if they have not yet been accessed. This is required
 * to avoid picking stale state.
 * PMC13 is "active" if:
 *  one of the pmc13.cfg_dbrpXX field is different from 0x3
--- linux-next-20200720.orig/arch/ia64/kernel/perfmon_montecito.h
+++ linux-next-20200720/arch/ia64/kernel/perfmon_montecito.h
@@ -174,7 +174,7 @@ pfm_mont_pmc_check(struct task_struct *t
/*
 * we must clear the debug registers if pmc41 has a value which enable
 * memory pipeline event constraints. In this case we need to clear the
-* the debug registers if they have not yet been accessed. This is 
required
+* debug registers if they have not yet been accessed. This is required
 * to avoid picking stale state.
 * PMC41 is "active" if:
 *  one of the pmc41.cfg_dtagXX field is different from 0x3


[PATCH 0/5] ia64: delete duplicated words

2020-07-25 Thread Randy Dunlap
Drop repeated words in arch/ia64/ header files.

Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org

 arch/ia64/include/asm/pal.h  |2 +-
 arch/ia64/include/asm/perfmon.h  |2 +-
 arch/ia64/include/asm/spinlock.h |2 +-
 arch/ia64/include/asm/uv/uv_hub.h|2 +-
 arch/ia64/kernel/perfmon_mckinley.h  |2 +-
 arch/ia64/kernel/perfmon_montecito.h |2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)


[PATCH 3/5] ia64: spinlock.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/include/asm/spinlock.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/ia64/include/asm/spinlock.h
+++ linux-next-20200720/arch/ia64/include/asm/spinlock.h
@@ -26,7 +26,7 @@
  * the queue, and the other indicating the current tail. The lock is acquired
  * by atomically noting the tail and incrementing it by one (thus adding
  * ourself to the queue and noting our position), then waiting until the head
- * becomes equal to the the initial value of the tail.
+ * becomes equal to the initial value of the tail.
  * The pad bits in the middle are used to prevent the next_ticket number
  * overflowing into the now_serving number.
  *


[PATCH 4/5] ia64: uv: uv_hub.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Tony Luck 
Cc: Fenghua Yu 
Cc: linux-i...@vger.kernel.org
---
 arch/ia64/include/asm/uv/uv_hub.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/ia64/include/asm/uv/uv_hub.h
+++ linux-next-20200720/arch/ia64/include/asm/uv/uv_hub.h
@@ -257,7 +257,7 @@ static inline int uv_numa_blade_id(void)
return 0;
 }
 
-/* Convert a cpu number to the the UV blade number */
+/* Convert a cpu number to the UV blade number */
 static inline int uv_cpu_to_blade_id(int cpu)
 {
return 0;


[PATCH 4/9] powerpc: epapr_hcalls.h: delete duplicated words

2020-07-25 Thread Randy Dunlap
Drop the repeated words "file" and "the".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/epapr_hcalls.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/epapr_hcalls.h
+++ linux-next-20200720/arch/powerpc/include/asm/epapr_hcalls.h
@@ -37,7 +37,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* A "hypercall" is an "sc 1" instruction.  This header file file provides C
+/* A "hypercall" is an "sc 1" instruction.  This header file provides C
  * wrapper functions for the ePAPR hypervisor interface.  It is inteded
  * for use by Linux device drivers and other operating systems.
  *
@@ -246,7 +246,7 @@ static inline unsigned int ev_int_get_ma
  * ev_int_eoi - signal the end of interrupt processing
  * @interrupt: the interrupt number
  *
- * This function signals the end of processing for the the specified
+ * This function signals the end of processing for the specified
  * interrupt, which must be the interrupt currently in service. By
  * definition, this is also the highest-priority interrupt.
  *


[PATCH 8/9] powerpc: smu.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/smu.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/smu.h
+++ linux-next-20200720/arch/powerpc/include/asm/smu.h
@@ -108,7 +108,7 @@
  /*
   * i2c commands
   *
-  * To issue an i2c command, first is to send a parameter block to the
+  * To issue an i2c command, first is to send a parameter block to
   * the SMU. This is a command of type 0x9a with 9 bytes of header
   * eventually followed by data for a write:
   *


[PATCH 9/9] powerpc: powernv: pci.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "for".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/platforms/powernv/pci.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/platforms/powernv/pci.h
+++ linux-next-20200720/arch/powerpc/platforms/powernv/pci.h
@@ -87,7 +87,7 @@ struct pnv_ioda_pe {
booltce_bypass_enabled;
uint64_ttce_bypass_base;
 
-   /* MSIs. MVE index is identical for for 32 and 64 bit MSI
+   /* MSIs. MVE index is identical for 32 and 64 bit MSI
 * and -1 if not supported. (It's actually identical to the
 * PE number)
 */


[PATCH 5/9] powerpc: hw_breakpoint.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/hw_breakpoint.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/hw_breakpoint.h
+++ linux-next-20200720/arch/powerpc/include/asm/hw_breakpoint.h
@@ -17,7 +17,7 @@ struct arch_hw_breakpoint {
u16 hw_len; /* length programmed in hw */
 };
 
-/* Note: Don't change the the first 6 bits below as they are in the same order
+/* Note: Don't change the first 6 bits below as they are in the same order
  * as the dabr and dabrx.
  */
 #define HW_BRK_TYPE_READ   0x01


[PATCH 6/9] powerpc: ppc_asm.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "in".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/ppc_asm.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/ppc_asm.h
+++ linux-next-20200720/arch/powerpc/include/asm/ppc_asm.h
@@ -774,7 +774,7 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_B
 #define FIXUP_ENDIAN
 #else
 /*
- * This version may be used in in HV or non-HV context.
+ * This version may be used in HV or non-HV context.
  * MSR[EE] must be disabled.
  */
 #define FIXUP_ENDIAN  \


[PATCH 1/9] powerpc: book3s: mmu-hash.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "below".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/book3s/64/mmu-hash.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/book3s/64/mmu-hash.h
+++ linux-next-20200720/arch/powerpc/include/asm/book3s/64/mmu-hash.h
@@ -793,7 +793,7 @@ static inline unsigned long get_vsid(uns
 }
 
 /*
- * For kernel space, we use context ids as below
+ * For kernel space, we use context ids as
  * below. Range is 512TB per context.
  *
  * 0x1 -  [ 0xc000 - 0xc001]


[PATCH 3/9] powerpc: cputime.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "use".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/cputime.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/cputime.h
+++ linux-next-20200720/arch/powerpc/include/asm/cputime.h
@@ -67,7 +67,7 @@ static inline void arch_vtime_task_switc
 
 /*
  * account_cpu_user_entry/exit runs "unreconciled", so can't trace,
- * can't use use get_paca()
+ * can't use get_paca()
  */
 static notrace inline void account_cpu_user_entry(void)
 {


[PATCH 7/9] powerpc: reg.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "a".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/reg.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/reg.h
+++ linux-next-20200720/arch/powerpc/include/asm/reg.h
@@ -1472,7 +1472,7 @@ static inline void update_power8_hid0(un
 {
/*
 *  The HID0 update on Power8 should at the very least be
-*  preceded by a a SYNC instruction followed by an ISYNC
+*  preceded by a SYNC instruction followed by an ISYNC
 *  instruction
 */
asm volatile("sync; mtspr %0,%1; isync":: "i"(SPRN_HID0), "r"(hid0));


[PATCH 2/9] powerpc: book3s: radix-4k.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "per".

Signed-off-by: Randy Dunlap 
Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org
---
 arch/powerpc/include/asm/book3s/64/radix-4k.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/powerpc/include/asm/book3s/64/radix-4k.h
+++ linux-next-20200720/arch/powerpc/include/asm/book3s/64/radix-4k.h
@@ -11,7 +11,7 @@
 #define RADIX_PGD_INDEX_SIZE  13  // size: 8B << 13 = 64KB, maps 2^13 x 512GB 
=   4PB
 
 /*
- * One fragment per per page
+ * One fragment per page
  */
 #define RADIX_PTE_FRAG_SIZE_SHIFT  (RADIX_PTE_INDEX_SIZE + 3)
 #define RADIX_PTE_FRAG_NR  (PAGE_SIZE >> RADIX_PTE_FRAG_SIZE_SHIFT)


[PATCH 0/9] powerpc: delete duplicated words

2020-07-25 Thread Randy Dunlap
Drop duplicated words in arch/powerpc/ header files.

Cc: Michael Ellerman 
Cc: Benjamin Herrenschmidt 
Cc: Paul Mackerras 
Cc: linuxppc-...@lists.ozlabs.org

 arch/powerpc/include/asm/book3s/64/mmu-hash.h |2 +-
 arch/powerpc/include/asm/book3s/64/radix-4k.h |2 +-
 arch/powerpc/include/asm/cputime.h|2 +-
 arch/powerpc/include/asm/epapr_hcalls.h   |4 ++--
 arch/powerpc/include/asm/hw_breakpoint.h  |2 +-
 arch/powerpc/include/asm/ppc_asm.h|2 +-
 arch/powerpc/include/asm/reg.h|2 +-
 arch/powerpc/include/asm/smu.h|2 +-
 arch/powerpc/platforms/powernv/pci.h  |2 +-
 9 files changed, 10 insertions(+), 10 deletions(-)


[PATCH 0/6] mips: delete duplicated words

2020-07-25 Thread Randy Dunlap
Delete duplicated words in arch/mips/ header files.

Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org

 arch/mips/include/asm/io.h  |2 +-
 arch/mips/include/asm/octeon/cvmx-l2c.h |2 +-
 arch/mips/include/asm/octeon/cvmx-pip.h |2 +-
 arch/mips/include/asm/octeon/cvmx-pko.h |7 +++
 arch/mips/include/asm/octeon/cvmx-pow.h |8 
 arch/mips/include/asm/octeon/octeon.h   |2 +-
 6 files changed, 11 insertions(+), 12 deletions(-)


[PATCH 1/6] mips: io.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "on".

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/io.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/mips/include/asm/io.h
+++ linux-next-20200720/arch/mips/include/asm/io.h
@@ -59,7 +59,7 @@
  * which all ports are being mapped.  For sake of efficiency some code
  * assumes that this is an address that can be loaded with a single lui
  * instruction, so the lower 16 bits must be zero.  Should be true on
- * on any sane architecture; generic code does not use this assumption.
+ * any sane architecture; generic code does not use this assumption.
  */
 extern unsigned long mips_io_port_base;
 


[PATCH 2/6] mips: octeon: cvmx-l2c.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "Returns".

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/octeon/cvmx-l2c.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/mips/include/asm/octeon/cvmx-l2c.h
+++ linux-next-20200720/arch/mips/include/asm/octeon/cvmx-l2c.h
@@ -327,7 +327,7 @@ void cvmx_l2c_flush(void);
 
 /**
  *
- * Returns Returns the size of the L2 cache in bytes,
+ * Returns the size of the L2 cache in bytes,
  * -1 on error (unrecognized model)
  */
 int cvmx_l2c_get_cache_size_bytes(void);


[PATCH 6/6] mips: octeon: octeon.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "as".

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/octeon/octeon.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/mips/include/asm/octeon/octeon.h
+++ linux-next-20200720/arch/mips/include/asm/octeon/octeon.h
@@ -198,7 +198,7 @@ union octeon_cvmemctl {
 * CvmMemCtl[DIDTTO] */
__BITFIELD_FIELD(uint64_t didtto2:1,
/* R/W If set, marked write-buffer entries time out
-* the same as as other entries; if clear, marked
+* the same as other entries; if clear, marked
 * write-buffer entries use the maximum timeout. */
__BITFIELD_FIELD(uint64_t dismarkwblongto:1,
/* R/W If set, a merged store does not clear the


[PATCH 5/6] mips: octeon: cvmx-pow.h: fix duplicated words

2020-07-25 Thread Randy Dunlap
Delete the repeated words "Returns" and convert to kernel-doc
notation by adding a ':'.

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/octeon/cvmx-pow.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-next-20200720.orig/arch/mips/include/asm/octeon/cvmx-pow.h
+++ linux-next-20200720/arch/mips/include/asm/octeon/cvmx-pow.h
@@ -1345,7 +1345,7 @@ static inline void cvmx_pow_tag_sw_wait(
  * @wait:   When set, call stalls until work becomes avaiable, or times out.
  *  If not set, returns immediately.
  *
- * Returns Returns the WQE pointer from POW. Returns NULL if no work
+ * Returns: the WQE pointer from POW. Returns NULL if no work
  * was available.
  */
 static inline struct cvmx_wqe 
*cvmx_pow_work_request_sync_nocheck(cvmx_pow_wait_t
@@ -1379,7 +1379,7 @@ static inline struct cvmx_wqe *cvmx_pow_
  * @wait:   When set, call stalls until work becomes avaiable, or times out.
  *  If not set, returns immediately.
  *
- * Returns Returns the WQE pointer from POW. Returns NULL if no work
+ * Returns: the WQE pointer from POW. Returns NULL if no work
  * was available.
  */
 static inline struct cvmx_wqe *cvmx_pow_work_request_sync(cvmx_pow_wait_t wait)
@@ -1398,7 +1398,7 @@ static inline struct cvmx_wqe *cvmx_pow_
  * This function waits for any previous tag switch to complete before
  * requesting the null_rd.
  *
- * Returns Returns the POW state of type cvmx_pow_tag_type_t.
+ * Returns: the POW state of type cvmx_pow_tag_type_t.
  */
 static inline enum cvmx_pow_tag_type cvmx_pow_work_request_null_rd(void)
 {
@@ -1482,7 +1482,7 @@ static inline void cvmx_pow_work_request
  * @scr_addr: Scratch memory address to get result from Byte address,
  *   must be 8 byte aligned.
  *
- * Returns Returns the WQE from the scratch register, or NULL if no
+ * Returns: the WQE from the scratch register, or NULL if no
  * work was available.
  */
 static inline struct cvmx_wqe *cvmx_pow_work_response_async(int scr_addr)


[PATCH 3/6] mips: octeon: cvmx-pip.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Delete the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/octeon/cvmx-pip.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/mips/include/asm/octeon/cvmx-pip.h
+++ linux-next-20200720/arch/mips/include/asm/octeon/cvmx-pip.h
@@ -503,7 +503,7 @@ static inline void cvmx_pip_tag_mask_cle
  * offsetof() to determine the offsets into packet headers.
  * For example, offsetof(ethhdr, protocol) returns the offset
  * of the ethernet protocol field.  The bitmask selects which
- * bytes to include the the tag, with bit offset X selecting
+ * bytes to include the tag, with bit offset X selecting
  * byte at offset X from the beginning of the packet data.
  * @len:Number of bytes to include. Usually this is the sizeof()
  * the field.


[PATCH 4/6] mips: octeon: cvmx-pkoh: fix duplicated words

2020-07-25 Thread Randy Dunlap
Delete the repeated word "command".
Delete the repeated words "returns" and convert to kernel-doc notation
by adding a ':'.

Signed-off-by: Randy Dunlap 
Cc: Thomas Bogendoerfer 
Cc: linux-m...@vger.kernel.org
---
 arch/mips/include/asm/octeon/cvmx-pko.h |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

--- linux-next-20200720.orig/arch/mips/include/asm/octeon/cvmx-pko.h
+++ linux-next-20200720/arch/mips/include/asm/octeon/cvmx-pko.h
@@ -40,8 +40,7 @@
  * generic code while CVMX_PKO_LOCK_CMD_QUEUE should be used
  * with hand tuned fast path code.
  *
- * Some of other SDK differences visible to the command command
- * queuing:
+ * Some of other SDK differences visible to the command queuing:
  * - PKO indexes are no longer stored in the FAU. A large
  *   percentage of the FAU register block used to be tied up
  *   maintaining PKO queue pointers. These are now stored in a
@@ -413,7 +412,7 @@ static inline void cvmx_pko_send_packet_
  * @use_locking: CVMX_PKO_LOCK_NONE, CVMX_PKO_LOCK_ATOMIC_TAG, or
  *  CVMX_PKO_LOCK_CMD_QUEUE
  *
- * Returns returns CVMX_PKO_SUCCESS on success, or error code on
+ * Returns: CVMX_PKO_SUCCESS on success, or error code on
  * failure of output
  */
 static inline cvmx_pko_status_t cvmx_pko_send_packet_finish(
@@ -456,7 +455,7 @@ static inline cvmx_pko_status_t cvmx_pko
  * @use_locking: CVMX_PKO_LOCK_NONE, CVMX_PKO_LOCK_ATOMIC_TAG, or
  *  CVMX_PKO_LOCK_CMD_QUEUE
  *
- * Returns returns CVMX_PKO_SUCCESS on success, or error code on
+ * Returns: CVMX_PKO_SUCCESS on success, or error code on
  * failure of output
  */
 static inline cvmx_pko_status_t cvmx_pko_send_packet_finish3(


[PATCH 0/3] arm64: delete duplicated words

2020-07-25 Thread Randy Dunlap
Delete duplicated words in arch/arm64/ header files.

Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org

 arch/arm64/include/asm/pgtable-hwdef.h   |4 ++--
 arch/arm64/include/asm/ptrace.h  |2 +-
 arch/arm64/include/uapi/asm/sigcontext.h |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)


[PATCH 2/3] arm64: ptrace.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm64/include/asm/ptrace.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/arm64/include/asm/ptrace.h
+++ linux-next-20200720/arch/arm64/include/asm/ptrace.h
@@ -27,7 +27,7 @@
  *
  * Some code sections either automatically switch back to PSR.I or explicitly
  * require to not use priority masking. If bit GIC_PRIO_PSR_I_SET is included
- * in the  the priority mask, it indicates that PSR.I should be set and
+ * in the priority mask, it indicates that PSR.I should be set and
  * interrupt disabling temporarily does not rely on IRQ priorities.
  */
 #define GIC_PRIO_IRQON 0xe0


[PATCH 1/3] arm64: pgtable-hwdef.h: delete duplicated words

2020-07-25 Thread Randy Dunlap
Drop the repeated words "at" and "the".

Signed-off-by: Randy Dunlap 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm64/include/asm/pgtable-hwdef.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20200720.orig/arch/arm64/include/asm/pgtable-hwdef.h
+++ linux-next-20200720/arch/arm64/include/asm/pgtable-hwdef.h
@@ -29,7 +29,7 @@
  * Size mapped by an entry at level n ( 0 <= n <= 3)
  * We map (PAGE_SHIFT - 3) at all translation levels and PAGE_SHIFT bits
  * in the final page. The maximum number of translation levels supported by
- * the architecture is 4. Hence, starting at at level n, we have further
+ * the architecture is 4. Hence, starting at level n, we have further
  * ((4 - n) - 1) levels of translation excluding the offset within the page.
  * So, the total number of bits mapped by an entry at level n is :
  *
@@ -98,7 +98,7 @@
 #define CONT_PMDS  (1 << (CONT_PMD_SHIFT - PMD_SHIFT))
 #define CONT_PMD_SIZE  (CONT_PMDS * PMD_SIZE)
 #define CONT_PMD_MASK  (~(CONT_PMD_SIZE - 1))
-/* the the numerical offset of the PTE within a range of CONT_PTES */
+/* the numerical offset of the PTE within a range of CONT_PTES */
 #define CONT_RANGE_OFFSET(addr) (((addr)>>PAGE_SHIFT)&(CONT_PTES-1))
 
 /*


[PATCH 3/3] arm64: sigcontext.h: delete duplicated word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "the".

Signed-off-by: Randy Dunlap 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org
---
 arch/arm64/include/uapi/asm/sigcontext.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/arm64/include/uapi/asm/sigcontext.h
+++ linux-next-20200720/arch/arm64/include/uapi/asm/sigcontext.h
@@ -179,7 +179,7 @@ struct sve_context {
  * The same convention applies when returning from a signal: a caller
  * will need to remove or resize the sve_context block if it wants to
  * make the SVE registers live when they were previously non-live or
- * vice-versa.  This may require the the caller to allocate fresh
+ * vice-versa.  This may require the caller to allocate fresh
  * memory and/or move other context blocks in the signal frame.
  *
  * Changing the vector length during signal return is not permitted:


[PATCH] arm: mach-omap1: mux.h: delete duplicate word

2020-07-25 Thread Randy Dunlap
Drop the repeated word "is".

Signed-off-by: Randy Dunlap 
Cc: Aaro Koskinen 
Cc: Tony Lindgren 
Cc: linux-o...@vger.kernel.org
---
 arch/arm/mach-omap1/include/mach/mux.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200720.orig/arch/arm/mach-omap1/include/mach/mux.h
+++ linux-next-20200720/arch/arm/mach-omap1/include/mach/mux.h
@@ -88,7 +88,7 @@
  * OMAP730/850 has a slightly different config for the pin mux.
  * - config regs are the OMAP7XX_IO_CONF_x regs (see omap7xx.h) regs and
  *   not the FUNC_MUX_CTRL_x regs from hardware.h
- * - for pull-up/down, only has one enable bit which is is in the same register
+ * - for pull-up/down, only has one enable bit which is in the same register
  *   as mux config
  */
 #define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode,  \


  1   2   3   4   5   >