[PATCH net v6 4/6] net: marvell: prestera: Add ethtool interface support

2020-09-02 Thread Vadym Kochan
The ethtool API provides support for the configuration of the following
features: speed and duplex, auto-negotiation, MDI-x, forward error
correction, port media type. The API also provides information about the
port status, hardware and software statistic. The following limitation
exists:

- port media type should be configured before speed setting
- ethtool -m option is not supported
- ethtool -p option is not supported
- ethtool -r option is supported for RJ45 port only
- the following combination of parameters is not supported:

  ethtool -s sw1pX port XX autoneg on

- forward error correction feature is supported only on SFP ports, 10G
  speed

- auto-negotiation and MDI-x features are not supported on
  Copper-to-Fiber SFP module

Co-developed-by: Andrii Savka 
Signed-off-by: Andrii Savka 
Co-developed-by: Serhiy Boiko 
Signed-off-by: Serhiy Boiko 
Signed-off-by: Vadym Kochan 
---
PATCH v5:

1) Convert following error check:

if (func(...))
or
if (!func(...))

to use err variable:

err = func(...)
if (err)

2) Remove "," from terminated enum entry.

PATCH v4:
1) Export only prestera_ethtool_ops instead of
   each ethtool handler.

2) Get rid of not needed cast in prestera_ethtool_get_stats(...)
   when doing memcpy.

 .../net/ethernet/marvell/prestera/Makefile|   2 +-
 .../net/ethernet/marvell/prestera/prestera.h  |   3 +
 .../marvell/prestera/prestera_ethtool.c   | 759 ++
 .../marvell/prestera/prestera_ethtool.h   |  14 +
 .../ethernet/marvell/prestera/prestera_hw.c   | 295 ++-
 .../ethernet/marvell/prestera/prestera_hw.h   |  65 ++
 .../ethernet/marvell/prestera/prestera_main.c |  28 +-
 7 files changed, 1159 insertions(+), 7 deletions(-)
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_ethtool.c
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_ethtool.h

diff --git a/drivers/net/ethernet/marvell/prestera/Makefile 
b/drivers/net/ethernet/marvell/prestera/Makefile
index babd71fba809..7684e7047562 100644
--- a/drivers/net/ethernet/marvell/prestera/Makefile
+++ b/drivers/net/ethernet/marvell/prestera/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_PRESTERA) += prestera.o
 prestera-objs  := prestera_main.o prestera_hw.o prestera_dsa.o \
-  prestera_rxtx.o prestera_devlink.o
+  prestera_rxtx.o prestera_devlink.o prestera_ethtool.o
 
 obj-$(CONFIG_PRESTERA_PCI) += prestera_pci.o
diff --git a/drivers/net/ethernet/marvell/prestera/prestera.h 
b/drivers/net/ethernet/marvell/prestera/prestera.h
index 5e890897356e..9a5a0deb909b 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera.h
+++ b/drivers/net/ethernet/marvell/prestera/prestera.h
@@ -174,4 +174,7 @@ void prestera_device_unregister(struct prestera_device 
*dev);
 struct prestera_port *prestera_port_find_by_hwid(struct prestera_switch *sw,
 u32 dev_id, u32 hw_id);
 
+int prestera_port_autoneg_set(struct prestera_port *port, bool enable,
+ u64 adver_link_modes, u8 adver_fec);
+
 #endif /* _PRESTERA_H_ */
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c 
b/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c
new file mode 100644
index ..d947c09ce134
--- /dev/null
+++ b/drivers/net/ethernet/marvell/prestera/prestera_ethtool.c
@@ -0,0 +1,759 @@
+// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
+/* Copyright (c) 2019-2020 Marvell International Ltd. All rights reserved */
+
+#include 
+#include 
+#include 
+
+#include "prestera.h"
+#include "prestera_hw.h"
+#include "prestera_ethtool.h"
+
+#define PRESTERA_STATS_CNT \
+   (sizeof(struct prestera_port_stats) / sizeof(u64))
+#define PRESTERA_STATS_IDX(name) \
+   (offsetof(struct prestera_port_stats, name) / sizeof(u64))
+#define PRESTERA_STATS_FIELD(name) \
+   [PRESTERA_STATS_IDX(name)] = __stringify(name)
+
+static const char driver_kind[] = "prestera";
+
+static const struct prestera_link_mode {
+   enum ethtool_link_mode_bit_indices eth_mode;
+   u32 speed;
+   u64 pr_mask;
+   u8 duplex;
+   u8 port_type;
+} port_link_modes[PRESTERA_LINK_MODE_MAX] = {
+   [PRESTERA_LINK_MODE_10baseT_Half] = {
+   .eth_mode =  ETHTOOL_LINK_MODE_10baseT_Half_BIT,
+   .speed = 10,
+   .pr_mask = 1 << PRESTERA_LINK_MODE_10baseT_Half,
+   .duplex = PRESTERA_PORT_DUPLEX_HALF,
+   .port_type = PRESTERA_PORT_TYPE_TP,
+   },
+   [PRESTERA_LINK_MODE_10baseT_Full] = {
+   .eth_mode =  ETHTOOL_LINK_MODE_10baseT_Full_BIT,
+   .speed = 10,
+   .pr_mask = 1 << PRESTERA_LINK_MODE_10baseT_Full,
+   .duplex = PRESTERA_PORT_DUPLEX_FULL,
+   .port_type = PRESTERA_PORT_TYPE_TP,
+   },
+   

Re: [RFC PATCH 0/2] mm/gup: fix gup_fast with dynamic page table folding

2020-09-02 Thread Gerald Schaefer
On Wed, 2 Sep 2020 14:24:37 +0200
Gerald Schaefer  wrote:

> On Tue, 1 Sep 2020 16:22:22 -0700
> John Hubbard  wrote:
> 
> > On 9/1/20 10:40 AM, Gerald Schaefer wrote:
> > > On Mon, 31 Aug 2020 12:15:53 -0700
> > > Andrew Morton  wrote:
> > ...
> > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> > > index e8cbc2e795d5..43dacbce823f 100644
> > > --- a/include/linux/pgtable.h
> > > +++ b/include/linux/pgtable.h
> > > @@ -681,6 +681,38 @@ static inline int arch_unmap_one(struct mm_struct 
> > > *mm,
> > >   })
> > >   #endif
> > >   
> > > +/*
> > > + * With dynamic page table levels on s390, the static pXd_addr_end() 
> > > functions
> > > + * will not return corresponding dynamic boundaries. This is no problem 
> > > as long
> > > + * as only pXd pointers are passed down during page table walk, because
> > > + * pXd_offset() will simply return the given pointer for folded levels, 
> > > and the
> > > + * pointer iteration over a range simply happens at the correct page 
> > > table
> > > + * level.
> > > + * It is however a problem with gup_fast, or other places walking the 
> > > page
> > > + * tables w/o locks using READ_ONCE(), and passing down the pXd values 
> > > instead
> > > + * of pointers. In this case, the pointer given to pXd_offset() is a 
> > > pointer to
> > > + * a stack variable, which cannot be used for pointer iteration at the 
> > > correct
> > > + * level. Instead, the iteration then has to happen by going up to pgd 
> > > level
> > > + * again. To allow this, provide pXd_addr_end_folded() functions with an
> > > + * additional pXd value parameter, which can be used on s390 to 
> > > determine the
> > > + * folding level and return the corresponding boundary.
> > 
> > Ah OK, I finally see what you have in mind. And as Jason noted, if we just
> > pass an additional parameter to pXd_addr_end() that's going to be
> > cleaner. And doing so puts this in line with other page table
> > abstractions that also carry more information than some architectures
> > need. For example, on x86, set_pte_at() ignores the first two
> > parameters:
> > 
> > #define set_pte_at(mm, addr, ptep, pte) native_set_pte_at(mm, addr, 
> > ptep, pte)
> > 
> > static inline void native_set_pte_at(struct mm_struct *mm, unsigned long 
> > addr,
> >  pte_t *ptep , pte_t pte)
> > {
> > native_set_pte(ptep, pte);
> > }
> > 
> > This type of abstraction has worked out very well, IMHO.
> 
> Yes, it certainly feels like the right way to do it, and it would
> not affect other archs in a functional way. It would however introduce
> a subtle change for s390 behavior on _all_ page table walkers, not
> just the READ_ONCE gup_fast path, i.e. it changes the level at which
> the pointer iteration is done. Of course, that *should* not have any
> functional issues, or else it would also be broken in gup_fast, but
> in this area we often were wrong with should / could assumptions...

Hmm, not so sure about that "not affect other archs", that might also
be one of those *should*s. Consider this change to mm/mlock.c from
our current internal generalization work, for example:

diff --git a/mm/mlock.c b/mm/mlock.c
index 93ca2bf30b4f..dbde97f317d4 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -374,8 +374,12 @@ static unsigned long __munlock_pagevec_fill(struct pagevec 
*pvec,
struct vm_area_struct *vma, struct zone *zone,
unsigned long start, unsigned long end)
 {
-   pte_t *pte;
spinlock_t *ptl;
+   pte_t *pte;
+   pmd_t *pmd;
+   pud_t *pud;
+   p4d_t *p4d;
+   pgd_t *pgd;
 
/*
 * Initialize pte walk starting at the already pinned page where we
@@ -384,10 +388,14 @@ static unsigned long __munlock_pagevec_fill(struct 
pagevec *pvec,
 */
pte = get_locked_pte(vma->vm_mm, start, );
/* Make sure we do not cross the page table boundary */
-   end = pgd_addr_end(start, end);
-   end = p4d_addr_end(start, end);
-   end = pud_addr_end(start, end);
-   end = pmd_addr_end(start, end);
+   pgd = pgd_offset(vma->vm_mm, start);
+   end = pgd_addr_end(*pgd, start, end);
+   p4d = p4d_offset(pgd, start);
+   end = p4d_addr_end(*p4d, start, end);
+   pud = pud_offset(p4d, start);
+   end = pud_addr_end(*pud, start, end);
+   pmd = pmd_offset(pud, start);
+   end = pmd_addr_end(*pmd, start, end);
 
/* The page next to the pinned page is the first we will try to get */
start += PAGE_SIZE;

I guess we *could* assume that all the extra pXd_offset() calls and
also the de-referencing would be optimized out by the compiler for other
archs, but it is one example where my gut tells me that this might not
be so trivial and w/o unwanted effects after all.

Anyway, stay tuned, we will send a v2 of this RFC with going the
"modify pXd_addr_end" approach, including the minimal gup-specific
patch plus on top the generalization work. 

Re: [PATCH] trivial: docs: Section number should be "8.2"

2020-09-02 Thread Randy Dunlap
On 9/2/20 7:45 AM, Michael Witten wrote:
> Signed-off-by: Michael Witten 
> ---
>  Documentation/kbuild/makefiles.rst | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/kbuild/makefiles.rst 
> b/Documentation/kbuild/makefiles.rst
> index b81b8913a5a3..da6a708164c4 100644
> --- a/Documentation/kbuild/makefiles.rst
> +++ b/Documentation/kbuild/makefiles.rst
> @@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed 
> (roughly):
>   that may be shared between individual architectures.
>   The recommended approach how to use a generic header file is
>   to list the file in the Kbuild file.
> - See "7.2 generic-y" for further info on syntax etc.
> + See "8.2 generic-y" for further info on syntax etc.
>  
>  7.11 Post-link pass
>  ---
> 

Already fixed and merged:

from Masahiro Yamada :
Applied to linux-kbuild/fixes.
Thanks.

-- 
~Randy



Re: [PATCH v4 29/78] drm/vc4: crtc: Add a delay after disabling the PixelValve output

2020-09-02 Thread Maxime Ripard
On Tue, Sep 01, 2020 at 06:31:07PM +0200, Stefan Wahren wrote:
> Hi Maxime,
> 
> Am 01.09.20 um 11:58 schrieb Maxime Ripard:
> > Hi Stefan
> >
> > On Tue, Aug 25, 2020 at 11:30:58PM +0200, Stefan Wahren wrote:
> >> Am 25.08.20 um 17:06 schrieb Maxime Ripard:
> >>> Hi Stefan,
> >>>
> >>> On Wed, Jul 29, 2020 at 05:50:31PM +0200, Stefan Wahren wrote:
>  Am 29.07.20 um 16:42 schrieb Maxime Ripard:
> > Hi,
> >
> > On Wed, Jul 29, 2020 at 03:09:21PM +0100, Dave Stevenson wrote:
> >> On Wed, 8 Jul 2020 at 18:43, Maxime Ripard  wrote:
> >>> In order to avoid pixels getting stuck in the (unflushable) FIFO 
> >>> between
> >>> the HVS and the PV, we need to add some delay after disabling the PV 
> >>> output
> >>> and before disabling the HDMI controller. 20ms seems to be good 
> >>> enough so
> >>> let's use that.
> >>>
> >>> Signed-off-by: Maxime Ripard 
> >>> ---
> >>>  drivers/gpu/drm/vc4/vc4_crtc.c | 2 ++
> >>>  1 file changed, 2 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c 
> >>> b/drivers/gpu/drm/vc4/vc4_crtc.c
> >>> index d0b326e1df0a..7b178d67187f 100644
> >>> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> >>> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> >>> @@ -403,6 +403,8 @@ static void vc4_crtc_atomic_disable(struct 
> >>> drm_crtc *crtc,
> >>> ret = wait_for(!(CRTC_READ(PV_V_CONTROL) & 
> >>> PV_VCONTROL_VIDEN), 1);
> >>> WARN_ONCE(ret, "Timeout waiting for !PV_VCONTROL_VIDEN\n");
> >>>
> >>> +   mdelay(20);
> >> mdelay for 20ms seems a touch unfriendly as it's a busy wait. Can we
> >> not msleep instead?
> > Since the timing was fairly critical, sleeping didn't seem like a good
> > solution since there's definitely some chance you overshoot and end up
> > with a higher time than the one you targeted.
>  usleep_range(min, max) isn't a solution?
> >>> My understanding of usleep_range was that you can still overshoot, even
> >>> though it's backed by an HR timer so the resolution is not a jiffy. Are
> >>> we certain that we're going to be in that range?
> >> you are right there is no guarantee about the upper wake up time.
> >>
> >> And it's not worth the effort to poll the FIFO state until its empty
> >> (using 20 ms as timeout)?
> > I know this isn't really a great argument there, but getting this to
> > work has been quite painful, and the timing is very sensitive. If we
> > fail to wait for enough time, there's going to be a pixel shift that we
> > can't get rid of unless we reboot, which is pretty bad (and would fail
> > any CI test that checks for the output integrity).
> >
> > I know busy-looping for 20ms isn't ideal, but it's not really in a
> > hot-path (it's only done when changing a mode), with the sync time of
> > the display likely to be much more than that, and if it can avoid having
> > to look into it ever again or avoid random failures, I'd say it's worth
> > it.
> 
> i don't want to delay this series.
> 
> Could you please add a small comment to the delay to clarify the timing
> is very sensitive?

I will, thanks!
Maxime


signature.asc
Description: PGP signature


[PATCH 9/9] i2c: mux: reg: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/i2c/muxes/i2c-mux-reg.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c
index b59a62f8d7a6..0e0679f65cf7 100644
--- a/drivers/i2c/muxes/i2c-mux-reg.c
+++ b/drivers/i2c/muxes/i2c-mux-reg.c
@@ -171,13 +171,9 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)
sizeof(mux->data));
} else {
ret = i2c_mux_reg_probe_dt(mux, pdev);
-   if (ret == -EPROBE_DEFER)
-   return ret;
-
-   if (ret < 0) {
-   dev_err(>dev, "Error parsing device tree");
-   return ret;
-   }
+   if (ret < 0)
+   return dev_err_probe(>dev, ret,
+"Error parsing device tree");
}
 
parent = i2c_get_adapter(mux->data.parent);
-- 
2.17.1



[PATCH 5/9] i2c: davinci: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/i2c/busses/i2c-davinci.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 232a7679b69b..e9d07323c604 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -768,10 +768,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
if (irq <= 0) {
if (!irq)
irq = -ENXIO;
-   if (irq != -EPROBE_DEFER)
-   dev_err(>dev,
-   "can't get irq resource ret=%d\n", irq);
-   return irq;
+   return dev_err_probe(>dev, irq, "can't get irq 
resource\n");
}
 
dev = devm_kzalloc(>dev, sizeof(struct davinci_i2c_dev),
-- 
2.17.1



[PATCH 8/9] i2c: mux: gpmux: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/i2c/muxes/i2c-mux-gpmux.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c 
b/drivers/i2c/muxes/i2c-mux-gpmux.c
index f830535cff12..d3acd8d66c32 100644
--- a/drivers/i2c/muxes/i2c-mux-gpmux.c
+++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
@@ -85,18 +85,14 @@ static int i2c_mux_probe(struct platform_device *pdev)
return -ENOMEM;
 
mux->control = devm_mux_control_get(dev, NULL);
-   if (IS_ERR(mux->control)) {
-   if (PTR_ERR(mux->control) != -EPROBE_DEFER)
-   dev_err(dev, "failed to get control-mux\n");
-   return PTR_ERR(mux->control);
-   }
+   if (IS_ERR(mux->control))
+   return dev_err_probe(dev, PTR_ERR(mux->control),
+"failed to get control-mux\n");
 
parent = mux_parent_adapter(dev);
-   if (IS_ERR(parent)) {
-   if (PTR_ERR(parent) != -EPROBE_DEFER)
-   dev_err(dev, "failed to get i2c-parent adapter\n");
-   return PTR_ERR(parent);
-   }
+   if (IS_ERR(parent))
+   return dev_err_probe(dev, PTR_ERR(parent),
+"failed to get i2c-parent adapter\n");
 
children = of_get_child_count(np);
 
-- 
2.17.1



[PATCH 7/9] i2c: rk3x: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/i2c/busses/i2c-rk3x.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 8e3cc85d1921..819ab4ee517e 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -1312,18 +1312,13 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
i2c->pclk = devm_clk_get(>dev, "pclk");
}
 
-   if (IS_ERR(i2c->clk)) {
-   ret = PTR_ERR(i2c->clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Can't get bus clk: %d\n", ret);
-   return ret;
-   }
-   if (IS_ERR(i2c->pclk)) {
-   ret = PTR_ERR(i2c->pclk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Can't get periph clk: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(i2c->clk))
+   return dev_err_probe(>dev, PTR_ERR(i2c->clk),
+"Can't get bus clk\n");
+
+   if (IS_ERR(i2c->pclk))
+   return dev_err_probe(>dev, PTR_ERR(i2c->pclk),
+"Can't get periph clk\n");
 
ret = clk_prepare(i2c->clk);
if (ret < 0) {
-- 
2.17.1



Re: [PATCH v2 1/2] MAINTAINERS: Consolidate Analog Devices IIO entries and remove Beniamin Bia

2020-09-02 Thread Jonathan Cameron
On Wed, 2 Sep 2020 16:59:56 +0200
Krzysztof Kozlowski  wrote:

> Emails to Beniamin Bia bounce with no such address so remove him from
> maintainers.  After this removal, many entries for Analog Devices Inc
> IIO drivers look exactly the same so consolidate them.
> 
> Suggested-by: Andy Shevchenko 
> Suggested-by: Jonathan Cameron 
> Cc: Michael Hennerich 
> Cc: Jonathan Cameron 
> Cc: linux-iio 
> Signed-off-by: Krzysztof Kozlowski 
> 

I'll need acks from Michael and Lars to do this.

Jonathan

> ---
> 
> Changes since v1:
> 1. Consolidate IIO entries
> ---
>  MAINTAINERS | 56 -
>  1 file changed, 4 insertions(+), 52 deletions(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8107b3d5d6df..facffcf7b1d1 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -950,38 +950,6 @@ S:   Supported
>  F:   arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
>  F:   drivers/net/ethernet/amd/xgbe/
>  
> -ANALOG DEVICES INC AD5686 DRIVER
> -M:   Michael Hennerich 
> -L:   linux...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   drivers/iio/dac/ad5686*
> -F:   drivers/iio/dac/ad5696*
> -
> -ANALOG DEVICES INC AD5758 DRIVER
> -M:   Michael Hennerich 
> -L:   linux-...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   Documentation/devicetree/bindings/iio/dac/ad5758.txt
> -F:   drivers/iio/dac/ad5758.c
> -
> -ANALOG DEVICES INC AD7091R5 DRIVER
> -M:   Beniamin Bia 
> -L:   linux-...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   Documentation/devicetree/bindings/iio/adc/adi,ad7091r5.yaml
> -F:   drivers/iio/adc/ad7091r5.c
> -
> -ANALOG DEVICES INC AD7124 DRIVER
> -M:   Michael Hennerich 
> -L:   linux-...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml
> -F:   drivers/iio/adc/ad7124.c
> -
>  ANALOG DEVICES INC AD7192 DRIVER
>  M:   Alexandru Tachici 
>  L:   linux-...@vger.kernel.org
> @@ -998,15 +966,6 @@ W:   
> http://ez.analog.com/community/linux-device-drivers
>  F:   Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
>  F:   drivers/iio/adc/ad7292.c
>  
> -ANALOG DEVICES INC AD7606 DRIVER
> -M:   Michael Hennerich 
> -M:   Beniamin Bia 
> -L:   linux-...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
> -F:   drivers/iio/adc/ad7606.c
> -
>  ANALOG DEVICES INC AD7768-1 DRIVER
>  M:   Michael Hennerich 
>  L:   linux-...@vger.kernel.org
> @@ -1068,7 +1027,6 @@ F:  drivers/iio/imu/adis16475.c
>  F:   Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml
>  
>  ANALOG DEVICES INC ADM1177 DRIVER
> -M:   Beniamin Bia 
>  M:   Michael Hennerich 
>  L:   linux-hw...@vger.kernel.org
>  S:   Supported
> @@ -1135,15 +1093,6 @@ S: Supported
>  W:   http://ez.analog.com/community/linux-device-drivers
>  F:   drivers/dma/dma-axi-dmac.c
>  
> -ANALOG DEVICES INC HMC425A DRIVER
> -M:   Beniamin Bia 
> -M:   Michael Hennerich 
> -L:   linux-...@vger.kernel.org
> -S:   Supported
> -W:   http://ez.analog.com/community/linux-device-drivers
> -F:   Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml
> -F:   drivers/iio/amplifiers/hmc425a.c
> -
>  ANALOG DEVICES INC IIO DRIVERS
>  M:   Lars-Peter Clausen 
>  M:   Michael Hennerich 
> @@ -1152,8 +1101,12 @@ W: http://wiki.analog.com/
>  W:   http://ez.analog.com/community/linux-device-drivers
>  F:   Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
>  F:   Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350
> +F:   Documentation/devicetree/bindings/iio/adc/adi*
> +F:   Documentation/devicetree/bindings/iio/amplifiers/adi*
> +F:   Documentation/devicetree/bindings/iio/dac/ad5758.txt
>  F:   drivers/iio/*/ad*
>  F:   drivers/iio/adc/ltc249*
> +F:   drivers/iio/amplifiers/hmc425a.c
>  F:   drivers/staging/iio/*/ad*
>  X:   drivers/iio/*/adjd*
>  
> @@ -16537,7 +16490,6 @@ F:drivers/staging/rtl8712/
>  
>  STAGING - SEPS525 LCD CONTROLLER DRIVERS
>  M:   Michael Hennerich 
> -M:   Beniamin Bia 
>  L:   linux-fb...@vger.kernel.org
>  S:   Supported
>  F:   Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml




[PATCH 4/9] i2c: cadence: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/i2c/busses/i2c-cadence.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index e4b7f2a951ad..eefde554c50c 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -1214,11 +1214,10 @@ static int cdns_i2c_probe(struct platform_device *pdev)
 "Cadence I2C at %08lx", (unsigned long)r_mem->start);
 
id->clk = devm_clk_get(>dev, NULL);
-   if (IS_ERR(id->clk)) {
-   if (PTR_ERR(id->clk) != -EPROBE_DEFER)
-   dev_err(>dev, "input clock not found.\n");
-   return PTR_ERR(id->clk);
-   }
+   if (IS_ERR(id->clk))
+   return dev_err_probe(>dev, PTR_ERR(id->clk),
+"input clock not found.\n");
+
ret = clk_prepare_enable(id->clk);
if (ret)
dev_err(>dev, "Unable to enable clock.\n");
-- 
2.17.1



[PATCH 2/4] crypto: caam - Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/crypto/caam/caamalg_qi2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/caam/caamalg_qi2.c 
b/drivers/crypto/caam/caamalg_qi2.c
index 0441e4ff2df2..076c6b04bea9 100644
--- a/drivers/crypto/caam/caamalg_qi2.c
+++ b/drivers/crypto/caam/caamalg_qi2.c
@@ -5115,8 +5115,7 @@ static int dpaa2_caam_probe(struct fsl_mc_device 
*dpseci_dev)
/* DPIO */
err = dpaa2_dpseci_dpio_setup(priv);
if (err) {
-   if (err != -EPROBE_DEFER)
-   dev_err(dev, "dpaa2_dpseci_dpio_setup() failed\n");
+   dev_err_probe(dev, err, "dpaa2_dpseci_dpio_setup() failed\n");
goto err_dpio_setup;
}
 
-- 
2.17.1



[PATCH net v6 5/6] net: marvell: prestera: Add Switchdev driver implementation

2020-09-02 Thread Vadym Kochan
The following features are supported:

- VLAN-aware bridge offloading
- VLAN-unaware bridge offloading
- FDB offloading (learning, ageing)
- Switchport configuration

Currently there are some limitations like:

- Only 1 VLAN-aware bridge instance supported
- FDB ageing timeout parameter is set globally per device

Co-developed-by: Serhiy Boiko 
Signed-off-by: Serhiy Boiko 
Co-developed-by: Serhiy Pshyk 
Signed-off-by: Serhiy Pshyk 
Co-developed-by: Taras Chornyi 
Signed-off-by: Taras Chornyi 
Signed-off-by: Vadym Kochan 
---
PATCH v5:
0) Add Co-developed tag.

1) Remove "," from terminated enum entry.

2) Replace 'u8 *' -> 'void *' in prestera_fw_parse_fdb_evt(...)

3) Use ether_addr_copy() in prestera_fw_parse_fdb_evt(...)

PATCH v4:
1) Check for the prestera dev interface in switchdev event handler
   to ignore unsupported topology.

 .../net/ethernet/marvell/prestera/Makefile|3 +-
 .../net/ethernet/marvell/prestera/prestera.h  |   33 +-
 .../ethernet/marvell/prestera/prestera_hw.c   |  322 +++-
 .../ethernet/marvell/prestera/prestera_hw.h   |   48 +
 .../ethernet/marvell/prestera/prestera_main.c |  111 +-
 .../marvell/prestera/prestera_switchdev.c | 1289 +
 .../marvell/prestera/prestera_switchdev.h |   16 +
 7 files changed, 1815 insertions(+), 7 deletions(-)
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
 create mode 100644 drivers/net/ethernet/marvell/prestera/prestera_switchdev.h

diff --git a/drivers/net/ethernet/marvell/prestera/Makefile 
b/drivers/net/ethernet/marvell/prestera/Makefile
index 7684e7047562..93129e32ebc5 100644
--- a/drivers/net/ethernet/marvell/prestera/Makefile
+++ b/drivers/net/ethernet/marvell/prestera/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_PRESTERA) += prestera.o
 prestera-objs  := prestera_main.o prestera_hw.o prestera_dsa.o \
-  prestera_rxtx.o prestera_devlink.o prestera_ethtool.o
+  prestera_rxtx.o prestera_devlink.o 
prestera_ethtool.o \
+  prestera_switchdev.o
 
 obj-$(CONFIG_PRESTERA_PCI) += prestera_pci.o
diff --git a/drivers/net/ethernet/marvell/prestera/prestera.h 
b/drivers/net/ethernet/marvell/prestera/prestera.h
index 9a5a0deb909b..83df4695dc12 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera.h
+++ b/drivers/net/ethernet/marvell/prestera/prestera.h
@@ -15,6 +15,8 @@
 
 #define PRESTERA_DRV_NAME  "prestera"
 
