[PATCH 4.20 333/352] usb: gadget: udc: net2272: Fix bitwise and boolean operations

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Gustavo A. R. Silva 

commit 07c69f1148da7de3978686d3af9263325d9d60bd upstream.

(!x & y) strikes again.

Fix bitwise and boolean operations by enclosing the expression:

intcsr & (1 << NET2272_PCI_IRQ)

in parentheses, before applying the boolean operator '!'.

Notice that this code has been there since 2011. So, it would
be helpful if someone can double-check this.

This issue was detected with the help of Coccinelle.

Fixes: ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device 
controller")
Cc: sta...@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva 
Signed-off-by: Felipe Balbi 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/gadget/udc/net2272.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -2083,7 +2083,7 @@ static irqreturn_t net2272_irq(int irq,
 #if defined(PLX_PCI_RDK2)
/* see if PCI int for us by checking irqstat */
intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT);
-   if (!intcsr & (1 << NET2272_PCI_IRQ)) {
+   if (!(intcsr & (1 << NET2272_PCI_IRQ))) {
spin_unlock(>lock);
return IRQ_NONE;
}




[PATCH 4.20 335/352] staging: speakup: fix tty-operation NULL derefs

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Johan Hovold 

commit a1960e0f1639cb1f7a3d94521760fc73091f6640 upstream.

The send_xchar() and tiocmset() tty operations are optional. Add the
missing sanity checks to prevent user-space triggerable NULL-pointer
dereferences.

Fixes: 6b9ad1c742bf ("staging: speakup: add send_xchar, tiocmset and input 
functionality for tty")
Cc: stable  # 4.13
Cc: Okash Khawaja 
Cc: Samuel Thibault 
Signed-off-by: Johan Hovold 
Reviewed-by: Samuel Thibault 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/staging/speakup/spk_ttyio.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -265,7 +265,8 @@ static void spk_ttyio_send_xchar(char ch
return;
}
 
-   speakup_tty->ops->send_xchar(speakup_tty, ch);
+   if (speakup_tty->ops->send_xchar)
+   speakup_tty->ops->send_xchar(speakup_tty, ch);
mutex_unlock(_tty_mutex);
 }
 
@@ -277,7 +278,8 @@ static void spk_ttyio_tiocmset(unsigned
return;
}
 
-   speakup_tty->ops->tiocmset(speakup_tty, set, clear);
+   if (speakup_tty->ops->tiocmset)
+   speakup_tty->ops->tiocmset(speakup_tty, set, clear);
mutex_unlock(_tty_mutex);
 }
 




[PATCH 4.20 308/352] bnxt_en: Disable interrupts when allocating CP rings or NQs.

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Michael Chan 

[ Upstream commit 5e66e35aab335b83d9ffb220d8a3a13986a7a60e ]

When calling firmware to allocate a CP ring or NQ, an interrupt associated
with that ring may be generated immediately before the doorbell is even
setup after the firmware call returns.  When servicing the interrupt, the
driver may crash when trying to access the doorbell.

Fix it by disabling interrupt on that vector until the doorbell is
set up.

Fixes: 697197e5a173 ("bnxt_en: Re-structure doorbells.")
Signed-off-by: Michael Chan 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4903,12 +4903,18 @@ static int bnxt_hwrm_ring_alloc(struct b
struct bnxt_cp_ring_info *cpr = >cp_ring;
struct bnxt_ring_struct *ring = >cp_ring_struct;
u32 map_idx = ring->map_idx;
+   unsigned int vector;
 
+   vector = bp->irq_tbl[map_idx].vector;
+   disable_irq_nosync(vector);
rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx);
-   if (rc)
+   if (rc) {
+   enable_irq(vector);
goto err_out;
+   }
bnxt_set_db(bp, >cp_db, type, map_idx, ring->fw_ring_id);
bnxt_db_nq(bp, >cp_db, cpr->cp_raw_cons);
+   enable_irq(vector);
bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id;
 