+#define PRESTERA_DEFAULT_VID1
+
 struct prestera_fw_rev {
u16 maj;
u16 min;
@@ -51,8 +53,6 @@ struct prestera_port_stats {
u64 unicast_frames_sent;
u64 sent_multiple;
u64 sent_deferred;
-   u64 frames_1024_to_1518_octets;
-   u64 frames_1519_to_max_octets;
u64 good_octets_sent;
 };
 
@@ -71,11 +71,13 @@ struct prestera_port {
u32 hw_id;
u32 dev_id;
u16 fp_id;
+   u16 pvid;
bool autoneg;
u64 adver_link_modes;
u8 adver_fec;
struct prestera_port_caps caps;
struct list_head list;
+   struct list_head vlans_list;
struct {
struct prestera_port_stats stats;
struct delayed_work caching_dw;
@@ -105,6 +107,7 @@ enum prestera_event_type {
PRESTERA_EVENT_TYPE_UNSPEC,
 
PRESTERA_EVENT_TYPE_PORT,
+   PRESTERA_EVENT_TYPE_FDB,
PRESTERA_EVENT_TYPE_RXTX,
 
PRESTERA_EVENT_TYPE_MAX
@@ -127,19 +130,37 @@ struct prestera_port_event {
} data;
 };
 
+enum prestera_fdb_event_id {
+   PRESTERA_FDB_EVENT_UNSPEC,
+   PRESTERA_FDB_EVENT_LEARNED,
+   PRESTERA_FDB_EVENT_AGED,
+};
+
+struct prestera_fdb_event {
+   u32 port_id;
+   u32 vid;
+   union {
+   u8 mac[ETH_ALEN];
+   } data;
+};
+
 struct prestera_event {
u16 id;
union {
struct prestera_port_event port_evt;
+   struct prestera_fdb_event fdb_evt;
};
 };
 
+struct prestera_switchdev;
 struct prestera_rxtx;
 
 struct prestera_switch {
struct prestera_device *dev;
+   struct prestera_switchdev *swdev;
struct prestera_rxtx *rxtx;
struct list_head event_handlers;
+   struct notifier_block netdev_nb;
char base_mac[ETH_ALEN];
struct list_head port_list;
rwlock_t port_list_lock;
@@ -177,4 +198,12 @@ struct prestera_port *prestera_port_find_by_hwid(struct 
prestera_switch *sw,
 int prestera_port_autoneg_set(struct prestera_port *port, bool enable,
  u64 adver_link_modes, u8 adver_fec);
 
+struct prestera_port *prestera_find_port(struct prestera_switch *sw, u32 id);
+
+struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev);
+
+int prestera_port_pvid_set(struct prestera_port *port, u16 vid);
+
+bool prestera_netdev_check(const struct net_device *dev);
+
 #endif /* _PRESTERA_H_ */
diff --git 

[PATCH 4/4] crypto: allwinner/sun8i - Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 9 +++--
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 9 +++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c 
b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
index 138759dc8190..e3c62051c595 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -573,12 +573,9 @@ static int sun8i_ce_probe(struct platform_device *pdev)
return irq;
 
ce->reset = devm_reset_control_get(>dev, NULL);
-   if (IS_ERR(ce->reset)) {
-   if (PTR_ERR(ce->reset) == -EPROBE_DEFER)
-   return PTR_ERR(ce->reset);
-   dev_err(>dev, "No reset control found\n");
-   return PTR_ERR(ce->reset);
-   }
+   if (IS_ERR(ce->reset))
+   return dev_err_probe(>dev, PTR_ERR(ce->reset),
+"No reset control found\n");
 
mutex_init(>mlock);
 
diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c 
b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
index 9a23515783a6..576df8c8df51 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
@@ -545,12 +545,9 @@ static int sun8i_ss_probe(struct platform_device *pdev)
return irq;
 
ss->reset = devm_reset_control_get(>dev, NULL);
-   if (IS_ERR(ss->reset)) {
-   if (PTR_ERR(ss->reset) == -EPROBE_DEFER)
-   return PTR_ERR(ss->reset);
-   dev_err(>dev, "No reset control found\n");
-   return PTR_ERR(ss->reset);
-   }
+   if (IS_ERR(ss->reset))
+   return dev_err_probe(>dev, PTR_ERR(ss->reset),
+"No reset control found\n");
 
mutex_init(>mlock);
 
-- 
2.17.1



[PATCH net v6 0/6] net: marvell: prestera: Add Switchdev driver for Prestera family ASIC device 98DX3255 (AC3x)

2020-09-02 Thread Vadym Kochan
Marvell Prestera 98DX3255 integrates up to 24 ports of 1GbE with 8
ports of 10GbE uplinks or 2 ports of 40Gbps stacking for a largely
wireless SMB deployment.

Prestera Switchdev is a firmware based driver that operates via PCI bus.  The
current implementation supports only boards designed for the Marvell Switchdev
solution and requires special firmware.

This driver implementation includes only L1, basic L2 support, and RX/TX.

The core Prestera switching logic is implemented in prestera_main.c, there is
an intermediate hw layer between core logic and firmware. It is
implemented in prestera_hw.c, the purpose of it is to encapsulate hw
related logic, in future there is a plan to support more devices with
different HW related configurations.

The following Switchdev features are supported:

- VLAN-aware bridge offloading
- VLAN-unaware bridge offloading
- FDB offloading (learning, ageing)
- Switchport configuration

The original firmware image is uploaded to the linux-firmware repository.

PATCH v6:
1) Use rwlock to protect port list on create/delete stages. The list
   is mostly readable by fw event handler or packets receiver, but
   updated only on create/delete port which are performed on switch 
init/fini
   stages.

2) Remove not needed variable initialization in 
prestera_dsa.c:prestera_dsa_parse()

3) Get rid of bounce buffer used by tx handler in prestera_rxtx.c,
   the bounce buffer should be handled by dma_xxx API via swiotlb.

4) Fix PRESTERA_SDMA_RX_DESC_PKT_LEN macro by using correct GENMASK(13, 0) 
in prestera_rxtx.c

Patches updated:
[1] net: marvell: prestera: Add driver for Prestera family ASIC devices

PATCH v5:
0) add Co-developed tags for people who was involved in development.

1) Make SPDX license as separate comment

2) Change 'u8 *' -> 'void *', It allows to avoid not-needed u8* casting.

3) Remove "," in terminated enum's.

4) Use GENMASK(end, start) where it is applicable in.

5) Remove not-needed 'u8 *' casting.

6) Apply common error-check pattern

7) Use ether_addr_copy instead of memcpy

8) Use define for maximum MAC address range (255)

9) Simplify prestera_port_state_set() in prestera_main.c by
   using separate if-blocks for state setting:

if (is_up) {
...
} else {
...
}

  which makes logic more understandable.

10) Simplify sdma tx wait logic when checking/updating tx_ring->burst.

11) Remove not-needed packed & aligned attributes

12) Use USEC_PER_MSEC as multiplier when converting ms -> usec on calling
readl_poll_timeout.

13) Simplified some error path handling by simple return error code in.

14) Remove not-needed err assignment in.

15) Use dev_err() in prestera_devlink_register(...).

Patches updated:
[1] net: marvell: prestera: Add driver for Prestera family ASIC devices
[2] net: marvell: prestera: Add PCI interface support
[3] net: marvell: prestera: Add basic devlink support
[4] net: marvell: prestera: Add ethtool interface support
[5] net: marvell: prestera: Add Switchdev driver implementation

PATCH v4:
1) Use prestera_ prefix in netdev_ops variable.

2) Kconfig: use 'default PRESTERA' build type for CONFIG_PRESTERA_PCI to be
   synced by default with prestera core module.

3) Use memcpy_xxio helpers in prestera_pci.c for IO buffer copying.

4) Generate fw image path via snprintf() instead of macroses.

5) Use pcim_ helpers in prestera_pci.c which simplified the
   probe/remove logic.

6) Removed not needed initializations of variables which are used in
   readl_poll_xxx() helpers.

7) Fixed few grammar mistakes in patch[2] description.

8) Export only prestera_ethtool_ops struct instead of each
   ethtool handler.

9) Add check for prestera_dev_check() in switchdev event handling to
   make sure there is no wrong topology.

Patches updated:
[1] net: marvell: prestera: Add driver for Prestera family ASIC devices
[2] net: marvell: prestera: Add PCI interface support
[4] net: marvell: prestera: Add ethtool interface support
[5] net: marvell: prestera: Add Switchdev driver implementation

PATCH v3:
1) Simplify __be32 type casting in prestera_dsa.c

2) Added per-patch changelog under "---" line.

PATCH v2:
1) Use devlink_port_type_clear()

2) Add _MS prefix to timeout defines.

3) Remove not-needed packed attribute from the firmware ipc structs,
   also the firmware image needs to be uploaded too (will do it soon).

4) Introduce prestera_hw_switch_fini(), to be mirrored with init and
   do simple validation if the event handlers are unregistered.

5) Use kfree_rcu() for event handler unregistering.

6) Get rid of rcu-list usage when dealing with ports, not needed for
   now.

7) Little spelling 

[PATCH 09/10] clk: davinci: Add missing kerneldoc

2020-09-02 Thread Krzysztof Kozlowski
Add missing kerneldoc to fix compile warning:

  drivers/clk/davinci/da8xx-cfgchip.c:578: warning: Function parameter or 
member 'dev' not described in 'da8xx_cfgchip_register_usb1_clk48'

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clk/davinci/da8xx-cfgchip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/davinci/da8xx-cfgchip.c 
b/drivers/clk/davinci/da8xx-cfgchip.c
index bdc52364b421..77d18276bfe8 100644
--- a/drivers/clk/davinci/da8xx-cfgchip.c
+++ b/drivers/clk/davinci/da8xx-cfgchip.c
@@ -571,6 +571,7 @@ static const struct clk_ops da8xx_usb1_clk48_ops = {
 
 /**
  * da8xx_cfgchip_register_usb1_clk48 - Register a new USB 1.1 PHY clock
+ * @dev: The device
  * @regmap: The CFGCHIP regmap
  */
 static struct da8xx_usb1_clk48 *
-- 
2.17.1



[PATCH 06/10] clk: keystone: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clk/keystone/syscon-clk.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/keystone/syscon-clk.c 
b/drivers/clk/keystone/syscon-clk.c
index 5b3d36462174..12ddcbed00e4 100644
--- a/drivers/clk/keystone/syscon-clk.c
+++ b/drivers/clk/keystone/syscon-clk.c
@@ -102,12 +102,9 @@ static int ti_syscon_gate_clk_probe(struct platform_device 
*pdev)
return -EINVAL;
 
regmap = syscon_node_to_regmap(dev->of_node);
-   if (IS_ERR(regmap)) {
-   if (PTR_ERR(regmap) == -EPROBE_DEFER)
-   return -EPROBE_DEFER;
-   dev_err(dev, "failed to find parent regmap\n");
-   return PTR_ERR(regmap);
-   }
+   if (IS_ERR(regmap))
+   return dev_err_probe(dev, PTR_ERR(regmap),
+"failed to find parent regmap\n");
 
num_clks = 0;
for (p = data; p->name; p++)
-- 
2.17.1



[PATCH 07/10] clk: meson: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clk/meson/axg-audio.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
index 53715e36326c..dc22b0c45743 100644
--- a/drivers/clk/meson/axg-audio.c
+++ b/drivers/clk/meson/axg-audio.c
@@ -1509,12 +1509,8 @@ static int devm_clk_get_enable(struct device *dev, char 
*id)
int ret;
 
clk = devm_clk_get(dev, id);
-   if (IS_ERR(clk)) {
-   ret = PTR_ERR(clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(dev, "failed to get %s", id);
-   return ret;
-   }
+   if (IS_ERR(clk))
+   return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s", id);
 
ret = clk_prepare_enable(clk);
if (ret) {
-- 
2.17.1



[PATCH 05/10] clk: sunxi-ng: Simplify with dev_err_probe()

2020-09-02 Thread Krzysztof Kozlowski
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski 
---
 drivers/clk/sunxi-ng/ccu-sun8i-de2.c | 28 
 drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c  | 19 +---
 drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c |  9 +++-
 3 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c 
b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
index 524f33275bc7..0de024d3e466 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-de2.c
@@ -297,29 +297,19 @@ static int sunxi_de2_clk_probe(struct platform_device 
*pdev)
return PTR_ERR(reg);
 
bus_clk = devm_clk_get(>dev, "bus");
-   if (IS_ERR(bus_clk)) {
-   ret = PTR_ERR(bus_clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Couldn't get bus clk: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(bus_clk))
+   return dev_err_probe(>dev, PTR_ERR(bus_clk),
+"Couldn't get bus clk\n");
 
mod_clk = devm_clk_get(>dev, "mod");
-   if (IS_ERR(mod_clk)) {
-   ret = PTR_ERR(mod_clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Couldn't get mod clk: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(mod_clk))
+   return dev_err_probe(>dev, PTR_ERR(mod_clk),
+"Couldn't get mod clk\n");
 
rstc = devm_reset_control_get_exclusive(>dev, NULL);
-   if (IS_ERR(rstc)) {
-   ret = PTR_ERR(rstc);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev,
-   "Couldn't get reset control: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(rstc))
+   return dev_err_probe(>dev, PTR_ERR(rstc),
+"Couldn't get reset control\n");
 
/* The clocks need to be enabled for us to access the registers */
ret = clk_prepare_enable(bus_clk);
diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c 
b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
index 6616e8114f62..541c3d32b93e 100644
--- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
+++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c
@@ -215,21 +215,14 @@ static int sun9i_a80_de_clk_probe(struct platform_device 
*pdev)
return PTR_ERR(reg);
 
bus_clk = devm_clk_get(>dev, "bus");
-   if (IS_ERR(bus_clk)) {
-   ret = PTR_ERR(bus_clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Couldn't get bus clk: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(bus_clk))
+   return dev_err_probe(>dev, PTR_ERR(bus_clk),
+"Couldn't get bus clk\n");
 
rstc = devm_reset_control_get_exclusive(>dev, NULL);
-   if (IS_ERR(rstc)) {
-   ret = PTR_ERR(rstc);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev,
-   "Couldn't get reset control: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(rstc))
+   return dev_err_probe(>dev, PTR_ERR(rstc),
+"Couldn't get reset control\n");
 
/* The bus clock needs to be enabled for us to access the registers */
ret = clk_prepare_enable(bus_clk);
diff --git a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c 
b/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
index 4b4a507d04ed..f6a3989fea36 100644
--- a/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
+++ b/drivers/clk/sunxi-ng/ccu-sun9i-a80-usb.c
@@ -103,12 +103,9 @@ static int sun9i_a80_usb_clk_probe(struct platform_device 
*pdev)
return PTR_ERR(reg);
 
bus_clk = devm_clk_get(>dev, "bus");
-   if (IS_ERR(bus_clk)) {
-   ret = PTR_ERR(bus_clk);
-   if (ret != -EPROBE_DEFER)
-   dev_err(>dev, "Couldn't get bus clk: %d\n", ret);
-   return ret;
-   }
+   if (IS_ERR(bus_clk))
+   return dev_err_probe(>dev, PTR_ERR(bus_clk),
+"Couldn't get bus clk\n");
 
/* The bus clock needs to be enabled for us to access the registers */
ret = clk_prepare_enable(bus_clk);
-- 
2.17.1



[PATCH 07/13] x86/debug: Move historical SYSENTER junk into exc_debug_kernel()

2020-09-02 Thread Peter Zijlstra
The historical SYSENTER junk is explicitly for from-kernel, so move it
to the #DB-from-kernel handler.

It is ordered after the notifier, this is important for KGDB which
uses TF single-step and needs to consume the event before we get here.

Signed-off-by: Peter Zijlstra (Intel) 
---
 arch/x86/kernel/traps.c |   49 
 1 file changed, 25 insertions(+), 24 deletions(-)

--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -783,7 +783,7 @@ static __always_inline unsigned long deb
  *
  * May run on IST stack.
  */
-static void handle_debug(struct pt_regs *regs, unsigned long dr6)
+static bool handle_debug(struct pt_regs *regs, unsigned long *dr6)
 {
struct task_struct *tsk = current;
bool icebp;
@@ -793,15 +793,13 @@ static void handle_debug(struct pt_regs
 * then it's very likely the result of an icebp/int01 trap.
 * User wants a sigtrap for that.
 */
-   icebp = !dr6;
+   icebp = !*dr6;
 
/* Store the virtualized DR6 value */
-   tsk->thread.debugreg6 = dr6;
+   tsk->thread.debugreg6 = *dr6;
 
-   if (notify_die(DIE_DEBUG, "debug", regs, (long), 0,
-  SIGTRAP) == NOTIFY_STOP) {
-   return;
-   }
+   if (notify_die(DIE_DEBUG, "debug", regs, (long)dr6, 0, SIGTRAP) == 
NOTIFY_STOP)
+   return true;
 
/* It's safe to allow irq's after DR6 has been saved */
cond_local_irq_enable(regs);
@@ -815,25 +813,15 @@ static void handle_debug(struct pt_regs
/*
 * Reload dr6, the notifier might have changed it.
 */
-   dr6 = tsk->thread.debugreg6;
+   *dr6 = tsk->thread.debugreg6;
 
-   if (WARN_ON_ONCE((dr6 & DR_STEP) && !user_mode(regs))) {
-   /*
-* Historical junk that used to handle SYSENTER single-stepping.
-* This should be unreachable now.  If we survive for a while
-* without anyone hitting this warning, we'll turn this into
-* an oops.
-*/
-   tsk->thread.debugreg6 &= ~DR_STEP;
-   set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
-   regs->flags &= ~X86_EFLAGS_TF;
-   }
-
-   if (dr6 & (DR_STEP | DR_TRAP_BITS) || icebp)
-   send_sigtrap(regs, 0, get_si_code(dr6));
+   if (*dr6 & (DR_STEP | DR_TRAP_BITS) || icebp)
+   send_sigtrap(regs, 0, get_si_code(*dr6));
 
 out:
cond_local_irq_disable(regs);
+
+   return false;
 }
 
 static __always_inline void exc_debug_kernel(struct pt_regs *regs,
@@ -876,7 +864,20 @@ static __always_inline void exc_debug_ke
if (!dr6)
goto out;
 
-   handle_debug(regs, dr6);
+   if (handle_debug(regs, ))
+   goto out;
+
+   if (WARN_ON_ONCE(dr6 & DR_STEP)) {
+   /*
+* Historical junk that used to handle SYSENTER single-stepping.
+* This should be unreachable now.  If we survive for a while
+* without anyone hitting this warning, we'll turn this into
+* an oops.
+*/
+   dr6 &= ~DR_STEP;
+   set_thread_flag(TIF_SINGLESTEP);
+   regs->flags &= ~X86_EFLAGS_TF;
+   }
 
 out:
instrumentation_end();
@@ -906,7 +907,7 @@ static __always_inline void exc_debug_us
irqentry_enter_from_user_mode(regs);
instrumentation_begin();
 
-   handle_debug(regs, dr6);
+   handle_debug(regs, );
 
instrumentation_end();
irqentry_exit_to_user_mode(regs);




[PATCH v2 2/2] MAINTAINERS: Move Hartmut Knaack to Credits

2020-09-02 Thread Krzysztof Kozlowski
Hartmut Knaack was an active reviewer and contributor to the IIO
subsystem and drivers.  However his last message on LKML is from
October 2015.

In thanks for Hartmut's effort, move him name to the Credits.

Suggested-by: Andy Shevchenko 
Cc: Jonathan Cameron 
Cc: linux-iio 
Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. Fix order in CREDITS
---
 CREDITS | 4 
 MAINTAINERS | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CREDITS b/CREDITS
index 32ee70a7562e..c741455498a4 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1942,6 +1942,10 @@ S: Post Office Box 611311
 S: San Jose, California 95161-1311
 S: USA
 
+N: Hartmut Knaack
+E: knaac...@gmx.de
+D: IIO subsystem and drivers
+
 N: Thorsten Knabe
 E: Thorsten Knabe 
 E: Thorsten Knabe 
diff --git a/MAINTAINERS b/MAINTAINERS
index facffcf7b1d1..94dda8ae202c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8489,7 +8489,6 @@ F:drivers/iio/multiplexer/iio-mux.c
 
 IIO SUBSYSTEM AND DRIVERS
 M: Jonathan Cameron 
-R: Hartmut Knaack 
 R: Lars-Peter Clausen 
 R: Peter Meerwald-Stadler 
 L: linux-...@vger.kernel.org
-- 
2.17.1



[PATCH 08/13] x86/debug: Move cond_local_irq_enable() block into exc_debug_user()

2020-09-02 Thread Peter Zijlstra
The cond_local_irq_enable() block, dealing with vm86 and sending
signals is only relevant for #DB-from-user, move it there.

This then reduces handle_debug() to only the notifier call, so rename
it to notify_debug().

Signed-off-by: Peter Zijlstra (Intel) 
---
 arch/x86/kernel/traps.c |   58 
 1 file changed, 29 insertions(+), 29 deletions(-)

--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -783,17 +783,10 @@ static __always_inline unsigned long deb
  *
  * May run on IST stack.
  */
-static bool handle_debug(struct pt_regs *regs, unsigned long *dr6)
+
+static bool notify_debug(struct pt_regs *regs, unsigned long *dr6)
 {
struct task_struct *tsk = current;
-   bool icebp;
-
-   /*
-* If dr6 has no reason to give us about the origin of this trap,
-* then it's very likely the result of an icebp/int01 trap.
-* User wants a sigtrap for that.
-*/
-   icebp = !*dr6;
 
/* Store the virtualized DR6 value */
tsk->thread.debugreg6 = *dr6;
@@ -801,26 +794,9 @@ static bool handle_debug(struct pt_regs
if (notify_die(DIE_DEBUG, "debug", regs, (long)dr6, 0, SIGTRAP) == 
NOTIFY_STOP)
return true;
 
-   /* It's safe to allow irq's after DR6 has been saved */
-   cond_local_irq_enable(regs);
-
-   if (v8086_mode(regs)) {
-   handle_vm86_trap((struct kernel_vm86_regs *) regs, 0,
-X86_TRAP_DB);
-   goto out;
-   }
-
-   /*
-* Reload dr6, the notifier might have changed it.
-*/
+   /* Reload the DR6 value, the notifier might have changed it */
*dr6 = tsk->thread.debugreg6;
 
-   if (*dr6 & (DR_STEP | DR_TRAP_BITS) || icebp)
-   send_sigtrap(regs, 0, get_si_code(*dr6));
-
-out:
-   cond_local_irq_disable(regs);
-
return false;
 }
 
@@ -864,7 +840,7 @@ static __always_inline void exc_debug_ke
if (!dr6)
goto out;
 
-   if (handle_debug(regs, ))
+   if (notify_debug(regs, ))
goto out;
 
if (WARN_ON_ONCE(dr6 & DR_STEP)) {
@@ -889,6 +865,8 @@ static __always_inline void exc_debug_ke
 static __always_inline void exc_debug_user(struct pt_regs *regs,
   unsigned long dr6)
 {
+   bool icebp;
+
/*
 * If something gets miswired and we end up here for a kernel mode
 * #DB, we will malfunction.
@@ -907,8 +885,30 @@ static __always_inline void exc_debug_us
irqentry_enter_from_user_mode(regs);
instrumentation_begin();
 
-   handle_debug(regs, );
+   /*
+* If dr6 has no reason to give us about the origin of this trap,
+* then it's very likely the result of an icebp/int01 trap.
+* User wants a sigtrap for that.
+*/
+   icebp = !dr6;
 
+   if (notify_debug(regs, ))
+   goto out;
+
+   /* It's safe to allow irq's after DR6 has been saved */
+   local_irq_enable();
+
+   if (v8086_mode(regs)) {
+   handle_vm86_trap((struct kernel_vm86_regs *)regs, 0, 
X86_TRAP_DB);
+   goto out_irq;
+   }
+
+   if (dr6 & (DR_STEP | DR_TRAP_BITS) || icebp)
+   send_sigtrap(regs, 0, get_si_code(dr6));
+
+out_irq:
+   local_irq_disable();
+out:
instrumentation_end();
irqentry_exit_to_user_mode(regs);
 }




Re: watchdog start on restart

2020-09-02 Thread Guenter Roeck
On 9/2/20 6:02 AM, Ivan Mikhaylov wrote:
> Hello everyone. Currently, the watchdog interface only has "stop watchdog on
> restart" but lacks a "start watchdog on restart" one. Is there a way to 
> achieve
> such functionality?
> 
> I'd like to know why "stop watchdog on restart" wasn't implemented via ioctl
> interface? It would be more convenient from user perspective and you can
> control that behavior whenever you want from application layer.
> 

Because it is and always was a driver level decision. The function was added
to replace lots of driver level code implementing this functionality.
Overriding it from userspace doesn't make sense because the driver is supposed
to have a reason for disabling it on reboot (for example due to clock issues
or power issues or becasue it has a short hardware timeout).

> I have some thoughts on this problem that solve the aforementioned
> issue with "start watchdog on restart" but I don't think that my solution is
> correct.
> 
That functionality doesn't make much sense. It can be accomplished by not
stopping the watchdog on reboot in the first place. And if the watchdog
wasn't running before, it can be started from userspace just before the
reboot.

Guenter


[PATCH v2 1/2] MAINTAINERS: Consolidate Analog Devices IIO entries and remove Beniamin Bia

2020-09-02 Thread Krzysztof Kozlowski
Emails to Beniamin Bia bounce with no such address so remove him from
maintainers.  After this removal, many entries for Analog Devices Inc
IIO drivers look exactly the same so consolidate them.

Suggested-by: Andy Shevchenko 
Suggested-by: Jonathan Cameron 
Cc: Michael Hennerich 
Cc: Jonathan Cameron 
Cc: linux-iio 
Signed-off-by: Krzysztof Kozlowski 

---

Changes since v1:
1. Consolidate IIO entries
---
 MAINTAINERS | 56 -
 1 file changed, 4 insertions(+), 52 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8107b3d5d6df..facffcf7b1d1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -950,38 +950,6 @@ S: Supported
 F: arch/arm64/boot/dts/amd/amd-seattle-xgbe*.dtsi
 F: drivers/net/ethernet/amd/xgbe/
 
-ANALOG DEVICES INC AD5686 DRIVER
-M: Michael Hennerich 
-L: linux...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: drivers/iio/dac/ad5686*
-F: drivers/iio/dac/ad5696*
-
-ANALOG DEVICES INC AD5758 DRIVER
-M: Michael Hennerich 
-L: linux-...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: Documentation/devicetree/bindings/iio/dac/ad5758.txt
-F: drivers/iio/dac/ad5758.c
-
-ANALOG DEVICES INC AD7091R5 DRIVER
-M: Beniamin Bia 
-L: linux-...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: Documentation/devicetree/bindings/iio/adc/adi,ad7091r5.yaml
-F: drivers/iio/adc/ad7091r5.c
-
-ANALOG DEVICES INC AD7124 DRIVER
-M: Michael Hennerich 
-L: linux-...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: Documentation/devicetree/bindings/iio/adc/adi,ad7124.yaml
-F: drivers/iio/adc/ad7124.c
-
 ANALOG DEVICES INC AD7192 DRIVER
 M: Alexandru Tachici 
 L: linux-...@vger.kernel.org
@@ -998,15 +966,6 @@ W: http://ez.analog.com/community/linux-device-drivers
 F: Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml
 F: drivers/iio/adc/ad7292.c
 
-ANALOG DEVICES INC AD7606 DRIVER
-M: Michael Hennerich 
-M: Beniamin Bia 
-L: linux-...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
-F: drivers/iio/adc/ad7606.c
-
 ANALOG DEVICES INC AD7768-1 DRIVER
 M: Michael Hennerich 
 L: linux-...@vger.kernel.org
@@ -1068,7 +1027,6 @@ F:drivers/iio/imu/adis16475.c
 F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml
 
 ANALOG DEVICES INC ADM1177 DRIVER
-M: Beniamin Bia 
 M: Michael Hennerich 
 L: linux-hw...@vger.kernel.org
 S: Supported
@@ -1135,15 +1093,6 @@ S:   Supported
 W: http://ez.analog.com/community/linux-device-drivers
 F: drivers/dma/dma-axi-dmac.c
 
-ANALOG DEVICES INC HMC425A DRIVER
-M: Beniamin Bia 
-M: Michael Hennerich 
-L: linux-...@vger.kernel.org
-S: Supported
-W: http://ez.analog.com/community/linux-device-drivers
-F: Documentation/devicetree/bindings/iio/amplifiers/adi,hmc425a.yaml
-F: drivers/iio/amplifiers/hmc425a.c
-
 ANALOG DEVICES INC IIO DRIVERS
 M: Lars-Peter Clausen 
 M: Michael Hennerich 
@@ -1152,8 +1101,12 @@ W:   http://wiki.analog.com/
 W: http://ez.analog.com/community/linux-device-drivers
 F: Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
 F: Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350
+F: Documentation/devicetree/bindings/iio/adc/adi*
+F: Documentation/devicetree/bindings/iio/amplifiers/adi*
+F: Documentation/devicetree/bindings/iio/dac/ad5758.txt
 F: drivers/iio/*/ad*
 F: drivers/iio/adc/ltc249*
+F: drivers/iio/amplifiers/hmc425a.c
 F: drivers/staging/iio/*/ad*
 X: drivers/iio/*/adjd*
 
@@ -16537,7 +16490,6 @@ F:  drivers/staging/rtl8712/
 
 STAGING - SEPS525 LCD CONTROLLER DRIVERS
 M: Michael Hennerich 
-M: Beniamin Bia 
 L: linux-fb...@vger.kernel.org
 S: Supported
 F: Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
-- 
2.17.1



Re: [PATCH v2 00/28] The new cgroup slab memory controller

2020-09-02 Thread Michal Hocko
On Wed 02-09-20 08:53:49, Pavel Tatashin wrote:
> On Wed, Sep 2, 2020 at 7:32 AM Michal Hocko  wrote:
> >
> > On Wed 02-09-20 11:53:00, Vlastimil Babka wrote:
> > > >> > > Thread #2: ccs killer kthread
> > > >> > >css_killed_work_fn
> > > >> > >  cgroup_mutex  <- Grab this Mutex
> > > >> > >  mem_cgroup_css_offline
> > > >> > >memcg_offline_kmem.part
> > > >> > >   memcg_deactivate_kmem_caches
> > > >> > > get_online_mems
> > > >> > >   mem_hotplug_lock <- waits for Thread#1 to get read 
> > > >> > > access
> >
> > And one more thing. THis has been brought up several times already.
> > Maybe I have forgoten but why do we take hotplug locks in this path in
> > the first place? Memory hotplug notifier takes slab_mutex so this
> > shouldn't be really needed.
> 
> Good point, it seems this lock can be completely removed from
> memcg_deactivate_kmem_caches

I am pretty sure we have discussed that in the past. But I do not
remember the outcome. Either we have concluded that this is indeed the
case but nobody came up with a patch or we have hit some obscure
issue... Maybe David/Roman rememeber more than I do.

-- 
Michal Hocko
SUSE Labs


Re: [PATCH v4 00/78] drm/vc4: Support BCM2711 Display Pipeline

2020-09-02 Thread Maxime Ripard
On Wed, Sep 02, 2020 at 03:32:20PM +0200, Maxime Ripard wrote:
> Hi Hoegeun
> 
> On Fri, Aug 21, 2020 at 04:18:34PM +0900, Hoegeun Kwon wrote:
> > Hi Maxime,
> > 
> > Thank you for your version 4 patch.
> > I tested all 78 patches based on the next-20200708.
> > 
> > 
> > Dual HDMI opearation does not work normally.
> > flip_done timed out occurs and doesn't work.
> > Could you check please it.
> > 
> > [  105.694541] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* 
> > [CRTC:64:crtc-3] flip_done timed out
> > [  115.934994] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* 
> > [CONNECTOR:32:HDMI-A-1] flip_done timed out
> > [  126.174545] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* 
> > [PLANE:60:plane-3] flip_done timed out
> 
> Thanks for testing and reporting this. I've been looking into it, and it
> seems that it's not just the dual output that's broken, but HDMI1
> entirely (so even a single display connected to HDMI1 doesn't work).
> 
> Is it happening for you as well?

Nevermind, I had the DSI panel connected and it was interfering

Maxime



signature.asc
Description: PGP signature


Re: WARNING: suspicious RCU usage - sdhci-pltfm: SDHCI platform and OF driver helper

2020-09-02 Thread Paul E. McKenney
On Wed, Sep 02, 2020 at 08:49:11AM +0200, Ulf Hansson wrote:
> On Tue, 1 Sep 2020 at 17:00, Paul E. McKenney  wrote:

[ . . . ]

> > Here is the list, though it is early in the morning here:
> >
> > 1.  RCU_NONIDLE().
> >
> > 2.  Peter's patch, if it turns out to hoist your code out of what
> > RCU considers to be the idle loop.
> >
> > 3.  If the problem is trace events, use the _rcuidle() variant of the
> > trace event.  Instead of trace_blah(), use trace_blah_rcuidle().
> >
> > 4.  Switch from RCU (as in rcu_read_lock()) to SRCU (as in
> > srcu_read_lock()).
> >
> > 5.  Take Peter's patch a step further, moving the rcu_idle_enter()
> > and rcu_idle_exit() calls as needed.  But please keep in mind
> > that these two functions require that irqs be disabled by their
> > callers.
> >
> > 6.  If RCU_NONIDLE() in inconvenient due to early exits and such,
> > you could use the rcu_irq_enter_irqson() and rcu_irq_exit_irqson()
> > functions that it calls.
> >
> > Do any of those help?
> 
> Yes, they will, in one way or the other. Thanks for providing me with
> all the available options.
> 
> BTW, I still don't get what good rcu_idle_enter|exit() does, but I am
> assuming those need to be called at some point before the CPU goes to
> sleep.

These functions allow RCU to leave idle CPUs undisturbed.  If they
were not invoked, RCU would periodically IPI idle CPUs to verify that
there were no RCU readers running on them.  This would be quite bad for
battery lifetime, among other things.  So the call to rcu_idle_enter()
tells RCU that it may safely completely ignore this CPU until its next
call to rcu_idle_exit().

Thanx, Paul


[PATCH v2 2/3] dt-bindings: usb: cdns,usb3: Add cdns,phyrst-a-enable property

2020-09-02 Thread Roger Quadros
Controller version 0x0002450D has USB2 PHY RX sensitivity issues
that needs to be worked around by enabling phyrst-a-enable bit
in PHYRST_CFG register.

There is no way to know controller version before device controller
is started and the workaround needs to be applied for both host and
device modes, so we add this DT property.

Signed-off-by: Roger Quadros 
---
 Documentation/devicetree/bindings/usb/cdns,usb3.yaml | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/cdns,usb3.yaml 
b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
index 7bc0263accee..e670adc955e1 100644
--- a/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
+++ b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
@@ -58,6 +58,10 @@ properties:
   buffers expressed in KB
 $ref: /schemas/types.yaml#/definitions/uint32
 
+  cdns,phyrst-a-enable:
+description: Enable resetting of PHY if Rx fail is detected
+type: boolean
+
 required:
   - compatible
   - reg
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH] MAINTAINERS: Remove bouncing email of Beniamin Bia

2020-09-02 Thread Krzysztof Kozlowski
On Wed, 2 Sep 2020 at 15:28, Jonathan Cameron
 wrote:
>
> On Wed, 2 Sep 2020 10:49:04 +0300
> Andy Shevchenko  wrote:
>
> > On Wed, Sep 2, 2020 at 8:56 AM Ardelean, Alexandru
> >  wrote:
> > >
> > > [yes, I know, bad-email format, but I wanted this to come from my work 
> > > email]
> > >
> > > Apologies also for the delay here. Things pile-up on my side and I defer 
> > > things a bit.
> > >
> > > Talked to Michael Hennerich about this [since he's the more senior 
> > > contact at Analog].
> > > We can replace the email from Beniamin Bia with Michael's.
> > > Or, we can remove the "Orphan" blocks and just have the catch-all 
> > > "drivers/iio/*/ad*" cover this driver and others that were upstreamed by 
> > > Beniamin.
> > >
> > > Either option is fine from us.
> >
> > As a participant of activity to put MAINTAINERS in some order, I
> > prefer to have similar blocks be squashed.
> > If there will be a dedicated maintainer for a certain driver in the
> > future, we can always split into separate sections.
> >
> > So, something like
> > ANALOG DEVICES ADC (I guess it makes sense to have some grouping still)
> > ...
> > F: .../ad1234
> > F: .../ad2345
> >
> > In one section (no need to have wildcards right now).
> >
>
> ANALOG DEVICES INC IIO DRIVERS
> M:  Lars-Peter Clausen 
> M:  Michael Hennerich 
> S:  Supported
> W:  http://wiki.analog.com/
> W:  http://ez.analog.com/community/linux-device-drivers
> F:  Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9523
> F:  Documentation/ABI/testing/sysfs-bus-iio-frequency-adf4350
> F:  drivers/iio/*/ad*
> F:  drivers/iio/adc/ltc249*
> F:  drivers/staging/iio/*/ad*
> X:  drivers/iio/*/adjd*
>
> Already exists.  We could potentially clean that up.
>
> For the block that started this thread, we can just drop it.

I can send a follow up to merge/remove the entries.

Best regards,
Krzysztof


Re: [PATCH v5 0/4] Move Mediatek HDMI PHY driver from DRM folder to PHY folder

2020-09-02 Thread Chun-Kuang Hu
Chun-Kuang Hu  於 2020年8月23日 週日 上午9:48寫道:
>
> mtk_hdmi_phy is currently placed inside mediatek drm driver, but it's
> more suitable to place a phy driver into phy driver folder, so move
> mtk_hdmi_phy driver into phy driver folder.

For this series, applied to mediatek-drm-next [1].

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Changes in v5:
> - Fixup indent in Kconfig.
> - Refine config help message.
> - Refine Makefile.
>
> Changes in v4:
> - Rebase onto 5.9-rc1
> - Remove mtk_hdmi_conf_mt8173.
>
> Changes in v3:
> - Modify [PATCH v2 3/4] prefix.
>
> Changes in v2:
> - include module.h in mtk_hdmi.c
>
> CK Hu (3):
>   drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver
>   drm/mediatek: Separate mtk_hdmi_phy to an independent module
>   phy: mediatek: Move mtk_hdmi_phy driver into drivers/phy/mediatek
> folder
>
> Chun-Kuang Hu (1):
>   MAINTAINERS: add files for Mediatek DRM drivers
>
>  MAINTAINERS   |  1 +
>  drivers/gpu/drm/mediatek/Kconfig  |  2 +-
>  drivers/gpu/drm/mediatek/Makefile |  5 +
>  drivers/gpu/drm/mediatek/mtk_hdmi.c   | 21 +++
>  drivers/gpu/drm/mediatek/mtk_hdmi.h   |  1 -
>  drivers/phy/mediatek/Kconfig  |  7 +++
>  drivers/phy/mediatek/Makefile |  5 +
>  .../mediatek/phy-mtk-hdmi-mt2701.c}   |  3 +--
>  .../mediatek/phy-mtk-hdmi-mt8173.c}   |  2 +-
>  .../mediatek/phy-mtk-hdmi.c}  |  3 ++-
>  .../mediatek/phy-mtk-hdmi.h}  |  2 --
>  11 files changed, 36 insertions(+), 16 deletions(-)
>  rename drivers/{gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi-mt2701.c} (99%)
>  rename drivers/{gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi-mt8173.c} (99%)
>  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.c => 
> phy/mediatek/phy-mtk-hdmi.c} (98%)
>  rename drivers/{gpu/drm/mediatek/mtk_hdmi_phy.h => 
> phy/mediatek/phy-mtk-hdmi.h} (95%)
>
> --
> 2.17.1
>


Re: [PATCH] dt-bindings: crypto: Specify that allwinner,sun8i-a33-crypto needs reset

2020-09-02 Thread Maxime Ripard
On Wed, Sep 02, 2020 at 11:17:16AM +0200, Corentin Labbe wrote:
> When adding allwinner,sun8i-a33-crypto, I forgot to add that it needs reset.
> Furthermore, there are no need to use items to list only one compatible
> in compatible list.
> 
> Fixes: f81547ba7a98 ("dt-bindings: crypto: add new compatible for A33 SS")
> Signed-off-by: Corentin Labbe 
> ---
>  .../bindings/crypto/allwinner,sun4i-a10-crypto.yaml| 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml 
> b/Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml
> index fc823572bcff..1075f0e75368 100644
> --- a/Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml
> +++ b/Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml
> @@ -23,8 +23,7 @@ properties:
>- items:
>- const: allwinner,sun7i-a20-crypto
>- const: allwinner,sun4i-a10-crypto
> -  - items:
> -  - const: allwinner,sun8i-a33-crypto
> +  - const: allwinner,sun8i-a33-crypto
>  
>reg:
>  maxItems: 1
> @@ -59,7 +58,9 @@ if:
>properties:
>  compatible:
>contains:
> -const: allwinner,sun6i-a31-crypto
> +oneOf:
> +  - const: allwinner,sun6i-a31-crypto
> +  - const: allwinner,sun8i-a33-crypto

Even though it works, an enum would be best here

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v2] staging: qlge: fix build breakage with dumping enabled

2020-09-02 Thread Coiby Xu

On Thu, Aug 27, 2020 at 09:50:10AM +0900, Benjamin Poirier wrote:

On 2020-08-27 07:27 +0800, Coiby Xu wrote:

This fixes commit 0107635e15ac
("staging: qlge: replace pr_err with netdev_err") which introduced an
build breakage of missing `struct ql_adapter *qdev` for some functions
and a warning of type mismatch with dumping enabled, i.e.,

$ make CFLAGS_MODULE="QL_ALL_DUMP=1 QL_OB_DUMP=1 QL_CB_DUMP=1 \
  QL_IB_DUMP=1 QL_REG_DUMP=1 QL_DEV_DUMP=1" M=drivers/staging/qlge

qlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); did 
you mean ‘cdev’?
 2051 |  netdev_err(qdev->ndev, "%s\n", __func__);
  | ^~~~
qlge_dbg.c: In function ‘ql_dump_routing_entries’:
qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, but 
argument 3 has type ‘int’ [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ~^
  |  |
  |  char *
  | %d
 1436 |i, value);
  |~
  ||
  |int
qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ 
argument [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ^
  | |
  | unsigned int

Fixes: 0107635e15ac ("staging: qlge: replace pr_err with netdev_err")
Reported-by: Benjamin Poirier 
Suggested-by: Benjamin Poirier 
Signed-off-by: Coiby Xu 
---
 drivers/staging/qlge/qlge.h  | 20 ++--
 drivers/staging/qlge/qlge_dbg.c  | 24 ++--
 drivers/staging/qlge/qlge_main.c |  8 
 3 files changed, 32 insertions(+), 20 deletions(-)


[...]

@@ -1632,6 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)

 void ql_dump_tx_ring(struct tx_ring *tx_ring)
 {
+   struct ql_adapter *qdev = tx_ring->qdev;
+
if (!tx_ring)
return;


Given the null check for tx_ring, it seems unwise to dereference tx_ring
before the check.

Looking at ql_dump_all(), I'm not sure that the check is needed at all
though. Maybe it should be removed.

Same problem in ql_dump_rx_ring().


Thank you for the spotting this issue! I'll remove the check.




netdev_err(qdev->ndev, "= Dumping tx_ring %d 
===\n",
@@ -1657,6 +1662,8 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)
 void ql_dump_ricb(struct ricb *ricb)
 {
int i;
+   struct ql_adapter *qdev =
+   container_of(ricb, struct ql_adapter, ricb);


Here, davem would point out that the variables are not declared in
"reverse xmas tree" order.


I'll make davem happy then:)

--
Best regards,
Coiby


Re: [PATCH V2 0/2] percpu_ref & block: reduce memory footprint of percpu_ref in fast path

2020-09-02 Thread Jens Axboe
On 9/2/20 6:26 AM, Ming Lei wrote:
> Hi,
> 
> The 1st patch removes memory footprint of percpu_ref in fast path
> from 7 words to 2 words, since it is often used in fast path and
> embedded in user struct.
> 
> The 2nd patch moves .q_usage_counter to 1st cacheline of
> 'request_queue'.
> 
> Simple test on null_blk shows ~2% IOPS boost on one 16cores(two threads
> per core) machine, dual socket/numa.
> 
> V2:
>   - pass 'gfp' to kzalloc() for fixing block/027 failure reported by
>   kernel test robot
>   - protect percpu_ref_is_zero() with destroying percpu-refcount by
>   spin lock  
> 
> Ming Lei (2):
>   percpu_ref: reduce memory footprint of percpu_ref in fast path
>   block: move 'q_usage_counter' into front of 'request_queue'

Applied, thanks.

-- 
Jens Axboe



Re: [PATCH 04/10] USB: core: hub.c: use usb_control_msg_send() in a few places

2020-09-02 Thread Alan Stern
On Wed, Sep 02, 2020 at 01:01:06PM +0200, Greg Kroah-Hartman wrote:
> There are a few calls to usb_control_msg() that can be converted to use
> usb_control_msg_send() instead, so do that in order to make the error
> checking a bit simpler and the code smaller.
> 
> Cc: Alan Stern 
> Signed-off-by: Greg Kroah-Hartman 

One problem in this patch...

> @@ -3896,27 +3875,14 @@ static int usb_req_set_sel(struct usb_device *udev, 
> enum usb3_link_state state)
>   if (u2_pel > USB3_LPM_MAX_U2_SEL_PEL)
>   u2_pel = USB3_LPM_MAX_U2_SEL_PEL;
>  
> - /*
> -  * usb_enable_lpm() can be called as part of a failed device reset,
> -  * which may be initiated by an error path of a mass storage driver.
> -  * Therefore, use GFP_NOIO.
> -  */
> - sel_values = kmalloc(sizeof *(sel_values), GFP_NOIO);
> - if (!sel_values)
> - return -ENOMEM;
> -
> - sel_values->u1_sel = u1_sel;
> - sel_values->u1_pel = u1_pel;
> - sel_values->u2_sel = cpu_to_le16(u2_sel);
> - sel_values->u2_pel = cpu_to_le16(u2_pel);
> + sel_values.u1_sel = u1_sel;
> + sel_values.u1_pel = u1_pel;
> + sel_values.u2_sel = cpu_to_le16(u2_sel);
> + sel_values.u2_pel = cpu_to_le16(u2_pel);
>  
> - ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
> - USB_REQ_SET_SEL,
> - USB_RECIP_DEVICE,
> - 0, 0,
> - sel_values, sizeof *(sel_values),
> - USB_CTRL_SET_TIMEOUT);
> - kfree(sel_values);
> + ret = usb_control_msg_send(udev, 0, USB_REQ_SET_SEL, USB_RECIP_DEVICE,
> +0, 0, _values, sizeof(sel_values),
> +USB_CTRL_SET_TIMEOUT);

This effectively changes GFP_NOIO to GFP_KERNEL.  Probably you should
leave this particular call alone.

Alan Stern


Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Vlastimil Babka
On 9/2/20 4:26 PM, Pavel Tatashin wrote:
> On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko  wrote:
>>
>> >
>> > Thread#1 - continue
>> >  free_unref_page_commit
>> >migratetype = get_pcppage_migratetype(page);
>> >   // get old migration type
>> >list_add(>lru, >lists[migratetype]);
>> >   // add new page to already drained pcp list
>> >
>> > Thread#2
>> > Never drains pcp again, and therefore gets stuck in the loop.
>> >
>> > The fix is to try to drain per-cpu lists again after
>> > check_pages_isolated_cb() fails.
>>
>> But this means that the page is not isolated and so it could be reused
>> for something else. No?
> 
> The page is in a movable zone, has zero references, and the section is
> isolated (i.e. set_pageblock_migratetype(page, MIGRATE_ISOLATE);) is
> set. The page should be offlinable, but it is lost in a pcp list as
> that list is never drained again after the first failure to migrate
> all pages in the range.

Yeah. To answer Michal's "it could be reused for something else" - yes, somebody
could allocate it from the pcplist before we do the extra drain. But then it
becomes "visible again" and the loop in __offline_pages() should catch it by
scan_movable_pages() - do_migrate_range(). And this time the pageblock is
already marked as isolated, so the page (freed by migration) won't end up on the
pcplist again.


[PATCH] seccomp: don't leave dangling ->notif if file allocation fails

2020-09-02 Thread Tycho Andersen
Christian and Kees both pointed out that this is a bit sloppy to open-code
both places, and Christian points out that we leave a dangling pointer to
->notif if file allocation fails. Since we check ->notif for null in order
to determine if it's ok to install a filter, this means people won't be
able to install a filter if the file allocation fails for some reason, even
if they subsequently should be able to.

To fix this, let's hoist this free+null into its own little helper and use
it.

Reported-by: Kees Cook 
Reported-by: Christian Brauner 
Signed-off-by: Tycho Andersen 
---
 kernel/seccomp.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index bb0dd9ae699a..676d4af62103 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1109,6 +1109,12 @@ static long seccomp_set_mode_strict(void)
 }
 
 #ifdef CONFIG_SECCOMP_FILTER
+static void seccomp_notify_free(struct seccomp_filter *filter)
+{
+   kfree(filter->notif);
+   filter->notif = NULL;
+}
+
 static void seccomp_notify_detach(struct seccomp_filter *filter)
 {
struct seccomp_knotif *knotif;
@@ -1138,8 +1144,7 @@ static void seccomp_notify_detach(struct seccomp_filter 
*filter)
complete(>ready);
}
 
-   kfree(filter->notif);
-   filter->notif = NULL;
+   seccomp_notify_free(filter);
mutex_unlock(>notify_lock);
 }
 
@@ -1494,7 +1499,7 @@ static struct file *init_listener(struct seccomp_filter 
*filter)
 
 out_notif:
if (IS_ERR(ret))
-   kfree(filter->notif);
+   seccomp_notify_free(filter);
 out:
return ret;
 }

base-commit: 7b6aa0bb62fd6fd50f2d14136136262d28fb2dfe
-- 
2.25.1



Re: [PATCH v1] regmap: Add can_sleep configuration option

2020-09-02 Thread Marek Szyprowski
Hi Dmitry,

On 02.09.2020 16:18, Dmitry Osipenko wrote:
> Regmap can't sleep if spinlock is used for the locking protection.
> This patch fixes regression caused by a previous commit that switched
> regmap to use fsleep() and this broke Amlogic S922X platform.
>
> This patch adds new configuration option for regmap users, allowing to
> specify whether regmap operations can sleep and assuming that sleep is
> allowed if mutex is used for the regmap locking protection.
>
> Reported-by: Marek Szyprowski 
> Fixes: 2b32d2f7ce0a ("regmap: Use flexible sleep")
> Signed-off-by: Dmitry Osipenko 

This fixes the issue I've reported. Thanks!

Tested-by: Marek Szyprowski 

> ---
>   drivers/base/regmap/internal.h |  3 +++
>   drivers/base/regmap/regmap.c   | 19 +++
>   include/linux/regmap.h |  3 +++
>   3 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
> index 3d80c4b43f72..8a59359e145f 100644
> --- a/drivers/base/regmap/internal.h
> +++ b/drivers/base/regmap/internal.h
> @@ -161,6 +161,9 @@ struct regmap {
>   void *selector_work_buf;/* Scratch buffer used for selector */
>   
>   struct hwspinlock *hwlock;
> +
> + /* if set, the regmap core can sleep */
> + bool can_sleep;
>   };
>   
>   struct regcache_ops {
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index a417cb1a11dc..2807e544658e 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -697,11 +697,13 @@ struct regmap *__regmap_init(struct device *dev,
>   
>   if (config->disable_locking) {
>   map->lock = map->unlock = regmap_lock_unlock_none;
> + map->can_sleep = config->can_sleep;
>   regmap_debugfs_disable(map);
>   } else if (config->lock && config->unlock) {
>   map->lock = config->lock;
>   map->unlock = config->unlock;
>   map->lock_arg = config->lock_arg;
> + map->can_sleep = config->can_sleep;
>   } else if (config->use_hwlock) {
>   map->hwlock = hwspin_lock_request_specific(config->hwlock_id);
>   if (!map->hwlock) {
> @@ -737,6 +739,7 @@ struct regmap *__regmap_init(struct device *dev,
>   mutex_init(>mutex);
>   map->lock = regmap_lock_mutex;
>   map->unlock = regmap_unlock_mutex;
> + map->can_sleep = true;
>   lockdep_set_class_and_name(>mutex,
>  lock_key, lock_name);
>   }
> @@ -2230,8 +2233,12 @@ static int _regmap_range_multi_paged_reg_write(struct 
> regmap *map,
>   if (ret != 0)
>   return ret;
>   
> - if (regs[i].delay_us)
> - fsleep(regs[i].delay_us);
> + if (regs[i].delay_us) {
> + if (map->can_sleep)
> + fsleep(regs[i].delay_us);
> + else
> + udelay(regs[i].delay_us);
> + }
>   
>   base += n;
>   n = 0;
> @@ -2267,8 +2274,12 @@ static int _regmap_multi_reg_write(struct regmap *map,
>   if (ret != 0)
>   return ret;
>   
> - if (regs[i].delay_us)
> - fsleep(regs[i].delay_us);
> + if (regs[i].delay_us) {
> + if (map->can_sleep)
> + fsleep(regs[i].delay_us);
> + else
> + udelay(regs[i].delay_us);
> + }
>   }
>   return 0;
>   }
> diff --git a/include/linux/regmap.h b/include/linux/regmap.h
> index d865d8fea535..0c49d59168b5 100644
> --- a/include/linux/regmap.h
> +++ b/include/linux/regmap.h
> @@ -342,6 +342,7 @@ typedef void (*regmap_unlock)(void *);
>* @hwlock_id: Specify the hardware spinlock id.
>* @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
>*   HWLOCK_IRQ or 0.
> + * @can_sleep: Optional, specifies whether regmap operations can sleep.
>*/
>   struct regmap_config {
>   const char *name;
> @@ -398,6 +399,8 @@ struct regmap_config {
>   bool use_hwlock;
>   unsigned int hwlock_id;
>   unsigned int hwlock_mode;
> +
> + bool can_sleep;
>   };
>   
>   /**

Best regards
-- 
Marek Szyprowski, PhD
Samsung R Institute Poland



Re: [PATCH v3 2/6] workqueue: kasan: record workqueue stack

2020-09-02 Thread Tejun Heo
On Tue, Aug 25, 2020 at 09:58:33AM +0800, Walter Wu wrote:
> Records the last two enqueuing work call stacks in order to print them
> in KASAN report. It is useful for programmers to solve use-after-free
> or double-free memory workqueue issue.
> 
> For workqueue it has turned out to be useful to record the enqueuing
> work call stacks. Because user can see KASAN report to determine
> whether it is root cause. They don't need to enable debugobjects,
> but they have a chance to find out the root cause.
> 
> Signed-off-by: Walter Wu 
> Suggested-by: Marco Elver 
> Cc: Andrey Ryabinin 
> Cc: Dmitry Vyukov 
> Cc: Alexander Potapenko 
> Cc: Tejun Heo 
> Cc: Lai Jiangshan 

Acked-by: Tejun Heo 

Thanks.

-- 
tejun


Re: [PATCH] media: mtk-vcodec: set dma max segment size

2020-09-02 Thread Hsin-Yi Wang
On Wed, Sep 2, 2020 at 10:25 PM Robin Murphy  wrote:
>
> On 2020-08-21 05:14, Hsin-Yi Wang wrote:
> > Set dma max segment size for encoder and decoder driver.
> >
> > Fix following warning with CONFIG_DMA_API_DEBUG_SG=y
> >
> > [   75.147825] [ cut here ]
> > [   75.147844] mtk-vcodec-enc 19002000.vcodec: DMA-API: mapping sg segment 
> > longer than device claims to support [len=983040] [max=65536]
> > [   75.147876] WARNING: CPU: 2 PID: 4069 at kernel/dma/debug.c:1302 
> > debug_dma_map_sg+0x1a8/0x2c4
> > ...
> > [   75.148139] Call trace:
> > [   75.148149]  debug_dma_map_sg+0x1a8/0x2c4
> > [   75.148165]  vb2_dc_get_userptr+0x228/0x364 [videobuf2_dma_contig]
> > [   75.148178]  __buf_prepare+0x3ac/0x8c0 [videobuf2_common]
> > [   75.148188]  vb2_core_qbuf+0xa4/0x58c [videobuf2_common]
> > [   75.148199]  vb2_qbuf+0x88/0xe4 [videobuf2_v4l2]
> > [   75.148211]  v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
> > [   75.148221]  vidioc_venc_qbuf+0x3c/0x70 [mtk_vcodec_enc]
> > [   75.148234]  v4l_qbuf+0x48/0x58
> > [   75.148242]  __video_do_ioctl+0x200/0x37c
> > [   75.148250]  video_usercopy+0x360/0x834
> > [   75.148259]  video_ioctl2+0x38/0x48
> > [   75.148267]  v4l2_ioctl+0x6c/0x80
> > [   75.148276]  do_video_ioctl+0xefc/0x4b70
> > [   75.148284]  v4l2_compat_ioctl32+0x5c/0xcc
> > [   75.148294]  __arm64_compat_sys_ioctl+0xf4/0x240
> > [   75.148304]  el0_svc_common+0xac/0x198
> > [   75.148312]  el0_svc_compat_handler+0x2c/0x40
> > [   75.148321]  el0_svc_compat+0x8/0x18
> > [   75.148328] irq event stamp: 0
> > [   75.148337] hardirqs last  enabled at (0): [<>]  
> >  (null)
> > [   75.148347] hardirqs last disabled at (0): [] 
> > copy_process+0x380/0x115c
> > [   75.148356] softirqs last  enabled at (0): [] 
> > copy_process+0x398/0x115c
> > [   75.148364] softirqs last disabled at (0): [<>]  
> >  (null)
> > [   75.148372] ---[ end trace 588bf529451e3531 ]---
> >
> > Reported-by: Anand K Mistry 
> > Signed-off-by: Hsin-Yi Wang 
> > ---
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 8 
> >   drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 8 
> >   2 files changed, 16 insertions(+)
> >
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c 
> > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> > index 97a1b6664c20..3bbd0bac56d6 100644
> > --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> > @@ -242,6 +242,14 @@ static int mtk_vcodec_probe(struct platform_device 
> > *pdev)
> >   mtk_v4l2_err("[VPU] vpu device in not ready");
> >   return -EPROBE_DEFER;
> >   }
> > + if (!pdev->dev.dma_parms) {
> > + pdev->dev.dma_parms = devm_kzalloc(>dev,
> > + sizeof(*pdev->dev.dma_parms),
> > + GFP_KERNEL);
> > + if (!pdev->dev.dma_parms)
> > + return -ENOMEM;
> > + }
>
> Since 9495b7e92f71, dma_parms is included in the platform_device itself
> and always set, so you can drop these allocation paths.
>
> > + dma_set_max_seg_size(>dev, DMA_BIT_MASK(32));
>
> The segment size is simply a size, not a bitmask, so UINT_MAX would be
> more semantically appropriate.
>
> Robin.
>

Thanks. since this patch is already in media tree:
https://git.linuxtv.org/media_tree.git/commit/?id=13483fc2f20f0e2db7ba9c39b095ac7ea46f8de8,
I'll send a patch to modify this.


Re: refactoring livepatch documentation was Re: [PATCH 1/2] docs/livepatch: Add new compiler considerations doc

2020-09-02 Thread Miroslav Benes
[side note: So not only that my INBOX is a mess after the summer. I also 
lost some emails apparently. I'm really sorry about that. ]

CCing Nicolai too.

> Hi Petr, Josh,
> 
> The compiler optimization pitfall document can wait for refactored livepatch
> documentation if that puts it into better context, particularly for newbies.
> I don't mind either way.  FWIW, I don't profess to be an authoritative source
> its content -- we've dealt some of these issues in kpatch, so it was
> interesting to see how they affect livepatches that don't rely on binary
> comparison.
> 
> 
> Toward the larger goal, I've changed the thread subject to talk about how we
> may rearrange and supplement our current documentation.  This is a first pass
> at a possible refactoring...
> 
> 
> 1. Provide a better index page to connect the other files/docs, like
> https://www.kernel.org/doc/html/latest/core-api/index.html but obviously not
> that extensive.  Right now we have only a Table of Contents tree without any
> commentary.
> 
> 2. Rearrange and refactor sections:
> 
> livepatch.rst
>   Keep just about everything
>   Add a history section to explain ksplice, kgraft, kpatch for the
> uninitiated?
>   Add a section on source based vs. binary diff livepatch creation,
> this may be worth its own top-level section
> 
> Livepatch API
>   Basic API
>   Callbacks
>   Shadow variables
>   Cumulative patches
>   System state
> 
> KLP Relocations
>   Right now this is a bit academic AFAIK kpatch is the only tool
>   currently making use of them.  So maybe this document becomes a
>   more general purpose doc explaining how to reference unexported
>   symbols?  (ie, how does kgraft currently do it, particularly
>   w/kallsyms going unexported?)

Yes, we rely on kallsyms_lookup_name() pretty much right now and once we 
hit the problem with the next kernel version upgrade, we'll have to fix 
it.
 
>   Eventually this could contain klp-convert howto if it ever gets
>   merged.
> 
> Compiler considerations
>   TBD
> 
> I suppose this doesn't create a "Livepatching creation for dummies" guide, but
> my feeling is that there are so many potential (hidden) pitfalls that such
> guide would be dangerous.

It does not create the guide, but it looks like a good basis. I agree with 
Josh here. It might be difficult at the beginning, but the outcome could 
be great even for a newbie and I think we should aim for that.
 
> If someone were to ask me today how to start building a livepatch, I would
> probably point them at the samples to demonstrate the basic concept and API,
> but then implore them to read through the documentation to understand how
> quickly complicated it can become.

True.

We discuss the need to properly document our internal process every once 
in a while and there is always something more important to deal with, but 
it is high time to finally start with that.

Miroslav


[PATCH v3] staging: qlge: fix build breakage with dumping enabled

2020-09-02 Thread Coiby Xu
This fixes commit 0107635e15ac
("staging: qlge: replace pr_err with netdev_err") which introduced an
build breakage of missing `struct ql_adapter *qdev` for some functions
and a warning of type mismatch with dumping enabled, i.e.,

$ make CFLAGS_MODULE="QL_ALL_DUMP=1 QL_OB_DUMP=1 QL_CB_DUMP=1 \
  QL_IB_DUMP=1 QL_REG_DUMP=1 QL_DEV_DUMP=1" M=drivers/staging/qlge

qlge_dbg.c: In function ‘ql_dump_ob_mac_rsp’:
qlge_dbg.c:2051:13: error: ‘qdev’ undeclared (first use in this function); did 
you mean ‘cdev’?
 2051 |  netdev_err(qdev->ndev, "%s\n", __func__);
  | ^~~~
qlge_dbg.c: In function ‘ql_dump_routing_entries’:
qlge_dbg.c:1435:10: warning: format ‘%s’ expects argument of type ‘char *’, but 
argument 3 has type ‘int’ [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ~^
  |  |
  |  char *
  | %d
 1436 |i, value);
  |~
  ||
  |int
qlge_dbg.c:1435:37: warning: format ‘%x’ expects a matching ‘unsigned int’ 
argument [-Wformat=]
 1435 |"%s: Routing Mask %d = 0x%.08x\n",
  | ^
  | |
  | unsigned int

Fixes: 0107635e15ac ("staging: qlge: replace pr_err with netdev_err")
Reported-by: Benjamin Poirier 
Suggested-by: Benjamin Poirier 
Signed-off-by: Coiby Xu 
---
 drivers/staging/qlge/qlge.h  | 20 ++--
 drivers/staging/qlge/qlge_dbg.c  | 28 ++--
 drivers/staging/qlge/qlge_main.c |  8 
 3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/qlge/qlge.h b/drivers/staging/qlge/qlge.h
index 483ce04789ed..7f6798b223ef 100644
--- a/drivers/staging/qlge/qlge.h
+++ b/drivers/staging/qlge/qlge.h
@@ -2338,21 +2338,21 @@ void ql_dump_hw_cb(struct ql_adapter *qdev, int size, 
u32 bit, u16 q_id);
 #endif

 #ifdef QL_OB_DUMP
-void ql_dump_tx_desc(struct tx_buf_desc *tbd);
-void ql_dump_ob_mac_iocb(struct ob_mac_iocb_req *ob_mac_iocb);
-void ql_dump_ob_mac_rsp(struct ob_mac_iocb_rsp *ob_mac_rsp);
-#define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb) ql_dump_ob_mac_iocb(ob_mac_iocb)
-#define QL_DUMP_OB_MAC_RSP(ob_mac_rsp) ql_dump_ob_mac_rsp(ob_mac_rsp)
+void ql_dump_tx_desc(struct ql_adapter *qdev, struct tx_buf_desc *tbd);
+void ql_dump_ob_mac_iocb(struct ql_adapter *qdev, struct ob_mac_iocb_req 
*ob_mac_iocb);
+void ql_dump_ob_mac_rsp(struct ql_adapter *qdev, struct ob_mac_iocb_rsp 
*ob_mac_rsp);
+#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb) ql_dump_ob_mac_iocb(qdev, 
ob_mac_iocb)
+#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp) ql_dump_ob_mac_rsp(qdev, 
ob_mac_rsp)
 #else
-#define QL_DUMP_OB_MAC_IOCB(ob_mac_iocb)
-#define QL_DUMP_OB_MAC_RSP(ob_mac_rsp)
+#define QL_DUMP_OB_MAC_IOCB(qdev, ob_mac_iocb)
+#define QL_DUMP_OB_MAC_RSP(qdev, ob_mac_rsp)
 #endif

 #ifdef QL_IB_DUMP
-void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp);
-#define QL_DUMP_IB_MAC_RSP(ib_mac_rsp) ql_dump_ib_mac_rsp(ib_mac_rsp)
+void ql_dump_ib_mac_rsp(struct ql_adapter *qdev, struct ib_mac_iocb_rsp 
*ib_mac_rsp);
+#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp) ql_dump_ib_mac_rsp(qdev, 
ib_mac_rsp)
 #else
-#define QL_DUMP_IB_MAC_RSP(ib_mac_rsp)
+#define QL_DUMP_IB_MAC_RSP(qdev, ib_mac_rsp)
 #endif

 #ifdef QL_ALL_DUMP
diff --git a/drivers/staging/qlge/qlge_dbg.c b/drivers/staging/qlge/qlge_dbg.c
index a55bf0b3e9dc..e139e15516fa 100644
--- a/drivers/staging/qlge/qlge_dbg.c
+++ b/drivers/staging/qlge/qlge_dbg.c
@@ -1431,7 +1431,7 @@ void ql_dump_routing_entries(struct ql_adapter *qdev)
}
if (value)
netdev_err(qdev->ndev,
-  "%s: Routing Mask %d = 0x%.08x\n",
+  "Routing Mask %d = 0x%.08x\n",
   i, value);
}
ql_sem_unlock(qdev, SEM_RT_IDX_MASK);
@@ -1617,6 +1617,9 @@ void ql_dump_qdev(struct ql_adapter *qdev)
 #ifdef QL_CB_DUMP
 void ql_dump_wqicb(struct wqicb *wqicb)
 {
+   struct tx_ring *tx_ring = container_of(wqicb, struct tx_ring, wqicb);
+   struct ql_adapter *qdev = tx_ring->qdev;
+
netdev_err(qdev->ndev, "Dumping wqicb stuff...\n");
netdev_err(qdev->ndev, "wqicb->len = 0x%x\n", le16_to_cpu(wqicb->len));
netdev_err(qdev->ndev, "wqicb->flags = %x\n",
@@ -1632,8 +1635,8 @@ void ql_dump_wqicb(struct wqicb *wqicb)

 void ql_dump_tx_ring(struct tx_ring *tx_ring)
 {
-   if (!tx_ring)
-   return;
+   struct ql_adapter *qdev = tx_ring->qdev;
+
netdev_err(qdev->ndev, "= Dumping tx_ring %d 
===\n",
   tx_ring->wq_id);
netdev_err(qdev->ndev, "tx_ring->base = %p\n", tx_ring->wq_base);
@@ -1656,6 +1659,8 @@ void ql_dump_tx_ring(struct tx_ring *tx_ring)

 void ql_dump_ricb(struct ricb *ricb)
 {
+   struct ql_adapter *qdev =
+   container_of(ricb, struct 

Re: [PATCH] writeback: clear auto_free in initializaiton

2020-09-02 Thread Tejun Heo
Hello,

On Wed, Aug 26, 2020 at 06:11:26PM +0200, Jan Kara wrote:
> > Which seems like a strange place to set auto_free as
> > it is not where the rest of base_work is initialized.
> 
> Otherwise I agree it's a strange place. I've added Tejun to CC just in case
> he remembers why he's added that.

I don't remember exactly but maybe I was trying to mirror the
CGROUP_WRITEBACK counterpart without actually thinking about it? The patch
looks good to me.

Thanks.

-- 
tejun


Re: remove revalidate_disk()

2020-09-02 Thread Jens Axboe
On 9/1/20 9:57 AM, Christoph Hellwig wrote:
> Hi Jens,
> 
> this series removes the revalidate_disk() function, which has been a
> really odd duck in the last years.  The prime reason why most people
> use it is because it propagates a size change from the gendisk to
> the block_device structure.  But it also calls into the rather ill
> defined ->revalidate_disk method which is rather useless for the
> callers.  So this adds a new helper to just propagate the size, and
> cleans up all kinds of mess around this area.  Follow on patches
> will eventuall kill of ->revalidate_disk entirely, but ther are a lot
> more patches needed for that.

Applied, thanks.

-- 
Jens Axboe



Re: [PATCH] perf c2c report: count remote loads correctly

2020-09-02 Thread Arnaldo Carvalho de Melo
Em Wed, Sep 02, 2020 at 01:09:42PM +0100, Al Grant escreveu:
> On 01/09/2020 22:26, Joe Mario wrote:
> > On 9/1/20 4:46 PM, Jiri Olsa wrote:
> > > On Tue, Sep 01, 2020 at 10:17:19PM +0200, Jiri Olsa wrote:
> > > > On Thu, Aug 20, 2020 at 02:48:58PM +0100, Al Grant wrote:
> > > > I'm getting following when trying to apply the patch:

> > > > patching file util/mem-events.c
> > > > patch:  malformed patch at line 83: struct mem_info *mi)

> > > > > "perf c2c report" can show load counts for cache lines, which
> > > > > don't match the actual number of load samples, e.g. as
> > > > > displayed by "perf script". This is specific to "Remote Any
> > > > > cache hit" loads. Firstly, these loads are counted twice,
> > > > > because if the "remote" flag is set, rmt_dram is always
> > > > > incremented, and then rmt_hitm or rmt_hit may also be
> > > > > incremented. These are then totalled in the overall load
> > > > > count, causing double-counting. "Remote Any cache hit" should
> > > > > not increment rmt_dram. Instead, use LVLNUM to discriminate
> > > > > between remote cache and remote DRAM. Also, non-HITM loads to
> > > > > remote cache are not being counted as hits (the last column in
> > > > > the cache line report is zero), when the SNOOP field is unset.
> > > > > This causes under-reporting of the load count. The code
> > > > > currently only increments counters if the SNOOP field is set
> > > > > to either HIT or HITM. Instead, for access to remote cache (as
> > > > > indicated by LVLNUM), increment rmt_hitm if SNOOP=HITM,
> > > > > increment rmt_hit otherwise.

> > > > seems like you described more issues in here,
> > > > could you please put them in separate patches,
> > > > so it's easier to review?

> > > > Andi, Joe,
> > > > any idea about changes described above?

> > Hi Al:
> > Can you provide a simple reproducer for this?
> > When I try it, the "perf c2c report" shows the same counts for the load 
> > samples as the "perf script" output does.
> > 
> > For example:
> > Here's the output from the "perf c2c report"
> > # head -6 c2c.out
> > =
> > Trace Event Information
> > =
> >   Total records :  32923
> >   Locked Load/Store Operations  :306
> >   Load Operations   :   5392
> > 
> > And here's the grep count from the "perf script" output:
> > # egrep -c 'mem-stores|mem-loads' script.out
> > 32923
> > # egrep -c "LCK Yes" script.out
> > 306
> > # grep -c mem-loads script.out
> > 5392

> "Load Operations" is correct, the problem is with some of the
> counts of more specific load types. E.g. in this output:

>   Load Operations   :782
>   Loads - uncacheable   :  0
>   Loads - IO:  0
>   Loads - Miss  : 18
>   Loads - no mapping:  0
>   Load Fill Buffer Hit  : 85
>   Load L1D hit  :171
>   Load L2D hit  : 16
>   Load LLC hit  : 86
>   Load Local HITM   :  0
>   Load Remote HITM  :110
>   Load Remote HIT   :  0
>   Load Local DRAM   : 86
>   Load Remote DRAM  :320

> LFB, L1D, L2D, LLC, local DRAM, remote HIT/HITM and remote DRAM are
> distinct places so their individual counts should total up to no more
> than the total load count. But 85+171+16+86+110+86+320 is 874 which
> exceeds the total load count by 92. If you add in "Loads - Miss"
> (which is "L3 Miss" in perf script - it's not specific about where
> it hit) the excess is 110.

> # grep -c "Remote Any cache hit" script.out
> 111

> # grep -c "Remote Any cache hit|SNP HitM" script.out
> 110

> # grep -c "Remote RAM" script.out
> 209

> # grep -c "Remote" script.out
> 320

> Loads which hit remote cache are being counted as both remote HIT/HITM
> and remote DRAM. perf c2c is reporting 320 "Load Remote DRAM" but this
> is the count of all remote loads, including "Remote Any cache hit".
> "Load Remote DRAM" should match "grep -c "Remote RAM" i.e. 209 not
> 320.  The 110 excess in the total matches the count of "Remote Any
> cache hit|SNP HitM" as it is these which are counted twice. (There is
> one "SNP N/A" which isn't counted, that's the other issue I mentioned)

> There are knock-on effects in the detailed cache line reporting, but I
> believe it's all due to the same root cause where we have some records
> triggering two counts which should be mutually exclusive.

Would you consider adding a tools/perf/tests/ entry to do these checks,
i.e. run some synthetic workload, record some of these events, then do
this math, to check that perf is doing the right thing?

The starting point is 

Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Vlastimil Babka
On 9/2/20 4:31 PM, Pavel Tatashin wrote:
>> > > The fix is to try to drain per-cpu lists again after
>> > > check_pages_isolated_cb() fails.
>>
>> Still trying to wrap my head around this but I think this is not a
>> proper fix. It should be the page isolation to make sure no races are
>> possible with the page freeing path.
>>
> 
> As Bharata B Rao found in another thread, the problem was introduced
> by this change:
> c52e75935f8d: mm: remove extra drain pages on pcp list
> 
> So, the drain used to be tried every time with lru_add_drain_all();
> Which, I think is excessive, as we start a thread per cpu to try to
> drain and catch a rare race condition. With the proposed change we
> drain again only when we find such a condition. Fixing it in
> start_isolate_page_range means that we must somehow synchronize it
> with the release_pages() which adds costs to runtime code, instead of
> to hot-remove code.

Agreed. Isolation was always racy wrt freeing to pcplists, and it was simply
acceptable to do some extra drains if needed. Removing that race would be indeed
acceptable only if it didn't affect alloc/free fastpaths.

> Pasha
> 



Re: [PATCH] media: tc358743: initialize variable

2020-09-02 Thread Tom Rix


On 8/31/20 10:31 AM, Nick Desaulniers wrote:
> On Sun, Aug 30, 2020 at 9:30 AM  wrote:
>> From: Tom Rix 
>>
>> clang static analysis flags this error
>>
>> tc358743.c:1468:9: warning: Branch condition evaluates
>>   to a garbage value
>> return handled ? IRQ_HANDLED : IRQ_NONE;
>>^~~
>> handled should be initialized to false.
>>
>> Fixes: d747b806abf4 ("[media] tc358743: add direct interrupt handling")
>> Signed-off-by: Tom Rix 
> I'm guessing there was more to the report that says that `handled`
> isn't necessarily initialized along any of the paths within
> tc358743_isr()?  But you should fix this for all callers of
> tc358743_isr(), such as tc358743_work_i2c_poll(), not just
> tc358743_irq_handler().

tc358743_work_i2c_poll does not use handled, so in theory it could pass a null, 
however at least one of the subhandler, tc358743_cec_isr, does not check if 
null is passed in.

so i think that covers the callers.

i think initializing handler in tc358743_work_i2c_poll is a not needed since it 
is unused.  but the null check in tc358743_cec_isr needs to be done. i'll post 
that as a separate patch once this one settles.

Tom

>> ---
>>  drivers/media/i2c/tc358743.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
>> index a03dcab5ce61..c724bd1591de 100644
>> --- a/drivers/media/i2c/tc358743.c
>> +++ b/drivers/media/i2c/tc358743.c
>> @@ -1461,7 +1461,7 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 
>> status, bool *handled)
>>  static irqreturn_t tc358743_irq_handler(int irq, void *dev_id)
>>  {
>> struct tc358743_state *state = dev_id;
>> -   bool handled;
>> +   bool handled = false;
>>
>> tc358743_isr(>sd, 0, );
>>
>> --
>> 2.18.1
>>
>



Re: [PATCH v4 03/78] drm/vc4: hvs: Boost the core clock during modeset

2020-09-02 Thread Maxime Ripard
Hi,

On Tue, Sep 01, 2020 at 08:21:36PM +0900, Chanwoo Choi wrote:
> Hi Maxime,
> 
> On 7/9/20 2:41 AM, Maxime Ripard wrote:
> > In order to prevent timeouts and stalls in the pipeline, the core clock
> > needs to be maxed at 500MHz during a modeset on the BCM2711.
> > 
> > Reviewed-by: Eric Anholt 
> > Signed-off-by: Maxime Ripard 
> > ---
> >  drivers/gpu/drm/vc4/vc4_drv.h |  2 ++
> >  drivers/gpu/drm/vc4/vc4_hvs.c |  9 +
> >  drivers/gpu/drm/vc4/vc4_kms.c |  9 +
> >  3 files changed, 20 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> > index e4cde1f9224b..6358f6ca8d56 100644
> > --- a/drivers/gpu/drm/vc4/vc4_drv.h
> > +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> > @@ -320,6 +320,8 @@ struct vc4_hvs {
> > void __iomem *regs;
> > u32 __iomem *dlist;
> >  
> > +   struct clk *core_clk;
> > +
> > /* Memory manager for CRTCs to allocate space in the display
> >  * list.  Units are dwords.
> >  */
> > diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
> > index 836d8799d79e..091fdf4908aa 100644
> > --- a/drivers/gpu/drm/vc4/vc4_hvs.c
> > +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
> > @@ -19,6 +19,7 @@
> >   * each CRTC.
> >   */
> >  
> > +#include 
> >  #include 
> >  #include 
> >  
> > @@ -540,6 +541,14 @@ static int vc4_hvs_bind(struct device *dev, struct 
> > device *master, void *data)
> > hvs->regset.regs = hvs_regs;
> > hvs->regset.nregs = ARRAY_SIZE(hvs_regs);
> >  
> > +   if (hvs->hvs5) {
> > +   hvs->core_clk = devm_clk_get(>dev, NULL);
> > +   if (IS_ERR(hvs->core_clk)) {
> > +   dev_err(>dev, "Couldn't get core clock\n");
> > +   return PTR_ERR(hvs->core_clk);
> > +   }
> > +   }
> > +
> > if (!hvs->hvs5)
> > hvs->dlist = hvs->regs + SCALER_DLIST_START;
> > else
> > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
> > index 08318e69061b..210cc2408087 100644
> > --- a/drivers/gpu/drm/vc4/vc4_kms.c
> > +++ b/drivers/gpu/drm/vc4/vc4_kms.c
> > @@ -11,6 +11,8 @@
> >   * crtc, HDMI encoder).
> >   */
> >  
> > +#include 
> > +
> >  #include 
> >  #include 
> >  #include 
> > @@ -149,6 +151,7 @@ vc4_atomic_complete_commit(struct drm_atomic_state 
> > *state)
> >  {
> > struct drm_device *dev = state->dev;
> > struct vc4_dev *vc4 = to_vc4_dev(dev);
> > +   struct vc4_hvs *hvs = vc4->hvs;
> > struct vc4_crtc *vc4_crtc;
> > int i;
> >  
> > @@ -160,6 +163,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state 
> > *state)
> > vc4_hvs_mask_underrun(dev, vc4_crtc->channel);
> > }
> >  
> > +   if (vc4->hvs->hvs5)
> > +   clk_set_min_rate(hvs->core_clk, 5);
> > +
> > drm_atomic_helper_wait_for_fences(dev, state, false);
> >  
> > drm_atomic_helper_wait_for_dependencies(state);
> > @@ -182,6 +188,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state 
> > *state)
> >  
> > drm_atomic_helper_commit_cleanup_done(state);
> >  
> > +   if (vc4->hvs->hvs5)
> > +   clk_set_min_rate(hvs->core_clk, 0);
> > +
> > drm_atomic_state_put(state);
> >  
> > up(>async_modeset);
> > 
> 
> This patch doesn't control the enable/disable of core_clk.
> So, I think that it need to handle the clock as following:
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
> index 4ef88c0b51ab..355d67fd8beb 100644
> --- a/drivers/gpu/drm/vc4/vc4_hvs.c
> +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
> @@ -588,6 +588,12 @@ static int vc4_hvs_bind(struct device *dev, struct 
> device *master, void *data)
> dev_err(>dev, "Couldn't get core clock\n");
> return PTR_ERR(hvs->core_clk);
> }
> +
> +   ret = clk_prepare_enable(hvs->core_clk);
> +   if (ret) {
> +   dev_err(>dev, "Couldn't enable core clock\n");
> +   return ret;
> +   }
> }
>  
> if (!hvs->hvs5)
> @@ -681,6 +687,8 @@ static void vc4_hvs_unbind(struct device *dev, struct 
> device *master,
> drm_mm_takedown(>hvs->dlist_mm);
> drm_mm_takedown(>hvs->lbm_mm);
>  
> +   clk_prepare_enable(vc4->hvs->core_clk);
> +
> vc4->hvs = NULL;
>  }

Good catch, thanks!
Maxime


signature.asc
Description: PGP signature


[PATCH 08/19] xsysace: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call ace_revalidate_disk manually.  Given that ace_revalidate_disk only
deals with media change events, the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/xsysace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 5d8e0ab3f054f5..eefe542f2d9fff 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -922,7 +922,8 @@ static int ace_open(struct block_device *bdev, fmode_t mode)
ace->users++;
spin_unlock_irqrestore(>lock, flags);
 
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   ace_revalidate_disk(bdev->bd_disk);
mutex_unlock(_mutex);
 
return 0;
@@ -966,7 +967,6 @@ static const struct block_device_operations ace_fops = {
.open = ace_open,
.release = ace_release,
.check_events = ace_check_events,
-   .revalidate_disk = ace_revalidate_disk,
.getgeo = ace_getgeo,
 };
 
-- 
2.28.0



[PATCH 06/19] swim: simplify media change handling

2020-09-02 Thread Christoph Hellwig
floppy_revalidate mostly duplicates work already done in floppy_open
despite only beeing called from floppy_open.  Remove the function and
just clear the ->ejected flag directly under the right condition.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/swim.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index d4565c555b289f..52dd1efa00f9c5 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -217,8 +217,6 @@ extern int swim_read_sector_header(struct swim __iomem 
*base,
 extern int swim_read_sector_data(struct swim __iomem *base,
 unsigned char *data);
 
-static int floppy_revalidate(struct gendisk *disk);
-
 static DEFINE_MUTEX(swim_mutex);
 static inline void set_swim_mode(struct swim __iomem *base, int enable)
 {
@@ -640,8 +638,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
return 0;
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   if (bdev_check_media_change(bdev))
-   floppy_revalidate(bdev->bd_disk);
+   if (bdev_check_media_change(bdev) && fs->disk_in)
+   fs->ejected = 0;
if ((mode & FMODE_WRITE) && fs->write_protected) {
err = -EROFS;
goto out;
@@ -738,24 +736,6 @@ static unsigned int floppy_check_events(struct gendisk 
*disk,
return fs->ejected ? DISK_EVENT_MEDIA_CHANGE : 0;
 }
 
-static int floppy_revalidate(struct gendisk *disk)
-{
-   struct floppy_state *fs = disk->private_data;
-   struct swim __iomem *base = fs->swd->base;
-
-   swim_drive(base, fs->location);
-
-   if (fs->ejected)
-   setup_medium(fs);
-
-   if (!fs->disk_in)
-   swim_motor(base, OFF);
-   else
-   fs->ejected = 0;
-
-   return !fs->disk_in;
-}
-
 static const struct block_device_operations floppy_fops = {
.owner   = THIS_MODULE,
.open= floppy_unlocked_open,
-- 
2.28.0



[PATCH v1 1/2] media: ov8856: Add support for 1632x1224 mode

2020-09-02 Thread Robert Foss
OV8856 supports 1632x1224 @ 60 FPS, which is added
in this commit.

Signed-off-by: Robert Foss 
---
 drivers/media/i2c/ov8856.c | 215 +
 1 file changed, 215 insertions(+)

diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c
index 4ca27675cc5a..9b99affa90e2 100644
--- a/drivers/media/i2c/ov8856.c
+++ b/drivers/media/i2c/ov8856.c
@@ -528,6 +528,209 @@ static const struct ov8856_reg mode_1640x1232_regs[] = {
{0x5e00, 0x00}
 };
 
+static const struct ov8856_reg mode_1632x1224_regs[] = {
+   {0x0103, 0x01},
+   {0x0302, 0x3c},
+   {0x0303, 0x01},
+   {0x031e, 0x0c},
+   {0x3000, 0x20},
+   {0x3003, 0x08},
+   {0x300e, 0x20},
+   {0x3010, 0x00},
+   {0x3015, 0x84},
+   {0x3018, 0x72},
+   {0x3021, 0x23},
+   {0x3033, 0x24},
+   {0x3500, 0x00},
+   {0x3501, 0x4c},
+   {0x3502, 0xe0},
+   {0x3503, 0x08},
+   {0x3505, 0x83},
+   {0x3508, 0x01},
+   {0x3509, 0x80},
+   {0x350c, 0x00},
+   {0x350d, 0x80},
+   {0x350e, 0x04},
+   {0x350f, 0x00},
+   {0x3510, 0x00},
+   {0x3511, 0x02},
+   {0x3512, 0x00},
+   {0x3600, 0x72},
+   {0x3601, 0x40},
+   {0x3602, 0x30},
+   {0x3610, 0xc5},
+   {0x3611, 0x58},
+   {0x3612, 0x5c},
+   {0x3613, 0xca},
+   {0x3614, 0x60},
+   {0x3628, 0xff},
+   {0x3629, 0xff},
+   {0x362a, 0xff},
+   {0x3633, 0x10},
+   {0x3634, 0x10},
+   {0x3635, 0x10},
+   {0x3636, 0x10},
+   {0x3663, 0x08},
+   {0x3669, 0x34},
+   {0x366d, 0x00},
+   {0x366e, 0x08},
+   {0x3706, 0x86},
+   {0x370b, 0x7e},
+   {0x3714, 0x27},
+   {0x3730, 0x12},
+   {0x3733, 0x10},
+   {0x3764, 0x00},
+   {0x3765, 0x00},
+   {0x3769, 0x62},
+   {0x376a, 0x2a},
+   {0x376b, 0x30},
+   {0x3780, 0x00},
+   {0x3781, 0x24},
+   {0x3782, 0x00},
+   {0x3783, 0x23},
+   {0x3798, 0x2f},
+   {0x37a1, 0x60},
+   {0x37a8, 0x6a},
+   {0x37ab, 0x3f},
+   {0x37c2, 0x14},
+   {0x37c3, 0xf1},
+   {0x37c9, 0x80},
+   {0x37cb, 0x16},
+   {0x37cc, 0x16},
+   {0x37cd, 0x16},
+   {0x37ce, 0x16},
+   {0x3800, 0x00},
+   {0x3801, 0x00},
+   {0x3802, 0x00},
+   {0x3803, 0x0c},
+   {0x3804, 0x0c},
+   {0x3805, 0xdf},
+   {0x3806, 0x09},
+   {0x3807, 0xa3},
+   {0x3808, 0x06},
+   {0x3809, 0x60},
+   {0x380a, 0x04},
+   {0x380b, 0xc8},
+   {0x380c, 0x07},
+   {0x380d, 0x8c},
+   {0x380e, 0x09},
+   {0x380f, 0xb2},
+   {0x3810, 0x00},
+   {0x3811, 0x02},
+   {0x3812, 0x00},
+   {0x3813, 0x02},
+   {0x3814, 0x03},
+   {0x3815, 0x01},
+   {0x3816, 0x00},
+   {0x3817, 0x00},
+   {0x3818, 0x00},
+   {0x3819, 0x10},
+   {0x3820, 0x80},
+   {0x3821, 0x47},
+   {0x382a, 0x03},
+   {0x382b, 0x01},
+   {0x3830, 0x06},
+   {0x3836, 0x02},
+   {0x3862, 0x04},
+   {0x3863, 0x08},
+   {0x3cc0, 0x33},
+   {0x3d85, 0x17},
+   {0x3d8c, 0x73},
+   {0x3d8d, 0xde},
+   {0x4001, 0xe0},
+   {0x4003, 0x40},
+   {0x4008, 0x00},
+   {0x4009, 0x05},
+   {0x400a, 0x00},
+   {0x400b, 0x84},
+   {0x400f, 0x80},
+   {0x4010, 0xf0},
+   {0x4011, 0xff},
+   {0x4012, 0x02},
+   {0x4013, 0x01},
+   {0x4014, 0x01},
+   {0x4015, 0x01},
+   {0x4042, 0x00},
+   {0x4043, 0x80},
+   {0x4044, 0x00},
+   {0x4045, 0x80},
+   {0x4046, 0x00},
+   {0x4047, 0x80},
+   {0x4048, 0x00},
+   {0x4049, 0x80},
+   {0x4041, 0x03},
+   {0x404c, 0x20},
+   {0x404d, 0x00},
+   {0x404e, 0x20},
+   {0x4203, 0x80},
+   {0x4307, 0x30},
+   {0x4317, 0x00},
+   {0x4502, 0x50},
+   {0x4503, 0x08},
+   {0x4601, 0x80},
+   {0x4800, 0x44},
+   {0x4816, 0x53},
+   {0x481b, 0x50},
+   {0x481f, 0x27},
+   {0x4823, 0x3c},
+   {0x482b, 0x00},
+   {0x4831, 0x66},
+   {0x4837, 0x16},
+   {0x483c, 0x0f},
+   {0x484b, 0x05},
+   {0x5000, 0x77},
+   {0x5001, 0x0a},
+   {0x5003, 0xc8},
+   {0x5004, 0x04},
+   {0x5006, 0x00},
+   {0x5007, 0x00},
+   {0x502e, 0x03},
+   {0x5030, 0x41},
+   {0x5795, 0x00},
+   {0x5796, 0x10},
+   {0x5797, 0x10},
+   {0x5798, 0x73},
+   {0x5799, 0x73},
+   {0x579a, 0x00},
+   {0x579b, 0x28},
+   {0x579c, 0x00},
+   {0x579d, 0x16},
+   {0x579e, 0x06},
+   {0x579f, 0x20},
+   {0x57a0, 0x04},
+   {0x57a1, 0xa0},
+   {0x5780, 0x14},
+   {0x5781, 0x0f},
+   {0x5782, 0x44},
+   {0x5783, 0x02},
+   {0x5784, 0x01},
+   {0x5785, 0x01},
+   {0x5786, 0x00},
+   {0x5787, 0x04},
+   {0x5788, 0x02},
+   {0x5789, 0x0f},
+   {0x578a, 0xfd},
+   {0x578b, 0xf5},
+   {0x578c, 0xf5},
+   {0x578d, 0x03},
+   {0x578e, 0x08},
+   

[re-send][PATCH] drm/via: reduce no need mutex_lock area

2020-09-02 Thread Bernard
In function via_mem_alloc`s error branch, DRM_ERROR is protected
in the mutex_lock(>struct_mutex) area.
From the code, we see that DRM_ERROR is just an error log print
without any struct element, there is no need to protect this.

Signed-off-by: Bernard Zhao 
---
 drivers/gpu/drm/via/via_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/via/via_mm.c b/drivers/gpu/drm/via/via_mm.c
index 45cc9e900260..dae1bacd86c1 100644
--- a/drivers/gpu/drm/via/via_mm.c
+++ b/drivers/gpu/drm/via/via_mm.c
@@ -129,9 +129,9 @@ int via_mem_alloc(struct drm_device *dev, void *data,
mutex_lock(>struct_mutex);
if (0 == ((mem->type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized :
  dev_priv->agp_initialized)) {
+   mutex_unlock(>struct_mutex);
DRM_ERROR
("Attempt to allocate from uninitialized memory 
manager.\n");
-   mutex_unlock(>struct_mutex);
return -EINVAL;
}
 
-- 
2.26.2





[PATCH 01/19] block: add a bdev_check_media_change helper

2020-09-02 Thread Christoph Hellwig
Like check_disk_changed, except that it does not call ->revalidate_disk
but leaves that to the caller.

Signed-off-by: Christoph Hellwig 
---
 block/genhd.c | 29 -
 fs/block_dev.c| 17 +++--
 include/linux/genhd.h |  2 +-
 3 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 081f1039d9367f..9d060e79eb31d8 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -2052,7 +2052,7 @@ void disk_flush_events(struct gendisk *disk, unsigned int 
mask)
  * CONTEXT:
  * Might sleep.
  */
-unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
+static unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask)
 {
struct disk_events *ev = disk->ev;
unsigned int pending;
@@ -2090,6 +2090,33 @@ unsigned int disk_clear_events(struct gendisk *disk, 
unsigned int mask)
return pending;
 }
 
+/**
+ * bdev_check_media_change - check if a removable media has been changed
+ * @bdev: block device to check
+ *
+ * Check whether a removable media has been changed, and attempt to free all
+ * dentries and inodes and invalidates all block device page cache entries in
+ * that case.
+ *
+ * Returns %true if the block device changed, or %false if not.
+ */
+bool bdev_check_media_change(struct block_device *bdev)
+{
+   unsigned int events;
+
+   events = disk_clear_events(bdev->bd_disk, DISK_EVENT_MEDIA_CHANGE |
+  DISK_EVENT_EJECT_REQUEST);
+   if (!(events & DISK_EVENT_MEDIA_CHANGE))
+   return false;
+
+   if (__invalidate_device(bdev, true))
+   pr_warn("VFS: busy inodes on changed media %s\n",
+   bdev->bd_disk->disk_name);
+   set_bit(BDEV_NEED_PART_SCAN, >bd_flags);
+   return true;
+}
+EXPORT_SYMBOL(bdev_check_media_change);
+
 /*
  * Separate this part out so that a different pointer for clearing_ptr can be
  * passed in for disk_clear_events.
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9cb205405f9d99..37cb809b217926 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1350,21 +1350,10 @@ EXPORT_SYMBOL(revalidate_disk_size);
  */
 int check_disk_change(struct block_device *bdev)
 {
-   struct gendisk *disk = bdev->bd_disk;
-   const struct block_device_operations *bdops = disk->fops;
-   unsigned int events;
-
-   events = disk_clear_events(disk, DISK_EVENT_MEDIA_CHANGE |
-  DISK_EVENT_EJECT_REQUEST);
-   if (!(events & DISK_EVENT_MEDIA_CHANGE))
+   if (!bdev_check_media_change(bdev))
return 0;
-
-   if (__invalidate_device(bdev, true))
-   pr_warn("VFS: busy inodes on changed media %s\n",
-   disk->disk_name);
-   set_bit(BDEV_NEED_PART_SCAN, >bd_flags);
-   if (bdops->revalidate_disk)
-   bdops->revalidate_disk(bdev->bd_disk);
+   if (bdev->bd_disk->fops->revalidate_disk)
+   bdev->bd_disk->fops->revalidate_disk(bdev->bd_disk);
return 1;
 }
 
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index c618b27292fcc8..322d48a207728a 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -315,7 +315,6 @@ extern void disk_unblock_events(struct gendisk *disk);
 extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
 void set_capacity_revalidate_and_notify(struct gendisk *disk, sector_t size,
bool update_bdev);
-extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
 
 /* drivers/char/random.c */
 extern void add_disk_randomness(struct gendisk *disk) __latent_entropy;
@@ -372,6 +371,7 @@ void unregister_blkdev(unsigned int major, const char 
*name);
 
 void revalidate_disk_size(struct gendisk *disk, bool verbose);
 int check_disk_change(struct block_device *bdev);
+bool bdev_check_media_change(struct block_device *bdev);
 int __invalidate_device(struct block_device *bdev, bool kill_dirty);
 void bd_set_nr_sectors(struct block_device *bdev, sector_t sectors);
 
-- 
2.28.0



[PATCH 12/19] ide-cd: use bdev_check_media_changed

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_changed instead of check_disk_change and
call idecd_revalidate_disk manually.  Given that idecd_revalidate_disk
only re-reads the TOC, and we already do the same at probe time, the
extra call into ->revalidate_disk from bdev_disk_changed is not required
either, so stop wiring up the method.

Signed-off-by: Christoph Hellwig 
---
 drivers/ide/ide-cd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 212bb2d8bf346a..6a38cbc80aea0d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -56,6 +56,7 @@ static DEFINE_MUTEX(ide_cd_mutex);
 static DEFINE_MUTEX(idecd_ref_mutex);
 
 static void ide_cd_release(struct device *);
+static int idecd_revalidate_disk(struct gendisk *disk);
 
 static struct cdrom_info *ide_cd_get(struct gendisk *disk)
 {
@@ -1611,7 +1612,8 @@ static int idecd_open(struct block_device *bdev, fmode_t 
mode)
struct cdrom_info *info;
int rc = -ENXIO;
 
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   idecd_revalidate_disk(bdev->bd_disk);
 
mutex_lock(_cd_mutex);
info = ide_cd_get(bdev->bd_disk);
@@ -1770,7 +1772,6 @@ static const struct block_device_operations idecd_ops = {
.compat_ioctl   = IS_ENABLED(CONFIG_COMPAT) ?
  idecd_compat_ioctl : NULL,
.check_events   = idecd_check_events,
-   .revalidate_disk= idecd_revalidate_disk
 };
 
 /* module options */
-- 
2.28.0



[PATCH] mwifiex: sdio: Fix -Wunused-const-variable warnings

2020-09-02 Thread YueHaibing
These variables only used in sdio.c, move them to .c file
can silence these warnings:

In file included from drivers/net/wireless/marvell/mwifiex//main.h:59:0,
 from drivers/net/wireless/marvell/mwifiex//cfp.c:24:
drivers/net/wireless/marvell/mwifiex//sdio.h:705:41: warning: 
‘mwifiex_sdio_sd8801’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8801 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:689:41: warning: 
‘mwifiex_sdio_sd8987’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8987 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:674:41: warning: 
‘mwifiex_sdio_sd8887’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8887 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:658:41: warning: 
‘mwifiex_sdio_sd8997’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8997 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:642:41: warning: 
‘mwifiex_sdio_sd8977’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8977 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:627:41: warning: 
‘mwifiex_sdio_sd8897’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:612:41: warning: 
‘mwifiex_sdio_sd8797’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:597:41: warning: 
‘mwifiex_sdio_sd8787’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
 ^~~
drivers/net/wireless/marvell/mwifiex//sdio.h:582:41: warning: 
‘mwifiex_sdio_sd8786’ defined but not used [-Wunused-const-variable=]
 static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = {
 ^~~

Signed-off-by: YueHaibing 
---
 drivers/net/wireless/marvell/mwifiex/sdio.c | 427 
 drivers/net/wireless/marvell/mwifiex/sdio.h | 427 
 2 files changed, 427 insertions(+), 427 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c 
b/drivers/net/wireless/marvell/mwifiex/sdio.c
index a042965962a2..69911c728eb1 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -35,6 +35,433 @@ static void mwifiex_sdio_work(struct work_struct *work);
 
 static struct mwifiex_if_ops sdio_ops;
 
+static const struct mwifiex_sdio_card_reg mwifiex_reg_sd87xx = {
+   .start_rd_port = 1,
+   .start_wr_port = 1,
+   .base_0_reg = 0x0040,
+   .base_1_reg = 0x0041,
+   .poll_reg = 0x30,
+   .host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK,
+   .host_int_rsr_reg = 0x1,
+   .host_int_mask_reg = 0x02,
+   .host_int_status_reg = 0x03,
+   .status_reg_0 = 0x60,
+   .status_reg_1 = 0x61,
+   .sdio_int_mask = 0x3f,
+   .data_port_mask = 0xfffe,
+   .io_port_0_reg = 0x78,
+   .io_port_1_reg = 0x79,
+   .io_port_2_reg = 0x7A,
+   .max_mp_regs = 64,
+   .rd_bitmap_l = 0x04,
+   .rd_bitmap_u = 0x05,
+   .wr_bitmap_l = 0x06,
+   .wr_bitmap_u = 0x07,
+   .rd_len_p0_l = 0x08,
+   .rd_len_p0_u = 0x09,
+   .card_misc_cfg_reg = 0x6c,
+   .func1_dump_reg_start = 0x0,
+   .func1_dump_reg_end = 0x9,
+   .func1_scratch_reg = 0x60,
+   .func1_spec_reg_num = 5,
+   .func1_spec_reg_table = {0x28, 0x30, 0x34, 0x38, 0x3c},
+};
+
+static const struct mwifiex_sdio_card_reg mwifiex_reg_sd8897 = {
+   .start_rd_port = 0,
+   .start_wr_port = 0,
+   .base_0_reg = 0x60,
+   .base_1_reg = 0x61,
+   .poll_reg = 0x50,
+   .host_int_enable = UP_LD_HOST_INT_MASK | DN_LD_HOST_INT_MASK |
+   CMD_PORT_UPLD_INT_MASK | CMD_PORT_DNLD_INT_MASK,
+   .host_int_rsr_reg = 0x1,
+   .host_int_status_reg = 0x03,
+   .host_int_mask_reg = 0x02,
+   .status_reg_0 = 0xc0,
+   .status_reg_1 = 0xc1,
+   .sdio_int_mask = 0xff,
+   .data_port_mask = 0x,
+   .io_port_0_reg = 0xD8,
+   .io_port_1_reg = 0xD9,
+   .io_port_2_reg = 0xDA,
+   .max_mp_regs = 184,
+   .rd_bitmap_l = 0x04,
+   .rd_bitmap_u = 0x05,
+   .rd_bitmap_1l = 0x06,

Re: [PATCH 10/10] powerpc: remove address space overrides using set_fs()

2020-09-02 Thread Christophe Leroy




Le 02/09/2020 à 15:51, David Laight a écrit :

From: Christophe Leroy

Sent: 02 September 2020 14:25
Le 02/09/2020 à 15:13, David Laight a écrit :

From: Christoph Hellwig

Sent: 02 September 2020 13:37

On Wed, Sep 02, 2020 at 08:15:12AM +0200, Christophe Leroy wrote:

-   return 0;
-   return (size == 0 || size - 1 <= seg.seg - addr);
+   if (addr >= TASK_SIZE_MAX)
+   return false;
+   if (size == 0)
+   return false;


__access_ok() was returning true when size == 0 up to now. Any reason to
return false now ?


No, this is accidental and broken.  Can you re-run your benchmark with
this fixed?


Is TASK_SIZE_MASK defined such that you can do:

return (addr | size) < TASK_SIZE_MAX) || !size;


TASK_SIZE_MAX will usually be 0xc000

With:
addr = 0x8000;
size = 0x8000;

I expect it to fail 

With the formula you propose it will succeed, won't it ?


Hmmm... Was i getting confused about some comments for 64bit
about there being such a big hole between valid user and kernel
addresses that it was enough to check that 'size < TASK_SIZE_MAX'.

That would be true for 64bit x86 (and probably ppc (& arm??))
if TASK_SIZE_MAX were 0x4 << 60.
IIUC the highest user address is (much) less than 0x0 << 60
and the lowest kernel address (much) greater than 0xf << 60
on all these 64bit platforms.

Actually if doing access_ok() inside get_user() you don't
need to check the size at all.


You mean on 64 bit or on any platform ?

What about a word write to 0xbffe, won't it overwrite 0xc000 ?


You don't even need to in copy_to/from_user() provided
it always does a forwards copy.


Do you mean due to the gap ?
Is it garantied to be a gap ? Even on a 32 bits having TASK_SIZE set to 
0xc000 and PAGE_OFFSET set to the same ?



Christophe


[PATCH 09/19] xsysace: simplify media change handling

2020-09-02 Thread Christoph Hellwig
Pass a struct ace_device to ace_revalidate_disk, move the media changed
check into the one caller that needs it, and give the routine a better
name.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/xsysace.c | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index eefe542f2d9fff..8d581c7536fb51 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -888,26 +888,20 @@ static unsigned int ace_check_events(struct gendisk *gd, 
unsigned int clearing)
return ace->media_change ? DISK_EVENT_MEDIA_CHANGE : 0;
 }
 
-static int ace_revalidate_disk(struct gendisk *gd)
+static void ace_media_changed(struct ace_device *ace)
 {
-   struct ace_device *ace = gd->private_data;
unsigned long flags;
 
-   dev_dbg(ace->dev, "ace_revalidate_disk()\n");
-
-   if (ace->media_change) {
-   dev_dbg(ace->dev, "requesting cf id and scheduling tasklet\n");
+   dev_dbg(ace->dev, "requesting cf id and scheduling tasklet\n");
 
-   spin_lock_irqsave(>lock, flags);
-   ace->id_req_count++;
-   spin_unlock_irqrestore(>lock, flags);
+   spin_lock_irqsave(>lock, flags);
+   ace->id_req_count++;
+   spin_unlock_irqrestore(>lock, flags);
 
-   tasklet_schedule(>fsm_tasklet);
-   wait_for_completion(>id_completion);
-   }
+   tasklet_schedule(>fsm_tasklet);
+   wait_for_completion(>id_completion);
 
dev_dbg(ace->dev, "revalidate complete\n");
-   return ace->id_result;
 }
 
 static int ace_open(struct block_device *bdev, fmode_t mode)
@@ -922,8 +916,8 @@ static int ace_open(struct block_device *bdev, fmode_t mode)
ace->users++;
spin_unlock_irqrestore(>lock, flags);
 
-   if (bdev_check_media_change(bdev))
-   ace_revalidate_disk(bdev->bd_disk);
+   if (bdev_check_media_change(bdev) && ace->media_change)
+   ace_media_changed(ace);
mutex_unlock(_mutex);
 
return 0;
@@ -1080,7 +1074,7 @@ static int ace_setup(struct ace_device *ace)
(unsigned long long) ace->physaddr, ace->baseaddr, ace->irq);
 
ace->media_change = 1;
-   ace_revalidate_disk(ace->gd);
+   ace_media_changed(ace);
 
/* Make the sysace device 'live' */
add_disk(ace->gd);
-- 
2.28.0



[PATCH 03/19] ataflop: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/ataflop.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index a50e13af030526..3e881fdb06e0ad 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1732,7 +1732,8 @@ static int fd_locked_ioctl(struct block_device *bdev, 
fmode_t mode,
/* invalidate the buffer track to force a reread */
BufferDrive = -1;
set_bit(drive, _change);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
default:
return -EINVAL;
@@ -1909,7 +1910,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
return 0;
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (mode & FMODE_WRITE) {
if (p->wpstat) {
if (p->ref < 0)
@@ -1953,7 +1955,6 @@ static const struct block_device_operations floppy_fops = 
{
.release= floppy_release,
.ioctl  = fd_ioctl,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 };
 
 static const struct blk_mq_ops ataflop_mq_ops = {
-- 
2.28.0



[PATCH] trivial: docs: Section number should be "8.2"

2020-09-02 Thread Michael Witten
Signed-off-by: Michael Witten 
---
 Documentation/kbuild/makefiles.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/kbuild/makefiles.rst 
b/Documentation/kbuild/makefiles.rst
index b81b8913a5a3..da6a708164c4 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -1411,7 +1411,7 @@ When kbuild executes, the following steps are followed 
(roughly):
that may be shared between individual architectures.
The recommended approach how to use a generic header file is
to list the file in the Kbuild file.
-   See "7.2 generic-y" for further info on syntax etc.
+   See "8.2 generic-y" for further info on syntax etc.
 
 7.11 Post-link pass
 ---
-- 
2.22.0



Re: [PATCH V2] kvm x86/mmu: use KVM_REQ_MMU_SYNC to sync when needed

2020-09-02 Thread Vitaly Kuznetsov
Lai Jiangshan  writes:

> From: Lai Jiangshan 
>
> When kvm_mmu_get_page() gets a page with unsynced children, the spt
> pagetable is unsynchronized with the guest pagetable. But the
> guest might not issue a "flush" operation on it when the pagetable
> entry is changed from zero or other cases. The hypervisor has the 
> responsibility to synchronize the pagetables.
>
> The linux kernel behaves as above for many years, But
> 8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific 
> flushes)

Nit: checkpatch.pl complains here with 

ERROR: Please use git commit description style 'commit <12+ chars of
sha1> ("")' - ie: 'commit 8c8560b83390 ("KVM: x86/mmu: Use
KVM_REQ_TLB_FLUSH_CURRENT for MMU specific flushes")'
#118: 
8c8560b83390("KVM: x86/mmu: Use KVM_REQ_TLB_FLUSH_CURRENT for MMU specific 
flushes)

> inadvertently included a line of code to change it without giving any
> reason in the changelog. It is clear that the commit's intention was to
> change KVM_REQ_TLB_FLUSH -> KVM_REQ_TLB_FLUSH_CURRENT, so we don't
> unneedlesly flush other contexts but one of the hunks changed
> nearby KVM_REQ_MMU_SYNC instead.
>
> The this patch changes it back.
>
> Link: 
> https://lore.kernel.org/lkml/20200320212833.3507-26-sean.j.christopher...@intel.com/
> Cc: Sean Christopherson 
> Cc: Vitaly Kuznetsov 
> Signed-off-by: Lai Jiangshan 
> ---
> Changed from v1:
>   update patch description
>
>  arch/x86/kvm/mmu/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 4e03841f053d..9a93de921f2b 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -2468,7 +2468,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct 
> kvm_vcpu *vcpu,
>   }
>  
>   if (sp->unsync_children)
> - kvm_make_request(KVM_REQ_TLB_FLUSH_CURRENT, vcpu);
> + kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
>  
>   __clear_sp_write_flooding_count(sp);

FWIW, 

Reviewed-by: Vitaly Kuznetsov 

but it'd be great to hear from Sean).

-- 
Vitaly



Re: [PATCH 0/3] drm/msm: More GPU tracepoints

2020-09-02 Thread Rob Clark
The cat is somewhat out of the bag already.. so I took the approach of
making the more useful of the traces for visualization (freq_change
trace) identical to the i915 one in units and format, so userspace
just has to add another event name to a list, and not have to add more
parsing code.

But the bigger problem is that it doesn't seem possible to #include
multiple foo_trace.h's in a single C file, so I'm not seeing how it is
possible to have both generic and driver specific traces.

BR,
-R

On Tue, Sep 1, 2020 at 11:52 PM Tomeu Vizoso  wrote:
>
> Hi Rob,
>
> Do you think we could make all these generic? Visualization tools will need 
> to do some processing so these can be neatly presented and it could be far 
> more convenient if people wouldn't need to add code for each GPU driver.
>
> Maybe we could put all these tracepoints in DRM core as they seem useful to 
> all drivers?
>
> Thanks,
>
> Tomeu
>
> On Tue, 1 Sep 2020 at 17:41, Rob Clark  wrote:
>>
>> From: Rob Clark 
>>
>> Various extra tracepoints that I've been collecting.
>>
>> Rob Clark (3):
>>   drm/msm/gpu: Add GPU freq_change traces
>>   drm/msm: Convert shrinker msgs to tracepoints
>>   drm/msm/gpu: Add suspend/resume tracepoints
>>
>>  drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |  3 +
>>  drivers/gpu/drm/msm/adreno/a6xx_gpu.c  |  4 ++
>>  drivers/gpu/drm/msm/msm_gem_shrinker.c |  5 +-
>>  drivers/gpu/drm/msm/msm_gpu.c  |  4 ++
>>  drivers/gpu/drm/msm/msm_gpu_trace.h| 83 ++
>>  5 files changed, 97 insertions(+), 2 deletions(-)
>>
>> --
>> 2.26.2
>>
>> ___
>> dri-devel mailing list
>> dri-de...@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/2] phy: marvell: comphy: Convert internal SMCC firmware return codes to errno

2020-09-02 Thread Pali Rohár
Driver ->power_on and ->power_off callbacks leaks internal SMCC firmware
return codes to phy caller. This patch converts SMCC error codes to
standard linux errno codes. Include file linux/arm-smccc.h already provides
defines for SMCC error codes, so use them instead of custom driver defines.
Note that return value is signed 32bit, but stored in unsigned long type
with zero padding.

Signed-off-by: Pali Rohár 
---
 drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 14 +++---
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 +++---
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c 
b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
index 1a138be8bd6a..810f25a47632 100644
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -26,7 +26,6 @@
 #define COMPHY_SIP_POWER_ON0x8201
 #define COMPHY_SIP_POWER_OFF   0x8202
 #define COMPHY_SIP_PLL_LOCK0x8203
-#define COMPHY_FW_NOT_SUPPORTED(-1)
 
 #define COMPHY_FW_MODE_SATA0x1
 #define COMPHY_FW_MODE_SGMII   0x2
@@ -112,10 +111,19 @@ static int mvebu_a3700_comphy_smc(unsigned long function, 
unsigned long lane,
  unsigned long mode)
 {
struct arm_smccc_res res;
+   s32 ret;
 
arm_smccc_smc(function, lane, mode, 0, 0, 0, 0, 0, );
+   ret = res.a0;
 
-   return res.a0;
+   switch (ret) {
+   case SMCCC_RET_SUCCESS:
+   return 0;
+   case SMCCC_RET_NOT_SUPPORTED:
+   return -EOPNOTSUPP;
+   default:
+   return -EINVAL;
+   }
 }
 
 static int mvebu_a3700_comphy_get_fw_mode(int lane, int port,
@@ -220,7 +228,7 @@ static int mvebu_a3700_comphy_power_on(struct phy *phy)
}
 
ret = mvebu_a3700_comphy_smc(COMPHY_SIP_POWER_ON, lane->id, fw_param);
-   if (ret == COMPHY_FW_NOT_SUPPORTED)
+   if (ret == -EOPNOTSUPP)
dev_err(lane->dev,
"unsupported SMC call, try updating your firmware\n");
 
diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c 
b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
index e41367f36ee1..53ad127b100f 100644
--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
@@ -123,7 +123,6 @@
 
 #define COMPHY_SIP_POWER_ON0x8201
 #define COMPHY_SIP_POWER_OFF   0x8202
-#define COMPHY_FW_NOT_SUPPORTED(-1)
 
 /*
  * A lane is described by the following bitfields:
@@ -273,10 +272,19 @@ static int mvebu_comphy_smc(unsigned long function, 
unsigned long phys,
unsigned long lane, unsigned long mode)
 {
struct arm_smccc_res res;
+   s32 ret;
 
arm_smccc_smc(function, phys, lane, mode, 0, 0, 0, 0, );
+   ret = res.a0;
 
-   return res.a0;
+   switch (ret) {
+   case SMCCC_RET_SUCCESS:
+   return 0;
+   case SMCCC_RET_NOT_SUPPORTED:
+   return -EOPNOTSUPP;
+   default:
+   return -EINVAL;
+   }
 }
 
 static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port,
@@ -819,7 +827,7 @@ static int mvebu_comphy_power_on(struct phy *phy)
if (!ret)
return ret;
 
-   if (ret == COMPHY_FW_NOT_SUPPORTED)
+   if (ret == -EOPNOTSUPP)
dev_err(priv->dev,
"unsupported SMC call, try updating your firmware\n");
 
-- 
2.20.1



[PATCH 2/2] PCI: aardvark: Fix initialization with old Marvell's Arm Trusted Firmware

2020-09-02 Thread Pali Rohár
Old ATF automatically power on pcie phy and does not provide SMC call for
phy power on functionality which leads to aardvark initialization failure:

[0.330134] mvebu-a3700-comphy d0018300.phy: unsupported SMC call, try 
updating your firmware
[0.338846] phy phy-d0018300.phy.1: phy poweron failed --> -95
[0.344753] advk-pcie d007.pcie: Failed to initialize PHY (-95)
[0.351160] advk-pcie: probe of d007.pcie failed with error -95

This patch fixes above failure by ignoring 'not supported' error in
aardvark driver. In this case it is expected that phy is already power on.

Signed-off-by: Pali Rohár 
Fixes: 366697018c9a ("PCI: aardvark: Add PHY support")
---
 drivers/pci/controller/pci-aardvark.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pci-aardvark.c 
b/drivers/pci/controller/pci-aardvark.c
index c5d1bb3d52e4..e1a80c35c73d 100644
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1108,7 +1108,9 @@ static int advk_pcie_enable_phy(struct advk_pcie *pcie)
}
 
ret = phy_power_on(pcie->phy);
-   if (ret) {
+   if (ret == -EOPNOTSUPP) {
+   dev_warn(>pdev->dev, "PHY unsupported by firmware\n");
+   } else if (ret) {
phy_exit(pcie->phy);
return ret;
}
-- 
2.20.1



[PATCH 0/2] PCI: aardvark: Fix comphy with old ATF

2020-09-02 Thread Pali Rohár
This patch series fixes regression introduced in commit 366697018c9a
("PCI: aardvark: Add PHY support") which caused aardvark driver
initialization failure on EspressoBin board with factory version of
Arm Trusted Firmware provided by Marvell.

Second patch depends on the first patch, so please add appropriate
Fixes/Cc:stable@ tags to have both patches correctly backported to
stable kernels.

I have tested both patches with Marvell ATF firmware ebin-17.10-uart.zip
and with upstream ATF+uboot and aardvark was initialized successfully.
Without this patch series on ebin-17.10-uart.zip aardvark initialization
failed.

Pali Rohár (2):
  phy: marvell: comphy: Convert internal SMCC firmware return codes to
errno
  PCI: aardvark: Fix initialization with old Marvell's Arm Trusted
Firmware

 drivers/pci/controller/pci-aardvark.c|  4 +++-
 drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 14 +++---
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 +++---
 3 files changed, 25 insertions(+), 7 deletions(-)

-- 
2.20.1



[PATCH 14/19] ide-gd: stop using the disk events mechanism

2020-09-02 Thread Christoph Hellwig
ide-gd is only using the disk events mechanism to be able to force an
invalidation and partition scan on opening removable media.  Just open
code the logic without invoving the block layer.

Signed-off-by: Christoph Hellwig 
---
 drivers/ide/ide-disk.c   |  5 +
 drivers/ide/ide-floppy.c |  2 --
 drivers/ide/ide-gd.c | 48 +---
 include/linux/ide.h  |  2 --
 4 files changed, 7 insertions(+), 50 deletions(-)

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 1d3407d7e095fa..34b9441084f84f 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -739,12 +739,9 @@ static void ide_disk_setup(ide_drive_t *drive)
set_wcache(drive, 1);
 
if ((drive->dev_flags & IDE_DFLAG_LBA) == 0 &&
-   (drive->head == 0 || drive->head > 16)) {
+   (drive->head == 0 || drive->head > 16))
printk(KERN_ERR "%s: invalid geometry: %d physical heads?\n",
drive->name, drive->head);
-   drive->dev_flags &= ~IDE_DFLAG_ATTACH;
-   } else
-   drive->dev_flags |= IDE_DFLAG_ATTACH;
 }
 
 static void ide_disk_flush(ide_drive_t *drive)
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index af7503b47dbe32..f5a2870aaf54bb 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -516,8 +516,6 @@ static void ide_floppy_setup(ide_drive_t *drive)
(void) ide_floppy_get_capacity(drive);
 
ide_proc_register_driver(drive, floppy->driver);
-
-   drive->dev_flags |= IDE_DFLAG_ATTACH;
 }
 
 static void ide_floppy_flush(ide_drive_t *drive)
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 05c26986637ba3..661e2aa9c96784 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -225,8 +225,12 @@ static int ide_gd_open(struct block_device *bdev, fmode_t 
mode)
 * and the door_lock is irrelevant at this point.
 */
drive->disk_ops->set_doorlock(drive, disk, 1);
-   drive->dev_flags |= IDE_DFLAG_MEDIA_CHANGED;
-   check_disk_change(bdev);
+   if (__invalidate_device(bdev, true))
+   pr_warn("VFS: busy inodes on changed media %s\n",
+   bdev->bd_disk->disk_name);
+   drive->disk_ops->get_capacity(drive);
+   set_capacity(disk, ide_gd_capacity(drive));
+   set_bit(BDEV_NEED_PART_SCAN, >bd_flags);
} else if (drive->dev_flags & IDE_DFLAG_FORMAT_IN_PROGRESS) {
ret = -EBUSY;
goto out_put_idkp;
@@ -284,32 +288,6 @@ static int ide_gd_getgeo(struct block_device *bdev, struct 
hd_geometry *geo)
return 0;
 }
 
-static unsigned int ide_gd_check_events(struct gendisk *disk,
-   unsigned int clearing)
-{
-   struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
-   ide_drive_t *drive = idkp->drive;
-   bool ret;
-
-   /* do not scan partitions twice if this is a removable device */
-   if (drive->dev_flags & IDE_DFLAG_ATTACH) {
-   drive->dev_flags &= ~IDE_DFLAG_ATTACH;
-   return 0;
-   }
-
-   /*
-* The following is used to force revalidation on the first open on
-* removeable devices, and never gets reported to userland as
-* DISK_EVENT_FLAG_UEVENT isn't set in genhd->event_flags.
-* This is intended as removable ide disk can't really detect
-* MEDIA_CHANGE events.
-*/
-   ret = drive->dev_flags & IDE_DFLAG_MEDIA_CHANGED;
-   drive->dev_flags &= ~IDE_DFLAG_MEDIA_CHANGED;
-
-   return ret ? DISK_EVENT_MEDIA_CHANGE : 0;
-}
-
 static void ide_gd_unlock_native_capacity(struct gendisk *disk)
 {
struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
@@ -320,18 +298,6 @@ static void ide_gd_unlock_native_capacity(struct gendisk 
*disk)
disk_ops->unlock_native_capacity(drive);
 }
 
-static int ide_gd_revalidate_disk(struct gendisk *disk)
-{
-   struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
-   ide_drive_t *drive = idkp->drive;
-
-   if (ide_gd_check_events(disk, 0))
-   drive->disk_ops->get_capacity(drive);
-
-   set_capacity(disk, ide_gd_capacity(drive));
-   return 0;
-}
-
 static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode,
 unsigned int cmd, unsigned long arg)
 {
@@ -364,9 +330,7 @@ static const struct block_device_operations ide_gd_ops = {
.compat_ioctl   = ide_gd_compat_ioctl,
 #endif
.getgeo = ide_gd_getgeo,
-   .check_events   = ide_gd_check_events,
.unlock_native_capacity = ide_gd_unlock_native_capacity,
-   .revalidate_disk= ide_gd_revalidate_disk
 };
 
 static int ide_gd_probe(ide_drive_t *drive)
diff --git a/include/linux/ide.h b/include/linux/ide.h
index a254841bd3156d..62653769509f89 

Re: [PATCH v21 4/4] arm64: dts: mt8183: add scp node

2020-09-02 Thread Naresh Kamboju
On Thu, 27 Aug 2020 at 15:44, Matthias Brugger  wrote:
>
>
>
> On 12/11/2019 12:03, Pi-Hsun Shih wrote:
> > From: Eddie Huang 
> >
> > Add scp node to mt8183 and mt8183-evb
> >
> > Signed-off-by: Erin Lo 
> > Signed-off-by: Pi-Hsun Shih 
> > Signed-off-by: Eddie Huang 
>
> Sorry I somehow oversaw this. Next time please don't doubt to ping me.
>
> Bjorn, do I understand correctly that you don't send emails to the list
> informing of the inclusion of a patch/series in your tree?
>
> Anyway applied now to v5.9-next/dts64 :)

arm64 build dtbs failed on linux next 20200902.

mt8183.dtsi:342.21-352.5: ERROR (phandle_references):
/soc/scp@1050: Reference to non-existent node or label
"scp_mem_reserved"

build log,

make -sk KBUILD_BUILD_USER=TuxBuild -C/linux ARCH=arm64
CROSS_COMPILE=aarch64-linux-gnu- HOSTCC=gcc CC="sccache
aarch64-linux-gnu-gcc" O=build dtbs
#
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #address-cells (1) differs from / (2)
../arch/arm64/boot/dts/broadcom/stingray/stingray-usb.dtsi:7.3-14:
Warning (dma_ranges_format): /usb:dma-ranges: empty "dma-ranges"
property but its #size-cells (1) differs from / (2)
../arch/arm64/boot/dts/mediatek/mt8183.dtsi:342.21-352.5: ERROR
(phandle_references): /soc/scp@1050: Reference to non-existent
node or label "scp_mem_reserved"


>
> Thanks!
>
> > ---
> > Changes from v20 ... v14:
> >   - No change.
> >
> > Changes from v13:
> >   - Change the size of the cfg register region.
> >
> > Changes from v12 ... v10:
> >   - No change.
> >
> > Changes from v9:
> >   - Remove extra reserve-memory-vpu_share node.
> >
> > Changes from v8:
> >   - New patch.
> > ---
> >   arch/arm64/boot/dts/mediatek/mt8183-evb.dts | 11 +++
> >   arch/arm64/boot/dts/mediatek/mt8183.dtsi| 12 
> >   2 files changed, 23 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts 
> > b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts
> > index 1fb195c683c3..ddb7a7ac9655 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8183-evb.dts
> > +++ b/arch/arm64/boot/dts/mediatek/mt8183-evb.dts
> > @@ -24,6 +24,17 @@ memory@4000 {
> >   chosen {
> >   stdout-path = "serial0:921600n8";
> >   };
> > +
> > + reserved-memory {
> > + #address-cells = <2>;
> > + #size-cells = <2>;
> > + ranges;
> > + scp_mem_reserved: scp_mem_region {
> > + compatible = "shared-dma-pool";
> > + reg = <0 0x5000 0 0x290>;
> > + no-map;
> > + };
> > + };
> >   };
> >
> >{
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi 
> > b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> > index 10b32471bc7b..e582f5e6691d 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> > +++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
> > @@ -269,6 +269,18 @@ pwrap: pwrap@1000d000 {
> >   clock-names = "spi", "wrap";
> >   };
> >
> > + scp: scp@1050 {
> > + compatible = "mediatek,mt8183-scp";
> > + reg = <0 0x1050 0 0x8>,
> > +   <0 0x105c 0 0x19080>;
> > + reg-names = "sram", "cfg";
> > + interrupts = ;
> > + clocks = < CLK_INFRA_SCPSYS>;
> > + clock-names = "main";
> > + memory-region = <_mem_reserved>;
> > + status = "disabled";
> > + };
> > +
> >   systimer: timer@10017000 {
> >   compatible = "mediatek,mt8183-timer",
> >"mediatek,mt6765-timer";
> >

full build log,
https://builds.tuxbuild.com/_IfeLhOWMWxIkRkmAtAwOQ/build.log


-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH 7/9] sound: line6: convert to use new usb control function...

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:10 +0200,
Greg Kroah-Hartman wrote:
> 
> Signed-off-by: Greg Kroah-Hartman 

I guess this and a few others with (x/9) are stale patches, right?


thanks,

Takashi


> ---
>  sound/usb/line6/driver.c   | 69 +++---
>  sound/usb/line6/podhd.c| 17 --
>  sound/usb/line6/toneport.c |  8 ++---
>  3 files changed, 37 insertions(+), 57 deletions(-)
> 
> diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
> index 60674ce4879b..601292c51491 100644
> --- a/sound/usb/line6/driver.c
> +++ b/sound/usb/line6/driver.c
> @@ -337,23 +337,18 @@ int line6_read_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>  {
>   struct usb_device *usbdev = line6->usbdev;
>   int ret;
> - unsigned char *len;
> + u8 len;
>   unsigned count;
>  
>   if (address > 0x || datalen > 0xff)
>   return -EINVAL;
>  
> - len = kmalloc(1, GFP_KERNEL);
> - if (!len)
> - return -ENOMEM;
> -
>   /* query the serial number: */
> - ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> -   (datalen << 8) | 0x21, address,
> -   NULL, 0, LINE6_TIMEOUT * HZ);
> -
> - if (ret < 0) {
> + ret = usb_control_msg_send(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_OUT,
> +(datalen << 8) | 0x21, address, NULL, 0,
> +LINE6_TIMEOUT * HZ);
> + if (ret) {
>   dev_err(line6->ifcdev, "read request failed (error %d)\n", ret);
>   goto exit;
>   }
> @@ -362,45 +357,41 @@ int line6_read_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>   for (count = 0; count < LINE6_READ_WRITE_MAX_RETRIES; count++) {
>   mdelay(LINE6_READ_WRITE_STATUS_DELAY);
>  
> - ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE |
> -   USB_DIR_IN,
> -   0x0012, 0x, len, 1,
> -   LINE6_TIMEOUT * HZ);
> - if (ret < 0) {
> + ret = usb_control_msg_recv(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_IN,
> +0x0012, 0x, , 1,
> +LINE6_TIMEOUT * HZ);
> + if (ret) {
>   dev_err(line6->ifcdev,
>   "receive length failed (error %d)\n", ret);
>   goto exit;
>   }
>  
> - if (*len != 0xff)
> + if (len != 0xff)
>   break;
>   }
>  
>   ret = -EIO;
> - if (*len == 0xff) {
> + if (len == 0xff) {
>   dev_err(line6->ifcdev, "read failed after %d retries\n",
>   count);
>   goto exit;
> - } else if (*len != datalen) {
> + } else if (len != datalen) {
>   /* should be equal or something went wrong */
>   dev_err(line6->ifcdev,
>   "length mismatch (expected %d, got %d)\n",
> - (int)datalen, (int)*len);
> + (int)datalen, len);
>   goto exit;
>   }
>  
>   /* receive the result: */
> - ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
> -   0x0013, 0x, data, datalen,
> -   LINE6_TIMEOUT * HZ);
> -
> - if (ret < 0)
> + ret = usb_control_msg_recv(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_IN,
> +0x0013, 0x, data, datalen, LINE6_TIMEOUT 
> * HZ);
> + if (ret)
>   dev_err(line6->ifcdev, "read failed (error %d)\n", ret);
>  
>  exit:
> - kfree(len);
>   return ret;
>  }
>  EXPORT_SYMBOL_GPL(line6_read_data);
> @@ -423,12 +414,10 @@ int line6_write_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>   if (!status)
>   return -ENOMEM;
>  
> - ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> -   0x0022, address, data, datalen,
> -   LINE6_TIMEOUT * HZ);
> -
> - if (ret < 0) {
> + ret = usb_control_msg_send(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_OUT,
> +0x0022, address, data, datalen, 
> LINE6_TIMEOUT * HZ);
> + if (ret) {
>   

rework check_disk_change()

2020-09-02 Thread Christoph Hellwig
Hi Jens,

this series replaced the not very nice check_disk_change() function with
a new bdev_media_changed that avoids having the ->revalidate_disk call
at its end.  As a result ->revalidate_disk can be removed from a lot of
drivers.

Diffstat:
 block/genhd.c  |   29 ++-
 drivers/block/amiflop.c|2 -
 drivers/block/ataflop.c|7 +++---
 drivers/block/floppy.c |8 ---
 drivers/block/paride/pcd.c |2 -
 drivers/block/swim.c   |   22 +---
 drivers/block/swim3.c  |4 +--
 drivers/block/xsysace.c|   26 +---
 drivers/cdrom/gdrom.c  |2 -
 drivers/ide/ide-cd.c   |   16 ---
 drivers/ide/ide-disk.c |5 
 drivers/ide/ide-floppy.c   |2 -
 drivers/ide/ide-gd.c   |   48 +
 drivers/md/md.c|2 -
 drivers/scsi/sd.c  |7 +++---
 drivers/scsi/sr.c  |   36 +
 fs/block_dev.c |   31 -
 include/linux/genhd.h  |3 --
 include/linux/ide.h|2 -
 19 files changed, 86 insertions(+), 168 deletions(-)


[PATCH 05/19] swim: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/swim.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index dd34504382e533..d4565c555b289f 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -217,6 +217,8 @@ extern int swim_read_sector_header(struct swim __iomem 
*base,
 extern int swim_read_sector_data(struct swim __iomem *base,
 unsigned char *data);
 
+static int floppy_revalidate(struct gendisk *disk);
+
 static DEFINE_MUTEX(swim_mutex);
 static inline void set_swim_mode(struct swim __iomem *base, int enable)
 {
@@ -638,7 +640,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
return 0;
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if ((mode & FMODE_WRITE) && fs->write_protected) {
err = -EROFS;
goto out;
@@ -760,7 +763,6 @@ static const struct block_device_operations floppy_fops = {
.ioctl   = floppy_ioctl,
.getgeo  = floppy_getgeo,
.check_events= floppy_check_events,
-   .revalidate_disk = floppy_revalidate,
 };
 
 static struct kobject *floppy_find(dev_t dev, int *part, void *data)
-- 
2.28.0



Re: [PATCH 09/10] sound: hiface: move to use usb_control_msg_send()

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:14 +0200,
Greg Kroah-Hartman wrote:
> 
> The usb_control_msg_send() call can return an error if a "short" write
> happens, so move the driver over to using that call instead.
> 
> Cc: Jaroslav Kysela 
> Cc: Takashi Iwai 
> Cc: alsa-de...@alsa-project.org
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Takashi Iwai 


thanks,

Takashi

> ---
>  sound/usb/hiface/pcm.c | 14 ++
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/usb/hiface/pcm.c b/sound/usb/hiface/pcm.c
> index a148caa5f48e..f9c924e3964e 100644
> --- a/sound/usb/hiface/pcm.c
> +++ b/sound/usb/hiface/pcm.c
> @@ -156,16 +156,14 @@ static int hiface_pcm_set_rate(struct pcm_runtime *rt, 
> unsigned int rate)
>* This control message doesn't have any ack from the
>* other side
>*/
> - ret = usb_control_msg(device, usb_sndctrlpipe(device, 0),
> -   HIFACE_SET_RATE_REQUEST,
> -   USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
> -   rate_value, 0, NULL, 0, 100);
> - if (ret < 0) {
> + ret = usb_control_msg_send(device, 0,
> +HIFACE_SET_RATE_REQUEST,
> +USB_DIR_OUT | USB_TYPE_VENDOR | 
> USB_RECIP_OTHER,
> +rate_value, 0, NULL, 0, 100);
> + if (ret)
>   dev_err(>dev, "Error setting samplerate %d.\n", rate);
> - return ret;
> - }
>  
> - return 0;
> + return ret;
>  }
>  
>  static struct pcm_substream *hiface_pcm_get_substream(struct 
> snd_pcm_substream
> -- 
> 2.28.0
> 


Re: [PATCH 08/10] sound: line6: move to use usb_control_msg_send() and usb_control_msg_recv()

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:12 +0200,
Greg Kroah-Hartman wrote:
> 
> The usb_control_msg_send() and usb_control_msg_recv() calls can return
> an error if a "short" write/read happens, and they can handle data off
> of the stack, so move the driver over to using those calls instead,
> saving some logic when dynamically allocating memory.
> 
> Cc: Jaroslav Kysela 
> Cc: Takashi Iwai 
> Cc: Vasily Khoruzhick 
> Cc: alsa-de...@alsa-project.org
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Takashi Iwai 


thanks,

Takashi


> ---
>  sound/usb/line6/driver.c   | 69 +++---
>  sound/usb/line6/podhd.c| 17 --
>  sound/usb/line6/toneport.c |  8 ++---
>  3 files changed, 37 insertions(+), 57 deletions(-)
> 
> diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
> index 60674ce4879b..601292c51491 100644
> --- a/sound/usb/line6/driver.c
> +++ b/sound/usb/line6/driver.c
> @@ -337,23 +337,18 @@ int line6_read_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>  {
>   struct usb_device *usbdev = line6->usbdev;
>   int ret;
> - unsigned char *len;
> + u8 len;
>   unsigned count;
>  
>   if (address > 0x || datalen > 0xff)
>   return -EINVAL;
>  
> - len = kmalloc(1, GFP_KERNEL);
> - if (!len)
> - return -ENOMEM;
> -
>   /* query the serial number: */
> - ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> -   (datalen << 8) | 0x21, address,
> -   NULL, 0, LINE6_TIMEOUT * HZ);
> -
> - if (ret < 0) {
> + ret = usb_control_msg_send(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_OUT,
> +(datalen << 8) | 0x21, address, NULL, 0,
> +LINE6_TIMEOUT * HZ);
> + if (ret) {
>   dev_err(line6->ifcdev, "read request failed (error %d)\n", ret);
>   goto exit;
>   }
> @@ -362,45 +357,41 @@ int line6_read_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>   for (count = 0; count < LINE6_READ_WRITE_MAX_RETRIES; count++) {
>   mdelay(LINE6_READ_WRITE_STATUS_DELAY);
>  
> - ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE |
> -   USB_DIR_IN,
> -   0x0012, 0x, len, 1,
> -   LINE6_TIMEOUT * HZ);
> - if (ret < 0) {
> + ret = usb_control_msg_recv(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_IN,
> +0x0012, 0x, , 1,
> +LINE6_TIMEOUT * HZ);
> + if (ret) {
>   dev_err(line6->ifcdev,
>   "receive length failed (error %d)\n", ret);
>   goto exit;
>   }
>  
> - if (*len != 0xff)
> + if (len != 0xff)
>   break;
>   }
>  
>   ret = -EIO;
> - if (*len == 0xff) {
> + if (len == 0xff) {
>   dev_err(line6->ifcdev, "read failed after %d retries\n",
>   count);
>   goto exit;
> - } else if (*len != datalen) {
> + } else if (len != datalen) {
>   /* should be equal or something went wrong */
>   dev_err(line6->ifcdev,
>   "length mismatch (expected %d, got %d)\n",
> - (int)datalen, (int)*len);
> + (int)datalen, len);
>   goto exit;
>   }
>  
>   /* receive the result: */
> - ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
> -   0x0013, 0x, data, datalen,
> -   LINE6_TIMEOUT * HZ);
> -
> - if (ret < 0)
> + ret = usb_control_msg_recv(usbdev, 0, 0x67,
> +USB_TYPE_VENDOR | USB_RECIP_DEVICE | 
> USB_DIR_IN,
> +0x0013, 0x, data, datalen, LINE6_TIMEOUT 
> * HZ);
> + if (ret)
>   dev_err(line6->ifcdev, "read failed (error %d)\n", ret);
>  
>  exit:
> - kfree(len);
>   return ret;
>  }
>  EXPORT_SYMBOL_GPL(line6_read_data);
> @@ -423,12 +414,10 @@ int line6_write_data(struct usb_line6 *line6, unsigned 
> address, void *data,
>   if (!status)
>   return -ENOMEM;
>  
> - ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67,
> -   USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
> -   0x0022, address, data, datalen,
> -   

Re: [PATCH] rt2x00: Use fallthrough pseudo-keyword macro

2020-09-02 Thread Leesoo Ahn

20. 9. 2. 오후 11:20에 Gustavo A. R. Silva 이(가) 쓴 글:



On 9/2/20 08:05, Leesoo Ahn wrote:

Replace all '/* fall through */' comments with the macro[1].

[1]: 
https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through



This looks familiar...

https://lore.kernel.org/lkml/20200821062052.GA8618@embeddedor/

Thanks
--
Gustavo



I didn't notice the patch. Please, ignore this.

Thanks

Leesoo


Re: [PATCH v3 6/9] drm/bridge: ti-sn65dsi86: Use 18-bit DP if we can

2020-09-02 Thread Doug Anderson
Hi,

On Tue, Jul 14, 2020 at 8:31 AM Doug Anderson  wrote:
>
> > Hopefully BOE gets back to you soon, and there's no rush, I'm just an
> > end user who is extremely appreciative of all the work everyone on the
> > list and the kernel in general put in to make my machines usable.
>
> Just FYI that I got confirmation that the panel is truly 6 bpp but it
> will do FRC dithering if given an 8 bpp input.  That means that you
> should be getting just as good picture quality (and possibly more
> tunable) by using the dithering in the display pipeline and leaving
> the panel as 6bpp.  Thus I'm going to assume that's the route we'll go
> down.  If ever we find someone that wants to use this panel on a
> display controller that can't do its own dithering then I guess we'll
> have to figure out what to do then...
>
> In terms of the more optimal pixel clock for saving power, my proposal
> is still being analyzed and I'll report back when I hear more.  I'm
> seeing if BOE can confirm that my proposal will work both for my panel
> (the -n62 variant) and the one you have (the -n61 variant).

To close the loop here: we finally got back an official word that we
shouldn't use my proposed timings that would have allowed us to move
down to a 1.62 GHz pixel clock.  Though they work most of the time,
there are apparently some corner cases where they cause problems /
flickering.  :(  While you could certainly use the timings on your own
system if they happen to work for you, I don't think it'd be a good
idea to switch the default over to them or anything.  I'm told that
hardware makers will take this type of thing into consideration for
future hardware.

-Doug


Re: [PATCH 06/10] sound: usx2y: move to use usb_control_msg_send()

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:08 +0200,
Greg Kroah-Hartman wrote:
> 
> The usb_control_msg_send() call can handle data on the stack, as well as
> returning an error if a "short" write happens, so move the driver over
> to using that call instead.  This ends up removing a helper function
> that is no longer needed.
> 
> Cc: Jaroslav Kysela 
> Cc: Takashi Iwai 
> Cc: alsa-de...@alsa-project.org
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Takashi Iwai 


thanks,

Takashi

> ---
>  sound/usb/usx2y/us122l.c | 42 
>  1 file changed, 8 insertions(+), 34 deletions(-)
> 
> diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
> index f86f7a61fb36..e5c5a0d03d8a 100644
> --- a/sound/usb/usx2y/us122l.c
> +++ b/sound/usb/usx2y/us122l.c
> @@ -82,40 +82,13 @@ static int us144_create_usbmidi(struct snd_card *card)
> (card)->midi_list, );
>  }
>  
> -/*
> - * Wrapper for usb_control_msg().
> - * Allocates a temp buffer to prevent dmaing from/to the stack.
> - */
> -static int us122l_ctl_msg(struct usb_device *dev, unsigned int pipe,
> -   __u8 request, __u8 requesttype,
> -   __u16 value, __u16 index, void *data,
> -   __u16 size, int timeout)
> -{
> - int err;
> - void *buf = NULL;
> -
> - if (size > 0) {
> - buf = kmemdup(data, size, GFP_KERNEL);
> - if (!buf)
> - return -ENOMEM;
> - }
> - err = usb_control_msg(dev, pipe, request, requesttype,
> -   value, index, buf, size, timeout);
> - if (size > 0) {
> - memcpy(data, buf, size);
> - kfree(buf);
> - }
> - return err;
> -}
> -
>  static void pt_info_set(struct usb_device *dev, u8 v)
>  {
>   int ret;
>  
> - ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
> -   'I',
> -   USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> -   v, 0, NULL, 0, 1000);
> + ret = usb_control_msg_send(dev, 0, 'I',
> +USB_DIR_OUT | USB_TYPE_VENDOR | 
> USB_RECIP_DEVICE,
> +v, 0, NULL, 0, 1000);
>   snd_printdd(KERN_DEBUG "%i\n", ret);
>  }
>  
> @@ -305,10 +278,11 @@ static int us122l_set_sample_rate(struct usb_device 
> *dev, int rate)
>   data[0] = rate;
>   data[1] = rate >> 8;
>   data[2] = rate >> 16;
> - err = us122l_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC_SET_CUR,
> -  USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
> -  UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3, 
> 1000);
> - if (err < 0)
> + err = usb_control_msg_send(dev, 0, UAC_SET_CUR,
> +
> USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT,
> +UAC_EP_CS_ATTR_SAMPLE_RATE << 8, ep, data, 3,
> +1000);
> + if (err)
>   snd_printk(KERN_ERR "%d: cannot set freq %d to ep 0x%x\n",
>  dev->devnum, rate, ep);
>   return err;
> -- 
> 2.28.0
> 


Re: [PATCH 07/10] sound: 6fire: move to use usb_control_msg_send() and usb_control_msg_recv()

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:09 +0200,
Greg Kroah-Hartman wrote:
> 
> The usb_control_msg_send() and usb_control_msg_recv() calls can return
> an error if a "short" write/read happens, so move the driver over to
> using those calls instead, saving some logic in the wrapper functions
> that were being used in this driver.
> 
> This also resolves a long-staging bug where data on the stack was being
> sent in a USB control message, which was not allowed.
> 
> Cc: Jaroslav Kysela 
> Cc: Takashi Iwai 
> Cc: alsa-de...@alsa-project.org
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Takashi Iwai 


thanks,

Takashi


> ---
>  sound/usb/6fire/firmware.c | 38 +-
>  1 file changed, 13 insertions(+), 25 deletions(-)
> 
> diff --git a/sound/usb/6fire/firmware.c b/sound/usb/6fire/firmware.c
> index 69137c14d0dc..5b8994070c96 100644
> --- a/sound/usb/6fire/firmware.c
> +++ b/sound/usb/6fire/firmware.c
> @@ -158,29 +158,17 @@ static int usb6fire_fw_ihex_init(const struct firmware 
> *fw,
>  static int usb6fire_fw_ezusb_write(struct usb_device *device,
>   int type, int value, char *data, int len)
>  {
> - int ret;
> -
> - ret = usb_control_msg(device, usb_sndctrlpipe(device, 0), type,
> - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
> - value, 0, data, len, HZ);
> - if (ret < 0)
> - return ret;
> - else if (ret != len)
> - return -EIO;
> - return 0;
> + return usb_control_msg_send(device, 0, type,
> + USB_DIR_OUT | USB_TYPE_VENDOR | 
> USB_RECIP_DEVICE,
> + value, 0, data, len, HZ);
>  }
>  
>  static int usb6fire_fw_ezusb_read(struct usb_device *device,
>   int type, int value, char *data, int len)
>  {
> - int ret = usb_control_msg(device, usb_rcvctrlpipe(device, 0), type,
> - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value,
> - 0, data, len, HZ);
> - if (ret < 0)
> - return ret;
> - else if (ret != len)
> - return -EIO;
> - return 0;
> + return usb_control_msg_recv(device, 0, type,
> + USB_DIR_IN | USB_TYPE_VENDOR | 
> USB_RECIP_DEVICE,
> + value, 0, data, len, HZ);
>  }
>  
>  static int usb6fire_fw_fpga_write(struct usb_device *device,
> @@ -230,7 +218,7 @@ static int usb6fire_fw_ezusb_upload(
>   /* upload firmware image */
>   data = 0x01; /* stop ezusb cpu */
>   ret = usb6fire_fw_ezusb_write(device, 0xa0, 0xe600, , 1);
> - if (ret < 0) {
> + if (ret) {
>   kfree(rec);
>   release_firmware(fw);
>   dev_err(>dev,
> @@ -242,7 +230,7 @@ static int usb6fire_fw_ezusb_upload(
>   while (usb6fire_fw_ihex_next_record(rec)) { /* write firmware */
>   ret = usb6fire_fw_ezusb_write(device, 0xa0, rec->address,
>   rec->data, rec->len);
> - if (ret < 0) {
> + if (ret) {
>   kfree(rec);
>   release_firmware(fw);
>   dev_err(>dev,
> @@ -257,7 +245,7 @@ static int usb6fire_fw_ezusb_upload(
>   if (postdata) { /* write data after firmware has been uploaded */
>   ret = usb6fire_fw_ezusb_write(device, 0xa0, postaddr,
>   postdata, postlen);
> - if (ret < 0) {
> + if (ret) {
>   dev_err(>dev,
>   "unable to upload ezusb firmware %s: post 
> urb.\n",
>   fwname);
> @@ -267,7 +255,7 @@ static int usb6fire_fw_ezusb_upload(
>  
>   data = 0x00; /* resume ezusb cpu */
>   ret = usb6fire_fw_ezusb_write(device, 0xa0, 0xe600, , 1);
> - if (ret < 0) {
> + if (ret) {
>   dev_err(>dev,
>   "unable to upload ezusb firmware %s: end message.\n",
>   fwname);
> @@ -302,7 +290,7 @@ static int usb6fire_fw_fpga_upload(
>   end = fw->data + fw->size;
>  
>   ret = usb6fire_fw_ezusb_write(device, 8, 0, NULL, 0);
> - if (ret < 0) {
> + if (ret) {
>   kfree(buffer);
>   release_firmware(fw);
>   dev_err(>dev,
> @@ -327,7 +315,7 @@ static int usb6fire_fw_fpga_upload(
>   kfree(buffer);
>  
>   ret = usb6fire_fw_ezusb_write(device, 9, 0, NULL, 0);
> - if (ret < 0) {
> + if (ret) {
>   dev_err(>dev,
>   "unable to upload fpga firmware: end urb.\n");
>   return ret;
> @@ -363,7 +351,7 @@ int usb6fire_fw_init(struct usb_interface *intf)
>   u8 buffer[12];
>  
>   ret = usb6fire_fw_ezusb_read(device, 1, 0, buffer, 8);
> - if (ret < 0) {
> + if (ret) {
>   dev_err(>dev,
>   "unable to receive device firmware state.\n");
>   return ret;

Re: [PATCH 01/10] USB: move snd_usb_pipe_sanity_check into the USB core

2020-09-02 Thread Takashi Iwai
On Wed, 02 Sep 2020 13:01:03 +0200,
Greg Kroah-Hartman wrote:
> 
> snd_usb_pipe_sanity_check() is a great function, so let's move it into
> the USB core so that other parts of the kernel, including the USB core,
> can call it.
> 
> Name it usb_pipe_type_check() to match the existing
> usb_urb_ep_type_check() call, which now uses this function.
> 
> Cc: Jaroslav Kysela 
> Cc: Takashi Iwai 
> Cc: "Gustavo A. R. Silva" 
> Cc: Eli Billauer 
> Cc: Emiliano Ingrassia 
> Cc: Alan Stern 
> Cc: Alexander Tsoy 
> Cc: "Geoffrey D. Bennett" 
> Cc: Jussi Laako 
> Cc: Nick Kossifidis 
> Cc: Dmitry Panchenko 
> Cc: Chris Wulff 
> Cc: Jesus Ramos 
> Cc: linux-...@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: alsa-de...@alsa-project.org
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Takashi Iwai 


thanks,

Takashi


> ---
>  drivers/usb/core/urb.c  | 29 ++---
>  include/linux/usb.h |  1 +
>  sound/usb/helper.c  | 16 +---
>  sound/usb/helper.h  |  1 -
>  sound/usb/mixer_scarlett_gen2.c |  2 +-
>  sound/usb/quirks.c  | 12 ++--
>  6 files changed, 31 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
> index 27e83e55a590..45bc2914c1ba 100644
> --- a/drivers/usb/core/urb.c
> +++ b/drivers/usb/core/urb.c
> @@ -192,24 +192,39 @@ static const int pipetypes[4] = {
>  };
>  
>  /**
> - * usb_urb_ep_type_check - sanity check of endpoint in the given urb
> - * @urb: urb to be checked
> + * usb_pipe_type_check - sanity check of a specific pipe for a usb device
> + * @dev: struct usb_device to be checked
> + * @pipe: pipe to check
>   *
>   * This performs a light-weight sanity check for the endpoint in the
> - * given urb.  It returns 0 if the urb contains a valid endpoint, otherwise
> - * a negative error code.
> + * given usb device.  It returns 0 if the pipe is a valid for the specific 
> usb
> + * device, otherwise a negative error code.
>   */
> -int usb_urb_ep_type_check(const struct urb *urb)
> +int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe)
>  {
>   const struct usb_host_endpoint *ep;
>  
> - ep = usb_pipe_endpoint(urb->dev, urb->pipe);
> + ep = usb_pipe_endpoint(dev, pipe);
>   if (!ep)
>   return -EINVAL;
> - if (usb_pipetype(urb->pipe) != pipetypes[usb_endpoint_type(>desc)])
> + if (usb_pipetype(pipe) != pipetypes[usb_endpoint_type(>desc)])
>   return -EINVAL;
>   return 0;
>  }
> +EXPORT_SYMBOL_GPL(usb_pipe_type_check);
> +
> +/**
> + * usb_urb_ep_type_check - sanity check of endpoint in the given urb
> + * @urb: urb to be checked
> + *
> + * This performs a light-weight sanity check for the endpoint in the
> + * given urb.  It returns 0 if the urb contains a valid endpoint, otherwise
> + * a negative error code.
> + */
> +int usb_urb_ep_type_check(const struct urb *urb)
> +{
> + return usb_pipe_type_check(urb->dev, urb->pipe);
> +}
>  EXPORT_SYMBOL_GPL(usb_urb_ep_type_check);
>  
>  /**
> diff --git a/include/linux/usb.h b/include/linux/usb.h
> index 20c555db4621..0b3963d7ec38 100644
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -1764,6 +1764,7 @@ static inline int usb_urb_dir_out(struct urb *urb)
>   return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
>  }
>  
> +int usb_pipe_type_check(struct usb_device *dev, unsigned int pipe);
>  int usb_urb_ep_type_check(const struct urb *urb);
>  
>  void *usb_alloc_coherent(struct usb_device *dev, size_t size,
> diff --git a/sound/usb/helper.c b/sound/usb/helper.c
> index 4c12cc5b53fd..cf92d7110773 100644
> --- a/sound/usb/helper.c
> +++ b/sound/usb/helper.c
> @@ -63,20 +63,6 @@ void *snd_usb_find_csint_desc(void *buffer, int buflen, 
> void *after, u8 dsubtype
>   return NULL;
>  }
>  
> -/* check the validity of pipe and EP types */
> -int snd_usb_pipe_sanity_check(struct usb_device *dev, unsigned int pipe)
> -{
> - static const int pipetypes[4] = {
> - PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
> - };
> - struct usb_host_endpoint *ep;
> -
> - ep = usb_pipe_endpoint(dev, pipe);
> - if (!ep || usb_pipetype(pipe) != 
> pipetypes[usb_endpoint_type(>desc)])
> - return -EINVAL;
> - return 0;
> -}
> -
>  /*
>   * Wrapper for usb_control_msg().
>   * Allocates a temp buffer to prevent dmaing from/to the stack.
> @@ -89,7 +75,7 @@ int snd_usb_ctl_msg(struct usb_device *dev, unsigned int 
> pipe, __u8 request,
>   void *buf = NULL;
>   int timeout;
>  
> - if (snd_usb_pipe_sanity_check(dev, pipe))
> + if (usb_pipe_type_check(dev, pipe))
>   return -EINVAL;
>  
>   if (size > 0) {
> diff --git a/sound/usb/helper.h b/sound/usb/helper.h
> index 5e8a18b4e7b9..f5b4c6647e4d 100644
> --- a/sound/usb/helper.h
> +++ b/sound/usb/helper.h
> @@ -7,7 +7,6 @@ unsigned int snd_usb_combine_bytes(unsigned char *bytes, int 
> size);
>  void 

Re: [PATCH] rt2x00: Use fallthrough pseudo-keyword macro

2020-09-02 Thread Gustavo A. R. Silva



On 9/2/20 08:05, Leesoo Ahn wrote:
> Replace all '/* fall through */' comments with the macro[1].
> 
> [1]: 
> https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
> 

This looks familiar...

https://lore.kernel.org/lkml/20200821062052.GA8618@embeddedor/

Thanks
--
Gustavo


Re: [PATCH] seccomp: don't leave dangling ->notif if file allocation fails

2020-09-02 Thread Christian Brauner
On Wed, Sep 02, 2020 at 08:09:53AM -0600, Tycho Andersen wrote:
> Christian and Kees both pointed out that this is a bit sloppy to open-code
> both places, and Christian points out that we leave a dangling pointer to
> ->notif if file allocation fails. Since we check ->notif for null in order
> to determine if it's ok to install a filter, this means people won't be
> able to install a filter if the file allocation fails for some reason, even
> if they subsequently should be able to.
> 
> To fix this, let's hoist this free+null into its own little helper and use
> it.
> 
> Reported-by: Kees Cook 
> Reported-by: Christian Brauner 
> Signed-off-by: Tycho Andersen 
> ---

Thanks for the patch, Tycho! Looks simple enough to me:

Acked-by: Christian Brauner 

>  kernel/seccomp.c | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index bb0dd9ae699a..676d4af62103 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -1109,6 +1109,12 @@ static long seccomp_set_mode_strict(void)
>  }
>  
>  #ifdef CONFIG_SECCOMP_FILTER
> +static void seccomp_notify_free(struct seccomp_filter *filter)

I think an explicit "inline" coldn't hurt but it's fine either way and
no need to resend imho. Probably Kees can just add this when applying if
we reall cared.

> +{
> + kfree(filter->notif);
> + filter->notif = NULL;
> +}
> +
>  static void seccomp_notify_detach(struct seccomp_filter *filter)
>  {
>   struct seccomp_knotif *knotif;
> @@ -1138,8 +1144,7 @@ static void seccomp_notify_detach(struct seccomp_filter 
> *filter)
>   complete(>ready);
>   }
>  
> - kfree(filter->notif);
> - filter->notif = NULL;
> + seccomp_notify_free(filter);
>   mutex_unlock(>notify_lock);
>  }
>  
> @@ -1494,7 +1499,7 @@ static struct file *init_listener(struct seccomp_filter 
> *filter)
>  
>  out_notif:
>   if (IS_ERR(ret))
> - kfree(filter->notif);
> + seccomp_notify_free(filter);
>  out:
>   return ret;
>  }
> 
> base-commit: 7b6aa0bb62fd6fd50f2d14136136262d28fb2dfe
> -- 
> 2.25.1
> 


Re: [PATCH 4.19 108/125] USB: yurex: Fix bad gfp argument

2020-09-02 Thread Greg Kroah-Hartman
On Wed, Sep 02, 2020 at 02:58:27PM +0200, Pavel Machek wrote:
> Hi!
> 
> > The syzbot fuzzer identified a bug in the yurex driver: It passes
> > GFP_KERNEL as a memory-allocation flag to usb_submit_urb() at a time
> > when its state is TASK_INTERRUPTIBLE, not TASK_RUNNING:
> 
> Yeah, and instead of fixing the bug, patch papers over it, reducing
> reliability of the driver in the process.
> 
> > This patch changes the call to use GFP_ATOMIC instead of GFP_KERNEL.
> 
> Fixing it properly should be as simple as moving prepare_to_wait down,
> no?
> 
> Signed-off-by: Pavel Machek (CIP) 
> 
> diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
> index 785080f79073..5fbbb57e6e95 100644
> --- a/drivers/usb/misc/yurex.c
> +++ b/drivers/usb/misc/yurex.c
> @@ -489,10 +489,10 @@ static ssize_t yurex_write(struct file *file, const 
> char __user *user_buffer,
>   }
>  
>   /* send the data as the control msg */
> - prepare_to_wait(>waitq, , TASK_INTERRUPTIBLE);
>   dev_dbg(>interface->dev, "%s - submit %c\n", __func__,
>   dev->cntl_buffer[0]);
> - retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
> + retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL);
> + prepare_to_wait(>waitq, , TASK_INTERRUPTIBLE);
>   if (retval >= 0)
>   timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
>   finish_wait(>waitq, );
> 
> 
> Best regards,
>   Pavel
>

I can't take patches like this, you know that...


Re: [RFC net-next] udp: add a GSO type for UDPv6

2020-09-02 Thread Willem de Bruijn
On Wed, Sep 2, 2020 at 2:18 PM Huazhong Tan  wrote:
>
> In some cases, for UDP GSO, UDPv4 and UDPv6 need to be handled
> separately, for example, checksum offload, so add new GSO type
> SKB_GSO_UDPV6_L4 for UDPv6, and the old SKB_GSO_UDP_L4 stands
> for UDPv4.

This is in preparation for hardware you have that actually cares about
this distinction, I guess?


> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 2cc3cf8..b7c1a76 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -54,6 +54,7 @@ enum {
> NETIF_F_GSO_UDP_BIT,/* ... UFO, deprecated except tuntap 
> */
> NETIF_F_GSO_UDP_L4_BIT, /* ... UDP payload GSO (not UFO) */
> NETIF_F_GSO_FRAGLIST_BIT,   /* ... Fraglist GSO */
> +   NETIF_F_GSO_UDPV6_L4_BIT,   /* ... UDPv6 payload GSO (not UFO) */
> /**/NETIF_F_GSO_LAST =  /* last bit, see GSO_MASK */
> NETIF_F_GSO_FRAGLIST_BIT,

Need to update NETIF_F_GSO_LAST then, too.


[PATCH 18/19] sr: simplify sr_block_revalidate_disk

2020-09-02 Thread Christoph Hellwig
Both callers have a valid CD struture available, so rely on that instead
of getting another reference.  Also move the function to avoid a forward
declaration.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/sr.c | 36 +---
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 34be94b62523fa..2b43c0f97442d4 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -86,7 +86,6 @@ static int sr_remove(struct device *);
 static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt);
 static int sr_done(struct scsi_cmnd *);
 static int sr_runtime_suspend(struct device *dev);
-static int sr_block_revalidate_disk(struct gendisk *disk);
 
 static const struct dev_pm_ops sr_pm_ops = {
.runtime_suspend= sr_runtime_suspend,
@@ -518,6 +517,17 @@ static blk_status_t sr_init_command(struct scsi_cmnd 
*SCpnt)
return ret;
 }
 
+static void sr_revalidate_disk(struct scsi_cd *cd)
+{
+   struct scsi_sense_hdr sshdr;
+
+   /* if the unit is not ready, nothing more to do */
+   if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, ))
+   return;
+   sr_cd_check(>cdi);
+   get_sectorsize(cd);
+}
+
 static int sr_block_open(struct block_device *bdev, fmode_t mode)
 {
struct scsi_cd *cd;
@@ -531,7 +541,7 @@ static int sr_block_open(struct block_device *bdev, fmode_t 
mode)
sdev = cd->device;
scsi_autopm_get_device(sdev);
if (bdev_check_media_change(bdev))
-   sr_block_revalidate_disk(bdev->bd_disk);
+   sr_revalidate_disk(cd);
 
mutex_lock(>lock);
ret = cdrom_open(>cdi, bdev, mode);
@@ -660,26 +670,6 @@ static unsigned int sr_block_check_events(struct gendisk 
*disk,
return ret;
 }
 
-static int sr_block_revalidate_disk(struct gendisk *disk)
-{
-   struct scsi_sense_hdr sshdr;
-   struct scsi_cd *cd;
-
-   cd = scsi_cd_get(disk);
-   if (!cd)
-   return -ENXIO;
-
-   /* if the unit is not ready, nothing more to do */
-   if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, ))
-   goto out;
-
-   sr_cd_check(>cdi);
-   get_sectorsize(cd);
-out:
-   scsi_cd_put(cd);
-   return 0;
-}
-
 static const struct block_device_operations sr_bdops =
 {
.owner  = THIS_MODULE,
@@ -803,7 +793,7 @@ static int sr_probe(struct device *dev)
 
dev_set_drvdata(dev, cd);
disk->flags |= GENHD_FL_REMOVABLE;
-   sr_block_revalidate_disk(disk);
+   sr_revalidate_disk(cd);
device_add_disk(>sdev_gendev, disk, NULL);
 
sdev_printk(KERN_DEBUG, sdev,
-- 
2.28.0



[PATCH 19/19] block: remove check_disk_change

2020-09-02 Thread Christoph Hellwig
Remove the now unused check_disk_change helper.

Signed-off-by: Christoph Hellwig 
---
 fs/block_dev.c| 20 
 include/linux/genhd.h |  1 -
 2 files changed, 21 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 37cb809b217926..c6baae5b85060c 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1339,26 +1339,6 @@ void revalidate_disk_size(struct gendisk *disk, bool 
verbose)
 }
 EXPORT_SYMBOL(revalidate_disk_size);
 
-/*
- * This routine checks whether a removable media has been changed,
- * and invalidates all buffer-cache-entries in that case. This
- * is a relatively slow routine, so we have to try to minimize using
- * it. Thus it is called only upon a 'mount' or 'open'. This
- * is the best way of combining speed and utility, I think.
- * People changing diskettes in the middle of an operation deserve
- * to lose :-)
- */
-int check_disk_change(struct block_device *bdev)
-{
-   if (!bdev_check_media_change(bdev))
-   return 0;
-   if (bdev->bd_disk->fops->revalidate_disk)
-   bdev->bd_disk->fops->revalidate_disk(bdev->bd_disk);
-   return 1;
-}
-
-EXPORT_SYMBOL(check_disk_change);
-
 void bd_set_nr_sectors(struct block_device *bdev, sector_t sectors)
 {
spin_lock(>bd_size_lock);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 322d48a207728a..1c97cf84f011a7 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -370,7 +370,6 @@ int register_blkdev(unsigned int major, const char *name);
 void unregister_blkdev(unsigned int major, const char *name);
 
 void revalidate_disk_size(struct gendisk *disk, bool verbose);
-int check_disk_change(struct block_device *bdev);
 bool bdev_check_media_change(struct block_device *bdev);
 int __invalidate_device(struct block_device *bdev, bool kill_dirty);
 void bd_set_nr_sectors(struct block_device *bdev, sector_t sectors);
-- 
2.28.0



Re: [PATCH -next] remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()

2020-09-02 Thread Suman Anna
On 9/2/20 9:06 AM, YueHaibing wrote:
> In case of error, the function devm_ioremap_wc() returns NULL pointer
> not ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test.

Thanks for the fix.

> 
> Fixes: 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs")

This should instead be
Fixes: 6edbe024ba17 ("remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x 
DSPs")

With that,
Acked-by: Suman Anna 

> Signed-off-by: YueHaibing 
> ---
>  drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c 
> b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> index 9011e477290c..f373df35d7d0 100644
> --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
> @@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct 
> platform_device *pdev,
>  
>   kproc->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start,
>resource_size(res));
> - if (IS_ERR(kproc->mem[i].cpu_addr)) {
> + if (!kproc->mem[i].cpu_addr) {
>   dev_err(dev, "failed to map %s memory\n",
>   data->mems[i].name);
> - return PTR_ERR(kproc->mem[i].cpu_addr);
> + return -EBUSY;
>   }
>   kproc->mem[i].bus_addr = res->start;
>   kproc->mem[i].dev_addr = data->mems[i].dev_addr;
> 



Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Pavel Tatashin
> > > The fix is to try to drain per-cpu lists again after
> > > check_pages_isolated_cb() fails.
>
> Still trying to wrap my head around this but I think this is not a
> proper fix. It should be the page isolation to make sure no races are
> possible with the page freeing path.
>

As Bharata B Rao found in another thread, the problem was introduced
by this change:
c52e75935f8d: mm: remove extra drain pages on pcp list

So, the drain used to be tried every time with lru_add_drain_all();
Which, I think is excessive, as we start a thread per cpu to try to
drain and catch a rare race condition. With the proposed change we
drain again only when we find such a condition. Fixing it in
start_isolate_page_range means that we must somehow synchronize it
with the release_pages() which adds costs to runtime code, instead of
to hot-remove code.

Pasha


[PATCH v2 1/3] dt-bindings: usb: Convert cdns-usb3.txt to YAML schema

2020-09-02 Thread Roger Quadros
Converts cdns-usb3.txt to YAML schema cdns,usb3.yaml

Signed-off-by: Roger Quadros 
---
 .../devicetree/bindings/usb/cdns,usb3.yaml| 89 +++
 .../devicetree/bindings/usb/cdns-usb3.txt | 45 --
 2 files changed, 89 insertions(+), 45 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/cdns,usb3.yaml
 delete mode 100644 Documentation/devicetree/bindings/usb/cdns-usb3.txt

diff --git a/Documentation/devicetree/bindings/usb/cdns,usb3.yaml 
b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
new file mode 100644
index ..7bc0263accee
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/cdns,usb3.yaml
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/cdns,usb3.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence USBSS-DRD controller bindings
+
+maintainers:
+  - Pawel Laszczak 
+
+properties:
+  compatible:
+oneOf:
+  - const: cdns,usb3
+
+  reg:
+items:
+  - description: OTG controller registers
+  - description: XHCI Host controller registers
+  - description: DEVICE controller registers
+
+  reg-names:
+items:
+  - const: otg
+  - const: xhci
+  - const: dev
+
+  interrupts:
+items:
+  - description: OTG/DRD controller interrupt
+  - description: XHCI host controller interrupt
+  - description: Device controller interrupt
+
+  interrupt-names:
+items:
+  - const: host
+  - const: peripheral
+  - const: otg
+
+  dr_mode:
+enum: [host, otg, peripheral]
+
+  maximum-speed:
+enum: [super-speed, high-speed, full-speed]
+
+  phys:
+   minItems: 1
+   maxItems: 2
+
+  phy-names:
+minItems: 1
+maxItems: 2
+
+  cdns,on-chip-buff-size:
+description:
+  size of memory intended as internal memory for endpoints
+  buffers expressed in KB
+$ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+bus {
+#address-cells = <2>;
+#size-cells = <2>;
+
+usb@600 {
+compatible = "cdns,usb3";
+reg = <0x00 0x600 0x00 0x1>,
+  <0x00 0x601 0x00 0x1>,
+  <0x00 0x602 0x00 0x1>;
+reg-names = "otg", "xhci", "dev";
+interrupts = ,
+ ,
+ ;
+interrupt-names = "host", "peripheral", "otg";
+maximum-speed = "super-speed";
+dr_mode = "otg";
+};
+};
diff --git a/Documentation/devicetree/bindings/usb/cdns-usb3.txt 
b/Documentation/devicetree/bindings/usb/cdns-usb3.txt
deleted file mode 100644
index b7dc606d37b5..
--- a/Documentation/devicetree/bindings/usb/cdns-usb3.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Binding for the Cadence USBSS-DRD controller
-
-Required properties:
- - reg: Physical base address and size of the controller's register areas.
-Controller has 3 different regions:
-- HOST registers area
-- DEVICE registers area
-- OTG/DRD registers area
- - reg-names - register memory area names:
-   "xhci" - for HOST registers space
-   "dev" - for DEVICE registers space
-   "otg" - for OTG/DRD registers space
- - compatible: Should contain: "cdns,usb3"
- - interrupts: Interrupts used by cdns3 controller:
-   "host" - interrupt used by XHCI driver.
-   "peripheral" - interrupt used by device driver
-   "otg" - interrupt used by DRD/OTG  part of driver
-
-Optional properties:
- - maximum-speed : valid arguments are "super-speed", "high-speed" and
-   "full-speed"; refer to usb/generic.txt
- - dr_mode: Should be one of "host", "peripheral" or "otg".
- - phys: reference to the USB PHY
- - phy-names: from the *Generic PHY* bindings;
-   Supported names are:
-   - cdns3,usb2-phy
-   - cdns3,usb3-phy
-
- - cdns,on-chip-buff-size : size of memory intended as internal memory for 
endpoints
-   buffers expressed in KB
-
-Example:
-   usb@f300 {
-   compatible = "cdns,usb3";
-   interrupts = ,
-   ,
-   ;
-   interrupt-names = "host", "peripheral", "otg";
-   reg = <0xf300 0x1>, /* memory area for HOST 
registers */
-   <0xf301 0x1>,   /* memory area for DEVICE 
registers */
-   <0xf302 0x1>;   /* memory area for OTG/DRD 
registers */
-   reg-names = "xhci", "dev", "otg";
-   phys = <_phy>, <_phy>;
-   phy-names = "cdns3,usb2-phy", "cnds3,usb3-phy";
-   };
-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH] media: mtk-vcodec: set dma max segment size

2020-09-02 Thread Robin Murphy

On 2020-08-21 05:14, Hsin-Yi Wang wrote:

Set dma max segment size for encoder and decoder driver.

Fix following warning with CONFIG_DMA_API_DEBUG_SG=y

[   75.147825] [ cut here ]
[   75.147844] mtk-vcodec-enc 19002000.vcodec: DMA-API: mapping sg segment 
longer than device claims to support [len=983040] [max=65536]
[   75.147876] WARNING: CPU: 2 PID: 4069 at kernel/dma/debug.c:1302 
debug_dma_map_sg+0x1a8/0x2c4
...
[   75.148139] Call trace:
[   75.148149]  debug_dma_map_sg+0x1a8/0x2c4
[   75.148165]  vb2_dc_get_userptr+0x228/0x364 [videobuf2_dma_contig]
[   75.148178]  __buf_prepare+0x3ac/0x8c0 [videobuf2_common]
[   75.148188]  vb2_core_qbuf+0xa4/0x58c [videobuf2_common]
[   75.148199]  vb2_qbuf+0x88/0xe4 [videobuf2_v4l2]
[   75.148211]  v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem]
[   75.148221]  vidioc_venc_qbuf+0x3c/0x70 [mtk_vcodec_enc]
[   75.148234]  v4l_qbuf+0x48/0x58
[   75.148242]  __video_do_ioctl+0x200/0x37c
[   75.148250]  video_usercopy+0x360/0x834
[   75.148259]  video_ioctl2+0x38/0x48
[   75.148267]  v4l2_ioctl+0x6c/0x80
[   75.148276]  do_video_ioctl+0xefc/0x4b70
[   75.148284]  v4l2_compat_ioctl32+0x5c/0xcc
[   75.148294]  __arm64_compat_sys_ioctl+0xf4/0x240
[   75.148304]  el0_svc_common+0xac/0x198
[   75.148312]  el0_svc_compat_handler+0x2c/0x40
[   75.148321]  el0_svc_compat+0x8/0x18
[   75.148328] irq event stamp: 0
[   75.148337] hardirqs last  enabled at (0): [<>]   
(null)
[   75.148347] hardirqs last disabled at (0): [] 
copy_process+0x380/0x115c
[   75.148356] softirqs last  enabled at (0): [] 
copy_process+0x398/0x115c
[   75.148364] softirqs last disabled at (0): [<>]   
(null)
[   75.148372] ---[ end trace 588bf529451e3531 ]---

Reported-by: Anand K Mistry 
Signed-off-by: Hsin-Yi Wang 
---
  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 8 
  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 8 
  2 files changed, 16 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 97a1b6664c20..3bbd0bac56d6 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -242,6 +242,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
mtk_v4l2_err("[VPU] vpu device in not ready");
return -EPROBE_DEFER;
}
+   if (!pdev->dev.dma_parms) {
+   pdev->dev.dma_parms = devm_kzalloc(>dev,
+   sizeof(*pdev->dev.dma_parms),
+   GFP_KERNEL);
+   if (!pdev->dev.dma_parms)
+   return -ENOMEM;
+   }


Since 9495b7e92f71, dma_parms is included in the platform_device itself 
and always set, so you can drop these allocation paths.



+   dma_set_max_seg_size(>dev, DMA_BIT_MASK(32));


The segment size is simply a size, not a bitmask, so UINT_MAX would be 
more semantically appropriate.


Robin.


vpu_wdt_reg_handler(dev->vpu_plat_dev, mtk_vcodec_dec_reset_handler,
dev, VPU_RST_DEC);
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 4d31f1ed113f..ff4a87485d69 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -249,6 +249,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
mtk_v4l2_err("[VPU] vpu device in not ready");
return -EPROBE_DEFER;
}
+   if (!pdev->dev.dma_parms) {
+   pdev->dev.dma_parms = devm_kzalloc(>dev,
+   sizeof(*pdev->dev.dma_parms),
+   GFP_KERNEL);
+   if (!pdev->dev.dma_parms)
+   return -ENOMEM;
+   }
+   dma_set_max_seg_size(>dev, DMA_BIT_MASK(32));
  
  	vpu_wdt_reg_handler(dev->vpu_plat_dev, mtk_vcodec_enc_reset_handler,

dev, VPU_RST_ENC);



[PATCH v5 2/3] dt-bindings: mfd: add LP87524-Q1

2020-09-02 Thread Luca Ceresoli
Add the LP87524-Q1 to the bindings along with an example. This is a variant
of the LP87565-Q1 and LP87561-Q1 chips which already have bindings.

Signed-off-by: Luca Ceresoli 

---

Changes in v5:
 - describe the "regulators" node too (Rob)
 - add 'additionalProperties: false' (Rob)
 - user patternProperties for supplies
 - simplify supply description

Changes in v4:
 - reformat as a standalone file

Changes in v3:
 - fix yaml errors

Changes in v2:
 - RFC,v1 was based on the txt file, rewrite for yaml
 - use uppercase consistently in model names (Lee Jones)
 - replace "regulator" -> "mfd" in subject line (Lee Jones)
 - replace "dt:" suffix with "dt-bindings:" prefix in subject line
---
 .../bindings/mfd/ti,lp87524-q1.yaml   | 112 ++
 1 file changed, 112 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87524-q1.yaml

diff --git a/Documentation/devicetree/bindings/mfd/ti,lp87524-q1.yaml 
b/Documentation/devicetree/bindings/mfd/ti,lp87524-q1.yaml
new file mode 100644
index ..c4fc5345d38d
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/ti,lp87524-q1.yaml
@@ -0,0 +1,112 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/ti,lp87524-q1.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI LP87524-Q1 four 1-phase output buck converter
+
+maintainers:
+  - Keerthy 
+
+properties:
+  compatible:
+const: ti,lp87524-q1
+
+  reg:
+description: I2C slave address
+const: 0x60
+
+  gpio-controller: true
+
+  '#gpio-cells':
+description:
+  The first cell is the pin number.
+  The second cell is is used to specify flags.
+  See ../gpio/gpio.txt for more information.
+const: 2
+
+  regulators:
+type: object
+
+patternProperties:
+  "^buck[0123]$":
+type: object
+$ref: /schemas/regulator/regulator.yaml#
+
+required:
+  - buck0
+  - buck1
+  - buck2
+  - buck3
+
+additionalProperties: false
+
+patternProperties:
+  "^buck[0123]-in-supply$":
+description: Voltage regulator supply for each BUCK converter
+
+required:
+  - compatible
+  - reg
+  - gpio-controller
+  - '#gpio-cells'
+  - buck0-in-supply
+  - buck1-in-supply
+  - buck2-in-supply
+  - buck3-in-supply
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+i2c@0 {
+reg = <0x0 0x100>;
+#address-cells = <1>;
+#size-cells = <0>;
+
+pmic@60 {
+compatible = "ti,lp87524-q1";
+reg = <0x60>;
+gpio-controller;
+#gpio-cells = <2>;
+
+buck0-in-supply = <_5v0>;
+buck1-in-supply = <_5v0>;
+buck2-in-supply = <_5v0>;
+buck3-in-supply = <_5v0>;
+
+regulators {
+buck0_reg: buck0 {
+regulator-name = "buck0";
+regulator-min-microvolt = <330>;
+regulator-max-microvolt = <330>;
+regulator-always-on;
+};
+
+buck1_reg: buck1 {
+regulator-name = "buck1";
+regulator-min-microvolt = <135>;
+regulator-max-microvolt = <135>;
+regulator-always-on;
+};
+
+buck2_reg: buck2 {
+regulator-name = "buck2";
+regulator-min-microvolt = <95>;
+regulator-max-microvolt = <95>;
+regulator-always-on;
+};
+
+buck3_reg: buck3 {
+regulator-name = "buck3";
+regulator-min-microvolt = <180>;
+regulator-max-microvolt = <180>;
+regulator-always-on;
+};
+};
+};
+};
+
+...
-- 
2.28.0



[PATCH v2 0/3] usb: cdns,usb3: Convert DT binding to YAML

2020-09-02 Thread Roger Quadros
Hi,

This series converts DT binding to YAML schema.
Then adds a new property to enable workaround for USB2.0 PHY
Rx compliance issues.

cheers,
-roger

Changelog:
v2:
- updated commit log to better describe why DT property is required
for the quirk.

Pawel Laszczak (1):
  usb: cdns3: Enable workaround for USB2.0 PHY Rx compliance test PHY
lockup

Roger Quadros (2):
  dt-bindings: usb: Convert cdns-usb3.txt to YAML schema
  dt-bindings: usb: cdns,usb3: Add cdns,phyrst-a-enable property

 .../devicetree/bindings/usb/cdns,usb3.yaml| 93 +++
 .../devicetree/bindings/usb/cdns-usb3.txt | 45 -
 drivers/usb/cdns3/core.c  |  2 +
 drivers/usb/cdns3/core.h  |  1 +
 drivers/usb/cdns3/drd.c   | 12 +++
 drivers/usb/cdns3/drd.h   |  5 +-
 6 files changed, 112 insertions(+), 46 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/cdns,usb3.yaml
 delete mode 100644 Documentation/devicetree/bindings/usb/cdns-usb3.txt

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki



Re: [PATCH v2] arm64: dts: qcom: sc7180: Add lpass cpu node for I2S driver

2020-09-02 Thread kernel test robot
Hi Srinivasa,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v5.9-rc3 next-20200902]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Srinivasa-Rao-Mandadapu/arm64-dts-qcom-sc7180-Add-lpass-cpu-node-for-I2S-driver/20200902-120555
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arm64-randconfig-r021-20200902 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=arm64 

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

All errors (new ones prefixed by >>):

>> Error: arch/arm64/boot/dts/qcom/sc7180.dtsi:687.31-32 syntax error
>> FATAL ERROR: Unable to parse input tree

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


.config.gz
Description: application/gzip


[PATCH v5 1/3] dt-bindings: mfd: lp87565: convert to yaml

2020-09-02 Thread Luca Ceresoli
Also apply a few smaller improvements:

 - document that the only possible I2C slave address is 0x60 as per the
   datasheet and fix the second example accordingly
 - The definition of "xxx-in-supply" was generic, thus define in detail the
   possible cases for each chip variant
 - remove "MFD driver" from the title as it is implementation specific
 - replace "PMIC" with "buck converter" in title as it is more informative

Signed-off-by: Luca Ceresoli 

---

Changes in v5:
 - describe the "regulators" node too (Rob)
 - add 'additionalProperties: false' (Rob)
 - simplify supply description
 - update commit message

Changes in v4:
 - split in two different bindings (Rob)
 - remove "MFD driver" from title as it is implementation specific; also
   replace "PMIC" with "buck converter" which is more informative

Changes in v3:
 - fix yaml errors

Changes in v2:
 - this patch replaces patch "regulator: lp87565: dt: remove duplicated
   section" in RFC,v1 (Rob Herring)
 - use capital letters consistently (Lee Jones)
 - replace "regulator" -> "mfd" in subject line (Lee Jones)
 - replace "dt:" suffix with "dt-bindings:" prefix in subject line
---
 .../devicetree/bindings/mfd/lp87565.txt   |  79 --
 .../bindings/mfd/ti,lp87561-q1.yaml   |  83 ++
 .../bindings/mfd/ti,lp87565-q1.yaml   | 101 ++
 3 files changed, 184 insertions(+), 79 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/lp87565.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87561-q1.yaml
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87565-q1.yaml

diff --git a/Documentation/devicetree/bindings/mfd/lp87565.txt 
b/Documentation/devicetree/bindings/mfd/lp87565.txt
deleted file mode 100644
index 41671e0dc26b..
--- a/Documentation/devicetree/bindings/mfd/lp87565.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-TI LP87565 PMIC MFD driver
-
-Required properties:
-  - compatible:"ti,lp87565", "ti,lp87565-q1"
-  - reg:   I2C slave address.
-  - gpio-controller:   Marks the device node as a GPIO Controller.
-  - #gpio-cells:   Should be two.  The first cell is the pin number and
-   the second cell is used to specify flags.
-   See ../gpio/gpio.txt for more information.
-  - xxx-in-supply: Phandle to parent supply node of each regulator
-   populated under regulators node. xxx should match
-   the supply_name populated in driver.
-Example:
-
-lp87565_pmic: pmic@60 {
-   compatible = "ti,lp87565-q1";
-   reg = <0x60>;
-   gpio-controller;
-   #gpio-cells = <2>;
-
-   buck10-in-supply = <_3v3>;
-   buck23-in-supply = <_3v3>;
-
-   regulators: regulators {
-   buck10_reg: buck10 {
-   /* VDD_MPU */
-   regulator-name = "buck10";
-   regulator-min-microvolt = <85>;
-   regulator-max-microvolt = <125>;
-   regulator-always-on;
-   regulator-boot-on;
-   };
-
-   buck23_reg: buck23 {
-   /* VDD_GPU */
-   regulator-name = "buck23";
-   regulator-min-microvolt = <85>;
-   regulator-max-microvolt = <125>;
-   regulator-boot-on;
-   regulator-always-on;
-   };
-   };
-};
-
-TI LP87561 PMIC:
-
-This is a single output 4-phase regulator configuration
-
-Required properties:
-  - compatible:"ti,lp87561-q1"
-  - reg:   I2C slave address.
-  - gpio-controller:   Marks the device node as a GPIO Controller.
-  - #gpio-cells:   Should be two.  The first cell is the pin number and
-   the second cell is used to specify flags.
-   See ../gpio/gpio.txt for more information.
-  - xxx-in-supply: Phandle to parent supply node of each regulator
-   populated under regulators node. xxx should match
-   the supply_name populated in driver.
-Example:
-
-lp87561_pmic: pmic@62 {
-   compatible = "ti,lp87561-q1";
-   reg = <0x62>;
-   gpio-controller;
-   #gpio-cells = <2>;
-
-   buck3210-in-supply = <_3v3>;
-
-   regulators: regulators {
-   buck3210_reg: buck3210 {
-   /* VDD_CORE */
-   regulator-name = "buck3210";
-   regulator-min-microvolt = <80>;
-   regulator-max-microvolt = <80>;
-   regulator-always-on;
-   regulator-boot-on;
-   };
-   };
-};
diff --git a/Documentation/devicetree/bindings/mfd/ti,lp87561-q1.yaml 
b/Documentation/devicetree/bindings/mfd/ti,lp87561-q1.yaml
new file mode 100644
index ..a7e57c0913e1
--- /dev/null
+++ 

[PATCH v5 3/3] mfd: lp87565: add LP87524-Q1 variant

2020-09-02 Thread Luca Ceresoli
Add support for the LP87524B/J/P-Q1 Four 4-MHz Buck Converter. This is a
variant of the LP87565 having 4 single-phase outputs and up to 10 A of
total output current.

Signed-off-by: Luca Ceresoli 
Acked-for-MFD-by: Lee Jones 

---

Changes in v5: none

Changes in v4: none

Changes in v3: none

Changes in v2:
 - replace "regulator" -> "mfd" in subject line (Lee Jones)
 - add Acked-for-MFD-by: from Lee Jones
---
 drivers/mfd/lp87565.c   | 4 
 include/linux/mfd/lp87565.h | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/mfd/lp87565.c b/drivers/mfd/lp87565.c
index 2268be9113f1..9c21483d9653 100644
--- a/drivers/mfd/lp87565.c
+++ b/drivers/mfd/lp87565.c
@@ -26,6 +26,10 @@ static const struct mfd_cell lp87565_cells[] = {
 
 static const struct of_device_id of_lp87565_match_table[] = {
{ .compatible = "ti,lp87565", },
+   {
+   .compatible = "ti,lp87524-q1",
+   .data = (void *)LP87565_DEVICE_TYPE_LP87524_Q1,
+   },
{
.compatible = "ti,lp87565-q1",
.data = (void *)LP87565_DEVICE_TYPE_LP87565_Q1,
diff --git a/include/linux/mfd/lp87565.h b/include/linux/mfd/lp87565.h
index 43716aca46fa..d44ddfb6bb63 100644
--- a/include/linux/mfd/lp87565.h
+++ b/include/linux/mfd/lp87565.h
@@ -14,6 +14,7 @@
 
 enum lp87565_device_type {
LP87565_DEVICE_TYPE_UNKNOWN = 0,
+   LP87565_DEVICE_TYPE_LP87524_Q1,
LP87565_DEVICE_TYPE_LP87561_Q1,
LP87565_DEVICE_TYPE_LP87565_Q1,
 };
-- 
2.28.0



Re: [PATCH] mm/memory_hotplug: drain per-cpu pages again during memory offline

2020-09-02 Thread Pavel Tatashin
On Wed, Sep 2, 2020 at 10:08 AM Michal Hocko  wrote:
>
> On Tue 01-09-20 08:46:15, Pavel Tatashin wrote:
> > There is a race during page offline that can lead to infinite loop:
> > a page never ends up on a buddy list and __offline_pages() keeps
> > retrying infinitely or until a termination signal is received.
> >
> > Thread#1 - a new process:
> >
> > load_elf_binary
> >  begin_new_exec
> >   exec_mmap
> >mmput
> > exit_mmap
> >  tlb_finish_mmu
> >   tlb_flush_mmu
> >release_pages
> > free_unref_page_list
> >  free_unref_page_prepare
> >   set_pcppage_migratetype(page, migratetype);
> >  // Set page->index migration type below  MIGRATE_PCPTYPES
> >
> > Thread#2 - hot-removes memory
> > __offline_pages
> >   start_isolate_page_range
> > set_migratetype_isolate
> >   set_pageblock_migratetype(page, MIGRATE_ISOLATE);
> > Set migration type to MIGRATE_ISOLATE-> set
> > drain_all_pages(zone);
> >  // drain per-cpu page lists to buddy allocator.
>
> It is not really clear to me how we could have passed
> has_unmovable_pages at this stage when the page is not PageBuddy. Is
> this because you are using Movable Zones?

Yes, we hot-remove memory from the movable zone.

>
> >
> > Thread#1 - continue
> >  free_unref_page_commit
> >migratetype = get_pcppage_migratetype(page);
> >   // get old migration type
> >list_add(>lru, >lists[migratetype]);
> >   // add new page to already drained pcp list
> >
> > Thread#2
> > Never drains pcp again, and therefore gets stuck in the loop.
> >
> > The fix is to try to drain per-cpu lists again after
> > check_pages_isolated_cb() fails.
>
> But this means that the page is not isolated and so it could be reused
> for something else. No?

The page is in a movable zone, has zero references, and the section is
isolated (i.e. set_pageblock_migratetype(page, MIGRATE_ISOLATE);) is
set. The page should be offlinable, but it is lost in a pcp list as
that list is never drained again after the first failure to migrate
all pages in the range.

>
> > Signed-off-by: Pavel Tatashin 
> > Cc: sta...@vger.kernel.org
> > ---
> >  mm/memory_hotplug.c | 9 +
> >  1 file changed, 9 insertions(+)
> >
> > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> > index e9d5ab5d3ca0..d6d54922bfce 100644
> > --- a/mm/memory_hotplug.c
> > +++ b/mm/memory_hotplug.c
> > @@ -1575,6 +1575,15 @@ static int __ref __offline_pages(unsigned long 
> > start_pfn,
> >   /* check again */
> >   ret = walk_system_ram_range(start_pfn, end_pfn - start_pfn,
> >   NULL, check_pages_isolated_cb);
> > + /*
> > +  * per-cpu pages are drained in start_isolate_page_range, but 
> > if
> > +  * there are still pages that are not free, make sure that we
> > +  * drain again, because when we isolated range we might
> > +  * have raced with another thread that was adding pages to
> > +  * pcp list.
> > +  */
> > + if (ret)
> > + drain_all_pages(zone);
> >   } while (ret);
> >
> >   /* Ok, all of our target is isolated.
> > --
> > 2.25.1
> >
>
> --
> Michal Hocko
> SUSE Labs


[PATCH v5 0/3] mfd: lp87565: convert DT to yaml and add LP87524-Q1

2020-09-02 Thread Luca Ceresoli
Hi,

the following patches are a fairly straightforward addition of a new chip
variant along with DT bindings conversion to yaml.

v5 adds the description of the "regulators" DT node and has smaller
improvements to the bindings. No changes to the driver since v2.

RFC,v1: https://lkml.org/lkml/2020/6/3/908
v2: https://lkml.org/lkml/2020/6/17/492
v3: https://lkml.org/lkml/2020/6/22/1139
v4: https://lkml.org/lkml/2020/8/17/830

Luca

Luca Ceresoli (3):
  dt-bindings: mfd: lp87565: convert to yaml
  dt-bindings: mfd: add LP87524-Q1
  mfd: lp87565: add LP87524-Q1 variant

 .../devicetree/bindings/mfd/lp87565.txt   |  79 
 .../bindings/mfd/ti,lp87524-q1.yaml   | 112 ++
 .../bindings/mfd/ti,lp87561-q1.yaml   |  83 +
 .../bindings/mfd/ti,lp87565-q1.yaml   | 101 
 drivers/mfd/lp87565.c |   4 +
 include/linux/mfd/lp87565.h   |   1 +
 6 files changed, 301 insertions(+), 79 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/lp87565.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87524-q1.yaml
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87561-q1.yaml
 create mode 100644 Documentation/devicetree/bindings/mfd/ti,lp87565-q1.yaml

-- 
2.28.0



[PATCH 17/19] sr: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call sr_block_revalidate_disk manually.  Also add an explicit call to
sr_block_revalidate_disk just before disk_add() to ensure we always
read check for a ready unit and read the TOC and then stop wiring up
->revalidate_disk.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/sr.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 3b3a53c6a0de53..34be94b62523fa 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -86,6 +86,7 @@ static int sr_remove(struct device *);
 static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt);
 static int sr_done(struct scsi_cmnd *);
 static int sr_runtime_suspend(struct device *dev);
+static int sr_block_revalidate_disk(struct gendisk *disk);
 
 static const struct dev_pm_ops sr_pm_ops = {
.runtime_suspend= sr_runtime_suspend,
@@ -529,7 +530,8 @@ static int sr_block_open(struct block_device *bdev, fmode_t 
mode)
 
sdev = cd->device;
scsi_autopm_get_device(sdev);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   sr_block_revalidate_disk(bdev->bd_disk);
 
mutex_lock(>lock);
ret = cdrom_open(>cdi, bdev, mode);
@@ -688,7 +690,6 @@ static const struct block_device_operations sr_bdops =
.compat_ioctl   = sr_block_compat_ioctl,
 #endif
.check_events   = sr_block_check_events,
-   .revalidate_disk = sr_block_revalidate_disk,
 };
 
 static int sr_open(struct cdrom_device_info *cdi, int purpose)
@@ -802,6 +803,7 @@ static int sr_probe(struct device *dev)
 
dev_set_drvdata(dev, cd);
disk->flags |= GENHD_FL_REMOVABLE;
+   sr_block_revalidate_disk(disk);
device_add_disk(>sdev_gendev, disk, NULL);
 
sdev_printk(KERN_DEBUG, sdev,
-- 
2.28.0



[PATCH 07/19] swim3: use bdev_check_media_changed

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_changed instead of check_disk_change and
call floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/swim3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index aa77eb5fb7de88..c2d922d125e281 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -945,7 +945,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
 
if (err == 0 && (mode & FMODE_NDELAY) == 0
&& (mode & (FMODE_READ|FMODE_WRITE))) {
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (fs->ejected)
err = -ENXIO;
}
@@ -1055,7 +1056,6 @@ static const struct block_device_operations floppy_fops = 
{
.release= floppy_release,
.ioctl  = floppy_ioctl,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 };
 
 static const struct blk_mq_ops swim3_mq_ops = {
-- 
2.28.0



[PATCH 10/19] paride/pcd: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
The pcd driver does not have a ->revalidate_disk method, so it can just
use bdev_check_media_change without any additional changes.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/paride/pcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 5124eca90e8337..70da8b86ce587d 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -233,7 +233,7 @@ static int pcd_block_open(struct block_device *bdev, 
fmode_t mode)
struct pcd_unit *cd = bdev->bd_disk->private_data;
int ret;
 
-   check_disk_change(bdev);
+   bdev_check_media_change(bdev);
 
mutex_lock(_mutex);
ret = cdrom_open(>info, bdev, mode);
-- 
2.28.0



include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context imbalance in 'dn_socket_seq_next' - unexpected unlock

2020-09-02 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   9c7d619be5a002ea29c172df5e3c1227c22cbb41
commit: a4654e9bde4ecedb4921e6c8fe2088114bdff1b3 Merge branch 'x86/kdump' into 
locking/kcsan, to resolve conflicts
date:   6 months ago
config: arm64-randconfig-s031-20200902 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
git checkout a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

   net/decnet/af_decnet.c:249:22: sparse: sparse: incorrect type in assignment 
(different base types) @@ expected unsigned int hash @@ got restricted 
__le16 [usertype] sdn_objnamel @@
   net/decnet/af_decnet.c:249:22: sparse: expected unsigned int hash
   net/decnet/af_decnet.c:249:22: sparse: got restricted __le16 [usertype] 
sdn_objnamel
   net/decnet/af_decnet.c: note: in included file:
   include/net/dn.h:192:24: sparse: sparse: incorrect type in assignment 
(different base types) @@ expected restricted __be16 [usertype] sport @@
 got restricted __le16 [usertype] addrloc @@
   include/net/dn.h:192:24: sparse: expected restricted __be16 [usertype] 
sport
   include/net/dn.h:192:24: sparse: got restricted __le16 [usertype] addrloc
   include/net/dn.h:193:24: sparse: sparse: incorrect type in assignment 
(different base types) @@ expected restricted __be16 [usertype] dport @@
 got restricted __le16 [usertype] addrrem @@
   include/net/dn.h:193:24: sparse: expected restricted __be16 [usertype] 
dport
   include/net/dn.h:193:24: sparse: got restricted __le16 [usertype] addrrem
   net/decnet/af_decnet.c:2159:13: sparse: sparse: context imbalance in 
'dn_socket_get_idx' - wrong count at exit
   net/decnet/af_decnet.c: note: in included file (through 
arch/arm64/include/asm/atomic.h, include/linux/atomic.h, 
include/asm-generic/bitops/atomic.h, ...):
>> include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context 
>> imbalance in 'dn_socket_seq_next' - unexpected unlock
>> include/asm-generic/atomic-instrumented.h:193:29: sparse: sparse: context 
>> imbalance in 'dn_socket_seq_stop' - unexpected unlock

# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a4654e9bde4ecedb4921e6c8fe2088114bdff1b3
vim +/dn_socket_seq_next +193 include/asm-generic/atomic-instrumented.h

aa525d063851a9 Mark Rutland 2018-09-04  188  
aa525d063851a9 Mark Rutland 2018-09-04  189  #if 
defined(arch_atomic_sub_return_release)
c020395b6634b7 Marco Elver  2019-11-26  190  static __always_inline int
aa525d063851a9 Mark Rutland 2018-09-04  191  atomic_sub_return_release(int i, 
atomic_t *v)
aa525d063851a9 Mark Rutland 2018-09-04  192  {
e75a6795ed132f Marco Elver  2019-11-14 @193 __atomic_check_write(v, 
sizeof(*v));
aa525d063851a9 Mark Rutland 2018-09-04  194 return 
arch_atomic_sub_return_release(i, v);
aa525d063851a9 Mark Rutland 2018-09-04  195  }
aa525d063851a9 Mark Rutland 2018-09-04  196  #define atomic_sub_return_release 
atomic_sub_return_release
aa525d063851a9 Mark Rutland 2018-09-04  197  #endif
aa525d063851a9 Mark Rutland 2018-09-04  198  

:: The code at line 193 was first introduced by commit
:: e75a6795ed132f26f69d08dea958630d5993056d locking/atomics, kcsan: Add 
KCSAN instrumentation

:: TO: Marco Elver 
:: CC: Paul E. McKenney 

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


.config.gz
Description: application/gzip


Re: [PATCH v2 00/28] The new cgroup slab memory controller

2020-09-02 Thread Pavel Tatashin
> > This is how we are using it at Microsoft: there is  a very large
> > number of small memory machines (8G each) with low downtime
> > requirements (reboot must be under a second). There is also a large
> > state ~2G of memory that we need to transfer during reboot, otherwise
> > it is very expensive to recreate the state. We have 2G of system
> > memory memory reserved as a pmem in the device tree, and use it to
> > pass information across reboots. Once the information is not needed we
> > hot-add that memory and use it during runtime, before shutdown we
> > hot-remove the 2G, save the program state on it, and do the reboot.
>
> I still do not get it. So what does guarantee that the memory is
> offlineable in the first place?

It is in a movable zone, and we have more than 2G of free memory for
successful migrations.

> Also what is the difference between
> offlining and simply shutting the system down so that the memory is not
> used in the first place. In other words what kind of difference
> hotremove makes?

For performance reasons during system updates/reboots we do not erase
memory content. The memory content is erased only on power cycle,
which we do not do in production.

Once we hot-remove the memory, we convert it back into DAXFS PMEM
device, format it into EXT4, mount it as DAX file system, and allow
programs to serialize their states to it so they can read it back
after the reboot.

During startup we mount pmem, programs read the state back, and after
that we hotplug the PMEM DAX as a movable zone. This way during normal
runtime we have 8G available to programs.

Pasha


[PATCH v1] regmap: Add can_sleep configuration option

2020-09-02 Thread Dmitry Osipenko
Regmap can't sleep if spinlock is used for the locking protection.
This patch fixes regression caused by a previous commit that switched
regmap to use fsleep() and this broke Amlogic S922X platform.

This patch adds new configuration option for regmap users, allowing to
specify whether regmap operations can sleep and assuming that sleep is
allowed if mutex is used for the regmap locking protection.

Reported-by: Marek Szyprowski 
Fixes: 2b32d2f7ce0a ("regmap: Use flexible sleep")
Signed-off-by: Dmitry Osipenko 
---
 drivers/base/regmap/internal.h |  3 +++
 drivers/base/regmap/regmap.c   | 19 +++
 include/linux/regmap.h |  3 +++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index 3d80c4b43f72..8a59359e145f 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -161,6 +161,9 @@ struct regmap {
void *selector_work_buf;/* Scratch buffer used for selector */
 
struct hwspinlock *hwlock;
+
+   /* if set, the regmap core can sleep */
+   bool can_sleep;
 };
 
 struct regcache_ops {
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index a417cb1a11dc..2807e544658e 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -697,11 +697,13 @@ struct regmap *__regmap_init(struct device *dev,
 
if (config->disable_locking) {
map->lock = map->unlock = regmap_lock_unlock_none;
+   map->can_sleep = config->can_sleep;
regmap_debugfs_disable(map);
} else if (config->lock && config->unlock) {
map->lock = config->lock;
map->unlock = config->unlock;
map->lock_arg = config->lock_arg;
+   map->can_sleep = config->can_sleep;
} else if (config->use_hwlock) {
map->hwlock = hwspin_lock_request_specific(config->hwlock_id);
if (!map->hwlock) {
@@ -737,6 +739,7 @@ struct regmap *__regmap_init(struct device *dev,
mutex_init(>mutex);
map->lock = regmap_lock_mutex;
map->unlock = regmap_unlock_mutex;
+   map->can_sleep = true;
lockdep_set_class_and_name(>mutex,
   lock_key, lock_name);
}
@@ -2230,8 +2233,12 @@ static int _regmap_range_multi_paged_reg_write(struct 
regmap *map,
if (ret != 0)
return ret;
 
-   if (regs[i].delay_us)
-   fsleep(regs[i].delay_us);
+   if (regs[i].delay_us) {
+   if (map->can_sleep)
+   fsleep(regs[i].delay_us);
+   else
+   udelay(regs[i].delay_us);
+   }
 
base += n;
n = 0;
@@ -2267,8 +2274,12 @@ static int _regmap_multi_reg_write(struct regmap *map,
if (ret != 0)
return ret;
 
-   if (regs[i].delay_us)
-   fsleep(regs[i].delay_us);
+   if (regs[i].delay_us) {
+   if (map->can_sleep)
+   fsleep(regs[i].delay_us);
+   else
+   udelay(regs[i].delay_us);
+   }
}
return 0;
}
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index d865d8fea535..0c49d59168b5 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -342,6 +342,7 @@ typedef void (*regmap_unlock)(void *);
  * @hwlock_id: Specify the hardware spinlock id.
  * @hwlock_mode: The hardware spinlock mode, should be HWLOCK_IRQSTATE,
  *  HWLOCK_IRQ or 0.
+ * @can_sleep: Optional, specifies whether regmap operations can sleep.
  */
 struct regmap_config {
const char *name;
@@ -398,6 +399,8 @@ struct regmap_config {
bool use_hwlock;
unsigned int hwlock_id;
unsigned int hwlock_mode;
+
+   bool can_sleep;
 };
 
 /**
-- 
2.27.0



[PATCH 16/19] sd: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call cd_revalidate_disk manually.  As sd also calls sd_revalidate_disk
manually during probe and open, , the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/scsi/sd.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2bec8cd526164d..d020639c28c6ca 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1381,8 +1381,10 @@ static int sd_open(struct block_device *bdev, fmode_t 
mode)
if (!scsi_block_when_processing_errors(sdev))
goto error_out;
 
-   if (sdev->removable || sdkp->write_prot)
-   check_disk_change(bdev);
+   if (sdev->removable || sdkp->write_prot) {
+   if (bdev_check_media_change(bdev))
+   sd_revalidate_disk(bdev->bd_disk);
+   }
 
/*
 * If the drive is empty, just let the open fail.
@@ -1843,7 +1845,6 @@ static const struct block_device_operations sd_fops = {
.compat_ioctl   = sd_compat_ioctl,
 #endif
.check_events   = sd_check_events,
-   .revalidate_disk= sd_revalidate_disk,
.unlock_native_capacity = sd_unlock_native_capacity,
.report_zones   = sd_zbc_report_zones,
.pr_ops = _pr_ops,
-- 
2.28.0



[PATCH 02/19] amiflop: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
The Amiga floppy driver does not have a ->revalidate_disk method, so it
can just use bdev_check_media_change without any additional changes.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/amiflop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 226219da3da6a7..71c2b156455860 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1670,7 +1670,7 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
}
 
if (mode & (FMODE_READ|FMODE_WRITE)) {
-   check_disk_change(bdev);
+   bdev_check_media_change(bdev);
if (mode & FMODE_WRITE) {
int wrprot;
 
-- 
2.28.0



[PATCH 04/19] floppy: use bdev_check_media_change

2020-09-02 Thread Christoph Hellwig
Switch to use bdev_check_media_change instead of check_disk_change and
call floppy_revalidate manually.  Given that floppy_revalidate only
deals with media change events, the extra call into ->revalidate_disk
from bdev_disk_changed is not required either, so stop wiring up the
method.

Signed-off-by: Christoph Hellwig 
---
 drivers/block/floppy.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index a563b023458a8b..7df79ae6b0a1e1 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -561,6 +561,7 @@ static void floppy_release_irq_and_dma(void);
  * output_byte is automatically disabled when reset is set.
  */
 static void reset_fdc(void);
+static int floppy_revalidate(struct gendisk *disk);
 
 /*
  * These are global variables, as that's the easiest way to give
@@ -3275,7 +3276,8 @@ static int invalidate_drive(struct block_device *bdev)
/* invalidate the buffer track to force a reread */
set_bit((long)bdev->bd_disk->private_data, _change);
process_fd_request();
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
return 0;
 }
 
@@ -4123,7 +4125,8 @@ static int floppy_open(struct block_device *bdev, fmode_t 
mode)
drive_state[drive].last_checked = 0;
clear_bit(FD_OPEN_SHOULD_FAIL_BIT,
  _state[drive].flags);
-   check_disk_change(bdev);
+   if (bdev_check_media_change(bdev))
+   floppy_revalidate(bdev->bd_disk);
if (test_bit(FD_DISK_CHANGED_BIT, 
_state[drive].flags))
goto out;
if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, 
_state[drive].flags))
@@ -4291,7 +4294,6 @@ static const struct block_device_operations floppy_fops = 
{
.ioctl  = fd_ioctl,
.getgeo = fd_getgeo,
.check_events   = floppy_check_events,
-   .revalidate_disk= floppy_revalidate,
 #ifdef CONFIG_COMPAT
.compat_ioctl   = fd_compat_ioctl,
 #endif
-- 
2.28.0



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