if (!i) {




[PATCH 4.20 334/352] usb: gadget: musb: fix short isoc packets with inventra dma

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Paul Elder 

commit c418fd6c01fbc5516a2cd1eaf1df1ec86869028a upstream.

Handling short packets (length < max packet size) in the Inventra DMA
engine in the MUSB driver causes the MUSB DMA controller to hang. An
example of a problem that is caused by this problem is when streaming
video out of a UVC gadget, only the first video frame is transferred.

For short packets (mode-0 or mode-1 DMA), MUSB_TXCSR_TXPKTRDY must be
set manually by the driver. This was previously done in musb_g_tx
(musb_gadget.c), but incorrectly (all csr flags were cleared, and only
MUSB_TXCSR_MODE and MUSB_TXCSR_TXPKTRDY were set). Fixing that problem
allows some requests to be transferred correctly, but multiple requests
were often put together in one USB packet, and caused problems if the
packet size was not a multiple of 4. Instead, set MUSB_TXCSR_TXPKTRDY
in dma_controller_irq (musbhsdma.c), just like host mode transfers.

This topic was originally tackled by Nicolas Boichat [0] [1] and is
discussed further at [2] as part of his GSoC project [3].

[0] https://groups.google.com/forum/?hl=en#!topic/beagleboard-gsoc/k8Azwfp75CU
[1] 
https://gitorious.org/beagleboard-usbsniffer/beagleboard-usbsniffer-kernel/commit/b0be3b6cc195ba732189b04f1d43ec843c3e54c9?p=beagleboard-usbsniffer:beagleboard-usbsniffer-kernel.git;a=patch;h=b0be3b6cc195ba732189b04f1d43ec843c3e54c9
[2] 
http://beagleboard-usbsniffer.blogspot.com/2010/07/musb-isochronous-transfers-fixed.html
[3] http://elinux.org/BeagleBoard/GSoC/USBSniffer

Fixes: 550a7375fe72 ("USB: Add MUSB and TUSB support")
Signed-off-by: Paul Elder 
Signed-off-by: Bin Liu 
Cc: stable 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/usb/musb/musb_gadget.c |   13 +
 drivers/usb/musb/musbhsdma.c   |   21 +++--
 2 files changed, 12 insertions(+), 22 deletions(-)

--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -452,13 +452,10 @@ void musb_g_tx(struct musb *musb, u8 epn
}
 
if (request) {
-   u8  is_dma = 0;
-   boolshort_packet = false;
 
trace_musb_req_tx(req);
 
if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
-   is_dma = 1;
csr |= MUSB_TXCSR_P_WZC_BITS;
csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN |
 MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET);
@@ -476,16 +473,8 @@ void musb_g_tx(struct musb *musb, u8 epn
 */
if ((request->zero && request->length)
&& (request->length % musb_ep->packet_sz == 0)
-   && (request->actual == request->length))
-   short_packet = true;
+   && (request->actual == request->length)) {
 
-   if ((musb_dma_inventra(musb) || musb_dma_ux500(musb)) &&
-   (is_dma && (!dma->desired_mode ||
-   (request->actual &
-   (musb_ep->packet_sz - 1)
-   short_packet = true;
-
-   if (short_packet) {
/*
 * On DMA completion, FIFO may not be
 * available yet...
--- a/drivers/usb/musb/musbhsdma.c
+++ b/drivers/usb/musb/musbhsdma.c
@@ -346,12 +346,10 @@ static irqreturn_t dma_controller_irq(in
channel->status = MUSB_DMA_STATUS_FREE;
 
/* completed */
-   if ((devctl & MUSB_DEVCTL_HM)
-   && (musb_channel->transmit)
-   && ((channel->desired_mode == 0)
-   || (channel->actual_len &
-   (musb_channel->max_packet_sz - 1)))
-   ) {
+   if (musb_channel->transmit &&
+   (!channel->desired_mode ||
+   (channel->actual_len %
+   musb_channel->max_packet_sz))) {
u8  epnum  = musb_channel->epnum;
int offset = musb->io.ep_offset(epnum,
MUSB_TXCSR);
@@ -363,11 +361,14 @@ static irqreturn_t dma_controller_irq(in
 */
musb_ep_select(mbase, epnum);
txcsr = musb_readw(mbase, offset);
-   txcsr &= ~(MUSB_TXCSR_DMAENAB
+   if (channel->desired_mode == 1) {
+   txcsr 

[PATCH 4.20 311/352] net/mlx5e: Use the inner headers to determine tc/pedit offload limitation on decap flows

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Guy Shattah 

[ Upstream commit 1651925d403e077e3fc86f961905e27c6810e132 ]

In packets that need to be decaped the internal headers
have to be checked, not the external ones.

Fixes: bdd66ac0aeed ("net/mlx5e: Disallow TC offloading of unsupported 
match/action combinations")
Signed-off-by: Guy Shattah 
Reviewed-by: Or Gerlitz 
Signed-off-by: Saeed Mahameed 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -2133,6 +2133,7 @@ static bool csum_offload_supported(struc
 
 static bool modify_header_match_supported(struct mlx5_flow_spec *spec,
  struct tcf_exts *exts,
+ u32 match_actions,
  struct netlink_ext_ack *extack)
 {
const struct tc_action *a;
@@ -2143,7 +2144,11 @@ static bool modify_header_match_supporte
u16 ethertype;
int nkeys, i;
 
-   headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, 
outer_headers);
+   if (match_actions & MLX5_FLOW_CONTEXT_ACTION_DECAP)
+   headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, 
inner_headers);
+   else
+   headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, 
outer_headers);
+
ethertype = MLX5_GET(fte_match_set_lyr_2_4, headers_v, ethertype);
 
/* for non-IP we only re-write MACs, so we're okay */
@@ -2200,7 +2205,7 @@ static bool actions_match_supported(stru
 
if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
return modify_header_match_supported(_attr->spec, exts,
-extack);
+actions, extack);
 
return true;
 }




[PATCH 4.20 309/352] net: cls_flower: Remove filter from mask before freeing it

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Petr Machata 

[ Upstream commit c1f7e02979edd7a3a3e69fe04be60b1d650dc8a7 ]

In fl_change(), when adding a new rule (i.e. fold == NULL), a driver may
reject the new rule, for example due to resource exhaustion. By that
point, the new rule was already assigned a mask, and it was added to
that mask's hash table. The clean-up path that's invoked as a result of
the rejection however neglects to undo the hash table addition, and
proceeds to free the new rule, thus leaving a dangling pointer in the
hash table.

Fix by removing fnew from the mask's hash table before it is freed.

Fixes: 35cc3cefc4de ("net/sched: cls_flower: Reject duplicated rules also under 
skip_sw")
Signed-off-by: Petr Machata 
Acked-by: Jiri Pirko 
Reviewed-by: Ido Schimmel 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 net/sched/cls_flower.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1257,7 +1257,7 @@ static int fl_change(struct net *net, st
if (!tc_skip_hw(fnew->flags)) {
err = fl_hw_replace_filter(tp, fnew, extack);
if (err)
-   goto errout_mask;
+   goto errout_mask_ht;
}
 
if (!tc_in_hw(fnew->flags))
@@ -1287,6 +1287,10 @@ static int fl_change(struct net *net, st
kfree(mask);
return 0;
 
+errout_mask_ht:
+   rhashtable_remove_fast(>mask->ht, >ht_node,
+  fnew->mask->filter_ht_params);
+
 errout_mask:
fl_mask_put(head, fnew->mask, false);
 




[PATCH 4.20 310/352] net: dsa: b53: Fix for failure when irq is not defined in dt

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Arun Parameswaran 

[ Upstream commit 39841cc1cbb69344539c98a1fa9d858ed124c7ba ]

Fixes the issues with non BCM58XX chips in the b53 driver
failing, when the irq is not specified in the device tree.

Removed the check for BCM58XX in b53_srab_prepare_irq(),
so the 'port->irq' will be set to '-EXIO' if the irq is not
specified in the device tree.

Fixes: 16994374a6fc ("net: dsa: b53: Make SRAB driver manage port interrupts")
Fixes: b2ddc48a81b5 ("net: dsa: b53: Do not fail when IRQ are not initialized")
Signed-off-by: Arun Parameswaran 
Reviewed-by: Florian Fainelli 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/dsa/b53/b53_srab.c |3 ---
 1 file changed, 3 deletions(-)

--- a/drivers/net/dsa/b53/b53_srab.c
+++ b/drivers/net/dsa/b53/b53_srab.c
@@ -511,9 +511,6 @@ static void b53_srab_prepare_irq(struct
/* Clear all pending interrupts */
writel(0x, priv->regs + B53_SRAB_INTR);
 
-   if (dev->pdata && dev->pdata->chip_id != BCM58XX_DEVICE_ID)
-   return;
-
for (i = 0; i < B53_N_PORTS; i++) {
port = >port_intrs[i];
 




[PATCH 4.20 338/352] scsi: aic94xx: fix module loading

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: James Bottomley 

commit 42caa0edabd6a0a392ec36a5f0943924e4954311 upstream.

The aic94xx driver is currently failing to load with errors like

sysfs: cannot create duplicate filename 
'/devices/pci:00/:00:03.0/:02:00.3/:07:02.0/revision'

Because the PCI code had recently added a file named 'revision' to every
PCI device.  Fix this by renaming the aic94xx revision file to
aic_revision.  This is safe to do for us because as far as I can tell,
there's nothing in userspace relying on the current aic94xx revision file
so it can be renamed without breaking anything.

Fixes: 702ed3be1b1b (PCI: Create revision file in sysfs)
Cc: sta...@vger.kernel.org
Signed-off-by: James Bottomley 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/scsi/aic94xx/aic94xx_init.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -281,7 +281,7 @@ static ssize_t asd_show_dev_rev(struct d
return snprintf(buf, PAGE_SIZE, "%s\n",
asd_dev_rev[asd_ha->revision_id]);
 }
-static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL);
+static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
 
 static ssize_t asd_show_dev_bios_build(struct device *dev,
   struct device_attribute *attr,char *buf)
@@ -478,7 +478,7 @@ static int asd_create_dev_attrs(struct a
 {
int err;
 
-   err = device_create_file(_ha->pcidev->dev, _attr_revision);
+   err = device_create_file(_ha->pcidev->dev, _attr_aic_revision);
if (err)
return err;
 
@@ -500,13 +500,13 @@ err_update_bios:
 err_biosb:
device_remove_file(_ha->pcidev->dev, _attr_bios_build);
 err_rev:
-   device_remove_file(_ha->pcidev->dev, _attr_revision);
+   device_remove_file(_ha->pcidev->dev, _attr_aic_revision);
return err;
 }
 
 static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
 {
-   device_remove_file(_ha->pcidev->dev, _attr_revision);
+   device_remove_file(_ha->pcidev->dev, _attr_aic_revision);
device_remove_file(_ha->pcidev->dev, _attr_bios_build);
device_remove_file(_ha->pcidev->dev, _attr_pcba_sn);
device_remove_file(_ha->pcidev->dev, _attr_update_bios);




Re: [PATCH 1/2] Provide in-kernel headers for making it easy to extend the kernel

2019-02-11 Thread Joel Fernandes
On Mon, Feb 11, 2019 at 10:39:43AM +0900, Masahiro Yamada wrote:
> On Fri, Feb 8, 2019 at 6:13 AM Joel Fernandes (Google)
>  wrote:
> >
> > Introduce in-kernel headers and other artifacts which are made available
> > as an archive through proc (/proc/kheaders.txz file). This archive makes
> > it possible to build kernel modules, run eBPF programs, and other
> > tracing programs that need to extend the kernel for tracing purposes
> > without any dependency on the file system having headers and build
> > artifacts.
> >
> > On Android and embedded systems, it is common to switch kernels but not
> > have kernel headers available on the file system. Raw kernel headers
> > also cannot be copied into the filesystem like they can be on other
> > distros, due to licensing and other issues. There's no linux-headers
> > package on Android. Further once a different kernel is booted, any
> > headers stored on the file system will no longer be useful. By storing
> > the headers as a compressed archive within the kernel, we can avoid these
> > issues that have been a hindrance for a long time.
> >
> > The feature is also buildable as a module just in case the user desires
> > it not being part of the kernel image. This makes it possible to load
> > and unload the headers on demand. A tracing program, or a kernel module
> > builder can load the module, do its operations, and then unload the
> > module to save kernel memory. The total memory needed is 3.8MB.
> >
> > The code to read the headers is based on /proc/config.gz code and uses
> > the same technique to embed the headers.
> >
> > To build a module, the below steps have been tested on an x86 machine:
> > modprobe kheaders
> > rm -rf $HOME/headers
> > mkdir -p $HOME/headers
> > tar -xvf /proc/kheaders.txz -C $HOME/headers >/dev/null
> > cd my-kernel-module
> > make -C $HOME/headers M=$(pwd) modules
> > rmmod kheaders
> >
> > Signed-off-by: Joel Fernandes (Google) 
> > ---
> > Changes since RFC:
> > Both changes bring size down to 3.8MB:
> > - use xz for compression
> > - strip comments except SPDX lines
> > - Call out the module name in Kconfig
> > - Also added selftests in second patch to ensure headers are always
> > working.
> >
> >  Documentation/dontdiff|  1 +
> >  arch/x86/Makefile |  2 ++
> >  init/Kconfig  | 11 ++
> >  kernel/.gitignore |  2 ++
> >  kernel/Makefile   | 29 +++
> >  kernel/kheaders.c | 74 +++
> >  scripts/gen_ikh_data.sh   | 19 ++
> >  scripts/strip-comments.pl |  8 +
> >  8 files changed, 146 insertions(+)
> >  create mode 100644 kernel/kheaders.c
> >  create mode 100755 scripts/gen_ikh_data.sh
> >  create mode 100755 scripts/strip-comments.pl
> >
> > diff --git a/Documentation/dontdiff b/Documentation/dontdiff
> > index 2228fcc8e29f..05a2319ee2a2 100644
> > --- a/Documentation/dontdiff
> > +++ b/Documentation/dontdiff
> > @@ -151,6 +151,7 @@ int8.c
> >  kallsyms
> >  kconfig
> >  keywords.c
> > +kheaders_data.h*
> >  ksym.c*
> >  ksym.h*
> >  kxgettext
> > diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> > index 88398fdf8129..ad176d669da4 100644
> > --- a/arch/x86/Makefile
> > +++ b/arch/x86/Makefile
> > @@ -240,6 +240,8 @@ archmacros:
> >  ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s
> >  export ASM_MACRO_FLAGS
> >  KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)
> > +IKH_EXTRA += arch/x86/kernel/macros.s
> > +export IKH_EXTRA
> 
> 
> This does not exist in any of released kernels.
> 
> See commit 6ac389346e6

Ok, thanks fixed it in v2 which I just sent and rebased on linus master branch. 

- Joel



[PATCH 4.20 340/352] kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974)

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Jann Horn 

commit cfa39381173d5f969daf43582c95ad679189cbc9 upstream.

kvm_ioctl_create_device() does the following:

1. creates a device that holds a reference to the VM object (with a borrowed
   reference, the VM's refcount has not been bumped yet)
2. initializes the device
3. transfers the reference to the device to the caller's file descriptor table
4. calls kvm_get_kvm() to turn the borrowed reference to the VM into a real
   reference

The ownership transfer in step 3 must not happen before the reference to the VM
becomes a proper, non-borrowed reference, which only happens in step 4.
After step 3, an attacker can close the file descriptor and drop the borrowed
reference, which can cause the refcount of the kvm object to drop to zero.

This means that we need to grab a reference for the device before
anon_inode_getfd(), otherwise the VM can disappear from under us.

Fixes: 852b6d57dc7f ("kvm: add device control API")
Cc: sta...@kernel.org
Signed-off-by: Jann Horn 
Signed-off-by: Paolo Bonzini 
Signed-off-by: Greg Kroah-Hartman 

---
 virt/kvm/kvm_main.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2919,8 +2919,10 @@ static int kvm_ioctl_create_device(struc
if (ops->init)
ops->init(dev);
 
+   kvm_get_kvm(kvm);
ret = anon_inode_getfd(ops->name, _device_fops, dev, O_RDWR | 
O_CLOEXEC);
if (ret < 0) {
+   kvm_put_kvm(kvm);
mutex_lock(>lock);
list_del(>vm_node);
mutex_unlock(>lock);
@@ -2928,7 +2930,6 @@ static int kvm_ioctl_create_device(struc
return ret;
}
 
-   kvm_get_kvm(kvm);
cd->fd = ret;
return 0;
 }




[PATCH 4.20 349/352] serial: 8250_pci: Make PCI class test non fatal

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Andy Shevchenko 

commit 824d17c57b0abbcb9128fb3f7327fae14761914b upstream.

As has been reported the National Instruments serial cards have broken
PCI class.

The commit 7d8905d06405

  ("serial: 8250_pci: Enable device after we check black list")

made the PCI class check mandatory for the case when device is listed in
a quirk list.

Make PCI class test non fatal to allow broken card be enumerated.

Fixes: 7d8905d06405 ("serial: 8250_pci: Enable device after we check black 
list")
Cc: stable 
Reported-by: Guan Yung Tseng 
Tested-by: Guan Yung Tseng 
Tested-by: KHUENY.Gerhard 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/tty/serial/8250/8250_pci.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -3420,6 +3420,11 @@ static int
 serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
 {
int num_iomem, num_port, first_port = -1, i;
+   int rc;
+
+   rc = serial_pci_is_class_communication(dev);
+   if (rc)
+   return rc;
 
/*
 * Should we try to make guesses for multiport serial devices later?
@@ -3647,10 +3652,6 @@ pciserial_init_one(struct pci_dev *dev,
 
board = _boards[ent->driver_data];
 
-   rc = serial_pci_is_class_communication(dev);
-   if (rc)
-   return rc;
-
rc = serial_pci_is_blacklisted(dev);
if (rc)
return rc;




[PATCH 4.20 351/352] cacheinfo: Keep the old value if of_property_read_u32 fails

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Huacai Chen 

commit 3a34c986324c07dde32903f7bb262e6138e77c2a upstream.

Commit 448a5a552f336bd7b847b1951 ("drivers: base: cacheinfo: use OF
property_read_u32 instead of get_property,read_number") makes cache
size and number_of_sets be 0 if DT doesn't provide there values. I
think this is unreasonable so make them keep the old values, which is
the same as old kernels.

Fixes: 448a5a552f33 ("drivers: base: cacheinfo: use OF property_read_u32 
instead of get_property,read_number")
Cc: sta...@vger.kernel.org
Signed-off-by: Huacai Chen 
Reviewed-by: Sudeep Holla 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/base/cacheinfo.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -79,8 +79,7 @@ static void cache_size(struct cacheinfo
ct_idx = get_cacheinfo_idx(this_leaf->type);
propname = cache_type_info[ct_idx].size_prop;
 
-   if (of_property_read_u32(np, propname, _leaf->size))
-   this_leaf->size = 0;
+   of_property_read_u32(np, propname, _leaf->size);
 }
 
 /* not cache_line_size() because that's a macro in include/linux/cache.h */
@@ -114,8 +113,7 @@ static void cache_nr_sets(struct cachein
ct_idx = get_cacheinfo_idx(this_leaf->type);
propname = cache_type_info[ct_idx].nr_sets_prop;
 
-   if (of_property_read_u32(np, propname, _leaf->number_of_sets))
-   this_leaf->number_of_sets = 0;
+   of_property_read_u32(np, propname, _leaf->number_of_sets);
 }
 
 static void cache_associativity(struct cacheinfo *this_leaf)




[PATCH 4.20 305/352] sctp: walk the list of asoc safely

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Greg Kroah-Hartman 

[ Upstream commit ba59fb0273076637f0add4311faa990a5eec27c0 ]

In sctp_sendmesg(), when walking the list of endpoint associations, the
association can be dropped from the list, making the list corrupt.
Properly handle this by using list_for_each_entry_safe()

Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in 
sendmsg")
Reported-by: Secunia Research 
Tested-by: Secunia Research 
Signed-off-by: Greg Kroah-Hartman 
Acked-by: Marcelo Ricardo Leitner 
Acked-by: Neil Horman 
Signed-off-by: David S. Miller 
Signed-off-by: Greg Kroah-Hartman 
---
 net/sctp/socket.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -2027,7 +2027,7 @@ static int sctp_sendmsg(struct sock *sk,
struct sctp_endpoint *ep = sctp_sk(sk)->ep;
struct sctp_transport *transport = NULL;
struct sctp_sndrcvinfo _sinfo, *sinfo;
-   struct sctp_association *asoc;
+   struct sctp_association *asoc, *tmp;
struct sctp_cmsgs cmsgs;
union sctp_addr *daddr;
bool new = false;
@@ -2053,7 +2053,7 @@ static int sctp_sendmsg(struct sock *sk,
 
/* SCTP_SENDALL process */
if ((sflags & SCTP_SENDALL) && sctp_style(sk, UDP)) {
-   list_for_each_entry(asoc, >asocs, asocs) {
+   list_for_each_entry_safe(asoc, tmp, >asocs, asocs) {
err = sctp_sendmsg_check_sflags(asoc, sflags, msg,
msg_len);
if (err == 0)




[PATCH 4.20 342/352] cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Josh Poimboeuf 

commit b284909abad48b07d3071a9fc9b5692b3e64914b upstream.

With the following commit:

  73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")

... the hotplug code attempted to detect when SMT was disabled by BIOS,
in which case it reported SMT as permanently disabled.  However, that
code broke a virt hotplug scenario, where the guest is booted with only
primary CPU threads, and a sibling is brought online later.

The problem is that there doesn't seem to be a way to reliably
distinguish between the HW "SMT disabled by BIOS" case and the virt
"sibling not yet brought online" case.  So the above-mentioned commit
was a bit misguided, as it permanently disabled SMT for both cases,
preventing future virt sibling hotplugs.

Going back and reviewing the original problems which were attempted to
be solved by that commit, when SMT was disabled in BIOS:

  1) /sys/devices/system/cpu/smt/control showed "on" instead of
 "notsupported"; and

  2) vmx_vm_init() was incorrectly showing the L1TF_MSG_SMT warning.

I'd propose that we instead consider #1 above to not actually be a
problem.  Because, at least in the virt case, it's possible that SMT
wasn't disabled by BIOS and a sibling thread could be brought online
later.  So it makes sense to just always default the smt control to "on"
to allow for that possibility (assuming cpuid indicates that the CPU
supports SMT).

The real problem is #2, which has a simple fix: change vmx_vm_init() to
query the actual current SMT state -- i.e., whether any siblings are
currently online -- instead of looking at the SMT "control" sysfs value.

So fix it by:

  a) reverting the original "fix" and its followup fix:

 73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
 bc2d8d262cba ("cpu/hotplug: Fix SMT supported evaluation")

 and

  b) changing vmx_vm_init() to query the actual current SMT state --
 instead of the sysfs control value -- to determine whether the L1TF
 warning is needed.  This also requires the 'sched_smt_present'
 variable to exported, instead of 'cpu_smt_control'.

Fixes: 73d5e2b47264 ("cpu/hotplug: detect SMT disabled by BIOS")
Reported-by: Igor Mammedov 
Signed-off-by: Josh Poimboeuf 
Signed-off-by: Thomas Gleixner 
Cc: Joe Mario 
Cc: Jiri Kosina 
Cc: Peter Zijlstra 
Cc: k...@vger.kernel.org
Cc: sta...@vger.kernel.org
Link: 
https://lkml.kernel.org/r/e3a85d585da28cc333ecbc1e78ee9216e6da9396.1548794349.git.jpoim...@redhat.com
Signed-off-by: Greg Kroah-Hartman 


---
 arch/x86/kernel/cpu/bugs.c |2 +-
 arch/x86/kvm/vmx.c |3 ++-
 include/linux/cpu.h|2 --
 kernel/cpu.c   |   33 -
 kernel/sched/fair.c|1 +
 kernel/smp.c   |2 --
 6 files changed, 8 insertions(+), 35 deletions(-)

--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -69,7 +69,7 @@ void __init check_bugs(void)
 * identify_boot_cpu() initialized SMT support information, let the
 * core code know.
 */
-   cpu_smt_check_topology_early();
+   cpu_smt_check_topology();
 
if (!IS_ENABLED(CONFIG_SMP)) {
pr_info("CPU: ");
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -11643,7 +11644,7 @@ static int vmx_vm_init(struct kvm *kvm)
 * Warn upon starting the first VM in a potentially
 * insecure environment.
 */
-   if (cpu_smt_control == CPU_SMT_ENABLED)
+   if (sched_smt_active())
pr_warn_once(L1TF_MSG_SMT);
if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER)
pr_warn_once(L1TF_MSG_L1D);
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -180,12 +180,10 @@ enum cpuhp_smt_control {
 #if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_SMT)
 extern enum cpuhp_smt_control cpu_smt_control;
 extern void cpu_smt_disable(bool force);
-extern void cpu_smt_check_topology_early(void);
 extern void cpu_smt_check_topology(void);
 #else
 # define cpu_smt_control   (CPU_SMT_ENABLED)
 static inline void cpu_smt_disable(bool force) { }
-static inline void cpu_smt_check_topology_early(void) { }
 static inline void cpu_smt_check_topology(void) { }
 #endif
 
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -376,9 +376,6 @@ void __weak arch_smt_update(void) { }
 
 #ifdef CONFIG_HOTPLUG_SMT
 enum cpuhp_smt_control cpu_smt_control __read_mostly = CPU_SMT_ENABLED;
-EXPORT_SYMBOL_GPL(cpu_smt_control);
-
-static bool cpu_smt_available __read_mostly;
 
 void __init cpu_smt_disable(bool force)
 {
@@ -397,25 +394,11 @@ void __init cpu_smt_disable(bool force)
 
 /*
  * The decision whether SMT is supported can only be 

[PATCH 4.20 313/352] xfs: eof trim writeback mapping as soon as it is cached

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Brian Foster 

commit aa6ee4ab69293969867ab09b57546d226ace3d7a upstream.

The cached writeback mapping is EOF trimmed to try and avoid races
between post-eof block management and writeback that result in
sending cached data to a stale location. The cached mapping is
currently trimmed on the validation check, which leaves a race
window between the time the mapping is cached and when it is trimmed
against the current inode size.

For example, if a new mapping is cached by delalloc conversion on a
blocksize == page size fs, we could cycle various locks, perform
memory allocations, etc.  in the writeback codepath before the
associated mapping is eventually trimmed to i_size. This leaves
enough time for a post-eof truncate and file append before the
cached mapping is trimmed. The former event essentially invalidates
a range of the cached mapping and the latter bumps the inode size
such the trim on the next writepage event won't trim all of the
invalid blocks. fstest generic/464 reproduces this scenario
occasionally and causes a lost writeback and stale delalloc blocks
warning on inode inactivation.

To work around this problem, trim the cached writeback mapping as
soon as it is cached in addition to on subsequent validation checks.
This is a minor tweak to tighten the race window as much as possible
until a proper invalidation mechanism is available.

Fixes: 40214d128e07 ("xfs: trim writepage mapping to within eof")
Cc:  # v4.14+
Signed-off-by: Brian Foster 
Reviewed-by: Allison Henderson 
Reviewed-by: Christoph Hellwig 
Reviewed-by: Darrick J. Wong 
Signed-off-by: Darrick J. Wong 
Signed-off-by: Greg Kroah-Hartman 

---
 fs/xfs/xfs_aops.c |2 ++
 1 file changed, 2 insertions(+)

--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -449,6 +449,7 @@ xfs_map_blocks(
}
 
wpc->imap = imap;
+   xfs_trim_extent_eof(>imap, ip);
trace_xfs_map_blocks_found(ip, offset, count, wpc->io_type, );
return 0;
 allocate_blocks:
@@ -459,6 +460,7 @@ allocate_blocks:
ASSERT(whichfork == XFS_COW_FORK || cow_fsb == NULLFILEOFF ||
   imap.br_startoff + imap.br_blockcount <= cow_fsb);
wpc->imap = imap;
+   xfs_trim_extent_eof(>imap, ip);
trace_xfs_map_blocks_alloc(ip, offset, count, wpc->io_type, );
return 0;
 }




[PATCH 4.20 341/352] KVM: nVMX: unconditionally cancel preemption timer in free_nested (CVE-2019-7221)

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Peter Shier 

commit ecec76885bcfe3294685dc363fd1273df0d5d65f upstream.

Bugzilla: 1671904

There are multiple code paths where an hrtimer may have been started to
emulate an L1 VMX preemption timer that can result in a call to free_nested
without an intervening L2 exit where the hrtimer is normally
cancelled. Unconditionally cancel in free_nested to cover all cases.

Embargoed until Feb 7th 2019.

Signed-off-by: Peter Shier 
Reported-by: Jim Mattson 
Reviewed-by: Jim Mattson 
Reported-by: Felix Wilhelm 
Cc: sta...@kernel.org
Message-Id: <20181011184646.154065-1-psh...@google.com>
Signed-off-by: Paolo Bonzini 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kvm/vmx.c |1 +
 1 file changed, 1 insertion(+)

--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -8509,6 +8509,7 @@ static void free_nested(struct kvm_vcpu
if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon)
return;
 
+   hrtimer_cancel(>nested.preemption_timer);
vmx->nested.vmxon = false;
vmx->nested.smm.vmxon = false;
free_vpid(vmx->nested.vpid02);




[PATCH 4.20 346/352] perf/core: Dont WARN() for impossible ring-buffer sizes

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Mark Rutland 

commit 9dff0aa95a324e262ffb03f425d00e4751f3294e upstream.

The perf tool uses /proc/sys/kernel/perf_event_mlock_kb to determine how
large its ringbuffer mmap should be. This can be configured to arbitrary
values, which can be larger than the maximum possible allocation from
kmalloc.

When this is configured to a suitably large value (e.g. thanks to the
perf fuzzer), attempting to use perf record triggers a WARN_ON_ONCE() in
__alloc_pages_nodemask():

   WARNING: CPU: 2 PID: 5666 at mm/page_alloc.c:4511 
__alloc_pages_nodemask+0x3f8/0xbc8

Let's avoid this by checking that the requested allocation is possible
before calling kzalloc.

Reported-by: Julien Thierry 
Signed-off-by: Mark Rutland 
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Julien Thierry 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: 
Link: https://lkml.kernel.org/r/20190110142745.25495-1-mark.rutl...@arm.com
Signed-off-by: Ingo Molnar 
Signed-off-by: Greg Kroah-Hartman 

---
 kernel/events/ring_buffer.c |3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -734,6 +734,9 @@ struct ring_buffer *rb_alloc(int nr_page
size = sizeof(struct ring_buffer);
size += nr_pages * sizeof(void *);
 
+   if (order_base_2(size) >= MAX_ORDER)
+   goto fail;
+
rb = kzalloc(size, GFP_KERNEL);
if (!rb)
goto fail;




[PATCH 4.20 347/352] perf tests evsel-tp-sched: Fix bitwise operator

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Gustavo A. R. Silva 

commit 489338a717a0dfbbd5a3fabccf172b78f0ac9015 upstream.

Notice that the use of the bitwise OR operator '|' always leads to true
in this particular case, which seems a bit suspicious due to the context
in which this expression is being used.

Fix this by using bitwise AND operator '&' instead.

This bug was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
Acked-by: Jiri Olsa 
Cc: Alexander Shishkin 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: sta...@vger.kernel.org
Fixes: 6a6cd11d4e57 ("perf test: Add test for the sched tracepoint format 
fields")
Link: http://lkml.kernel.org/r/20190122233439.GA5868@embeddedor
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Greg Kroah-Hartman 

---
 tools/perf/tests/evsel-tp-sched.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/tools/perf/tests/evsel-tp-sched.c
+++ b/tools/perf/tests/evsel-tp-sched.c
@@ -17,7 +17,7 @@ static int perf_evsel__test_field(struct
return -1;
}
 
-   is_signed = !!(field->flags | TEP_FIELD_IS_SIGNED);
+   is_signed = !!(field->flags & TEP_FIELD_IS_SIGNED);
if (should_be_signed && !is_signed) {
pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n",
 evsel->name, name, is_signed, should_be_signed);




[PATCH 4.20 339/352] KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222)

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Paolo Bonzini 

commit 353c0956a618a07ba4bbe7ad00ff29fe70e8412a upstream.

Bugzilla: 1671930

Emulation of certain instructions (VMXON, VMCLEAR, VMPTRLD, VMWRITE with
memory operand, INVEPT, INVVPID) can incorrectly inject a page fault
when passed an operand that points to an MMIO address.  The page fault
will use uninitialized kernel stack memory as the CR2 and error code.

The right behavior would be to abort the VM with a KVM_EXIT_INTERNAL_ERROR
exit to userspace; however, it is not an easy fix, so for now just
ensure that the error code and CR2 are zero.

Embargoed until Feb 7th 2019.

Reported-by: Felix Wilhelm 
Cc: sta...@kernel.org
Signed-off-by: Paolo Bonzini 
Signed-off-by: Greg Kroah-Hartman 

---
 arch/x86/kvm/x86.c |7 +++
 1 file changed, 7 insertions(+)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5041,6 +5041,13 @@ int kvm_read_guest_virt(struct kvm_vcpu
 {
u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0;
 
+   /*
+* FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED
+* is returned, but our callers are not ready for that and they blindly
+* call kvm_inject_page_fault.  Ensure that they at least do not leak
+* uninitialized kernel stack memory into cr2 and error code.
+*/
+   memset(exception, 0, sizeof(*exception));
return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access,
  exception);
 }




[PATCH 4.20 348/352] serial: fix race between flush_to_ldisc and tty_open

2019-02-11 Thread Greg Kroah-Hartman
4.20-stable review patch.  If anyone has any objections, please let me know.

--

From: Greg Kroah-Hartman 

commit fedb5760648a291e949f2380d383b5b2d2749b5e upstream.

There still is a race window after the commit b027e2298bd588
("tty: fix data race between tty_init_dev and flush of buf"),
and we encountered this crash issue if receive_buf call comes
before tty initialization completes in tty_open and
tty->driver_data may be NULL.

CPU0CPU1

  tty_open
   tty_init_dev
 tty_ldisc_unlock
   schedule
flush_to_ldisc
 receive_buf
  tty_port_default_receive_buf
   tty_ldisc_receive_buf
n_tty_receive_buf_common
  __receive_buf
   uart_flush_chars
uart_start
/*tty->driver_data is NULL*/
   tty->ops->open
   /*init tty->driver_data*/

it can be fixed by extending ldisc semaphore lock in tty_init_dev
to driver_data initialized completely after tty->ops->open(), but
this will lead to get lock on one function and unlock in some other
function, and hard to maintain, so fix this race only by checking
tty->driver_data when receiving, and return if tty->driver_data
is NULL, and n_tty_receive_buf_common maybe calls uart_unthrottle,
so add the same check.

Because the tty layer knows nothing about the driver associated with the
device, the tty layer can not do anything here, it is up to the tty
driver itself to check for this type of race.  Fix up the serial driver
to correctly check to see if it is finished binding with the device when
being called, and if not, abort the tty calls.

[Description and problem report and testing from Li RongQing, I rewrote
the patch to be in the serial layer, not in the tty core - gregkh]

Reported-by: Li RongQing 
Tested-by: Li RongQing 
Signed-off-by: Wang Li 
Signed-off-by: Zhang Yu 
Signed-off-by: Li RongQing 
Cc: stable 
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/tty/serial/serial_core.c |6 ++
 1 file changed, 6 insertions(+)

--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -130,6 +130,9 @@ static void uart_start(struct tty_struct
struct uart_port *port;
unsigned long flags;
 
+   if (!state)
+   return;
+
port = uart_port_lock(state, flags);
__uart_start(tty);
uart_port_unlock(port, flags);
@@ -727,6 +730,9 @@ static void uart_unthrottle(struct tty_s
upstat_t mask = UPSTAT_SYNC_FIFO;
struct uart_port *port;
 
+   if (!state)
+   return;
+
port = uart_port_ref(state);
if (!port)
return;




[PATCH 4.19 001/313] devres: Align data[] to ARCH_KMALLOC_MINALIGN

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

From: Alexey Brodkin 

commit a66d972465d15b1d89281258805eb8b47d66bd36 upstream.

Initially we bumped into problem with 32-bit aligned atomic64_t
on ARC, see [1]. And then during quite lengthly discussion Peter Z.
mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense.
If allocation is done by plain kmalloc() obtained buffer will be
ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via
devm_kmalloc() should have any other alignment?

This way we at least get the same behavior for both types of
allocation.

[1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004009.html
[2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004036.html

Signed-off-by: Alexey Brodkin 
Cc: Greg Kroah-Hartman 
Cc: Geert Uytterhoeven 
Cc: David Laight 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: Vineet Gupta 
Cc: Will Deacon 
Cc: Greg KH 
Cc:  # 4.8+
Signed-off-by: Greg Kroah-Hartman 

---
 drivers/base/devres.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -24,8 +24,14 @@ struct devres_node {
 
 struct devres {
struct devres_node  node;
-   /* -- 3 pointers */
-   unsigned long long  data[]; /* guarantee ull alignment */
+   /*
+* Some archs want to perform DMA into kmalloc caches
+* and need a guaranteed alignment larger than
+* the alignment of a 64-bit integer.
+* Thus we use ARCH_KMALLOC_MINALIGN here and get exactly the same
+* buffer alignment as if it was allocated by plain kmalloc().
+*/
+   u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];
 };
 
 struct devres_group {




[PATCH 4.19 012/313] wil6210: fix reset flow for Talyn-mb

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit d083b2e2b7db5cca1791643d036e6597af27f49b ]

With current reset flow, Talyn sometimes get stuck causing PCIe
enumeration to fail. Fix this by removing some reset flow operations
that are not relevant for Talyn.
Setting bit 15 in RGF_HP_CTRL is WBE specific and is not in use for
all wil6210 devices.
For Sparrow, BIT_HPAL_PERST_FROM_PAD and BIT_CAR_PERST_RST were set
as a WA an HW issue.

Signed-off-by: Alexei Avshalom Lazar 
Signed-off-by: Maya Erez 
Signed-off-by: Kalle Valo 
Signed-off-by: Sasha Levin 
---
 drivers/net/wireless/ath/wil6210/main.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/wil6210/main.c 
b/drivers/net/wireless/ath/wil6210/main.c
index 7debed6bec06..a0fe8cbad104 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -995,10 +995,13 @@ static int wil_target_reset(struct wil6210_priv *wil, int 
no_flash)
 
wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->hw_name);
 
-   /* Clear MAC link up */
-   wil_s(wil, RGF_HP_CTRL, BIT(15));
-   wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_HPAL_PERST_FROM_PAD);
-   wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST);
+   if (wil->hw_version < HW_VER_TALYN) {
+   /* Clear MAC link up */
+   wil_s(wil, RGF_HP_CTRL, BIT(15));
+   wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0,
+ BIT_HPAL_PERST_FROM_PAD);
+   wil_s(wil, RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT_CAR_PERST_RST);
+   }
 
wil_halt_cpu(wil);
 
-- 
2.19.1





[PATCH 4.19 011/313] nds32: Fix gcc 8.0 compiler option incompatible.

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 4c3d6174e0e17599549f636ec48ddf78627a17fe ]

When the kernel configs of ftrace and frame pointer options are
choosed, the compiler option of kernel will incompatible.
Error message:
nds32le-linux-gcc: error: -pg and -fomit-frame-pointer are 
incompatible

Signed-off-by: Nickhu 
Signed-off-by: Zong Li 
Acked-by: Greentime Hu 
Signed-off-by: Greentime Hu 
Signed-off-by: Sasha Levin 
---
 arch/nds32/mm/Makefile | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/nds32/mm/Makefile b/arch/nds32/mm/Makefile
index 6b6855852223..7c5c15ad854a 100644
--- a/arch/nds32/mm/Makefile
+++ b/arch/nds32/mm/Makefile
@@ -4,4 +4,8 @@ obj-y   := extable.o tlb.o \
 
 obj-$(CONFIG_ALIGNMENT_TRAP)   += alignment.o
 obj-$(CONFIG_HIGHMEM)   += highmem.o
-CFLAGS_proc-n13.o  += -fomit-frame-pointer
+
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_proc.o = $(CC_FLAGS_FTRACE)
+endif
+CFLAGS_proc.o  += -fomit-frame-pointer
-- 
2.19.1





[PATCH 4.19 013/313] wil6210: fix memory leak in wil_find_tx_bcast_2

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 664497400c89a4d40aee51bcf48bbd2e4dc71104 ]

A successful call to wil_tx_ring takes skb reference so
it will only be freed in wil_tx_complete. Consume the skb
in wil_find_tx_bcast_2 to prevent memory leak.

Signed-off-by: Lior David 
Signed-off-by: Maya Erez 
Signed-off-by: Kalle Valo 
Signed-off-by: Sasha Levin 
---
 drivers/net/wireless/ath/wil6210/txrx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/wil6210/txrx.c 
b/drivers/net/wireless/ath/wil6210/txrx.c
index 6a7943e487fb..75c8aa297107 100644
--- a/drivers/net/wireless/ath/wil6210/txrx.c
+++ b/drivers/net/wireless/ath/wil6210/txrx.c
@@ -1313,6 +1313,8 @@ found:
wil_dbg_txrx(wil, "BCAST DUP -> ring %d\n", i);
wil_set_da_for_vring(wil, skb2, i);
wil_tx_ring(wil, vif, v2, skb2);
+   /* successful call to wil_tx_ring takes skb2 ref */
+   dev_kfree_skb_any(skb2);
} else {
wil_err(wil, "skb_copy failed\n");
}
-- 
2.19.1





[PATCH 4.19 010/313] gpu: ipu-v3: image-convert: Prevent race between run and unprepare

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 819bec35c8c9706185498c9222bd244e0781ad35 ]

Prevent possible race by parallel threads between ipu_image_convert_run()
and ipu_image_convert_unprepare(). This involves setting ctx->aborting
to true unconditionally so that no new job runs can be queued during
unprepare, and holding the ctx->aborting flag until the context is freed.

Note that the "normal" ipu_image_convert_abort() case (e.g. not during
context unprepare) should clear the ctx->aborting flag after aborting
any active run and clearing the context's pending queue. This is because
it should be possible to continue to use the conversion context and queue
more runs after an abort.

Signed-off-by: Steve Longerbeam 
Tested-by: Philipp Zabel 
Signed-off-by: Philipp Zabel 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c 
b/drivers/gpu/ipu-v3/ipu-image-convert.c
index f4081962784c..91653adc41cc 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -1524,7 +1524,7 @@ unlock:
 EXPORT_SYMBOL_GPL(ipu_image_convert_queue);
 
 /* Abort any active or pending conversions for this context */
-void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
+static void __ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
 {
struct ipu_image_convert_chan *chan = ctx->chan;
struct ipu_image_convert_priv *priv = chan->priv;
@@ -1551,7 +1551,7 @@ void ipu_image_convert_abort(struct ipu_image_convert_ctx 
*ctx)
 
need_abort = (run_count || active_run);
 
-   ctx->aborting = need_abort;
+   ctx->aborting = true;
 
spin_unlock_irqrestore(>irqlock, flags);
 
@@ -1572,7 +1572,11 @@ void ipu_image_convert_abort(struct 
ipu_image_convert_ctx *ctx)
dev_warn(priv->ipu->dev, "%s: timeout\n", __func__);
force_abort(ctx);
}
+}
 
+void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
+{
+   __ipu_image_convert_abort(ctx);
ctx->aborting = false;
 }
 EXPORT_SYMBOL_GPL(ipu_image_convert_abort);
@@ -1586,7 +1590,7 @@ void ipu_image_convert_unprepare(struct 
ipu_image_convert_ctx *ctx)
bool put_res;
 
/* make sure no runs are hanging around */
-   ipu_image_convert_abort(ctx);
+   __ipu_image_convert_abort(ctx);
 
dev_dbg(priv->ipu->dev, "%s: task %u: removing ctx %p\n", __func__,
chan->ic_task, ctx);
-- 
2.19.1





[PATCH 4.19 021/313] dlm: Dont swamp the CPU with callbacks queued during recovery

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 216f0efd19b9cc32207934fd1b87a45f2c4c593e ]

Before this patch, recovery would cause all callbacks to be delayed,
put on a queue, and afterward they were all queued to the callback
work queue. This patch does the same thing, but occasionally takes
a break after 25 of them so it won't swamp the CPU at the expense
of other RT processes like corosync.

Signed-off-by: Bob Peterson 
Signed-off-by: David Teigland 
Signed-off-by: Sasha Levin 
---
 fs/dlm/ast.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c
index 562fa8c3edff..47ee66d70109 100644
--- a/fs/dlm/ast.c
+++ b/fs/dlm/ast.c
@@ -292,6 +292,8 @@ void dlm_callback_suspend(struct dlm_ls *ls)
flush_workqueue(ls->ls_callback_wq);
 }
 
+#define MAX_CB_QUEUE 25
+
 void dlm_callback_resume(struct dlm_ls *ls)
 {
struct dlm_lkb *lkb, *safe;
@@ -302,15 +304,23 @@ void dlm_callback_resume(struct dlm_ls *ls)
if (!ls->ls_callback_wq)
return;
 
+more:
mutex_lock(>ls_cb_mutex);
list_for_each_entry_safe(lkb, safe, >ls_cb_delay, lkb_cb_list) {
list_del_init(>lkb_cb_list);
queue_work(ls->ls_callback_wq, >lkb_cb_work);
count++;
+   if (count == MAX_CB_QUEUE)
+   break;
}
mutex_unlock(>ls_cb_mutex);
 
if (count)
log_rinfo(ls, "dlm_callback_resume %d", count);
+   if (count == MAX_CB_QUEUE) {
+   count = 0;
+   cond_resched();
+   goto more;
+   }
 }
 
-- 
2.19.1





[PATCH 4.19 015/313] ath9k: dynack: use authentication messages for late ack

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 3831a2a0010c72e3956020cbf1057a1701a2e469 ]

In order to properly support dynack in ad-hoc mode running
wpa_supplicant, take into account authentication frames for
'late ack' detection. This patch has been tested on devices
mounted on offshore high-voltage stations connected through
~24Km link

Reported-by: Koen Vandeputte 
Tested-by: Koen Vandeputte 
Signed-off-by: Lorenzo Bianconi 
Signed-off-by: Kalle Valo 
Signed-off-by: Sasha Levin 
---
 drivers/net/wireless/ath/ath9k/dynack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/dynack.c 
b/drivers/net/wireless/ath/ath9k/dynack.c
index 7334c9b09e82..cc0dc966c512 100644
--- a/drivers/net/wireless/ath/ath9k/dynack.c
+++ b/drivers/net/wireless/ath/ath9k/dynack.c
@@ -187,7 +187,8 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct 
sk_buff *skb,
/* late ACK */
if (ts->ts_status & ATH9K_TXERR_XRETRY) {
if (ieee80211_is_assoc_req(hdr->frame_control) ||
-   ieee80211_is_assoc_resp(hdr->frame_control)) {
+   ieee80211_is_assoc_resp(hdr->frame_control) ||
+   ieee80211_is_auth(hdr->frame_control)) {
ath_dbg(common, DYNACK, "late ack\n");
ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2);
ath9k_hw_set_ack_timeout(ah, LATEACK_TO);
-- 
2.19.1





[PATCH 4.19 004/313] drm/vgem: Fix vgem_init to get drm device available.

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit d5c04dff24870ef07ce6453a3f4e1ffd9cf88d27 ]

Modify vgem_init to take platform dev as parent in drm_dev_init.
This will make drm device available at "/sys/devices/platform/vgem"
in x86 chromebook.

v2: rebase, address checkpatch typo and line over 80 characters

Cc: Daniel Vetter 
Signed-off-by: Deepak Sharma 
Reviewed-by: Sean Paul 
Signed-off-by: Emil Velikov 
Reviewed-by: Daniel Vetter 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20181023163550.15211-1-emil.l.veli...@gmail.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/vgem/vgem_drv.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index 0e5620f76ee0..6887db878b38 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -471,31 +471,31 @@ static int __init vgem_init(void)
if (!vgem_device)
return -ENOMEM;
 
-   ret = drm_dev_init(_device->drm, _driver, NULL);
-   if (ret)
-   goto out_free;
-
vgem_device->platform =
platform_device_register_simple("vgem", -1, NULL, 0);
if (IS_ERR(vgem_device->platform)) {
ret = PTR_ERR(vgem_device->platform);
-   goto out_fini;
+   goto out_free;
}
 
dma_coerce_mask_and_coherent(_device->platform->dev,
 DMA_BIT_MASK(64));
+   ret = drm_dev_init(_device->drm, _driver,
+  _device->platform->dev);
+   if (ret)
+   goto out_unregister;
 
/* Final step: expose the device/driver to userspace */
ret  = drm_dev_register(_device->drm, 0);
if (ret)
-   goto out_unregister;
+   goto out_fini;
 
return 0;
 
-out_unregister:
-   platform_device_unregister(vgem_device->platform);
 out_fini:
drm_dev_fini(_device->drm);
+out_unregister:
+   platform_device_unregister(vgem_device->platform);
 out_free:
kfree(vgem_device);
return ret;
-- 
2.19.1





[PATCH 4.19 017/313] scsi: mpt3sas: Call sas_remove_host before removing the target devices

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit dc730212e8a378763cb182b889f90c8101331332 ]

Call sas_remove_host() before removing the target devices in the driver's
.remove() callback function(i.e. during driver unload time).  So that
driver can provide a way to allow SYNC CACHE, START STOP unit commands
etc. (which are issued from SML) to the target drives during driver unload
time.

Once sas_remove_host() is called before removing the target drives then
driver can just clean up the resources allocated for target devices and no
need to call sas_port_delete_phy(), sas_port_delete() API's as these API's
internally called from sas_remove_host().

Signed-off-by: Suganath Prabu 
Reviewed-by: Bjorn Helgaas 
Reviewed-by: Andy Shevchenko 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
 drivers/scsi/mpt3sas/mpt3sas_transport.c | 7 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c 
b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 53133cfd420f..622832e55211 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -9809,6 +9809,7 @@ static void scsih_remove(struct pci_dev *pdev)
 
/* release all the volumes */
_scsih_ir_shutdown(ioc);
+   sas_remove_host(shost);
list_for_each_entry_safe(raid_device, next, >raid_device_list,
list) {
if (raid_device->starget) {
@@ -9851,7 +9852,6 @@ static void scsih_remove(struct pci_dev *pdev)
ioc->sas_hba.num_phys = 0;
}
 
-   sas_remove_host(shost);
mpt3sas_base_detach(ioc);
spin_lock(_lock);
list_del(>list);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c 
b/drivers/scsi/mpt3sas/mpt3sas_transport.c
index f8cc2677c1cd..20d36061c217 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_transport.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c
@@ -834,10 +834,13 @@ mpt3sas_transport_port_remove(struct MPT3SAS_ADAPTER 
*ioc, u64 sas_address,
mpt3sas_port->remote_identify.sas_address,
mpt3sas_phy->phy_id);
mpt3sas_phy->phy_belongs_to_port = 0;
-   sas_port_delete_phy(mpt3sas_port->port, mpt3sas_phy->phy);
+   if (!ioc->remove_host)
+   sas_port_delete_phy(mpt3sas_port->port,
+   mpt3sas_phy->phy);
list_del(_phy->port_siblings);
}
-   sas_port_delete(mpt3sas_port->port);
+   if (!ioc->remove_host)
+   sas_port_delete(mpt3sas_port->port);
kfree(mpt3sas_port);
 }
 
-- 
2.19.1





[PATCH 4.19 018/313] scsi: lpfc: Fix LOGO/PLOGI handling when triggerd by ABTS Timeout event

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 30e196cacefdd9a38c857caed23cefc9621bc5c1 ]

After a LOGO in response to an ABTS timeout, a PLOGI wasn't issued to
re-establish the login.  An nlp_type check in the LOGO completion
handler failed to restart discovery for NVME targets.  Revised the
nlp_type check for NVME as well as SCSI.

While reviewing the LOGO handling a few other issues were seen and
were addressed:

- Better lock synchronization around ndlp data types

- When the ABTS times out, unregister the RPI before sending the LOGO
  so that all local exchange contexts are cleared and nothing received
  while awaiting LOGO/PLOGI handling will be accepted.

- LOGO handling optimized to:
   Wait only R_A_TOV for a response.
   It doesn't need to be retried on timeout. If there wasn't a
 response, a PLOGI will be sent, thus an implicit logout
 applies as well when the other port sees it.
   If there is a response, any kind of response is considered "good"
 and the XRI quarantined for a exchange qualifier window.

- PLOGI is issued as soon a LOGO state is resolved.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_els.c   | 49 +-
 drivers/scsi/lpfc/lpfc_nportdisc.c |  5 +++
 2 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 56a4f626349c..0d214e6b8e9a 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -242,6 +242,8 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t 
expectRsp,
icmd->ulpCommand = CMD_ELS_REQUEST64_CR;
if (elscmd == ELS_CMD_FLOGI)
icmd->ulpTimeout = FF_DEF_RATOV * 2;
+   else if (elscmd == ELS_CMD_LOGO)
+   icmd->ulpTimeout = phba->fc_ratov;
else
icmd->ulpTimeout = phba->fc_ratov * 2;
} else {
@@ -2682,16 +2684,15 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct 
lpfc_iocbq *cmdiocb,
goto out;
}
 
+   /* The LOGO will not be retried on failure.  A LOGO was
+* issued to the remote rport and a ACC or RJT or no Answer are
+* all acceptable.  Note the failure and move forward with
+* discovery.  The PLOGI will retry.
+*/
if (irsp->ulpStatus) {
-   /* Check for retry */
-   if (lpfc_els_retry(phba, cmdiocb, rspiocb)) {
-   /* ELS command is being retried */
-   skip_recovery = 1;
-   goto out;
-   }
/* LOGO failed */
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
-"2756 LOGO failure DID:%06X Status:x%x/x%x\n",
+"2756 LOGO failure, No Retry DID:%06X 
Status:x%x/x%x\n",
 ndlp->nlp_DID, irsp->ulpStatus,
 irsp->un.ulpWord[4]);
/* Do not call DSM for lpfc_els_abort'ed ELS cmds */
@@ -2737,7 +2738,8 @@ out:
 * For any other port type, the rpi is unregistered as an implicit
 * LOGO.
 */
-   if ((ndlp->nlp_type & NLP_FCP_TARGET) && (skip_recovery == 0)) {
+   if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET) &&
+   skip_recovery == 0) {
lpfc_cancel_retry_delay_tmo(vport, ndlp);
spin_lock_irqsave(shost->host_lock, flags);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
@@ -2770,6 +2772,8 @@ out:
  * will be stored into the context1 field of the IOCB for the completion
  * callback function to the LOGO ELS command.
  *
+ * Callers of this routine are expected to unregister the RPI first
+ *
  * Return code
  *   0 - successfully issued logo
  *   1 - failed to issue logo
@@ -2811,22 +2815,6 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct 
lpfc_nodelist *ndlp,
"Issue LOGO:  did:x%x",
ndlp->nlp_DID, 0, 0);
 
-   /*
-* If we are issuing a LOGO, we may try to recover the remote NPort
-* by issuing a PLOGI later. Even though we issue ELS cmds by the
-* VPI, if we have a valid RPI, and that RPI gets unreg'ed while
-* that ELS command is in-flight, the HBA returns a IOERR_INVALID_RPI
-* for that ELS cmd. To avoid this situation, lets get rid of the
-* RPI right now, before any ELS cmds are sent.
-*/
-   spin_lock_irq(shost->host_lock);
-   ndlp->nlp_flag |= NLP_ISSUE_LOGO;
-   spin_unlock_irq(shost->host_lock);
-   if (lpfc_unreg_rpi(vport, ndlp)) {
-   lpfc_els_free_iocb(phba, elsiocb);
-   return 0;
-   }
-
phba->fc_stat.elsXmitLOGO++;

Re: [PATCH] net: phy: mdio_bus: add missing device_del() in mdiobus_register() error handling

2019-02-11 Thread Thomas Petazzoni
Hello Andrew,

On Wed, 16 Jan 2019 16:44:39 +0100
Andrew Lunn  wrote:

> > On Wed, 16 Jan 2019 15:48:29 +0100, Andrew Lunn wrote:
> >   
> > > Reviewed-by: Andrew Lunn 
> > > 
> > > However, i wounder if it makes sense to add a label before the
> > > existing device_del() at the end of the function, and convert this,
> > > and the case above into a goto? That might scale better, avoiding the
> > > same issue in the future?  
> > 
> > That's another option indeed.
> > 
> > Hmm, now that I looked at it, I think we should use device_unregister()
> > instead. device_unregister() does both device_del() and put_device().  
> 
> Hi Thomas
> 
> device_unregister() does seem symmetrical with device_register() which
> is what we are trying to undo.

Even if DaveM already merged my simple fix, I had a further look at
whether we should be using device_unregister(), and in fact we should
not, but not really for a good reason: because the mdio API is not very
symmetrical.

The typical flow is:

probe() {
bus = mdiobus_alloc();
if (!bus)
return -ENOMEM;

ret = mdiobus_register();
if (ret) {
mdiobus_free(bus);

...
}

remove() {
mdiobus_unregister();
mdiobus_free();
}

mdiobus_alloc() only does memory allocation, i.e it has no side effects
on the device model data structures.

mdiobus_register() does a device_register(). If it fails, it only
cleans up with a device_del(), i.e it doesn't do the put_device() that
it should do to fully "undo" its effect.

mdiobus_unregister() does a device_del(), i.e it also doesn't do the
opposite of mdiobus_register(), which should be device_del() +
put_device() (device_unregister() is a shortcut for both).

mdiobus_free() does the put_device()

So:

 * mdiobus_alloc() / mdiobus_free() are not symmetrical in terms of
   their interaction with the device model data structures

 * On error, mdiobus_register() leaves a non-zero reference count to the
   bus->dev structure, which will be freed up by mdiobus_free()

 * mdiobus_unregister() leaves a non-zero reference count to the
   bus->dev structure, which will be freed up by mdiobus_free()

So, if we were to use device_unregister() in the error path of
mdiobus_register() and in mdiobus_unregister(), it would break how
mdiobus_free() works.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH 4.19 014/313] ath10k: assign n_cipher_suites for WCN3990

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 2bd345cd2bfc0bd44528896313c0b45f087bdf67 ]

Commit 2ea9f12cefe4 ("ath10k: add new cipher suite support") added a new
n_cipher_suites HW param with a fallback value and a warning log. Commit
03a72288c546 ("ath10k: wmi: add hw params entry for wcn3990") later
added WCN3990 HW entries, but it missed the n_cipher_suites.

Rather than seeing this warning every boot

  ath10k_snoc 1880.wifi: invalid hw_params.n_cipher_suites 0

let's provide the appropriate value.

Cc: Rakesh Pillai 
Cc: Govind Singh 
Signed-off-by: Brian Norris 
Signed-off-by: Kalle Valo 
Signed-off-by: Sasha Levin 
---
 drivers/net/wireless/ath/ath10k/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index c40cd129afe7..5210cffb5344 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -532,6 +532,7 @@ static const struct ath10k_hw_params 
ath10k_hw_params_list[] = {
.hw_ops = _ops,
.decap_align_bytes = 1,
.num_peers = TARGET_HL_10_TLV_NUM_PEERS,
+   .n_cipher_suites = 8,
.ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT,
.num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES,
.target_64bit = true,
-- 
2.19.1





[PATCH 4.19 020/313] clk: boston: fix possible memory leak in clk_boston_setup()

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 46fda5b5067a391912cf73bf3d32c26b6a22ad09 ]

Smatch report warnings:
drivers/clk/imgtec/clk-boston.c:76 clk_boston_setup() warn: possible memory 
leak of 'onecell'
drivers/clk/imgtec/clk-boston.c:83 clk_boston_setup() warn: possible memory 
leak of 'onecell'
drivers/clk/imgtec/clk-boston.c:90 clk_boston_setup() warn: possible memory 
leak of 'onecell'

'onecell' is malloced in clk_boston_setup(), but not be freed
before leaving from the error handling cases.

Signed-off-by: Yi Wang 
Signed-off-by: Stephen Boyd 
Signed-off-by: Sasha Levin 
---
 drivers/clk/imgtec/clk-boston.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/imgtec/clk-boston.c b/drivers/clk/imgtec/clk-boston.c
index 15af423cc0c9..f5d54a64d33c 100644
--- a/drivers/clk/imgtec/clk-boston.c
+++ b/drivers/clk/imgtec/clk-boston.c
@@ -73,27 +73,32 @@ static void __init clk_boston_setup(struct device_node *np)
hw = clk_hw_register_fixed_rate(NULL, "input", NULL, 0, in_freq);
if (IS_ERR(hw)) {
pr_err("failed to register input clock: %ld\n", PTR_ERR(hw));
-   return;
+   goto error;
}
onecell->hws[BOSTON_CLK_INPUT] = hw;
 
hw = clk_hw_register_fixed_rate(NULL, "sys", "input", 0, sys_freq);
if (IS_ERR(hw)) {
pr_err("failed to register sys clock: %ld\n", PTR_ERR(hw));
-   return;
+   goto error;
}
onecell->hws[BOSTON_CLK_SYS] = hw;
 
hw = clk_hw_register_fixed_rate(NULL, "cpu", "input", 0, cpu_freq);
if (IS_ERR(hw)) {
pr_err("failed to register cpu clock: %ld\n", PTR_ERR(hw));
-   return;
+   goto error;
}
onecell->hws[BOSTON_CLK_CPU] = hw;
 
err = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, onecell);
if (err)
pr_err("failed to add DT provider: %d\n", err);
+
+   return;
+
+error:
+   kfree(onecell);
 }
 
 /*
-- 
2.19.1





[PATCH 4.19 016/313] scsi: lpfc: Correct LCB RJT handling

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit b114d9009d386276bfc3352289fc235781ae3353 ]

When LCB's are rejected, if beaconing was already in progress, the
Reason Code Explanation was not being set. Should have been set to
command in progress.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
Reviewed-by: Hannes Reinecke 
Signed-off-by: Martin K. Petersen 
Signed-off-by: Sasha Levin 
---
 drivers/scsi/lpfc/lpfc_els.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 4dda969e947c..56a4f626349c 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5701,6 +5701,9 @@ error:
stat = (struct ls_rjt *)(pcmd + sizeof(uint32_t));
stat->un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
 
+   if (shdr_add_status == ADD_STATUS_OPERATION_ALREADY_ACTIVE)
+   stat->un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS;
+
elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
phba->fc_stat.elsXmitLSRJT++;
rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0);
-- 
2.19.1





[PATCH v3 1/2] media: uapi: Add H264 low-level decoder API compound controls.

2019-02-11 Thread Maxime Ripard
From: Pawel Osciak 

Stateless video codecs will require both the H264 metadata and slices in
order to be able to decode frames.

This introduces the definitions for a new pixel format for H264 slices that
have been parsed, as well as the structures used to pass the metadata from
the userspace to the kernel.

Co-Developed-by: Maxime Ripard 
Signed-off-by: Pawel Osciak 
Signed-off-by: Guenter Roeck 
Signed-off-by: Maxime Ripard 
---
 Documentation/media/uapi/v4l/biblio.rst|   9 +-
 Documentation/media/uapi/v4l/extended-controls.rst | 530 ++-
 Documentation/media/uapi/v4l/pixfmt-compressed.rst |  20 +-
 Documentation/media/uapi/v4l/vidioc-queryctrl.rst  |  30 +-
 Documentation/media/videodev2.h.rst.exceptions |   5 +-
 drivers/media/v4l2-core/v4l2-ctrls.c   |  42 +-
 drivers/media/v4l2-core/v4l2-ioctl.c   |   1 +-
 include/media/h264-ctrls.h | 179 +-
 include/media/v4l2-ctrls.h |  13 +-
 include/uapi/linux/videodev2.h |   1 +-
 10 files changed, 829 insertions(+), 1 deletion(-)
 create mode 100644 include/media/h264-ctrls.h

diff --git a/Documentation/media/uapi/v4l/biblio.rst 
b/Documentation/media/uapi/v4l/biblio.rst
index ec33768c055e..3fc3f7ff338a 100644
--- a/Documentation/media/uapi/v4l/biblio.rst
+++ b/Documentation/media/uapi/v4l/biblio.rst
@@ -122,6 +122,15 @@ ITU BT.1119
 
 :author:International Telecommunication Union (http://www.itu.ch)
 
+.. _h264:
+
+ITU H.264
+=
+
+:title: ITU-T Recommendation H.264 "Advanced Video Coding for Generic 
Audiovisual Services"
+
+:author:International Telecommunication Union (http://www.itu.ch)
+
 .. _jfif:
 
 JFIF
diff --git a/Documentation/media/uapi/v4l/extended-controls.rst 
b/Documentation/media/uapi/v4l/extended-controls.rst
index af4273aa5e85..7e306aa0d0a6 100644
--- a/Documentation/media/uapi/v4l/extended-controls.rst
+++ b/Documentation/media/uapi/v4l/extended-controls.rst
@@ -1703,6 +1703,536 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
non-intra-coded frames, in zigzag scanning order. Only relevant for
non-4:2:0 YUV formats.
 
+.. _v4l2-mpeg-h264:
+
+``V4L2_CID_MPEG_VIDEO_H264_SPS (struct)``
+Specifies the sequence parameter set (as extracted from the
+bitstream) for the associated H264 slice data. This includes the
+necessary parameters for configuring a stateless hardware decoding
+pipeline for H264.  The bitstream parameters are defined according
+to :ref:`h264`. Unless there's a specific comment, refer to the
+specification for the documentation of these fields, section 7.4.2.1.1
+"Sequence Parameter Set Data Semantics".
+
+.. note::
+
+   This compound control is not yet part of the public kernel API and
+   it is expected to change.
+
+.. c:type:: v4l2_ctrl_h264_sps
+
+.. cssclass:: longtable
+
+.. flat-table:: struct v4l2_ctrl_h264_sps
+:header-rows:  0
+:stub-columns: 0
+:widths:   1 1 2
+
+* - __u8
+  - ``profile_idc``
+  -
+* - __u8
+  - ``constraint_set_flags``
+  - See :ref:`Sequence Parameter Set Constraints Set Flags 
`
+* - __u8
+  - ``level_idc``
+  -
+* - __u8
+  - ``seq_parameter_set_id``
+  -
+* - __u8
+  - ``chroma_format_idc``
+  -
+* - __u8
+  - ``bit_depth_luma_minus8``
+  -
+* - __u8
+  - ``bit_depth_chroma_minus8``
+  -
+* - __u8
+  - ``log2_max_frame_num_minus4``
+  -
+* - __u8
+  - ``pic_order_cnt_type``
+  -
+* - __u8
+  - ``log2_max_pic_order_cnt_lsb_minus4``
+  -
+* - __u8
+  - ``max_num_ref_frames``
+  -
+* - __u8
+  - ``num_ref_frames_in_pic_order_cnt_cycle``
+  -
+* - __s32
+  - ``offset_for_ref_frame[255]``
+  -
+* - __s32
+  - ``offset_for_non_ref_pic``
+  -
+* - __s32
+  - ``offset_for_top_to_bottom_field``
+  -
+* - __u16
+  - ``pic_width_in_mbs_minus1``
+  -
+* - __u16
+  - ``pic_height_in_map_units_minus1``
+  -
+* - __u32
+  - ``flags``
+  - See :ref:`Sequence Parameter Set Flags `
+
+.. _h264_sps_constraints_set_flags:
+
+``Sequence Parameter Set Constraints Set Flags``
+
+.. cssclass:: longtable
+
+.. flat-table::
+:header-rows:  0
+:stub-columns: 0
+:widths:   1 1 2
+
+* - ``V4L2_H264_SPS_CONSTRAINT_SET0_FLAG``
+  - 0x0001
+  -
+* - ``V4L2_H264_SPS_CONSTRAINT_SET1_FLAG``
+  - 0x0002
+  -
+* - ``V4L2_H264_SPS_CONSTRAINT_SET2_FLAG``
+  - 0x0004
+  -
+* - ``V4L2_H264_SPS_CONSTRAINT_SET3_FLAG``
+  - 0x0008
+  -
+* - ``V4L2_H264_SPS_CONSTRAINT_SET4_FLAG``
+  - 0x0010
+  -
+* - ``V4L2_H264_SPS_CONSTRAINT_SET5_FLAG``
+  - 0x0020
+  -
+
+.. _h264_sps_flags:
+
+``Sequence Parameter Set Flags``
+
+.. cssclass:: longtable
+
+.. flat-table::
+:header-rows:  0
+

Re: [PATCH 4.20 066/352] ASoC: sunxi: sun50i-codec-analog: Add support for cpvdd regulator supply

2019-02-11 Thread Mark Brown
On Mon, Feb 11, 2019 at 03:14:53PM +0100, Greg Kroah-Hartman wrote:

> On the Allwinner A64 SoCs, the audio codec has a built-in headphone
> amplifier. This amplifier has a power supply separate from the rest of
> the analog audio circuitry, labeled cpvdd.

> This patch adds a DAPM widget for this supply, and ties it to the
> headphone amp widget.

This is more a new feature than a bug fix, it doesn't look like obvious
stable material.


signature.asc
Description: PGP signature


[PATCH 4.19 008/313] drm/sun4i: Initialize registers in tcon-top driver

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit c96d62215fb540e2ae61de44cb7caf4db50958e3 ]

It turns out that TCON TOP registers in H6 SoC have non-zero reset
value. This may cause issues if bits are not changed during
configuration.

To prevent that, initialize registers to 0.

Signed-off-by: Jernej Skrabec 
Signed-off-by: Maxime Ripard 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20181104182705.18047-24-jernej.skra...@siol.net
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c 
b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
index d5240b777a8f..adcdf946c365 100644
--- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
+++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
@@ -168,6 +168,13 @@ static int sun8i_tcon_top_bind(struct device *dev, struct 
device *master,
goto err_assert_reset;
}
 
+   /*
+* At least on H6, some registers have some bits set by default
+* which may cause issues. Clear them here.
+*/
+   writel(0, regs + TCON_TOP_PORT_SEL_REG);
+   writel(0, regs + TCON_TOP_GATE_SRC_REG);
+
/*
 * TCON TOP has two muxes, which select parent clock for each TCON TV
 * channel clock. Parent could be either TCON TV or TVE clock. For now
-- 
2.19.1





[PATCH 4.19 009/313] genirq/affinity: Spread IRQs to all available NUMA nodes

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit b82592199032bf7c778f861b936287e37ebc9f62 ]

If the number of NUMA nodes exceeds the number of MSI/MSI-X interrupts
which are allocated for a device, the interrupt affinity spreading code
fails to spread them across all nodes.

The reason is, that the spreading code starts from node 0 and continues up
to the number of interrupts requested for allocation. This leaves the nodes
past the last interrupt unused.

This results in interrupt concentration on the first nodes which violates
the assumption of the block layer that all nodes are covered evenly. As a
consequence the NUMA nodes above the number of interrupts are all assigned
to hardware queue 0 and therefore NUMA node 0, which results in bad
performance and has CPU hotplug implications, because queue 0 gets shut
down when the last CPU of node 0 is offlined.

Go over all NUMA nodes and assign them round-robin to all requested
interrupts to solve this.

[ tglx: Massaged changelog ]

Signed-off-by: Long Li 
Signed-off-by: Thomas Gleixner 
Reviewed-by: Ming Lei 
Cc: Michael Kelley 
Link: https://lkml.kernel.org/r/20181102180248.13583-1-lon...@linuxonhyperv.com
Signed-off-by: Sasha Levin 
---
 kernel/irq/affinity.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index f4f29b9d90ee..e12cdf637c71 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -117,12 +117,11 @@ static int irq_build_affinity_masks(const struct 
irq_affinity *affd,
 */
if (numvecs <= nodes) {
for_each_node_mask(n, nodemsk) {
-   cpumask_copy(masks + curvec, node_to_cpumask[n]);
-   if (++done == numvecs)
-   break;
+   cpumask_or(masks + curvec, masks + curvec, 
node_to_cpumask[n]);
if (++curvec == last_affv)
curvec = affd->pre_vectors;
}
+   done = numvecs;
goto out;
}
 
-- 
2.19.1





[PATCH 4.19 000/313] 4.19.21-stable review

2019-02-11 Thread Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.21 release.
There are 313 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Wed Feb 13 14:17:25 UTC 2019.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:

https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.21-rc1.gz
or in the git tree and branch at:

git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
linux-4.19.y
and the diffstat can be found below.

thanks,

greg k-h

-
Pseudo-Shortlog of commits:

Greg Kroah-Hartman 
Linux 4.19.21-rc1

Peter Zijlstra 
perf/x86/intel: Delay memory deallocation until x86_pmu_dead_cpu()

Mike Marciniszyn 
IB/hfi1: Add limit test for RC/UC send via loopback

Huacai Chen 
cacheinfo: Keep the old value if of_property_read_u32 fails

Chris Brandt 
serial: sh-sci: Do not free irqs that have already been freed

Andy Shevchenko 
serial: 8250_pci: Make PCI class test non fatal

Greg Kroah-Hartman 
serial: fix race between flush_to_ldisc and tty_open

Gustavo A. R. Silva 
perf tests evsel-tp-sched: Fix bitwise operator

Mark Rutland 
perf/core: Don't WARN() for impossible ring-buffer sizes

Tony Luck 
x86/MCE: Initialize mce.bank in the case of a fatal error in 
mce_no_way_out()

Kan Liang 
perf/x86/intel/uncore: Add Node ID mask

Josh Poimboeuf 
cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM

Peter Shier 
KVM: nVMX: unconditionally cancel preemption timer in free_nested 
(CVE-2019-7221)

Jann Horn 
kvm: fix kvm_ioctl_create_device() reference counting (CVE-2019-6974)

Paolo Bonzini 
KVM: x86: work around leak of uninitialized stack contents (CVE-2019-7222)

James Bottomley 
scsi: aic94xx: fix module loading

Vaibhav Jain 
scsi: cxlflash: Prevent deadlock when adapter probe fails

Johan Hovold 
staging: speakup: fix tty-operation NULL derefs

Paul Elder 
usb: gadget: musb: fix short isoc packets with inventra dma

Gustavo A. R. Silva 
usb: gadget: udc: net2272: Fix bitwise and boolean operations

Tejas Joglekar 
usb: dwc3: gadget: Handle 0 xfer length for OUT EP

Bin Liu 
usb: phy: am335x: fix race condition in _probe

Marc Zyngier 
irqchip/gic-v3-its: Plug allocation race for devices sharing a DevID

Thomas Gleixner 
futex: Handle early deadlock return correctly

Leonid Iziumtsev 
dmaengine: imx-dma: fix wrong callback invoke

Lukas Wunner 
dmaengine: bcm2835: Fix abort of transactions

Lukas Wunner 
dmaengine: bcm2835: Fix interrupt race on RT

Vladis Dronov 
HID: debug: fix the ring buffer implementation

Miklos Szeredi 
fuse: handle zero sized retrieve correctly

Miklos Szeredi 
fuse: decrement NR_WRITEBACK_TEMP on the right page

Jann Horn 
fuse: call pipe_buf_release() under pipe lock

Jeremy Soller 
ALSA: hda/realtek - Headset microphone support for System76 darp5

Takashi Iwai 
ALSA: hda/realtek - Use a common helper for hp pin reference

Kailang Yang 
ALSA: hda/realtek - Fix lose hp_pins for disable auto mute

Takashi Iwai 
ALSA: hda - Serialize codec registrations

Udo Eberhardt 
ALSA: usb-audio: Add support for new T+A USB DAC

Charles Keepax 
ALSA: compress: Fix stop handling on compressed capture streams

Brian Foster 
xfs: eof trim writeback mapping as soon as it is cached

Raed Salem 
net/mlx5e: FPGA, fix Innova IPsec TX offload data path performance

Toshiaki Makita 
virtio_net: Account for tx bytes and packets on sending xdp_frames

Dan Carpenter 
skge: potential memory corruption in skge_get_regs()

Greg Kroah-Hartman 
sctp: walk the list of asoc safely

Xin Long 
sctp: check and update stream->out_curr when allocating stream_out

Eric Dumazet 
rxrpc: bad unlock balance in rxrpc_recvmsg

Russell King 
Revert "net: phy: marvell: avoid pause mode on SGMII-to-Copper for 88e151x"

Eric Dumazet 
rds: fix refcount bug in rds_sock_addref

Florian Fainelli 
net: systemport: Fix WoL with password after deep sleep

Cong Wang 
net/mlx5e: Force CHECKSUM_UNNECESSARY for short ethernet frames

Rundong Ge 
net: dsa: slave: Don't propagate flag changes on down slave interfaces

Andrew Lunn 
net: dsa: mv88e6xxx: Fix counting of ATU violations

Dan Carpenter 
net: dsa: Fix NULL checking in dsa_slave_set_eee()

Marc Zyngier 
net: dsa: Fix lockdep false positive splat

Sebastian Andrzej Siewior 
net: dp83640: expire old TX-skb

Bart Van Assche 
lib/test_rhashtable: Make test_insert_dup() allocate its hash table 
dynamically

Govindarajulu Varadarajan 
enic: fix checksum validation for IPv6

Eric Dumazet 
dccp: fool proof ccid_hc_[rt]x_parse_options()

Eduardo Valentin 
thermal: hwmon: inline helpers when CONFIG_THERMAL_HWMON is not set

Eric 

[PATCH 4.19 033/313] Tools: hv: kvp: Fix a warning of buffer overflow with gcc 8.0.1

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 4fcba7802c3e15a6e56e255871d6c72f829b9dd8 ]

The patch fixes:

hv_kvp_daemon.c: In function 'kvp_set_ip_info':
hv_kvp_daemon.c:1305:2: note: 'snprintf' output between 41 and 4136 bytes
into a destination of size 4096

The "(unsigned int)str_len" is to avoid:

hv_kvp_daemon.c:1309:30: warning: comparison of integer expressions of
different signedness: 'int' and 'long unsigned int' [-Wsign-compare]

Signed-off-by: Dexuan Cui 
Cc: K. Y. Srinivasan 
Cc: Haiyang Zhang 
Cc: Stephen Hemminger 
Signed-off-by: K. Y. Srinivasan 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 tools/hv/hv_kvp_daemon.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c
index bbb2a8ef367c..d7e06fe0270e 100644
--- a/tools/hv/hv_kvp_daemon.c
+++ b/tools/hv/hv_kvp_daemon.c
@@ -1178,6 +1178,7 @@ static int kvp_set_ip_info(char *if_name, struct 
hv_kvp_ipaddr_value *new_val)
FILE *file;
char cmd[PATH_MAX];
char *mac_addr;
+   int str_len;
 
/*
 * Set the configuration for the specified interface with
@@ -1301,8 +1302,18 @@ static int kvp_set_ip_info(char *if_name, struct 
hv_kvp_ipaddr_value *new_val)
 * invoke the external script to do its magic.
 */
 
-   snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
-"hv_set_ifconfig", if_file);
+   str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
+  "hv_set_ifconfig", if_file);
+   /*
+* This is a little overcautious, but it's necessary to suppress some
+* false warnings from gcc 8.0.1.
+*/
+   if (str_len <= 0 || (unsigned int)str_len >= sizeof(cmd)) {
+   syslog(LOG_ERR, "Cmd '%s' (len=%d) may be too long",
+  cmd, str_len);
+   return HV_E_FAIL;
+   }
+
if (system(cmd)) {
syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
cmd, errno, strerror(errno));
-- 
2.19.1





[PATCH 4.19 035/313] vbox: fix link error with gcc -Og

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit b8ae30a7020d61e0504529adf45abb08fa5c59f5 ]

With the new CONFIG_CC_OPTIMIZE_FOR_DEBUGGING option, we get a link
error in the vboxguest driver, when that fails to optimize out the
call to the compat handler:

drivers/virt/vboxguest/vboxguest_core.o: In function `vbg_ioctl_hgcm_call':
vboxguest_core.c:(.text+0x1f6e): undefined reference to `vbg_hgcm_call32'

Another compile-time check documents better what we want and avoids
the error.

Acked-by: Randy Dunlap 
Tested-by: Randy Dunlap 
Signed-off-by: Arnd Bergmann 
Reviewed-by: Hans de Goede 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/virt/vboxguest/vboxguest_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virt/vboxguest/vboxguest_core.c 
b/drivers/virt/vboxguest/vboxguest_core.c
index 3093655c7b92..1475ed5ffcde 100644
--- a/drivers/virt/vboxguest/vboxguest_core.c
+++ b/drivers/virt/vboxguest/vboxguest_core.c
@@ -1312,7 +1312,7 @@ static int vbg_ioctl_hgcm_call(struct vbg_dev *gdev,
return -EINVAL;
}
 
-   if (f32bit)
+   if (IS_ENABLED(CONFIG_COMPAT) && f32bit)
ret = vbg_hgcm_call32(gdev, client_id,
  call->function, call->timeout_ms,
  VBG_IOCTL_HGCM_CALL_PARMS32(call),
-- 
2.19.1





Re: [PATCH 2/5] genirq/affinity: allow driver to setup managed IRQ's affinity

2019-02-11 Thread Bjorn Helgaas
On Mon, Feb 11, 2019 at 11:54:00AM +0800, Ming Lei wrote:
> On Sun, Feb 10, 2019 at 05:30:41PM +0100, Thomas Gleixner wrote:
> > On Fri, 25 Jan 2019, Ming Lei wrote:
> > 
> > > This patch introduces callback of .setup_affinity into 'struct
> > > irq_affinity', so that:
> > 
> > Please see Documentation/process/submitting-patches.rst. Search for 'This
> > patch' 
> 
> Sorry for that, because I am not a native English speaker and it looks a bit
> difficult for me to understand the subtle difference.

I think Thomas is saying that instead of "This patch introduces
callback ...", you could say "Introduce callback of ...".

The changelog is *part* of the patch, so the context is obvious and
there's no need to include the words "This patch".

I make the same changes to patches I receive.  In fact, I would go
even further and say "Add callback .setup_affinity() ..." because "add"
means the same as "introduce" but is shorter and simpler.

Bjorn


[PATCH 4.19 037/313] i40e: prevent overlapping tx_timeout recover

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit d5585b7b6846a6d0f9517afe57be3843150719da ]

If a TX hang occurs, we attempt to recover by incrementally resetting.
If we're starved for CPU time, it's possible the reset doesn't actually
complete (or even fire) before another tx_timeout fires causing us to
fly through the different resets without actually doing them.

This adds a bit to set and check if a timeout recovery is already
pending and, if so, bail out of tx_timeout.  The bit will get cleared at
the end of i40e_rebuild when reset is complete.

Signed-off-by: Alan Brady 
Tested-by: Andrew Bowers 
Signed-off-by: Jeff Kirsher 
Signed-off-by: Sasha Levin 
---
 drivers/net/ethernet/intel/i40e/i40e.h  | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h 
b/drivers/net/ethernet/intel/i40e/i40e.h
index 7a80652e2500..f84e2c2d02c0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -122,6 +122,7 @@ enum i40e_state_t {
__I40E_MDD_EVENT_PENDING,
__I40E_VFLR_EVENT_PENDING,
__I40E_RESET_RECOVERY_PENDING,
+   __I40E_TIMEOUT_RECOVERY_PENDING,
__I40E_MISC_IRQ_REQUESTED,
__I40E_RESET_INTR_RECEIVED,
__I40E_REINIT_REQUESTED,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index ed9d3fc4aaba..bfa5c525cf31 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -336,6 +336,10 @@ static void i40e_tx_timeout(struct net_device *netdev)
  (pf->tx_timeout_last_recovery + netdev->watchdog_timeo)))
return;   /* don't do any new action before the next timeout */
 
+   /* don't kick off another recovery if one is already pending */
+   if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state))
+   return;
+
if (tx_ring) {
head = i40e_get_head(tx_ring);
/* Read interrupt register */
@@ -9566,6 +9570,7 @@ end_core_reset:
clear_bit(__I40E_RESET_FAILED, pf->state);
 clear_recovery:
clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state);
+   clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state);
 }
 
 /**
-- 
2.19.1





[PATCH 4.19 042/313] ARM: OMAP2+: hwmod: Fix some section annotations

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit c10b26abeb53cabc1e6271a167d3f3d396ce0218 ]

When building the kernel with Clang, the following section mismatch
warnings appears:

WARNING: vmlinux.o(.text+0x2d398): Section mismatch in reference from
the function _setup() to the function .init.text:_setup_iclk_autoidle()
The function _setup() references
the function __init _setup_iclk_autoidle().
This is often because _setup lacks a __init
annotation or the annotation of _setup_iclk_autoidle is wrong.

WARNING: vmlinux.o(.text+0x2d3a0): Section mismatch in reference from
the function _setup() to the function .init.text:_setup_reset()
The function _setup() references
the function __init _setup_reset().
This is often because _setup lacks a __init
annotation or the annotation of _setup_reset is wrong.

WARNING: vmlinux.o(.text+0x2d408): Section mismatch in reference from
the function _setup() to the function .init.text:_setup_postsetup()
The function _setup() references
the function __init _setup_postsetup().
This is often because _setup lacks a __init
annotation or the annotation of _setup_postsetup is wrong.

_setup is used in omap_hwmod_allocate_module, which isn't marked __init
and looks like it shouldn't be, meaning to fix these warnings, those
functions must be moved out of the init section, which this patch does.

Signed-off-by: Nathan Chancellor 
Signed-off-by: Tony Lindgren 
Signed-off-by: Sasha Levin 
---
 arch/arm/mach-omap2/omap_hwmod.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cd65ea4e9c54..ec3789ba17b8 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2397,7 +2397,7 @@ static int __init _init(struct omap_hwmod *oh, void *data)
  * a stub; implementing this properly requires iclk autoidle usecounting in
  * the clock code.   No return value.
  */
-static void __init _setup_iclk_autoidle(struct omap_hwmod *oh)
+static void _setup_iclk_autoidle(struct omap_hwmod *oh)
 {
struct omap_hwmod_ocp_if *os;
 
@@ -2428,7 +2428,7 @@ static void __init _setup_iclk_autoidle(struct omap_hwmod 
*oh)
  * reset.  Returns 0 upon success or a negative error code upon
  * failure.
  */
-static int __init _setup_reset(struct omap_hwmod *oh)
+static int _setup_reset(struct omap_hwmod *oh)
 {
int r;
 
@@ -2489,7 +2489,7 @@ static int __init _setup_reset(struct omap_hwmod *oh)
  *
  * No return value.
  */
-static void __init _setup_postsetup(struct omap_hwmod *oh)
+static void _setup_postsetup(struct omap_hwmod *oh)
 {
u8 postsetup_state;
 
-- 
2.19.1





[PATCH 4.19 040/313] usbnet: smsc95xx: fix rx packet alignment

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 810eeb1f41a9a272eedc94ca18c072e75678ede4 ]

The smsc95xx driver already takes into account the NET_IP_ALIGN
parameter when setting up the receive packet data, which means
we do not need to worry about aligning the packets in the usbnet
driver.

Adding the EVENT_NO_IP_ALIGN means that the IPv4 header is now
passed to the ip_rcv() routine with the start on an aligned address.

Tested on Raspberry Pi B3.

Signed-off-by: Ben Dooks 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/net/usb/smsc95xx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index f2d01cb6f958..6e971628bb50 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1295,6 +1295,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct 
usb_interface *intf)
dev->net->features |= NETIF_F_RXCSUM;
 
dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+   set_bit(EVENT_NO_IP_ALIGN, >flags);
 
smsc95xx_init_mac_address(dev);
 
-- 
2.19.1





[PATCH 4.19 041/313] drm/rockchip: fix for mailbox read size

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit fa68d4f8476bea4cdf441062b614b41bb85ef1da ]

Some of the functions (like cdn_dp_dpcd_read, cdn_dp_get_edid_block)
allow to read 64KiB, but the cdn_dp_mailbox_read_receive, that is
used by them, can read only up to 255 bytes at once. Normally, it's
not a big issue as DPCD or EDID reads won't (hopefully) exceed that
value.
The real issue here is the revocation list read during the HDCP
authentication process. (problematic use case:
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/gpu/drm/rockchip/cdn-dp-reg.c#1152)
The list can reach 127*5+4 bytes (num devs * 5 bytes per ID/Bksv +
4 bytes of an additional info).
In other words - CTSes with HDCP Repeater won't pass without this
fix. Oh, and the driver will most likely stop working (best case
scenario).

Signed-off-by: Damian Kos 
Signed-off-by: Heiko Stuebner 
Link: 
https://patchwork.freedesktop.org/patch/msgid/1541518625-25984-1-git-send-email-d...@cadence.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/rockchip/cdn-dp-reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/cdn-dp-reg.c 
b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
index 3105965fc260..5a485489a1e2 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-reg.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-reg.c
@@ -147,7 +147,7 @@ static int cdn_dp_mailbox_validate_receive(struct 
cdn_dp_device *dp,
 }
 
 static int cdn_dp_mailbox_read_receive(struct cdn_dp_device *dp,
-  u8 *buff, u8 buff_size)
+  u8 *buff, u16 buff_size)
 {
u32 i;
int ret;
-- 
2.19.1





[PATCH 4.19 024/313] crypto: aes_ti - disable interrupts while accessing S-box

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 0a6a40c2a8c184a2fb467efacfb1cd338d719e0b ]

In the "aes-fixed-time" AES implementation, disable interrupts while
accessing the S-box, in order to make cache-timing attacks more
difficult.  Previously it was possible for the CPU to be interrupted
while the S-box was loaded into L1 cache, potentially evicting the
cachelines and causing later table lookups to be time-variant.

In tests I did on x86 and ARM, this doesn't affect performance
significantly.  Responsiveness is potentially a concern, but interrupts
are only disabled for a single AES block.

Note that even after this change, the implementation still isn't
necessarily guaranteed to be constant-time; see
https://cr.yp.to/antiforgery/cachetiming-20050414.pdf for a discussion
of the many difficulties involved in writing truly constant-time AES
software.  But it's valuable to make such attacks more difficult.

Reviewed-by: Ard Biesheuvel 
Signed-off-by: Eric Biggers 
Signed-off-by: Herbert Xu 
Signed-off-by: Sasha Levin 
---
 crypto/Kconfig  |  3 ++-
 crypto/aes_ti.c | 18 ++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/crypto/Kconfig b/crypto/Kconfig
index 59e32623a7ce..0fb9586766a7 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -1056,7 +1056,8 @@ config CRYPTO_AES_TI
  8 for decryption), this implementation only uses just two S-boxes of
  256 bytes each, and attempts to eliminate data dependent latencies by
  prefetching the entire table into the cache at the start of each
- block.
+ block. Interrupts are also disabled to avoid races where cachelines
+ are evicted when the CPU is interrupted to do something else.
 
 config CRYPTO_AES_586
tristate "AES cipher algorithms (i586)"
diff --git a/crypto/aes_ti.c b/crypto/aes_ti.c
index 03023b2290e8..1ff9785b30f5 100644
--- a/crypto/aes_ti.c
+++ b/crypto/aes_ti.c
@@ -269,6 +269,7 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
const u32 *rkp = ctx->key_enc + 4;
int rounds = 6 + ctx->key_length / 4;
u32 st0[4], st1[4];
+   unsigned long flags;
int round;
 
st0[0] = ctx->key_enc[0] ^ get_unaligned_le32(in);
@@ -276,6 +277,12 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
st0[2] = ctx->key_enc[2] ^ get_unaligned_le32(in + 8);
st0[3] = ctx->key_enc[3] ^ get_unaligned_le32(in + 12);
 
+   /*
+* Temporarily disable interrupts to avoid races where cachelines are
+* evicted when the CPU is interrupted to do something else.
+*/
+   local_irq_save(flags);
+
st0[0] ^= __aesti_sbox[ 0] ^ __aesti_sbox[128];
st0[1] ^= __aesti_sbox[32] ^ __aesti_sbox[160];
st0[2] ^= __aesti_sbox[64] ^ __aesti_sbox[192];
@@ -300,6 +307,8 @@ static void aesti_encrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
put_unaligned_le32(subshift(st1, 1) ^ rkp[5], out + 4);
put_unaligned_le32(subshift(st1, 2) ^ rkp[6], out + 8);
put_unaligned_le32(subshift(st1, 3) ^ rkp[7], out + 12);
+
+   local_irq_restore(flags);
 }
 
 static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
@@ -308,6 +317,7 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
const u32 *rkp = ctx->key_dec + 4;
int rounds = 6 + ctx->key_length / 4;
u32 st0[4], st1[4];
+   unsigned long flags;
int round;
 
st0[0] = ctx->key_dec[0] ^ get_unaligned_le32(in);
@@ -315,6 +325,12 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
st0[2] = ctx->key_dec[2] ^ get_unaligned_le32(in + 8);
st0[3] = ctx->key_dec[3] ^ get_unaligned_le32(in + 12);
 
+   /*
+* Temporarily disable interrupts to avoid races where cachelines are
+* evicted when the CPU is interrupted to do something else.
+*/
+   local_irq_save(flags);
+
st0[0] ^= __aesti_inv_sbox[ 0] ^ __aesti_inv_sbox[128];
st0[1] ^= __aesti_inv_sbox[32] ^ __aesti_inv_sbox[160];
st0[2] ^= __aesti_inv_sbox[64] ^ __aesti_inv_sbox[192];
@@ -339,6 +355,8 @@ static void aesti_decrypt(struct crypto_tfm *tfm, u8 *out, 
const u8 *in)
put_unaligned_le32(inv_subshift(st1, 1) ^ rkp[5], out + 4);
put_unaligned_le32(inv_subshift(st1, 2) ^ rkp[6], out + 8);
put_unaligned_le32(inv_subshift(st1, 3) ^ rkp[7], out + 12);
+
+   local_irq_restore(flags);
 }
 
 static struct crypto_alg aes_alg = {
-- 
2.19.1





[PATCH 4.19 043/313] drm/amd/display: fix gamma not being applied correctly

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 8ce504b9389be846bcdf512ed5be8f661b3bf097 ]

[why]
Gamma was always being set as identity on SDR monitor,
leading to no changes in gamma. This caused nightlight to
not apply correctly.

[how]
Added a default gamma structure to compare against
in the sdr case.

Signed-off-by: Murton Liu 
Reviewed-by: Krunoslav Kovac 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c 
b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
index cfcc54f2ce65..33a9d0c58966 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
@@ -1190,7 +1190,8 @@ static bool dcn10_set_input_transfer_func(struct pipe_ctx 
*pipe_ctx,
tf = plane_state->in_transfer_func;
 
if (plane_state->gamma_correction &&
-   !plane_state->gamma_correction->is_identity
+   !dpp_base->ctx->dc->debug.always_use_regamma
+   && !plane_state->gamma_correction->is_identity
&& dce_use_lut(plane_state->format))
dpp_base->funcs->dpp_program_input_lut(dpp_base, 
plane_state->gamma_correction);
 
-- 
2.19.1





[PATCH 4.19 045/313] bpf: libbpf: retry map creation without the name

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 23499442c319412aa8e54e7a939e2eb531bdd77d ]

Since commit 88cda1c9da02 ("bpf: libbpf: Provide basic API support
to specify BPF obj name"), libbpf unconditionally sets bpf_attr->name
for maps. Pre v4.14 kernels don't know about map names and return an
error about unexpected non-zero data. Retry sys_bpf without a map
name to cover older kernels.

v2 changes:
* check for errno == EINVAL as suggested by Daniel Borkmann

Signed-off-by: Stanislav Fomichev 
Signed-off-by: Daniel Borkmann 
Signed-off-by: Sasha Levin 
---
 tools/lib/bpf/bpf.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 60aa4ca8b2c5..7a0014794bff 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -77,6 +77,7 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr 
*create_attr)
 {
__u32 name_len = create_attr->name ? strlen(create_attr->name) : 0;
union bpf_attr attr;
+   int ret;
 
memset(, '\0', sizeof(attr));
 
@@ -94,7 +95,15 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr 
*create_attr)
attr.map_ifindex = create_attr->map_ifindex;
attr.inner_map_fd = create_attr->inner_map_fd;
 
-   return sys_bpf(BPF_MAP_CREATE, , sizeof(attr));
+   ret = sys_bpf(BPF_MAP_CREATE, , sizeof(attr));
+   if (ret < 0 && errno == EINVAL && create_attr->name) {
+   /* Retry the same syscall, but without the name.
+* Pre v4.14 kernels don't support map names.
+*/
+   memset(attr.map_name, 0, sizeof(attr.map_name));
+   return sys_bpf(BPF_MAP_CREATE, , sizeof(attr));
+   }
+   return ret;
 }
 
 int bpf_create_map_node(enum bpf_map_type map_type, const char *name,
-- 
2.19.1





[PATCH 4.19 044/313] drm/amd/display: calculate stream->phy_pix_clk before clock mapping

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 08e1c28dd521c7b08d1b0af0bae9fb22ccc012a4 ]

[why]
phy_pix_clk is one of the variable used to check if one PLL can be shared
with displays having common mode set configuration. As of now
phy_pix_clock varialbe is calculated in function dc_validate_stream().
dc_validate_stream() function is called after clocks are assigned for the
new display. Due to this during hotplug, when PLL sharing conditions are
checked for new display phy_pix_clk variable will be 0 and for displays
that are already enabled phy_pix_clk will have some value. Hence PLL will
not be shared and if the display hardware doesn't have any more PLL to
assign, mode set will fail due to resource unavailability.

[how]
Instead of only calculating the phy_pix_clk variable after the PLL is
assigned for new display, this patch calculates phy_pix_clk also during
the before assigning the PLL for new display.

Signed-off-by: Yogesh Mohan Marimuthu 
Reviewed-by: Harry Wentland 
Acked-by: Bhawanpreet Lakha 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c 
b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index ea6beccfd89d..87bf422f16be 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -1917,6 +1917,8 @@ enum dc_status resource_map_pool_resources(
}
*/
 
+   calculate_phy_pix_clks(stream);
+
/* acquire new resources */
pipe_idx = acquire_first_free_pipe(>res_ctx, pool, stream);
 
-- 
2.19.1





[PATCH 4.19 047/313] modpost: validate symbol names also in find_elf_symbol

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 5818c683a619c534c113e1f66d24f636defc29bc ]

If an ARM mapping symbol shares an address with a valid symbol,
find_elf_symbol can currently return the mapping symbol instead, as the
symbol is not validated. This can result in confusing warnings:

  WARNING: vmlinux.o(.text+0x18f4028): Section mismatch in reference
  from the function set_reset_devices() to the variable .init.text:$x.0

This change adds a call to is_valid_name to find_elf_symbol, similarly
to how it's already used in find_elf_symbol2.

Signed-off-by: Sami Tolvanen 
Signed-off-by: Masahiro Yamada 
Signed-off-by: Sasha Levin 
---
 scripts/mod/modpost.c | 50 ++-
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 5a5b3780456f..5a77efd39b3f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1204,6 +1204,30 @@ static int secref_whitelist(const struct sectioncheck 
*mismatch,
return 1;
 }
 
+static inline int is_arm_mapping_symbol(const char *str)
+{
+   return str[0] == '$' && strchr("axtd", str[1])
+  && (str[2] == '\0' || str[2] == '.');
+}
+
+/*
+ * If there's no name there, ignore it; likewise, ignore it if it's
+ * one of the magic symbols emitted used by current ARM tools.
+ *
+ * Otherwise if find_symbols_between() returns those symbols, they'll
+ * fail the whitelist tests and cause lots of false alarms ... fixable
+ * only by merging __exit and __init sections into __text, bloating
+ * the kernel (which is especially evil on embedded platforms).
+ */
+static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
+{
+   const char *name = elf->strtab + sym->st_name;
+
+   if (!name || !strlen(name))
+   return 0;
+   return !is_arm_mapping_symbol(name);
+}
+
 /**
  * Find symbol based on relocation record info.
  * In some cases the symbol supplied is a valid symbol so
@@ -1229,6 +1253,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, 
Elf64_Sword addr,
continue;
if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
continue;
+   if (!is_valid_name(elf, sym))
+   continue;
if (sym->st_value == addr)
return sym;
/* Find a symbol nearby - addr are maybe negative */
@@ -1247,30 +1273,6 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, 
Elf64_Sword addr,
return NULL;
 }
 
-static inline int is_arm_mapping_symbol(const char *str)
-{
-   return str[0] == '$' && strchr("axtd", str[1])
-  && (str[2] == '\0' || str[2] == '.');
-}
-
-/*
- * If there's no name there, ignore it; likewise, ignore it if it's
- * one of the magic symbols emitted used by current ARM tools.
- *
- * Otherwise if find_symbols_between() returns those symbols, they'll
- * fail the whitelist tests and cause lots of false alarms ... fixable
- * only by merging __exit and __init sections into __text, bloating
- * the kernel (which is especially evil on embedded platforms).
- */
-static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
-{
-   const char *name = elf->strtab + sym->st_name;
-
-   if (!name || !strlen(name))
-   return 0;
-   return !is_arm_mapping_symbol(name);
-}
-
 /*
  * Find symbols before or equal addr and after addr - in the section sec.
  * If we find two symbols with equal offset prefer one with a valid name.
-- 
2.19.1





[PATCH 4.19 049/313] soc/tegra: Dont leak device tree node reference

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 9eb40fa2cd2d1f6829e7b49bb22692f754b9cfe0 ]

of_find_node_by_path() acquires a reference to the node returned by it
and that reference needs to be dropped by its caller. soc_is_tegra()
doesn't do that, so fix it.

Signed-off-by: Yangtao Li 
Acked-by: Jon Hunter 
[treding: slightly rewrite to avoid inline comparison]
Signed-off-by: Thierry Reding 
Signed-off-by: Sasha Levin 
---
 drivers/soc/tegra/common.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
index cd8f41351add..7bfb154d6fa5 100644
--- a/drivers/soc/tegra/common.c
+++ b/drivers/soc/tegra/common.c
@@ -22,11 +22,15 @@ static const struct of_device_id tegra_machine_match[] = {
 
 bool soc_is_tegra(void)
 {
+   const struct of_device_id *match;
struct device_node *root;
 
root = of_find_node_by_path("/");
if (!root)
return false;
 
-   return of_match_node(tegra_machine_match, root) != NULL;
+   match = of_match_node(tegra_machine_match, root);
+   of_node_put(root);
+
+   return match != NULL;
 }
-- 
2.19.1





[PATCH 4.19 048/313] perf tools: Add Hygon Dhyana support

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 4787eff3fa88f62fede6ed7afa06477ae6bf984d ]

The tool perf is useful for the performance analysis on the Hygon Dhyana
platform. But right now there is no Hygon support for it to analyze the
KVM guest os data. So add Hygon Dhyana support to it by checking vendor
string to share the code path of AMD.

Signed-off-by: Pu Wen 
Acked-by: Borislav Petkov 
Cc: Alexander Shishkin 
Cc: Jiri Olsa 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: http://lkml.kernel.org/r/1542008451-31735-1-git-send-email-pu...@hygon.cn
Signed-off-by: Arnaldo Carvalho de Melo 
Signed-off-by: Sasha Levin 
---
 tools/perf/arch/x86/util/kvm-stat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/arch/x86/util/kvm-stat.c 
b/tools/perf/arch/x86/util/kvm-stat.c
index b32409a0e546..081353d7b095 100644
--- a/tools/perf/arch/x86/util/kvm-stat.c
+++ b/tools/perf/arch/x86/util/kvm-stat.c
@@ -156,7 +156,7 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char 
*cpuid)
if (strstr(cpuid, "Intel")) {
kvm->exit_reasons = vmx_exit_reasons;
kvm->exit_reasons_isa = "VMX";
-   } else if (strstr(cpuid, "AMD")) {
+   } else if (strstr(cpuid, "AMD") || strstr(cpuid, "Hygon")) {
kvm->exit_reasons = svm_exit_reasons;
kvm->exit_reasons_isa = "SVM";
} else
-- 
2.19.1





[PATCH 4.19 025/313] drm/vc4: ->x_scaling[1] should never be set to VC4_SCALING_NONE

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 0560054da5673b25d56bea6c57c8d069673af73b ]

For the YUV conversion to work properly, ->x_scaling[1] should never
be set to VC4_SCALING_NONE, but vc4_get_scaling_mode() might return
VC4_SCALING_NONE if the horizontal scaling ratio exactly matches the
horizontal subsampling factor. Add a test to turn VC4_SCALING_NONE
into VC4_SCALING_PPF when that happens.

The old ->x_scaling[0] adjustment is dropped as I couldn't find any
mention to this constraint in the spec and it's proven to be
unnecessary (I tested various multi-planar YUV formats with scaling
disabled, and all of them worked fine without this adjustment).

Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
Signed-off-by: Boris Brezillon 
Reviewed-by: Eric Anholt 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20181109102633.32603-1-boris.brezil...@bootlin.com
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/vc4/vc4_plane.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
index 629f40424bba..ab39315c9078 100644
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -315,12 +315,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct 
drm_plane_state *state)
vc4_get_scaling_mode(vc4_state->src_h[1],
 vc4_state->crtc_h);
 
-   /* YUV conversion requires that horizontal scaling be enabled,
-* even on a plane that's otherwise 1:1. Looks like only PPF
-* works in that case, so let's pick that one.
+   /* YUV conversion requires that horizontal scaling be enabled
+* on the UV plane even if vc4_get_scaling_mode() returned
+* VC4_SCALING_NONE (which can happen when the down-scaling
+* ratio is 0.5). Let's force it to VC4_SCALING_PPF in this
+* case.
 */
-   if (vc4_state->is_unity)
-   vc4_state->x_scaling[0] = VC4_SCALING_PPF;
+   if (vc4_state->x_scaling[1] == VC4_SCALING_NONE)
+   vc4_state->x_scaling[1] = VC4_SCALING_PPF;
} else {
vc4_state->is_yuv = false;
vc4_state->x_scaling[1] = VC4_SCALING_NONE;
-- 
2.19.1





[PATCH 4.19 071/313] i2c: sh_mobile: add support for r8a77990 (R-Car E3)

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 5eb316e636eb298c204f5b368526d4480b63c0ba ]

Add support for the IIC code for the r8a77990 (R-Car E3).

It is not considered compatible with existing fallback bindings
due to the documented absence of automatic transmission registers.

These registers are currently not used by the driver and
thus the provides the same behaviour for "renesas,iic-r8a77990" and
"renesas,rcar-gen3-iic". The point of declaring incompatibility is
to allow for automatic transmission register support to be added to
"renesas,iic-r8a77990" and "renesas,rcar-gen3-iic" in future.

Signed-off-by: Simon Horman 
Reviewed-by: Geert Uytterhoeven 
Signed-off-by: Wolfram Sang 
Signed-off-by: Sasha Levin 
---
 drivers/i2c/busses/i2c-sh_mobile.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c 
b/drivers/i2c/busses/i2c-sh_mobile.c
index 818cab14e87c..b3ed14f4eae9 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -808,6 +808,7 @@ static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
{ .compatible = "renesas,rcar-gen2-iic", .data = _clock_dt_config 
},
{ .compatible = "renesas,iic-r8a7795", .data = _clock_dt_config },
{ .compatible = "renesas,rcar-gen3-iic", .data = _clock_dt_config 
},
+   { .compatible = "renesas,iic-r8a77990", .data = _clock_dt_config },
{ .compatible = "renesas,iic-sh73a0", .data = _clock_dt_config },
{ .compatible = "renesas,rmobile-iic", .data = _dt_config },
{},
-- 
2.19.1





[PATCH 4.19 070/313] f2fs: fix wrong return value of f2fs_acl_create

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit f6176473a0c7472380eef72ebeb330cf9485bf0a ]

When call f2fs_acl_create_masq() failed, the caller f2fs_acl_create()
should return -EIO instead of -ENOMEM, this patch makes it consistent
with posix_acl_create() which has been fixed in commit beaf226b863a
("posix_acl: don't ignore return value of posix_acl_create_masq()").

Fixes: 83dfe53c185e ("f2fs: fix reference leaks in f2fs_acl_create")
Signed-off-by: Tiezhu Yang 
Reviewed-by: Chao Yu 
Signed-off-by: Jaegeuk Kim 
Signed-off-by: Sasha Levin 
---
 fs/f2fs/acl.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index 111824199a88..b9fe937a3c70 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -352,12 +352,14 @@ static int f2fs_acl_create(struct inode *dir, umode_t 
*mode,
return PTR_ERR(p);
 
clone = f2fs_acl_clone(p, GFP_NOFS);
-   if (!clone)
-   goto no_mem;
+   if (!clone) {
+   ret = -ENOMEM;
+   goto release_acl;
+   }
 
ret = f2fs_acl_create_masq(clone, mode);
if (ret < 0)
-   goto no_mem_clone;
+   goto release_clone;
 
if (ret == 0)
posix_acl_release(clone);
@@ -371,11 +373,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t 
*mode,
 
return 0;
 
-no_mem_clone:
+release_clone:
posix_acl_release(clone);
-no_mem:
+release_acl:
posix_acl_release(p);
-   return -ENOMEM;
+   return ret;
 }
 
 int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
-- 
2.19.1





[PATCH 4.19 069/313] f2fs: fix race between write_checkpoint and write_begin

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 2866fb16d67992195b0526d19e65acb6640fb87f ]

The following race could lead to inconsistent SIT bitmap:

Task A  Task B
==  ==
f2fs_write_checkpoint
  block_operations
f2fs_lock_all
  down_write(node_change)
  down_write(node_write)
  ... sync ...
  up_write(node_change)
f2fs_file_write_iter
  set_inode_flag(FI_NO_PREALLOC)
  ..
  f2fs_write_begin(index=0, has inline data)
prepare_write_begin
  __do_map_lock(AIO) => 
down_read(node_change)
  f2fs_convert_inline_page => update SIT
  __do_map_lock(AIO) => up_read(node_change)
  f2fs_flush_sit_entries <= inconsistent SIT
  finish write checkpoint
  sudden-power-off

If SPO occurs after checkpoint is finished, SIT bitmap will be set
incorrectly.

Signed-off-by: Sheng Yong 
Reviewed-by: Chao Yu 
Signed-off-by: Jaegeuk Kim 
Signed-off-by: Sasha Levin 
---
 fs/f2fs/data.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 11f28342f641..08314fb42652 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2259,6 +2259,7 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
bool locked = false;
struct extent_info ei = {0,0,0};
int err = 0;
+   int flag;
 
/*
 * we already allocated all the blocks, so we don't need to get
@@ -2268,9 +2269,15 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
!is_inode_flag_set(inode, FI_NO_PREALLOC))
return 0;
 
+   /* f2fs_lock_op avoids race between write CP and convert_inline_page */
+   if (f2fs_has_inline_data(inode) && pos + len > MAX_INLINE_DATA(inode))
+   flag = F2FS_GET_BLOCK_DEFAULT;
+   else
+   flag = F2FS_GET_BLOCK_PRE_AIO;
+
if (f2fs_has_inline_data(inode) ||
(pos & PAGE_MASK) >= i_size_read(inode)) {
-   __do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, true);
+   __do_map_lock(sbi, flag, true);
locked = true;
}
 restart:
@@ -2308,6 +2315,7 @@ restart:
f2fs_put_dnode();
__do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO,
true);
+   WARN_ON(flag != F2FS_GET_BLOCK_PRE_AIO);
locked = true;
goto restart;
}
@@ -2321,7 +2329,7 @@ out:
f2fs_put_dnode();
 unlock_out:
if (locked)
-   __do_map_lock(sbi, F2FS_GET_BLOCK_PRE_AIO, false);
+   __do_map_lock(sbi, flag, false);
return err;
 }
 
-- 
2.19.1





[PATCH 4.19 072/313] arm64: io: Ensure calls to delay routines are ordered against prior readX()

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 6460d32014717686d3b7963595950ba2c6d1bb5e ]

A relatively standard idiom for ensuring that a pair of MMIO writes to a
device arrive at that device with a specified minimum delay between them
is as follows:

writel_relaxed(42, dev_base + CTL1);
readl(dev_base + CTL1);
udelay(10);
writel_relaxed(42, dev_base + CTL2);

the intention being that the read-back from the device will push the
prior write to CTL1, and the udelay will hold up the write to CTL1 until
at least 10us have elapsed.

Unfortunately, on arm64 where the underlying delay loop is implemented
as a read of the architected counter, the CPU does not guarantee
ordering from the readl() to the delay loop and therefore the delay loop
could in theory be speculated and not provide the desired interval
between the two writes.

Fix this in a similar manner to PowerPC by introducing a dummy control
dependency on the output of readX() which, combined with the ISB in the
read of the architected counter, guarantees that a subsequent delay loop
can not be executed until the readX() has returned its result.

Cc: Benjamin Herrenschmidt 
Cc: Arnd Bergmann 
Signed-off-by: Will Deacon 
Signed-off-by: Sasha Levin 
---
 arch/arm64/include/asm/io.h | 31 +++
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 35b2e50f17fb..b2bc7dbc1fa6 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -106,7 +106,22 @@ static inline u64 __raw_readq(const volatile void __iomem 
*addr)
 }
 
 /* IO barriers */
-#define __iormb()  rmb()
+#define __iormb(v) \
+({ \
+   unsigned long tmp;  \
+   \
+   rmb();  \
+   \
+   /*  \
+* Create a dummy control dependency from the IO read to any\
+* later instructions. This ensures that a subsequent call to   \
+* udelay() will be ordered due to the ISB in get_cycles(). \
+*/ \
+   asm volatile("eor   %0, %1, %1\n"   \
+"cbnz  %0, ."  \
+: "=r" (tmp) : "r" (v) : "memory");\
+})
+
 #define __iowmb()  wmb()
 
 #define mmiowb()   do { } while (0)
@@ -131,10 +146,10 @@ static inline u64 __raw_readq(const volatile void __iomem 
*addr)
  * following Normal memory access. Writes are ordered relative to any prior
  * Normal memory access.
  */
-#define readb(c)   ({ u8  __v = readb_relaxed(c); __iormb(); __v; 
})
-#define readw(c)   ({ u16 __v = readw_relaxed(c); __iormb(); __v; 
})
-#define readl(c)   ({ u32 __v = readl_relaxed(c); __iormb(); __v; 
})
-#define readq(c)   ({ u64 __v = readq_relaxed(c); __iormb(); __v; 
})
+#define readb(c)   ({ u8  __v = readb_relaxed(c); __iormb(__v); 
__v; })
+#define readw(c)   ({ u16 __v = readw_relaxed(c); __iormb(__v); 
__v; })
+#define readl(c)   ({ u32 __v = readl_relaxed(c); __iormb(__v); 
__v; })
+#define readq(c)   ({ u64 __v = readq_relaxed(c); __iormb(__v); 
__v; })
 
 #define writeb(v,c)({ __iowmb(); writeb_relaxed((v),(c)); })
 #define writew(v,c)({ __iowmb(); writew_relaxed((v),(c)); })
@@ -185,9 +200,9 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, 
size_t size);
 /*
  * io{read,write}{16,32,64}be() macros
  */
-#define ioread16be(p)  ({ __u16 __v = be16_to_cpu((__force 
__be16)__raw_readw(p)); __iormb(); __v; })
-#define ioread32be(p)  ({ __u32 __v = be32_to_cpu((__force 
__be32)__raw_readl(p)); __iormb(); __v; })
-#define ioread64be(p)  ({ __u64 __v = be64_to_cpu((__force 
__be64)__raw_readq(p)); __iormb(); __v; })
+#define ioread16be(p)  ({ __u16 __v = be16_to_cpu((__force 
__be16)__raw_readw(p)); __iormb(__v); __v; })
+#define ioread32be(p)  ({ __u32 __v = be32_to_cpu((__force 
__be32)__raw_readl(p)); __iormb(__v); __v; })
+#define ioread64be(p)  ({ __u64 __v = be64_to_cpu((__force 
__be64)__raw_readq(p)); __iormb(__v); __v; })
 
 #define iowrite16be(v,p)   ({ __iowmb(); __raw_writew((__force 
__u16)cpu_to_be16(v), p); })
 #define iowrite32be(v,p)   ({ __iowmb(); __raw_writel((__force 
__u32)cpu_to_be32(v), p); })
-- 
2.19.1





[PATCH 4.19 029/313] dpaa2-ptp: defer probe when portal allocation failed

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 5500598abbfb5b46201b9768bd9ea873a5eeaece ]

The fsl_mc_portal_allocate can fail when the requested MC portals are
not yet probed by the fsl_mc_allocator. In this situation, the driver
should defer the probe.

Signed-off-by: Ioana Ciornei 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/staging/fsl-dpaa2/rtc/rtc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-dpaa2/rtc/rtc.c 
b/drivers/staging/fsl-dpaa2/rtc/rtc.c
index 0d52cb85441f..318a33c2f7a7 100644
--- a/drivers/staging/fsl-dpaa2/rtc/rtc.c
+++ b/drivers/staging/fsl-dpaa2/rtc/rtc.c
@@ -142,7 +142,10 @@ static int rtc_probe(struct fsl_mc_device *mc_dev)
 
err = fsl_mc_portal_allocate(mc_dev, 0, _dev->mc_io);
if (err) {
-   dev_err(dev, "fsl_mc_portal_allocate err %d\n", err);
+   if (err == -ENXIO)
+   err = -EPROBE_DEFER;
+   else
+   dev_err(dev, "fsl_mc_portal_allocate err %d\n", err);
goto err_exit;
}
 
-- 
2.19.1





[PATCH 4.19 031/313] staging:iio:ad2s90: Make probe handle spi_setup failure

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit b3a3eafeef769c6982e15f83631dcbf8d1794efb ]

Previously, ad2s90_probe ignored the return code from spi_setup, not
handling its possible failure. This patch makes ad2s90_probe check if
the code is an error code and, if so, do the following:

- Call dev_err with an appropriate error message.
- Return the spi_setup's error code.

Note: The 'return ret' statement could be out of the 'if' block, but
this whole block will be moved up in the function in the patch:
'staging:iio:ad2s90: Move device registration to the end of probe'.

Signed-off-by: Matheus Tavares 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/staging/iio/resolver/ad2s90.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/resolver/ad2s90.c 
b/drivers/staging/iio/resolver/ad2s90.c
index 59586947a936..51cda9151412 100644
--- a/drivers/staging/iio/resolver/ad2s90.c
+++ b/drivers/staging/iio/resolver/ad2s90.c
@@ -85,7 +85,12 @@ static int ad2s90_probe(struct spi_device *spi)
/* need 600ns between CS and the first falling edge of SCLK */
spi->max_speed_hz = 83;
spi->mode = SPI_MODE_3;
-   spi_setup(spi);
+   ret = spi_setup(spi);
+
+   if (ret < 0) {
+   dev_err(>dev, "spi_setup failed!\n");
+   return ret;
+   }
 
return 0;
 }
-- 
2.19.1





[PATCH 4.19 022/313] x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux)

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 53bb565fc5439f2c8c57a786feea5946804aa3e9 ]

In the expression "word1 << 16", word1 starts as u16, but is promoted to a
signed int, then sign-extended to resource_size_t, which is probably not
what was intended.  Cast to resource_size_t to avoid the sign extension.

This fixes an identical issue as fixed by commit 0b2d70764bb3 ("x86/PCI:
Fix Broadcom CNB20LE unintended sign extension") back in 2014.

Detected by CoverityScan, CID#138749, 138750 ("Unintended sign extension")

Fixes: 3f6ea84a3035 ("PCI: read memory ranges out of Broadcom CNB20LE host 
bridge")
Signed-off-by: Colin Ian King 
Signed-off-by: Bjorn Helgaas 
Signed-off-by: Sasha Levin 
---
 arch/x86/pci/broadcom_bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c
index 526536c81ddc..ca1e8e6dccc8 100644
--- a/arch/x86/pci/broadcom_bus.c
+++ b/arch/x86/pci/broadcom_bus.c
@@ -50,8 +50,8 @@ static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
word1 = read_pci_config_16(bus, slot, func, 0xc0);
word2 = read_pci_config_16(bus, slot, func, 0xc2);
if (word1 != word2) {
-   res.start = (word1 << 16) | 0x;
-   res.end   = (word2 << 16) | 0x;
+   res.start = ((resource_size_t) word1 << 16) | 0x;
+   res.end   = ((resource_size_t) word2 << 16) | 0x;
res.flags = IORESOURCE_MEM;
update_res(info, res.start, res.end, res.flags, 0);
}
-- 
2.19.1





[PATCH 4.19 055/313] clk: meson: meson8b: do not use cpu_div3 for cpu_scale_out_sel

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a5ac1ead32c9aac285f6436e09b4f6111996e9b8 ]

The cpu_div3 clock (cpu_in divided by 3) generates a signal with a duty
cycle of 33%. The CPU clock however requires a clock signal with a duty
cycle of 50% to run stable.
cpu_div3 was observed to be problematic when cycling through all
available CPU frequencies (with additional patches on top of this one)
while running "stress --cpu 4" in the background. This caused sporadic
hangs where the whole system would fully lock up.

Amlogic's 3.10 kernel code also does not use the cpu_div3 clock either
when changing the CPU clock.

Signed-off-by: Martin Blumenstingl 
Reviewed-by: Jerome Brunet 
Signed-off-by: Neil Armstrong 
Link: 
https://lkml.kernel.org/r/20181115224048.13511-3-martin.blumensti...@googlemail.com
Signed-off-by: Sasha Levin 
---
 drivers/clk/meson/meson8b.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index 50060e895e7a..580a86d120e8 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -596,20 +596,27 @@ static struct clk_regmap meson8b_cpu_scale_div = {
},
 };
 
+static u32 mux_table_cpu_scale_out_sel[] = { 0, 1, 3 };
 static struct clk_regmap meson8b_cpu_scale_out_sel = {
.data = &(struct clk_regmap_mux_data){
.offset = HHI_SYS_CPU_CLK_CNTL0,
.mask = 0x3,
.shift = 2,
+   .table = mux_table_cpu_scale_out_sel,
},
.hw.init = &(struct clk_init_data){
.name = "cpu_scale_out_sel",
.ops = _regmap_mux_ro_ops,
+   /*
+* NOTE: We are skipping the parent with value 0x2 (which is
+* "cpu_div3") because it results in a duty cycle of 33% which
+* makes the system unstable and can result in a lockup of the
+* whole system.
+*/
.parent_names = (const char *[]) { "cpu_in_sel",
   "cpu_div2",
-  "cpu_div3",
   "cpu_scale_div" },
-   .num_parents = 4,
+   .num_parents = 3,
.flags = CLK_SET_RATE_PARENT,
},
 };
-- 
2.19.1





[PATCH 4.19 053/313] staging: erofs: fix the definition of DBG_BUGON

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit eef168789866514e5d4316f030131c9fe65b643f ]

It's better not to positively BUG_ON the kernel, however developers
need a way to locate issues as soon as possible.

DBG_BUGON is introduced and it could only crash when EROFS_FS_DEBUG
(EROFS developping feature) is on. It is helpful for developers
to find and solve bugs quickly by eng builds.

Previously, DBG_BUGON is defined as ((void)0) if EROFS_FS_DEBUG is off,
but some unused variable warnings as follows could occur:

drivers/staging/erofs/unzip_vle.c: In function `init_alway:':
drivers/staging/erofs/unzip_vle.c:61:33: warning: unused variable `work' 
[-Wunused-variable]
  struct z_erofs_vle_work *const work =
 ^~~~

Fix it to #define DBG_BUGON(x) ((void)(x)).

Reviewed-by: Chao Yu 
Signed-off-by: Gao Xiang 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/erofs/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/internal.h b/drivers/staging/erofs/internal.h
index 367b39fe46e5..e6313c54e3ad 100644
--- a/drivers/staging/erofs/internal.h
+++ b/drivers/staging/erofs/internal.h
@@ -39,7 +39,7 @@
 #define debugln(x, ...) ((void)0)
 
 #define dbg_might_sleep()   ((void)0)
-#define DBG_BUGON(...)  ((void)0)
+#define DBG_BUGON(x)((void)(x))
 #endif
 
 #ifdef CONFIG_EROFS_FAULT_INJECTION
-- 
2.19.1





[PATCH 4.19 066/313] staging: pi433: fix potential null dereference

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 64c4c4ca6c129a4191e8e1e91b2d5d9b8d08c518 ]

Add a test for successful call to cdev_alloc() to avoid
potential null dereference. Issue reported by smatch.

Signed-off-by: Michael Straube 
Fixes: 874bcba65f9a ("staging: pi433: New driver")
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/staging/pi433/pi433_if.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index c85a805a1243..a497ec197872 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1255,6 +1255,10 @@ static int pi433_probe(struct spi_device *spi)
 
/* create cdev */
device->cdev = cdev_alloc();
+   if (!device->cdev) {
+   dev_dbg(device->dev, "allocation of cdev failed");
+   goto cdev_failed;
+   }
device->cdev->owner = THIS_MODULE;
cdev_init(device->cdev, _fops);
retval = cdev_add(device->cdev, device->devt, 1);
-- 
2.19.1





[PATCH 4.19 028/313] MIPS: Boston: Disable EG20T prefetch

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 5ec17af7ead09701e23d2065e16db6ce4e137289 ]

The Intel EG20T Platform Controller Hub used on the MIPS Boston
development board supports prefetching memory to optimize DMA transfers.
Unfortunately for unknown reasons this doesn't work well with some MIPS
CPUs such as the P6600, particularly when using an I/O Coherence Unit
(IOCU) to provide cache-coherent DMA. In these systems it is common for
DMA data to be lost, resulting in broken access to EG20T devices such as
the MMC or SATA controllers.

Support for a DT property to configure the prefetching was added a while
back by commit 549ce8f134bd ("misc: pch_phub: Read prefetch value from
device tree if passed") but we never added the DT snippet to make use of
it. Add that now in order to disable the prefetching & fix DMA on the
affected systems.

Signed-off-by: Paul Burton 
Patchwork: https://patchwork.linux-mips.org/patch/21068/
Cc: linux-m...@linux-mips.org
Signed-off-by: Sasha Levin 
---
 arch/mips/boot/dts/img/boston.dts | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/boot/dts/img/boston.dts 
b/arch/mips/boot/dts/img/boston.dts
index 65af3f6ba81c..84328afa3a55 100644
--- a/arch/mips/boot/dts/img/boston.dts
+++ b/arch/mips/boot/dts/img/boston.dts
@@ -141,6 +141,12 @@
#size-cells = <2>;
#interrupt-cells = <1>;
 
+   eg20t_phub@2,0,0 {
+   compatible = "pci8086,8801";
+   reg = <0x0002 0 0 0 0>;
+   intel,eg20t-prefetch = <0>;
+   };
+
eg20t_mac@2,0,1 {
compatible = "pci8086,8802";
reg = <0x00020100 0 0 0 0>;
-- 
2.19.1





[PATCH 4.19 068/313] f2fs: avoid build warn of fall_through

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit f5d5510e7389fa264337fb524346bac9eb93adc8 ]

After merging the f2fs tree, today's linux-next build
 (x86_64_allmodconfig) produced this warning:

 In file included from fs/f2fs/dir.c:11:
 fs/f2fs/f2fs.h: In function '__mark_inode_dirty_flag':
 fs/f2fs/f2fs.h:2388:6: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
if (set)
   ^
 fs/f2fs/f2fs.h:2390:2: note: here
   case FI_DATA_EXIST:
   ^~~~

 Exposed by my use of -Wimplicit-fallthrough

Reported-by: Stephen Rothwell 
Signed-off-by: Jaegeuk Kim 
Signed-off-by: Sasha Levin 
---
 fs/f2fs/f2fs.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index ecb735142276..462a2fb8aa69 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2311,6 +2311,7 @@ static inline void __mark_inode_dirty_flag(struct inode 
*inode,
case FI_NEW_INODE:
if (set)
return;
+   /* fall through */
case FI_DATA_EXIST:
case FI_INLINE_DOTS:
case FI_PIN_FILE:
-- 
2.19.1





[PATCH 4.19 076/313] nfsd4: fix crash on writing v4_end_grace before nfsd startup

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 62a063b8e7d1db684db3f207261a466fa3194e72 ]

Anatoly Trosinenko reports that this:

1) Checkout fresh master Linux branch (tested with commit e195ca6cb)
2) Copy x84_64-config-4.14 to .config, then enable NFS server v4 and build
3) From `kvm-xfstests shell`:

results in NULL dereference in locks_end_grace.

Check that nfsd has been started before trying to end the grace period.

Reported-by: Anatoly Trosinenko 
Signed-off-by: J. Bruce Fields 
Signed-off-by: Sasha Levin 
---
 fs/nfsd/nfsctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 7fb9f7c667b1..899174c7a8ae 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1126,6 +1126,8 @@ static ssize_t write_v4_end_grace(struct file *file, char 
*buf, size_t size)
case 'Y':
case 'y':
case '1':
+   if (nn->nfsd_serv)
+   return -EBUSY;
nfsd4_end_grace(nn);
break;
default:
-- 
2.19.1





[PATCH 4.19 056/313] clk: meson: meson8b: fix the width of the cpu_scale_div clock

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a8662eadd1032018f31e37deda811790b2326662 ]

According to the public S805 datasheet HHI_SYS_CPU_CLK_CNTL1[29:20] is
the register for the CPU scale_div clock. This matches the code in
Amlogic's 3.10 GPL kernel sources:
N = (aml_read_reg32(P_HHI_SYS_CPU_CLK_CNTL1) >> 20) & 0x3FF;

This means that the divider register is 10 bit wide instead of 9 bits.
So far this is not a problem since all u-boot versions I have seen are
not using the cpu_scale_div clock at all (instead they are configuring
the CPU clock to run off cpu_in_sel directly).

The fixes tag points to the latest rework of the CPU clocks. However,
even before the rework it was wrong. Commit 7a29a869434e8b ("clk: meson:
Add support for Meson clock controller") defines MESON_N_WIDTH as 9 (in
drivers/clk/meson/clk-cpu.c). But since the old clk-cpu implementation
this only carries the fixes tag for the CPU clock rewordk.

Fixes: 251b6fd38bcb9c ("clk: meson: rework meson8b cpu clock")
Signed-off-by: Martin Blumenstingl 
Signed-off-by: Neil Armstrong 
Link: 
https://lkml.kernel.org/r/20180927085921.24627-3-martin.blumensti...@googlemail.com
Signed-off-by: Sasha Levin 
---
 drivers/clk/meson/meson8b.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index 580a86d120e8..0da8334f2e43 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -583,7 +583,7 @@ static struct clk_regmap meson8b_cpu_scale_div = {
.data = &(struct clk_regmap_div_data){
.offset =  HHI_SYS_CPU_CLK_CNTL1,
.shift = 20,
-   .width = 9,
+   .width = 10,
.table = cpu_scale_table,
.flags = CLK_DIVIDER_ALLOW_ZERO,
},
-- 
2.19.1





[PATCH 4.19 074/313] sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a11f6ca9aef989b56cd31ff4ee2af4fb31a172ec ]

__vdc_tx_trigger should only loop on EAGAIN a finite
number of times.

See commit adddc32d6fde ("sunvnet: Do not spin in an
infinite loop when vio_ldc_send() returns EAGAIN") for detail.

Signed-off-by: Young Xiao 
Signed-off-by: Jens Axboe 
Signed-off-by: Sasha Levin 
---
 drivers/block/sunvdc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index f68e9baffad7..5d7024057540 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -45,6 +45,8 @@ MODULE_VERSION(DRV_MODULE_VERSION);
 #define WAITING_FOR_GEN_CMD0x04
 #define WAITING_FOR_ANY-1
 
+#defineVDC_MAX_RETRIES 10
+
 static struct workqueue_struct *sunvdc_wq;
 
 struct vdc_req_entry {
@@ -431,6 +433,7 @@ static int __vdc_tx_trigger(struct vdc_port *port)
.end_idx= dr->prod,
};
int err, delay;
+   int retries = 0;
 
hdr.seq = dr->snd_nxt;
delay = 1;
@@ -443,6 +446,8 @@ static int __vdc_tx_trigger(struct vdc_port *port)
udelay(delay);
if ((delay <<= 1) > 128)
delay = 128;
+   if (retries++ > VDC_MAX_RETRIES)
+   break;
} while (err == -EAGAIN);
 
if (err == -ENOTCONN)
-- 
2.19.1





[PATCH 4.19 080/313] Thermal: do not clear passive state during system sleep

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 964f4843a455d2ffb199512b08be8d5f077c4cac ]

commit ff140fea847e ("Thermal: handle thermal zone device properly
during system sleep") added PM hook to call thermal zone reset during
sleep. However resetting thermal zone will also clear the passive state
and thus cancel the polling queue which leads the passive cooling device
state not being cleared properly after sleep.

thermal_pm_notify => thermal_zone_device_reset set passive to 0
thermal_zone_trip_update will skip update passive as `old_target ==
instance->target'.
monitor_thermal_zone => thermal_zone_device_set_polling will cancel
tz->poll_queue, so the cooling device state will not be changed
afterwards.

Reported-by: Kame Wang 
Signed-off-by: Wei Wang 
Signed-off-by: Zhang Rui 
Signed-off-by: Sasha Levin 
---
 drivers/thermal/thermal_core.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 441778100887..bf9721fc2824 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -451,16 +451,20 @@ static void update_temperature(struct thermal_zone_device 
*tz)
tz->last_temperature, tz->temperature);
 }
 
-static void thermal_zone_device_reset(struct thermal_zone_device *tz)
+static void thermal_zone_device_init(struct thermal_zone_device *tz)
 {
struct thermal_instance *pos;
-
tz->temperature = THERMAL_TEMP_INVALID;
-   tz->passive = 0;
list_for_each_entry(pos, >thermal_instances, tz_node)
pos->initialized = false;
 }
 
+static void thermal_zone_device_reset(struct thermal_zone_device *tz)
+{
+   tz->passive = 0;
+   thermal_zone_device_init(tz);
+}
+
 void thermal_zone_device_update(struct thermal_zone_device *tz,
enum thermal_notify_event event)
 {
@@ -1502,7 +1506,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
case PM_POST_SUSPEND:
atomic_set(_suspend, 0);
list_for_each_entry(tz, _tz_list, node) {
-   thermal_zone_device_reset(tz);
+   thermal_zone_device_init(tz);
thermal_zone_device_update(tz,
   THERMAL_EVENT_UNSPECIFIED);
}
-- 
2.19.1





[PATCH 4.19 083/313] s390/zcrypt: improve special ap message cmd handling

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit be534791011100d204602e2e0496e9e6ce8edf63 ]

There exist very few ap messages which need to have the 'special' flag
enabled. This flag tells the firmware layer to do some pre- and maybe
postprocessing. However, it may happen that this special flag is
enabled but the firmware is unable to deal with this kind of message
and thus returns with reply code 0x41. For example older firmware may
not know the newest messages triggered by the zcrypt device driver and
thus react with reject and the named reply code. Unfortunately this
reply code is not known to the zcrypt error routines and thus default
behavior is to switch the ap queue offline.

This patch now makes the ap error routine aware of the reply code and
so userspace is informed about the bad processing result but the queue
is not switched to offline state any more.

Signed-off-by: Harald Freudenberger 
Signed-off-by: Martin Schwidefsky 
Signed-off-by: Sasha Levin 
---
 arch/s390/include/uapi/asm/zcrypt.h | 4 ++--
 drivers/s390/crypto/zcrypt_error.h  | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/uapi/asm/zcrypt.h 
b/arch/s390/include/uapi/asm/zcrypt.h
index 2bb1f3bb98ac..48c784f2101a 100644
--- a/arch/s390/include/uapi/asm/zcrypt.h
+++ b/arch/s390/include/uapi/asm/zcrypt.h
@@ -147,8 +147,8 @@ struct ica_xcRB {
  * @cprb_len:  CPRB header length [0x0020]
  * @cprb_ver_id:   CPRB version id.   [0x04]
  * @pad_000:   Alignment pad bytes
- * @flags: Admin cmd [0x80] or functional cmd [0x00]
- * @func_id:   Function id / subtype [0x5434]
+ * @flags: Admin bit [0x80], Special bit [0x20]
+ * @func_id:   Function id / subtype [0x5434] "T4"
  * @source_id: Source id [originator id]
  * @target_id: Target id [usage/ctrl domain id]
  * @ret_code:  Return code
diff --git a/drivers/s390/crypto/zcrypt_error.h 
b/drivers/s390/crypto/zcrypt_error.h
index 6f7ebc1dbe10..2e1a27bd97d1 100644
--- a/drivers/s390/crypto/zcrypt_error.h
+++ b/drivers/s390/crypto/zcrypt_error.h
@@ -52,6 +52,7 @@ struct error_hdr {
 #define REP82_ERROR_FORMAT_FIELD   0x29
 #define REP82_ERROR_INVALID_COMMAND0x30
 #define REP82_ERROR_MALFORMED_MSG  0x40
+#define REP82_ERROR_INVALID_SPECIAL_CMD0x41
 #define REP82_ERROR_INVALID_DOMAIN_PRECHECK 0x42
 #define REP82_ERROR_RESERVED_FIELDO0x50 /* old value   */
 #define REP82_ERROR_WORD_ALIGNMENT 0x60
@@ -90,6 +91,7 @@ static inline int convert_error(struct zcrypt_queue *zq,
case REP88_ERROR_MESSAGE_MALFORMD:
case REP82_ERROR_INVALID_DOMAIN_PRECHECK:
case REP82_ERROR_INVALID_DOMAIN_PENDING:
+   case REP82_ERROR_INVALID_SPECIAL_CMD:
//   REP88_ERROR_INVALID_KEY// '82' CEX2A
//   REP88_ERROR_OPERAND// '84' CEX2A
//   REP88_ERROR_OPERAND_EVEN_MOD   // '85' CEX2A
-- 
2.19.1





[PATCH 4.19 078/313] perf: arm_spe: handle devm_kasprintf() failure

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 754a58db6a556e6e5f5e32f3e84e7d67b5bf9c8e ]

devm_kasprintf() may return NULL on failure of internal allocation
thus the assignment to 'name' is not safe if unchecked. If NULL
is passed in for name then perf_pmu_register() would not fail
but rather silently jump to skip_type which is not the intent
here. As perf_pmu_register() may also return -ENOMEM returning
-ENOMEM in the (unlikely) failure case of devm_kasprintf() should
be fine here as well.

Acked-by: Mark Rutland 
Fixes: d5d9696b0380 ("drivers/perf: Add support for ARMv8.2 Statistical 
Profiling Extension")
Signed-off-by: Nicholas Mc Guire 
[will: reworded error message]
Signed-off-by: Will Deacon 
Signed-off-by: Sasha Levin 
---
 drivers/perf/arm_spe_pmu.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index 54ec278d2fc4..e1a77b2de78a 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -927,6 +927,11 @@ static int arm_spe_pmu_perf_init(struct arm_spe_pmu 
*spe_pmu)
 
idx = atomic_inc_return(_idx);
name = devm_kasprintf(dev, GFP_KERNEL, "%s_%d", PMUNAME, idx);
+   if (!name) {
+   dev_err(dev, "failed to allocate name for pmu %d\n", idx);
+   return -ENOMEM;
+   }
+
return perf_pmu_register(_pmu->pmu, name, -1);
 }
 
-- 
2.19.1





[PATCH 4.19 058/313] ptp: Fix pass zero to ERR_PTR() in ptp_clock_register

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit aea0a897af9e44c258e8ab9296fad417f1bc063a ]

Fix smatch warning:

drivers/ptp/ptp_clock.c:298 ptp_clock_register() warn:
 passing zero to 'ERR_PTR'

'err' should be set while device_create_with_groups and
pps_register_source fails

Fixes: 85a66e550195 ("ptp: create "pins" together with the rest of attributes")
Signed-off-by: YueHaibing 
Acked-by: Richard Cochran 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 drivers/ptp/ptp_clock.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 7eacc1c4b3b1..c64903a5978f 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -253,8 +253,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info 
*info,
ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid,
 ptp, ptp->pin_attr_groups,
 "ptp%d", ptp->index);
-   if (IS_ERR(ptp->dev))
+   if (IS_ERR(ptp->dev)) {
+   err = PTR_ERR(ptp->dev);
goto no_device;
+   }
 
/* Register a new PPS source. */
if (info->pps) {
@@ -265,6 +267,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info 
*info,
pps.owner = info->owner;
ptp->pps_source = pps_register_source(, PTP_PPS_DEFAULTS);
if (!ptp->pps_source) {
+   err = -EINVAL;
pr_err("failed to register pps source\n");
goto no_pps;
}
-- 
2.19.1





[PATCH 4.19 061/313] iio: adc: meson-saradc: check for devm_kasprintf failure

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit aad172b017617994343e36d8659c69e14cd694fd ]

devm_kasprintf() may return NULL on failure of internal allocation thus
the assignments to  init.name  are not safe if not checked. On error
meson_sar_adc_clk_init() returns negative values so -ENOMEM in the
(unlikely) failure case of devm_kasprintf() should be fine here.

Signed-off-by: Nicholas Mc Guire 
Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic 
Meson SoCs")
Acked-by: Martin Blumenstingl 
Tested-by: Martin Blumenstingl 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/iio/adc/meson_saradc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index da2d16dfa63e..da4c391b8977 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -589,6 +589,9 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
 
init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%pOF#adc_div",
   indio_dev->dev.of_node);
+   if (!init.name)
+   return -ENOMEM;
+
init.flags = 0;
init.ops = _divider_ops;
clk_parents[0] = __clk_get_name(priv->clkin);
@@ -608,6 +611,9 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
 
init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%pOF#adc_en",
   indio_dev->dev.of_node);
+   if (!init.name)
+   return -ENOMEM;
+
init.flags = CLK_SET_RATE_PARENT;
init.ops = _gate_ops;
clk_parents[0] = __clk_get_name(priv->adc_div_clk);
-- 
2.19.1





[PATCH 4.19 062/313] iio: adc: meson-saradc: fix internal clock names

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 50314f98b0ac468218e7c9af8c99f215a35436df ]

Before this patch we are registering the internal clocks (for example on
Meson8b, where the SAR ADC IP block implements the divider and gate
clocks) with the following names:
- /soc/cbus@c110/adc@8680#adc_div
- /soc/cbus@c110/adc@8680#adc_en

This is bad because the common clock framework uses the clock to create
a directory in /clk. With such name, the directory creation
(silently) fails and the debugfs entry ends up being created at the
debugfs root.

With this change, the new clock names are:
- c1108680.adc#adc_div
- c1108680.adc#adc_en

This matches the clock naming scheme used in the PWM, Ethernet and MMC
drivers. It also fixes the problem with debugfs.
The idea is shamelessly taken from commit b96e9eb62841c5 ("pwm: meson:
Fix mux clock names").

Fixes: 3921db46a8c5bc ("iio: Convert to using %pOF instead of full_name")
Signed-off-by: Martin Blumenstingl 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/iio/adc/meson_saradc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index da4c391b8977..5dd104cf0939 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -587,8 +587,8 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
struct clk_init_data init;
const char *clk_parents[1];
 
-   init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%pOF#adc_div",
-  indio_dev->dev.of_node);
+   init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%s#adc_div",
+  dev_name(indio_dev->dev.parent));
if (!init.name)
return -ENOMEM;
 
@@ -609,8 +609,8 @@ static int meson_sar_adc_clk_init(struct iio_dev *indio_dev,
if (WARN_ON(IS_ERR(priv->adc_div_clk)))
return PTR_ERR(priv->adc_div_clk);
 
-   init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%pOF#adc_en",
-  indio_dev->dev.of_node);
+   init.name = devm_kasprintf(_dev->dev, GFP_KERNEL, "%s#adc_en",
+  dev_name(indio_dev->dev.parent));
if (!init.name)
return -ENOMEM;
 
-- 
2.19.1





[PATCH 4.19 085/313] arm64: ftrace: dont adjust the LR value

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 6e803e2e6e367db9a0d6ecae1bd24bb5752011bd ]

The core ftrace code requires that when it is handed the PC of an
instrumented function, this PC is the address of the instrumented
instruction. This is necessary so that the core ftrace code can identify
the specific instrumentation site. Since the instrumented function will
be a BL, the address of the instrumented function is LR - 4 at entry to
the ftrace code.

This fixup is applied in the mcount_get_pc and mcount_get_pc0 helpers,
which acquire the PC of the instrumented function.

The mcount_get_lr helper is used to acquire the LR of the instrumented
function, whose value does not require this adjustment, and cannot be
adjusted to anything meaningful. No adjustment of this value is made on
other architectures, including arm. However, arm64 adjusts this value by
4.

This patch brings arm64 in line with other architectures and removes the
adjustment of the LR value.

Signed-off-by: Mark Rutland 
Cc: AKASHI Takahiro 
Cc: Ard Biesheuvel 
Cc: Catalin Marinas 
Cc: Torsten Duwe 
Cc: Will Deacon 
Signed-off-by: Will Deacon 
Signed-off-by: Sasha Levin 
---
 arch/arm64/kernel/entry-ftrace.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index 1175f5827ae1..295951f3172e 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -79,7 +79,6 @@
.macro mcount_get_lr reg
ldr \reg, [x29]
ldr \reg, [\reg, #8]
-   mcount_adjust_addr  \reg, \reg
.endm
 
.macro mcount_get_lr_addr reg
-- 
2.19.1





[PATCH 4.19 060/313] powerpc/32: Add .data..Lubsan_data*/.data..Lubsan_type* sections explicitly

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit beba24ac59133cb36ecd03f9af9ccb11971ee20e ]

When both `CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y` and `CONFIG_UBSAN=y`
are set, link step typically produce numberous warnings about orphan
section:

  + powerpc-linux-gnu-ld -EB -m elf32ppc -Bstatic --orphan-handling=warn 
--build-id --gc-sections -X -o .tmp_vmlinux1 -T 
./arch/powerpc/kernel/vmlinux.lds --who
  le-archive built-in.a --no-whole-archive --start-group lib/lib.a --end-group
  powerpc-linux-gnu-ld: warning: orphan section `.data..Lubsan_data393' from 
`init/main.o' being placed in section `.data..Lubsan_data393'.
  powerpc-linux-gnu-ld: warning: orphan section `.data..Lubsan_data394' from 
`init/main.o' being placed in section `.data..Lubsan_data394'.
  ...
  powerpc-linux-gnu-ld: warning: orphan section `.data..Lubsan_type11' from 
`init/main.o' being placed in section `.data..Lubsan_type11'.
  powerpc-linux-gnu-ld: warning: orphan section `.data..Lubsan_type12' from 
`init/main.o' being placed in section `.data..Lubsan_type12'.
  ...

This commit remove those warnings produced at W=1.

Link: https://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg135407.html
Suggested-by: Nicholas Piggin 
Signed-off-by: Mathieu Malaterre 
Signed-off-by: Michael Ellerman 
Signed-off-by: Sasha Levin 
---
 arch/powerpc/kernel/vmlinux.lds.S | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/kernel/vmlinux.lds.S 
b/arch/powerpc/kernel/vmlinux.lds.S
index 07ae018e550e..53016c753f3c 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -296,6 +296,10 @@ SECTIONS
 #ifdef CONFIG_PPC32
.data : AT(ADDR(.data) - LOAD_OFFSET) {
DATA_DATA
+#ifdef CONFIG_UBSAN
+   *(.data..Lubsan_data*)
+   *(.data..Lubsan_type*)
+#endif
*(.data.rel*)
*(SDATA_MAIN)
*(.sdata2)
-- 
2.19.1





[PATCH 4.19 084/313] mt76x0: dfs: fix IBI_R11 configuration on non-radar channels

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 6bf4a8e902aad7df55d7f2b10b850cfa3f880996 ]

Fix IBI_R11 configuration on non-radar channels for mt76x0e
driver. This patch improve system stability under heavy load.
Moreover use IBI_R11 name and remove magic numbers for
0x212c register

Fixes: 0c3b3abc9251 ("mt76x0: pci: add DFS support")
Signed-off-by: Lorenzo Bianconi 
Signed-off-by: Felix Fietkau 
Signed-off-by: Sasha Levin 
---
 drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c 
b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c
index 374cc655c11d..16e6b6970e28 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_dfs.c
@@ -799,7 +799,7 @@ static void mt76x2_dfs_set_bbp_params(struct mt76x2_dev 
*dev)
 
/* enable detection*/
mt76_wr(dev, MT_BBP(DFS, 0), MT_DFS_CH_EN << 16);
-   mt76_wr(dev, 0x212c, 0x0c350001);
+   mt76_wr(dev, MT_BBP(IBI, 11), 0x0c350001);
 }
 
 void mt76x2_dfs_adjust_agc(struct mt76x2_dev *dev)
@@ -842,7 +842,11 @@ void mt76x2_dfs_init_params(struct mt76x2_dev *dev)
mt76_wr(dev, MT_BBP(DFS, 0), 0);
/* clear detector status */
mt76_wr(dev, MT_BBP(DFS, 1), 0xf);
-   mt76_wr(dev, 0x212c, 0);
+   if (mt76_chip(>mt76) == 0x7610 ||
+   mt76_chip(>mt76) == 0x7630)
+   mt76_wr(dev, MT_BBP(IBI, 11), 0xfde8081);
+   else
+   mt76_wr(dev, MT_BBP(IBI, 11), 0);
 
mt76x2_irq_disable(dev, MT_INT_GPTIMER);
mt76_rmw_field(dev, MT_INT_TIMER_EN,
-- 
2.19.1





[PATCH 4.19 086/313] drm/v3d: Fix prime imports of buffers from other drivers.

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 62d1a752874962f072de8a779e960fcd2ab4847b ]

v3d_bo_get_pages() checks this to decide to map the imported buffer
instead of the backing shmem file.  The caller was about to set this
value anyway, and there's no error path in between.  Ideally we
wouldn't even allocate the shmem file for our imports, but that's a
more invasive fix.

Signed-off-by: Eric Anholt 
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D 
V3.x+")
Link: 
https://patchwork.freedesktop.org/patch/msgid/20181128230927.10951-3-e...@anholt.net
Acked-by: Daniel Vetter 
Reviewed-by: Dave Emett 
Signed-off-by: Sasha Levin 
---
 drivers/gpu/drm/v3d/v3d_bo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c
index 54d96518a131..a08766d39eab 100644
--- a/drivers/gpu/drm/v3d/v3d_bo.c
+++ b/drivers/gpu/drm/v3d/v3d_bo.c
@@ -293,6 +293,7 @@ v3d_prime_import_sg_table(struct drm_device *dev,
bo->resv = attach->dmabuf->resv;
 
bo->sgt = sgt;
+   obj->import_attach = attach;
v3d_bo_get_pages(bo);
 
v3d_mmu_insert_ptes(bo);
-- 
2.19.1





[PATCH 4.19 097/313] usb: hub: delay hub autosuspend if USB3 port is still link training

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit e86108940e541febf35813402ff29fa6f4a9ac0b ]

When initializing a hub we want to give a USB3 port in link training
the same debounce delay time before autosuspening the hub as already
trained, connected enabled ports.

USB3 ports won't reach the enabled state with "current connect status" and
"connect status change" bits set until the USB3 link training finishes.

Catching the port in link training (polling) and adding the debounce delay
prevents unnecessary failed attempts to autosuspend the hub.

Signed-off-by: Mathias Nyman 
Acked-by: Alan Stern 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/usb/core/hub.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index cc62707c0251..3adff4da2ee1 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -,6 +,16 @@ static void hub_activate(struct usb_hub *hub, enum 
hub_activation_type type)
   USB_PORT_FEAT_ENABLE);
}
 
+   /*
+* Add debounce if USB3 link is in polling/link training state.
+* Link will automatically transition to Enabled state after
+* link training completes.
+*/
+   if (hub_is_superspeed(hdev) &&
+   ((portstatus & USB_PORT_STAT_LINK_STATE) ==
+   USB_SS_PORT_LS_POLLING))
+   need_debounce_delay = true;
+
/* Clear status-change flags; we'll debounce later */
if (portchange & USB_PORT_STAT_C_CONNECTION) {
need_debounce_delay = true;
-- 
2.19.1





[PATCH 4.19 088/313] ARM: mmp/mmp2: dt: enable the clock

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit f36797ee43802b367e59f0f9a9805304a4ff0c98 ]

The device-tree booted MMP2 needs to enable the timer clock, otherwise
it would stop ticking when the boot finishes.

It can also use the clock rate from the clk, the non-DT boards need to
keep using the hardcoded rates.

Signed-off-by: Lubomir Rintel 
Acked-by: Pavel Machek 
Signed-off-by: Olof Johansson 
Signed-off-by: Sasha Levin 
---
 arch/arm/mach-mmp/common.h |  2 +-
 arch/arm/mach-mmp/mmp2.c   |  2 +-
 arch/arm/mach-mmp/pxa168.c |  2 +-
 arch/arm/mach-mmp/time.c   | 32 
 4 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h
index 7e284d9c429f..5ac2851ef5d3 100644
--- a/arch/arm/mach-mmp/common.h
+++ b/arch/arm/mach-mmp/common.h
@@ -2,7 +2,7 @@
 #include 
 #define ARRAY_AND_SIZE(x)  (x), ARRAY_SIZE(x)
 
-extern void timer_init(int irq);
+extern void timer_init(int irq, unsigned long rate);
 
 extern void __init mmp_map_io(void);
 extern void mmp_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index afba5460cdaf..fb3e7e32c882 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -134,7 +134,7 @@ void __init mmp2_timer_init(void)
clk_rst = APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1);
__raw_writel(clk_rst, APBC_TIMERS);
 
-   timer_init(IRQ_MMP2_TIMER1);
+   timer_init(IRQ_MMP2_TIMER1, 650);
 }
 
 /* on-chip devices */
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 0f5f16fb8c66..77a358165a56 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -79,7 +79,7 @@ void __init pxa168_timer_init(void)
/* 3.25MHz, bus/functional clock enabled, release reset */
__raw_writel(TIMER_CLK_RST, APBC_TIMERS);
 
-   timer_init(IRQ_PXA168_TIMER1);
+   timer_init(IRQ_PXA168_TIMER1, 650);
 }
 
 void pxa168_clear_keypad_wakeup(void)
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 96ad1db0b04b..eab0fd8a7343 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -38,12 +39,6 @@
 #include "cputype.h"
 #include "clock.h"
 
-#ifdef CONFIG_CPU_MMP2
-#define MMP_CLOCK_FREQ 650
-#else
-#define MMP_CLOCK_FREQ 325
-#endif
-
 #define TIMERS_VIRT_BASE   TIMERS1_VIRT_BASE
 
 #define MAX_DELTA  (0xfffe)
@@ -189,19 +184,18 @@ static struct irqaction timer_irq = {
.dev_id = ,
 };
 
-void __init timer_init(int irq)
+void __init timer_init(int irq, unsigned long rate)
 {
timer_config();
 
-   sched_clock_register(mmp_read_sched_clock, 32, MMP_CLOCK_FREQ);
+   sched_clock_register(mmp_read_sched_clock, 32, rate);
 
ckevt.cpumask = cpumask_of(0);
 
setup_irq(irq, _irq);
 
-   clocksource_register_hz(, MMP_CLOCK_FREQ);
-   clockevents_config_and_register(, MMP_CLOCK_FREQ,
-   MIN_DELTA, MAX_DELTA);
+   clocksource_register_hz(, rate);
+   clockevents_config_and_register(, rate, MIN_DELTA, MAX_DELTA);
 }
 
 #ifdef CONFIG_OF
@@ -213,7 +207,9 @@ static const struct of_device_id mmp_timer_dt_ids[] = {
 void __init mmp_dt_init_timer(void)
 {
struct device_node *np;
+   struct clk *clk;
int irq, ret;
+   unsigned long rate;
 
np = of_find_matching_node(NULL, mmp_timer_dt_ids);
if (!np) {
@@ -221,6 +217,18 @@ void __init mmp_dt_init_timer(void)
goto out;
}
 
+   clk = of_clk_get(np, 0);
+   if (!IS_ERR(clk)) {
+   ret = clk_prepare_enable(clk);
+   if (ret)
+   goto out;
+   rate = clk_get_rate(clk) / 2;
+   } else if (cpu_is_pj4()) {
+   rate = 650;
+   } else {
+   rate = 325;
+   }
+
irq = irq_of_parse_and_map(np, 0);
if (!irq) {
ret = -EINVAL;
@@ -231,7 +239,7 @@ void __init mmp_dt_init_timer(void)
ret = -ENOMEM;
goto out;
}
-   timer_init(irq);
+   timer_init(irq, rate);
return;
 out:
pr_err("Failed to get timer from device tree with error:%d\n", ret);
-- 
2.19.1





[PATCH 4.19 054/313] x86/resctrl: Fixup the user-visible strings

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 723f1a0dd8e26a7523ba068204bee11c95ded38d ]

Fix the messages in rdt_last_cmd_printf() and rdt_last_cmd_puts() to
make them more meaningful and consistent.

 [ bp: s/cpu/CPU/; s/mem\W/memory ]

Signed-off-by: Babu Moger 
Signed-off-by: Borislav Petkov 
Cc: Andrew Morton 
Cc: Andy Lutomirski 
Cc: Arnd Bergmann 
Cc: Brijesh Singh 
Cc: "Chang S. Bae" 
Cc: David Miller 
Cc: David Woodhouse 
Cc: Dmitry Safonov 
Cc: Fenghua Yu 
Cc: Greg Kroah-Hartman 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: Jann Horn 
Cc: Joerg Roedel 
Cc: Jonathan Corbet 
Cc: Josh Poimboeuf 
Cc: Kate Stewart 
Cc: "Kirill A. Shutemov" 
Cc: 
Cc: Mauro Carvalho Chehab 
Cc: Paolo Bonzini 
Cc: Peter Zijlstra 
Cc: Philippe Ombredanne 
Cc: Pu Wen 
Cc: 
Cc: "Rafael J. Wysocki" 
Cc: Reinette Chatre 
Cc: Rian Hunter 
Cc: Sherry Hurwitz 
Cc: Suravee Suthikulpanit 
Cc: Thomas Gleixner 
Cc: Thomas Lendacky 
Cc: Tony Luck 
Cc: Vitaly Kuznetsov 
Cc: 
Link: https://lkml.kernel.org/r/20181121202811.4492-11-babu.mo...@amd.com
Signed-off-by: Sasha Levin 
---
 arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c | 22 ++---
 arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 34 +--
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c| 36 ++---
 3 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c 
b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c
index 627e5c809b33..79d099538f2e 100644
--- a/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c
+++ b/arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c
@@ -71,7 +71,7 @@ int parse_bw(struct rdt_parse_data *data, struct rdt_resource 
*r,
unsigned long bw_val;
 
if (d->have_new_ctrl) {
-   rdt_last_cmd_printf("duplicate domain %d\n", d->id);
+   rdt_last_cmd_printf("Duplicate domain %d\n", d->id);
return -EINVAL;
}
 
@@ -97,12 +97,12 @@ static bool cbm_validate(char *buf, u32 *data, struct 
rdt_resource *r)
 
ret = kstrtoul(buf, 16, );
if (ret) {
-   rdt_last_cmd_printf("non-hex character in mask %s\n", buf);
+   rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf);
return false;
}
 
if (val == 0 || val > r->default_ctrl) {
-   rdt_last_cmd_puts("mask out of range\n");
+   rdt_last_cmd_puts("Mask out of range\n");
return false;
}
 
@@ -110,12 +110,12 @@ static bool cbm_validate(char *buf, u32 *data, struct 
rdt_resource *r)
zero_bit = find_next_zero_bit(, cbm_len, first_bit);
 
if (find_next_bit(, cbm_len, zero_bit) < cbm_len) {
-   rdt_last_cmd_printf("mask %lx has non-consecutive 1-bits\n", 
val);
+   rdt_last_cmd_printf("The mask %lx has non-consecutive 
1-bits\n", val);
return false;
}
 
if ((zero_bit - first_bit) < r->cache.min_cbm_bits) {
-   rdt_last_cmd_printf("Need at least %d bits in mask\n",
+   rdt_last_cmd_printf("Need at least %d bits in the mask\n",
r->cache.min_cbm_bits);
return false;
}
@@ -135,7 +135,7 @@ int parse_cbm(struct rdt_parse_data *data, struct 
rdt_resource *r,
u32 cbm_val;
 
if (d->have_new_ctrl) {
-   rdt_last_cmd_printf("duplicate domain %d\n", d->id);
+   rdt_last_cmd_printf("Duplicate domain %d\n", d->id);
return -EINVAL;
}
 
@@ -145,7 +145,7 @@ int parse_cbm(struct rdt_parse_data *data, struct 
rdt_resource *r,
 */
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP &&
rdtgroup_pseudo_locked_in_hierarchy(d)) {
-   rdt_last_cmd_printf("pseudo-locked region in hierarchy\n");
+   rdt_last_cmd_printf("Pseudo-locked region in hierarchy\n");
return -EINVAL;
}
 
@@ -164,14 +164,14 @@ int parse_cbm(struct rdt_parse_data *data, struct 
rdt_resource *r,
 * either is exclusive.
 */
if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, true)) {
-   rdt_last_cmd_printf("overlaps with exclusive group\n");
+   rdt_last_cmd_printf("Overlaps with exclusive group\n");
return -EINVAL;
}
 
if (rdtgroup_cbm_overlaps(r, d, cbm_val, rdtgrp->closid, false)) {
if (rdtgrp->mode == RDT_MODE_EXCLUSIVE ||
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
-   rdt_last_cmd_printf("overlaps with other group\n");
+   rdt_last_cmd_printf("0verlaps with other group\n");
return -EINVAL;
}
}
@@ -293,7 +293,7 @@ static int rdtgroup_parse_resource(char *resname, char *tok,
if (!strcmp(resname, r->name) && rdtgrp->closid < r->num_closid)

[PATCH 4.19 098/313] timekeeping: Use proper seqcount initializer

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit ce10a5b3954f2514af726beb78ed8d7350c5e41c ]

tk_core.seq is initialized open coded, but that misses to initialize the
lockdep map when lockdep is enabled. Lockdep splats involving tk_core seq
consequently lack a name and are hard to read.

Use the proper initializer which takes care of the lockdep map
initialization.

[ tglx: Massaged changelog ]

Signed-off-by: Bart Van Assche 
Signed-off-by: Thomas Gleixner 
Cc: pet...@infradead.org
Cc: t...@kernel.org
Cc: johannes.b...@intel.com
Link: https://lkml.kernel.org/r/20181128234325.110011-12-bvanass...@acm.org
Signed-off-by: Sasha Levin 
---
 kernel/time/timekeeping.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index f3b22f456fac..7846ce24ecc0 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -50,7 +50,9 @@ enum timekeeping_adv_mode {
 static struct {
seqcount_t  seq;
struct timekeeper   timekeeper;
-} tk_core cacheline_aligned;
+} tk_core cacheline_aligned = {
+   .seq = SEQCNT_ZERO(tk_core.seq),
+};
 
 static DEFINE_RAW_SPINLOCK(timekeeper_lock);
 static struct timekeeper shadow_timekeeper;
-- 
2.19.1





[PATCH 4.19 063/313] iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 7f6232e69539971cf9eaed07a6c14ab4a2361133 ]

Various 2-in-1's use KIOX010A and KIOX020A as HIDs for 2 KXCJ91008
accelerometers. The KIOX010A HID is for the one in the base and the
KIOX020A for the accelerometer in the keyboard.

Since userspace does not have a way yet to deal with (or ignore) the
accelerometer in the keyboard, this commit just adds the KIOX010A HID
for now so that display rotation will work.

Related: https://github.com/hadess/iio-sensor-proxy/issues/166
Signed-off-by: Hans de Goede 
Signed-off-by: Jonathan Cameron 
Signed-off-by: Sasha Levin 
---
 drivers/iio/accel/kxcjk-1013.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index af53a1084ee5..471caa5323e4 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -1490,6 +1490,7 @@ static const struct acpi_device_id kx_acpi_match[] = {
{"KXCJ1008", KXCJ91008},
{"KXCJ9000", KXCJ91008},
{"KIOX000A", KXCJ91008},
+   {"KIOX010A", KXCJ91008}, /* KXCJ91008 inside the display of a 2-in-1 */
{"KXTJ1009", KXTJ21009},
{"SMO8500",  KXCJ91008},
{ },
-- 
2.19.1





[PATCH 4.19 101/313] media: imx274: select REGMAP_I2C

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 4f9d7225c70dd9d3f406b79e60f8dbd2cd5ae743 ]

The imx274 driver uses regmap and the build will fail without it.

Fixes:

  drivers/media/i2c/imx274.c:142:21: error: variable ‘imx274_regmap_config’ has 
initializer but incomplete type
   static const struct regmap_config imx274_regmap_config = {
   ^
  drivers/media/i2c/imx274.c:1869:19: error: implicit declaration of function 
‘devm_regmap_init_i2c’ [-Werror=implicit-function-declaration]
imx274->regmap = devm_regmap_init_i2c(client, _regmap_config);
 ^~~~

and others.

Signed-off-by: Luca Ceresoli 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/i2c/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 041a777dfdee..63c9ac2c6a5f 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -611,6 +611,7 @@ config VIDEO_IMX274
tristate "Sony IMX274 sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on MEDIA_CAMERA_SUPPORT
+   select REGMAP_I2C
---help---
  This is a V4L2 sensor driver for the Sony IMX274
  CMOS image sensor.
-- 
2.19.1





[PATCH 4.19 106/313] IB/hfi1: Unreserve a reserved request when it is completed

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit ca95f802ef5139722acc8d30aeaab6fe5bbe939e ]

Currently, When a reserved operation is completed, its entry in the send
queue will not be unreserved, which leads to the miscalculation of
qp->s_avail and thus the triggering of a WARN_ON call trace. This patch
fixes the problem by unreserving the reserved operation when it is
completed.

Fixes: 856cc4c237ad ("IB/hfi1: Add the capability for reserved operations")
Reviewed-by: Mike Marciniszyn 
Signed-off-by: Kaike Wan 
Signed-off-by: Dennis Dalessandro 
Signed-off-by: Jason Gunthorpe 
Signed-off-by: Sasha Levin 
---
 drivers/infiniband/hw/hfi1/rc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index 9bd63abb2dfe..6f013a565353 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -1157,6 +1157,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct 
hfi1_opa_header *opah)
if (cmp_psn(wqe->lpsn, qp->s_sending_psn) >= 0 &&
cmp_psn(qp->s_sending_psn, qp->s_sending_hpsn) <= 0)
break;
+   rvt_qp_wqe_unreserve(qp, wqe);
s_last = qp->s_last;
trace_hfi1_qp_send_completion(qp, wqe, s_last);
if (++s_last >= qp->s_size)
@@ -1209,6 +1210,7 @@ static struct rvt_swqe *do_rc_completion(struct rvt_qp 
*qp,
u32 s_last;
 
rvt_put_swqe(wqe);
+   rvt_qp_wqe_unreserve(qp, wqe);
s_last = qp->s_last;
trace_hfi1_qp_send_completion(qp, wqe, s_last);
if (++s_last >= qp->s_size)
-- 
2.19.1





[PATCH 4.19 102/313] drm/amdgpu/powerplay: fix clock stretcher limits on polaris (v2)

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit de4aaab5cc9770a8c4dc13d9bfb6a83b06bba57e ]

Adjust limits for newer polaris variants.

v2: fix polaris11 kicker (Jerry)

Reviewed-by: Junwei Zhang 
Signed-off-by: Alex Deucher 
Signed-off-by: Sasha Levin 
---
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c 
b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index 5b67f575cd34..45629f26dbc2 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -1528,8 +1528,21 @@ static int 
polaris10_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
efuse = efuse >> 24;
 
if (hwmgr->chip_id == CHIP_POLARIS10) {
-   min = 1000;
-   max = 2300;
+   if (hwmgr->is_kicker) {
+   min = 1200;
+   max = 2500;
+   } else {
+   min = 1000;
+   max = 2300;
+   }
+   } else if (hwmgr->chip_id == CHIP_POLARIS11) {
+   if (hwmgr->is_kicker) {
+   min = 900;
+   max = 2100;
+   } else {
+   min = 1100;
+   max = 2100;
+   }
} else {
min = 1100;
max = 2100;
-- 
2.19.1





[PATCH 4.19 089/313] ARM: dts: aspeed: add missing memory unit-address

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 8ef86955fe59f7912a40d57ae4c6d511f0187b4d ]

The base aspeed-g5.dtsi already defines a '/memory@8000' node, so
'/memory' in the board files create a duplicate node. We're probably
getting lucky that the bootloader fixes up the memory node that the
kernel ends up using. Add the unit-address so it's merged with the base
node.

Found with DT json-schema checks.

Cc: Joel Stanley 
Cc: Andrew Jeffery 
Cc: devicet...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-asp...@lists.ozlabs.org
Signed-off-by: Rob Herring 
Signed-off-by: Olof Johansson 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts | 2 +-
 arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts   | 2 +-
 arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts | 3 +--
 arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts| 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts 
b/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts
index df1227613d48..c2ece0b91885 100644
--- a/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-arm-centriq2400-rep.dts
@@ -13,7 +13,7 @@
bootargs = "console=ttyS4,115200 earlyprintk";
};
 
-   memory {
+   memory@8000 {
reg = <0x8000 0x4000>;
};
 
diff --git a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts 
b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts
index 7a291de02543..22dade6393d0 100644
--- a/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-intel-s2600wf.dts
@@ -13,7 +13,7 @@
bootargs = "earlyprintk";
};
 
-   memory {
+   memory@8000 {
reg = <0x8000 0x2000>;
};
 
diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts 
b/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts
index d598b6391362..024e52a6cd0f 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-lanyang.dts
@@ -14,7 +14,7 @@
bootargs = "console=ttyS4,115200 earlyprintk";
};
 
-   memory {
+   memory@8000 {
reg = <0x8000 0x4000>;
};
 
@@ -322,4 +322,3 @@
  {
status = "okay";
 };
-
diff --git a/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts 
b/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts
index 43ed13963d35..33d704541de6 100644
--- a/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-portwell-neptune.dts
@@ -17,7 +17,7 @@
bootargs = "console=ttyS4,115200 earlyprintk";
};
 
-   memory {
+   memory@8000 {
reg = <0x8000 0x2000>;
};
 
-- 
2.19.1





[PATCH 4.19 103/313] tipc: fix node keep alive interval calculation

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit f5d6c3e5a359c0507800e7ac68d565c21de9b5a1 ]

When setting LINK tolerance, node timer interval will be calculated
base on the LINK with lowest tolerance.

But when calculated, the old node timer interval only updated if current
setting value (tolerance/4) less than old ones regardless of number of
links as well as links' lowest tolerance value.

This caused to two cases missing if tolerance changed as following:
Case 1:
1.1/ There is one link (L1) available in the system
1.2/ Set L1's tolerance from 1500ms => lower (i.e 500ms)
1.3/ Then, fallback to default (1500ms) or higher (i.e 2000ms)

Expected:
node timer interval is 1500/4=375ms after 1.3

Result:
node timer interval will not being updated after changing tolerance at 1.3
since its value 1500/4=375ms is not less than 500/4=125ms at 1.2.

Case 2:
2.1/ There are two links (L1, L2) available in the system
2.2/ L1 and L2 tolerance value are 2000ms as initial
2.3/ Set L2's tolerance from 2000ms => lower 1500ms
2.4/ Disable link L2 (bring down its bearer)

Expected:
node timer interval is 2000ms/4=500ms after 2.4

Result:
node timer interval will not being updated after disabling L2 since
its value 2000ms/4=500ms is still not less than 1500/4=375ms at 2.3
although L2 is already not available in the system.

To fix this, we start the node interval calculation by initializing it to
a value larger than any conceivable calculated value. This way, the link
with the lowest tolerance will always determine the calculated value.

Acked-by: Jon Maloy 
Signed-off-by: Hoang Le 
Signed-off-by: David S. Miller 
Signed-off-by: Sasha Levin 
---
 net/tipc/node.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/net/tipc/node.c b/net/tipc/node.c
index 488019766433..32556f480a60 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -624,6 +624,12 @@ static void tipc_node_timeout(struct timer_list *t)
 
__skb_queue_head_init();
 
+   /* Initial node interval to value larger (10 seconds), then it will be
+* recalculated with link lowest tolerance
+*/
+   tipc_node_read_lock(n);
+   n->keepalive_intv = 1;
+   tipc_node_read_unlock(n);
for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) {
tipc_node_read_lock(n);
le = >links[bearer_id];
-- 
2.19.1





[PATCH 4.19 099/313] usb: mtu3: fix the issue about SetFeature(U1/U2_Enable)

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a0678e2eed41e81004308693ac84ea95614b0920 ]

Fix the issue: device doesn't accept LGO_U1/U2:
1. set SW_U1/U2_ACCEPT_ENABLE to eanble controller to accept LGO_U1/U2
by default;
2. enable/disable controller to initiate requests for transition into
U1/U2 by SW_U1/U2_REQUEST_ENABLE instead of SW_U1/U2_ACCEPT_ENABLE;

Signed-off-by: Chunfeng Yun 
Signed-off-by: Felipe Balbi 
Signed-off-by: Sasha Levin 
---
 drivers/usb/mtu3/mtu3_core.c   | 4 +++-
 drivers/usb/mtu3/mtu3_gadget_ep0.c | 8 
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index d045d8458f81..48d10a61e271 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -578,8 +578,10 @@ static void mtu3_regs_init(struct mtu3 *mtu)
if (mtu->is_u3_ip) {
/* disable LGO_U1/U2 by default */
mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL,
-   SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE |
SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE);
+   /* enable accept LGO_U1/U2 link command from host */
+   mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL,
+   SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE);
/* device responses to u3_exit from host automatically */
mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN);
/* automatically build U2 link when U3 detect fail */
diff --git a/drivers/usb/mtu3/mtu3_gadget_ep0.c 
b/drivers/usb/mtu3/mtu3_gadget_ep0.c
index 25216e79cd6e..3c464d8ae023 100644
--- a/drivers/usb/mtu3/mtu3_gadget_ep0.c
+++ b/drivers/usb/mtu3/mtu3_gadget_ep0.c
@@ -336,9 +336,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu,
 
lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL);
if (set)
-   lpc |= SW_U1_ACCEPT_ENABLE;
+   lpc |= SW_U1_REQUEST_ENABLE;
else
-   lpc &= ~SW_U1_ACCEPT_ENABLE;
+   lpc &= ~SW_U1_REQUEST_ENABLE;
mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc);
 
mtu->u1_enable = !!set;
@@ -351,9 +351,9 @@ static int ep0_handle_feature_dev(struct mtu3 *mtu,
 
lpc = mtu3_readl(mbase, U3D_LINK_POWER_CONTROL);
if (set)
-   lpc |= SW_U2_ACCEPT_ENABLE;
+   lpc |= SW_U2_REQUEST_ENABLE;
else
-   lpc &= ~SW_U2_ACCEPT_ENABLE;
+   lpc &= ~SW_U2_REQUEST_ENABLE;
mtu3_writel(mbase, U3D_LINK_POWER_CONTROL, lpc);
 
mtu->u2_enable = !!set;
-- 
2.19.1





[PATCH 4.19 104/313] driver core: Move async_synchronize_full call

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit c37d721c68ad88925ba0e72f6e14acb829a8c6bb ]

Move the async_synchronize_full call out of __device_release_driver and
into driver_detach.

The idea behind this is that the async_synchronize_full call will only
guarantee that any existing async operations are flushed. This doesn't do
anything to guarantee that a hotplug event that may occur while we are
doing the release of the driver will not be asynchronously scheduled.

By moving this into the driver_detach path we can avoid potential deadlocks
as we aren't holding the device lock at this point and we should not have
the driver we want to flush loaded so the flush will take care of any
asynchronous events the driver we are detaching might have scheduled.

Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for 
drivers")
Reviewed-by: Bart Van Assche 
Reviewed-by: Dan Williams 
Signed-off-by: Alexander Duyck 
Reviewed-by: Luis Chamberlain 
Signed-off-by: Greg Kroah-Hartman 
Signed-off-by: Sasha Levin 
---
 drivers/base/dd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 2607f859881a..7caa1adaf62a 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -926,9 +926,6 @@ static void __device_release_driver(struct device *dev, 
struct device *parent)
 
drv = dev->driver;
if (drv) {
-   if (driver_allows_async_probing(drv))
-   async_synchronize_full();
-
while (device_links_busy(dev)) {
device_unlock(dev);
if (parent && dev->bus->need_parent_lock)
@@ -1034,6 +1031,9 @@ void driver_detach(struct device_driver *drv)
struct device_private *dev_prv;
struct device *dev;
 
+   if (driver_allows_async_probing(drv))
+   async_synchronize_full();
+
for (;;) {
spin_lock(>p->klist_devices.k_lock);
if (list_empty(>p->klist_devices.k_list)) {
-- 
2.19.1





[PATCH 4.19 107/313] usb: dwc3: trace: add missing break statement to make compiler happy

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 54d48183d21e03f780053d7129312049cb5dd591 ]

The missed break statement in the outer switch makes the code fall through
always and thus always same value will be printed.

Besides that, compiler warns about missed fall through marker:

drivers/usb/dwc3/./trace.h: In function ‘trace_raw_output_dwc3_log_trb’:
drivers/usb/dwc3/./trace.h:246:4: warning: this statement may fall through 
[-Wimplicit-fallthrough=]
switch (pcm) {
^~

Add the missing break statement to work correctly without compilation
warnings.

Fixes: fa8d965d736b ("usb: dwc3: trace: pretty print high-bandwidth transfers 
too")
Cc: Felipe Balbi 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Felipe Balbi 
Signed-off-by: Sasha Levin 
---
 drivers/usb/dwc3/trace.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h
index f22714cce070..f27c5cbe285c 100644
--- a/drivers/usb/dwc3/trace.h
+++ b/drivers/usb/dwc3/trace.h
@@ -251,9 +251,11 @@ DECLARE_EVENT_CLASS(dwc3_log_trb,
s = "2x ";
break;
case 3:
+   default:
s = "3x ";
break;
}
+   break;
default:
s = "";
} s; }),
-- 
2.19.1





[PATCH 4.19 108/313] gpio: mt7621: report failure of devm_kasprintf()

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 59d646c775d6ae688ee90fda9f2a4270c47b7490 ]

kasprintf() may return NULL on failure of internal allocation thus the
assigned  label  is not safe if not explicitly checked. On error
mediatek_gpio_bank_probe() returns negative values so -ENOMEM in the
(unlikely) failure case should be fine here.

Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621")
Signed-off-by: Nicholas Mc Guire 
Reviewed-by: Bartosz Golaszewski 
Acked-by: Sean Wang 
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpio-mt7621.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c
index d72af6f6cdbd..1ec95bc18f5b 100644
--- a/drivers/gpio/gpio-mt7621.c
+++ b/drivers/gpio/gpio-mt7621.c
@@ -244,6 +244,8 @@ mediatek_gpio_bank_probe(struct device *dev,
rg->chip.of_xlate = mediatek_gpio_xlate;
rg->chip.label = devm_kasprintf(dev, GFP_KERNEL, "%s-bank%d",
dev_name(dev), bank);
+   if (!rg->chip.label)
+   return -ENOMEM;
 
ret = devm_gpiochip_add_data(dev, >chip, mtk);
if (ret < 0) {
-- 
2.19.1





[PATCH 4.19 109/313] gpio: mt7621: pass mediatek_gpio_bank_probe() failure up the stack

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a109c2dbb571b10bb9969285b646f57309c98251 ]

The error cases of mediatek_gpio_bank_probe() would go unnoticed (except
for the dev_err() messages). The probe function should return an error
if one of the banks failed to initialize properly indicated by
not returning non-0.

Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621")
Signed-off-by: Nicholas Mc Guire 
Acked-by: Sean Wang 
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/gpio/gpio-mt7621.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c
index 1ec95bc18f5b..00e954f22bc9 100644
--- a/drivers/gpio/gpio-mt7621.c
+++ b/drivers/gpio/gpio-mt7621.c
@@ -297,6 +297,7 @@ mediatek_gpio_probe(struct platform_device *pdev)
struct device_node *np = dev->of_node;
struct mtk *mtk;
int i;
+   int ret;
 
mtk = devm_kzalloc(dev, sizeof(*mtk), GFP_KERNEL);
if (!mtk)
@@ -311,8 +312,11 @@ mediatek_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mtk);
mediatek_gpio_irq_chip.name = dev_name(dev);
 
-   for (i = 0; i < MTK_BANK_CNT; i++)
-   mediatek_gpio_bank_probe(dev, np, i);
+   for (i = 0; i < MTK_BANK_CNT; i++) {
+   ret = mediatek_gpio_bank_probe(dev, np, i);
+   if (ret)
+   return ret;
+   }
 
return 0;
 }
-- 
2.19.1





[PATCH 4.19 110/313] pinctrl: sx150x: handle failure case of devm_kstrdup

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit a9d9f6b83f1bb05da849b3540e6d1f70ef1c2343 ]

devm_kstrdup() may return NULL if internal allocation failed.
Thus using  label, name  is unsafe without checking. Therefor
in the unlikely case of allocation failure, sx150x_probe() simply
returns -ENOMEM.

Signed-off-by: Nicholas Mc Guire 
Fixes: 9e80f9064e73 ("pinctrl: Add SX150X GPIO Extender Pinctrl Driver")
Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 drivers/pinctrl/pinctrl-sx150x.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c
index cbf58a10113d..4d87d75b9c6e 100644
--- a/drivers/pinctrl/pinctrl-sx150x.c
+++ b/drivers/pinctrl/pinctrl-sx150x.c
@@ -1166,7 +1166,6 @@ static int sx150x_probe(struct i2c_client *client,
}
 
/* Register GPIO controller */
-   pctl->gpio.label = devm_kstrdup(dev, client->name, GFP_KERNEL);
pctl->gpio.base = -1;
pctl->gpio.ngpio = pctl->data->npins;
pctl->gpio.get_direction = sx150x_gpio_get_direction;
@@ -1180,6 +1179,10 @@ static int sx150x_probe(struct i2c_client *client,
pctl->gpio.of_node = dev->of_node;
 #endif
pctl->gpio.can_sleep = true;
+   pctl->gpio.label = devm_kstrdup(dev, client->name, GFP_KERNEL);
+   if (!pctl->gpio.label)
+   return -ENOMEM;
+
/*
 * Setting multiple pins is not safe when all pins are not
 * handled by the same regmap register. The oscio pin (present
@@ -1200,13 +1203,15 @@ static int sx150x_probe(struct i2c_client *client,
 
/* Add Interrupt support if an irq is specified */
if (client->irq > 0) {
-   pctl->irq_chip.name = devm_kstrdup(dev, client->name,
-  GFP_KERNEL);
pctl->irq_chip.irq_mask = sx150x_irq_mask;
pctl->irq_chip.irq_unmask = sx150x_irq_unmask;
pctl->irq_chip.irq_set_type = sx150x_irq_set_type;
pctl->irq_chip.irq_bus_lock = sx150x_irq_bus_lock;
pctl->irq_chip.irq_bus_sync_unlock = sx150x_irq_bus_sync_unlock;
+   pctl->irq_chip.name = devm_kstrdup(dev, client->name,
+  GFP_KERNEL);
+   if (!pctl->irq_chip.name)
+   return -ENOMEM;
 
pctl->irq.masked = ~0;
pctl->irq.sense = 0;
-- 
2.19.1





[PATCH 4.19 113/313] mips: bpf: fix encoding bug for mm_srlv32_op

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 17f6c83fb5ebf7db4fcc94a5be4c22d5a7bfe428 ]

For micro-mips, srlv inside POOL32A encoding space should use 0x50
sub-opcode, NOT 0x90.

Some early version ISA doc describes the encoding as 0x90 for both srlv and
srav, this looks to me was a typo. I checked Binutils libopcode
implementation which is using 0x50 for srlv and 0x90 for srav.

v1->v2:
  - Keep mm_srlv32_op sorted by value.

Fixes: f31318fdf324 ("MIPS: uasm: Add srlv uasm instruction")
Cc: Markos Chandras 
Cc: Paul Burton 
Cc: linux-m...@vger.kernel.org
Acked-by: Jakub Kicinski 
Acked-by: Song Liu 
Signed-off-by: Jiong Wang 
Signed-off-by: Alexei Starovoitov 
Signed-off-by: Sasha Levin 
---
 arch/mips/include/uapi/asm/inst.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/include/uapi/asm/inst.h 
b/arch/mips/include/uapi/asm/inst.h
index c05dcf5ab414..273ef58f4d43 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -369,8 +369,8 @@ enum mm_32a_minor_op {
mm_ext_op = 0x02c,
mm_pool32axf_op = 0x03c,
mm_srl32_op = 0x040,
+   mm_srlv32_op = 0x050,
mm_sra_op = 0x080,
-   mm_srlv32_op = 0x090,
mm_rotr_op = 0x0c0,
mm_lwxs_op = 0x118,
mm_addu32_op = 0x150,
-- 
2.19.1





[PATCH 4.19 111/313] iommu/amd: Fix amd_iommu=force_isolation

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit c12b08ebbe16f0d3a96a116d86709b04c1ee8e74 ]

The parameter is still there but it's ignored. We need to check its
value before deciding to go into passthrough mode for AMD IOMMU v2
capable device.

We occasionally use this parameter to force v2 capable device into
translation mode to debug memory corruption that we suspect is
caused by DMA writes.

To address the following comment from Joerg Roedel on the first
version, v2 capability of device is completely ignored.
> This breaks the iommu_v2 use-case, as it needs a direct mapping for the
> devices that support it.

And from Documentation/admin-guide/kernel-parameters.txt:
  This option does not override iommu=pt

Fixes: aafd8ba0ca74 ("iommu/amd: Implement add_device and remove_device")

Signed-off-by: Yu Zhao 
Signed-off-by: Joerg Roedel 
Signed-off-by: Sasha Levin 
---
 drivers/iommu/amd_iommu.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index bee0dfb7b93b..34c9aa76a7bd 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -438,7 +438,14 @@ static int iommu_init_device(struct device *dev)
 
dev_data->alias = get_alias(dev);
 
-   if (dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) {
+   /*
+* By default we use passthrough mode for IOMMUv2 capable device.
+* But if amd_iommu=force_isolation is set (e.g. to debug DMA to
+* invalid address), we ignore the capability for the device so
+* it'll be forced to go into translation mode.
+*/
+   if ((iommu_pass_through || !amd_iommu_force_isolation) &&
+   dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) {
struct amd_iommu *iommu;
 
iommu = amd_iommu_rlookup_table[dev_data->devid];
-- 
2.19.1





[PATCH 4.19 117/313] watchdog: renesas_wdt: dont set divider while watchdog is running

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit e990e12741877e9bfac402ca468f4007a75f6e2a ]

The datasheet says we must stop the timer before changing the clock
divider. This can happen when the restart handler is called while the
watchdog is running.

Signed-off-by: Wolfram Sang 
Reviewed-by: Fabrizio Castro 
Reviewed-by: Guenter Roeck 
Signed-off-by: Guenter Roeck 
Signed-off-by: Wim Van Sebroeck 
Signed-off-by: Sasha Levin 
---
 drivers/watchdog/renesas_wdt.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 88d81feba4e6..d01efd342dc0 100644
--- a/drivers/watchdog/renesas_wdt.c
+++ b/drivers/watchdog/renesas_wdt.c
@@ -77,12 +77,17 @@ static int rwdt_init_timeout(struct watchdog_device *wdev)
 static int rwdt_start(struct watchdog_device *wdev)
 {
struct rwdt_priv *priv = watchdog_get_drvdata(wdev);
+   u8 val;
 
pm_runtime_get_sync(wdev->parent);
 
-   rwdt_write(priv, 0, RWTCSRB);
-   rwdt_write(priv, priv->cks, RWTCSRA);
+   /* Stop the timer before we modify any register */
+   val = readb_relaxed(priv->base + RWTCSRA) & ~RWTCSRA_TME;
+   rwdt_write(priv, val, RWTCSRA);
+
rwdt_init_timeout(wdev);
+   rwdt_write(priv, priv->cks, RWTCSRA);
+   rwdt_write(priv, 0, RWTCSRB);
 
while (readb_relaxed(priv->base + RWTCSRA) & RWTCSRA_WRFLG)
cpu_relax();
-- 
2.19.1





[PATCH 4.19 115/313] ARM: dts: Fix up the D-Link DIR-685 MTD partition info

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 738a05e673435afb986b53da43befd83ad87ec3b ]

The vendor firmware was analyzed to get the right idea about
this flash layout. /proc/mtd contains:

dev:size   erasesize  name
mtd0: 01e7ff40 0002 "rootfs"
mtd1: 01f4 0002 "upgrade"
mtd2: 0004 0002 "rgdb"
mtd3: 0002 0002 "nvram"
mtd4: 0004 0002 "RedBoot"
mtd5: 0002 0002 "LangPack"
mtd6: 0200 0002 "flash"

Here "flash" is obviously the whole device and we know "rootfs"
is a bogus hack to point to a squashfs rootfs inside of the main
"upgrade partition". We know "RedBoot" is the first 0x4 of
the flash and the "upgrade" partition follows from 0x4 to
0x1f8000. So we have mtd0, 1, 4 and 6 covered.

Remains:
mtd2: 0004 0002 "rgdb"
mtd3: 0002 0002 "nvram"
mtd5: 0002 0002 "LangPack"

Inspecting the flash at 0x1f8000 and 0x1fa000 reveals each of
these starting with "RGCFG1" so we assume 0x1f8000-1fbfff is
"rgdb" of 0x4.

Signed-off-by: Linus Walleij 
Signed-off-by: Sasha Levin 
---
 arch/arm/boot/dts/gemini-dlink-dir-685.dts | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/arm/boot/dts/gemini-dlink-dir-685.dts 
b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
index 6f258b50eb44..502a361d1fe9 100644
--- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
+++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
@@ -274,20 +274,16 @@
read-only;
};
/*
-* Between the boot loader and the rootfs is the kernel
-* in a custom Storlink format flashed from the boot
-* menu. The rootfs is in squashfs format.
+* This firmware image contains the kernel catenated
+* with the squashfs root filesystem. For some reason
+* this is called "upgrade" on the vendor system.
 */
-   partition@1800c0 {
-   label = "rootfs";
-   reg = <0x001800c0 0x01dbff40>;
-   read-only;
-   };
-   partition@1f4 {
+   partition@4 {
label = "upgrade";
-   reg = <0x01f4 0x0004>;
+   reg = <0x0004 0x01f4>;
read-only;
};
+   /* RGDB, Residental Gateway Database? */
partition@1f8 {
label = "rgdb";
reg = <0x01f8 0x0004>;
-- 
2.19.1





[PATCH 4.19 119/313] usb: dwc3: gadget: Disable CSP for stream OUT ep

2019-02-11 Thread Greg Kroah-Hartman
4.19-stable review patch.  If anyone has any objections, please let me know.

--

[ Upstream commit 244add8ebfb231c39db9e33b204bd0ce8f24f782 ]

In stream mode, when fast-forwarding TRBs, the stream number
is not cleared causing the new stream to not get assigned. So
we don't want controller to carry on transfers when short packet
is received. So disable the CSP for stream capable endpoint.

This is based on the 3.30a Programming guide, where table 3-1
device descriptor structure field definitions says for CSP bit
If this bit is 0, the controller generates an XferComplete event
and remove the stream. So if we keep CSP as 1 then switching between
streams would not happen as in stream mode, when fast-forwarding
TRBs, the stream number is not cleared causing the new stream to not get
assigned.

Signed-off-by: Tejas Joglekar 
Signed-off-by: Felipe Balbi 
Signed-off-by: Sasha Levin 
---
 drivers/usb/dwc3/gadget.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 74d29159f3b9..105278ccf487 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -981,9 +981,13 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, 
struct dwc3_trb *trb,
usb_endpoint_type(dep->endpoint.desc));
}
 
-   /* always enable Continue on Short Packet */
+   /*
+* Enable Continue on Short Packet
+* when endpoint is not a stream capable
+*/
if (usb_endpoint_dir_out(dep->endpoint.desc)) {
-   trb->ctrl |= DWC3_TRB_CTRL_CSP;
+   if (!dep->stream_capable)
+   trb->ctrl |= DWC3_TRB_CTRL_CSP;
 
if (short_not_ok)
trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
-- 
2.19.1





<    3   4   5   6   7   8   9   10   11   12   >