Re: [PATCH] scripts: stable: add script to validate backports

2021-03-24 Thread Greg Kroah-Hartman
On Tue, Mar 23, 2021 at 01:28:38PM -0700, Nick Desaulniers wrote:
> On Tue, Mar 23, 2021 at 12:05 PM Greg Kroah-Hartman
>  wrote:
> >
> > The only time git gets involved is when we do a -rc release or when we
> > do a "real" release, and then we use 'git quiltimport' on the whole
> > stack.
> >
> > Here's a script that I use (much too slow, I know), for checking this
> > type of thing and I try to remember to run it before every cycle of -rc
> > releases:
> > 
> > https://github.com/gregkh/commit_tree/blob/master/find_fixes_in_queue
> >
> > It's a hack, and picks up more things than is really needed, but I would
> > rather it error on that side than the other.
> 
> Yes, my script is similar.  Looks like yours also runs on a git tree.
> 
> I noticed that id_fixed_in runs `git grep -l --threads=3 ` to
> find fixes; that's neat, I didn't know about `--threads=`.  I tried it
> with ae46578b963f manually:
> 
> $ git grep -l --threads=3 ae46578b963f
> $
> 
> Should it have found a7889c6320b9 and 773e0c402534?  Perhaps `git log
> --grep=` should be used instead?  I thought `git grep` only greps
> files in the archive, not commit history?

Yes, it does only grep the files in the archive.

But look closer at the archive that this script lives in :)

This archive is a "blown up" copy of the Linux kernel tree, with one
file per commit.  The name of the file is the commit id, and the content
of the file is the changelog of the commit itself.

So it's a hack that I use to be able to simply search the changelogs of
all commits to find out if they have a "Fixes:" tag with a specific
commit id in it.

So in your example above, in the repo I run it and get:

~/linux/stable/commit_tree $ git grep -l --threads=3 ae46578b963f
changes/5.2/773e0c40253443e0ce5491cb0e414b62f7cc45ed
ids/5.2

Which shows me that in commit 773e0c402534 ("afs: Fix
afs_xattr_get_yfs() to not try freeing an error value") in the kernel
tree, it has a "Fixes:" tag that references "ae46578b963f".

It also shows me that commit ae46578b963f was contained in the 5.2
kernel release, as I use the "ids/" subdirectory here for other fast
lookups (it's a tiny bit faster than 'git describe --contains').

I don't know how your script is walking through all possible commits to
see if they are fixing a specific one, maybe I should look and see if
it's doing it better than my "git tree/directory as a database hack"
does :)

thanks,

greg k-h


Re: [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge

2021-03-24 Thread Laurent Pinchart
Hi Jagan,

On Wed, Mar 24, 2021 at 03:19:10PM +0530, Jagan Teki wrote:
> On Wed, Mar 24, 2021 at 3:09 PM Laurent Pinchart wrote:
> > On Wed, Mar 24, 2021 at 02:44:57PM +0530, Jagan Teki wrote:
> > > On Wed, Mar 24, 2021 at 8:18 AM Samuel Holland wrote:
> > > > On 3/23/21 5:53 PM, Laurent Pinchart wrote:
> > > > > On Mon, Mar 22, 2021 at 07:31:49PM +0530, Jagan Teki wrote:
> > > > >> Replace of_drm_find_panel with drm_of_find_panel_or_bridge
> > > > >> for finding panel, this indeed help to find the bridge if
> > > > >> bridge support added.
> > > > >>
> > > > >> Added NULL in bridge argument, same will replace with bridge
> > > > >> parameter once bridge supported.
> > > > >>
> > > > >> Signed-off-by: Jagan Teki 
> > > > >
> > > > > Looks good, there should be no functional change.
> > > >
> > > > Actually this breaks all existing users of this driver, see below.
> > > >
> > > > > Reviewed-by: Laurent Pinchart 
> > > > >
> > > > >> ---
> > > > >> Changes for v4, v3:
> > > > >> - none
> > > > >>
> > > > >>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ---
> > > > >>  1 file changed, 8 insertions(+), 3 deletions(-)
> > > > >>
> > > > >> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > > >> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > >> index 4f5efcace68e..2e9e7b2d4145 100644
> > > > >> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > >> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > >> @@ -21,6 +21,7 @@
> > > > >>
> > > > >>  #include 
> > > > >>  #include 
> > > > >> +#include 
> > > > >>  #include 
> > > > >>  #include 
> > > > >>  #include 
> > > > >> @@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct 
> > > > >> mipi_dsi_host *host,
> > > > >>  struct mipi_dsi_device *device)
> > > > >>  {
> > > > >>  struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
> > > > >> -struct drm_panel *panel = 
> > > > >> of_drm_find_panel(device->dev.of_node);
> > > >
> > > > This is using the OF node of the DSI device, which is a direct child of
> > > > the DSI host's OF node. There is no OF graph involved.
> > > >
> > > > >> +struct drm_panel *panel;
> > > > >> +int ret;
> > > > >> +
> > > > >> +ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
> > > > >> +  &panel, NULL);
> > > >
> > > > However, this function expects to find the panel using OF graph. This
> > > > does not work with existing device trees (PinePhone, PineTab) which do
> > > > not use OF graph to connect the panel. And it cannot work, because the
> > > > DSI host's binding specifies a single port: the input port from the
> > > > display engine.
> > >
> > > Thanks for noticing this. I did understand your point and yes, I did
> > > mention the updated pipeline in previous versions and forgot to add it
> > > to this series.
> > >
> > > Here is the updated pipeline to make it work:
> > >
> > > https://patchwork.kernel.org/project/dri-devel/patch/20190524104252.20236-1-ja...@amarulasolutions.com/
> > >
> > > Let me know your comments on this, so I will add a patch for the
> > > above-affected DTS files.
> >
> > DT is an ABI, we need to ensure backward compatibility. Changes in
> > kernel drivers can't break devices that have an old DT.
> 
> Thanks for your point.
> 
> So, we need to choose APIs that would compatible with the old DT and
> new DT changes. Am I correct?

Yes, that's correct.

-- 
Regards,

Laurent Pinchart


Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread Enric Balletbo i Serra
Hi Elaine,

This is not the exact version I sent, and you reintroduced a "problem" that were
already solved/discussed on previous versions. See below:

On 24/3/21 8:16, Elaine Zhang wrote:
> Convert the soc/rockchip/power_domain.txt binding document to
> json-schema and move to the power bindings directory.
> 
> Signed-off-by: Enric Balletbo i Serra 

If you do significant is a good practice shortly describe them within [] here.

> Signed-off-by: Elaine Zhang 

Note that my last version already had the

Reviewed-by: Rob Herring 

Which should be fine for merging (with probably only minor changes) and you
could maintain if you don't do significant changes, but that's not the case, as
I said, you are reintroducing one problem. Please review the comments already
received on this patchset or similar patchsets to avoid this.

> ---
>  .../power/rockchip,power-controller.yaml  | 284 ++
>  .../bindings/soc/rockchip/power_domain.txt| 136 -
>  2 files changed, 284 insertions(+), 136 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>  delete mode 100644 
> Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml 
> b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
> new file mode 100644
> index ..a220322c5139
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
> @@ -0,0 +1,284 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Rockchip Power Domains
> +
> +maintainers:
> +  - Elaine Zhang 
> +  - Rob Herring 

Up to Rob, but I don't think Rob would like to be the maintainer. I think you
can only include yourself and Heiko.


> +  - Heiko Stuebner 
> +
> +description: |
> +  Rockchip processors include support for multiple power domains which can be
> +  powered up/down by software based on different application scenarios to 
> save power.
> +
> +  Power domains contained within power-controller node are generic power 
> domain
> +  providers documented in 
> Documentation/devicetree/bindings/power/power-domain.yaml.
> +
> +  IP cores belonging to a power domain should contain a "power-domains"
> +  property that is a phandle for the power domain node representing the 
> domain.
> +
> +properties:
> +  $nodename:
> +const: power-controller
> +
> +  compatible:
> +enum:
> +  - rockchip,px30-power-controller
> +  - rockchip,rk3036-power-controller
> +  - rockchip,rk3066-power-controller
> +  - rockchip,rk3128-power-controller
> +  - rockchip,rk3188-power-controller
> +  - rockchip,rk3228-power-controller
> +  - rockchip,rk3288-power-controller
> +  - rockchip,rk3328-power-controller
> +  - rockchip,rk3366-power-controller
> +  - rockchip,rk3368-power-controller
> +  - rockchip,rk3399-power-controller
> +
> +  "#power-domain-cells":
> +const: 1
> +
> +  "#address-cells":
> +const: 1
> +
> +  "#size-cells":
> +const: 0
> +
> +patternProperties:
> +  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
> +type: object
> +description: |
> +  Represents the power domains within the power controller node as 
> documented
> +  in Documentation/devicetree/bindings/power/power-domain.yaml.
> +

The node names must be generic, as this is power-domain must be in the form:

+patternProperties:
+  "^power-domain@[0-9a-f]+$":


> +properties:
> +
> +  "#power-domain-cells":
> +description:
> +  Must be 0 for nodes representing a single PM domain and 1 for nodes
> +  providing multiple PM domains.
> +
> +  "#address-cells":
> +const: 1
> +
> +  "#size-cells":
> +const: 0
> +
> +  reg:
> +maxItems: 1
> +description: |
> +  Power domain index. Valid values are defined in
> +  "include/dt-bindings/power/px30-power.h"
> +  "include/dt-bindings/power/rk3036-power.h"
> +  "include/dt-bindings/power/rk3066-power.h"
> +  "include/dt-bindings/power/rk3128-power.h"
> +  "include/dt-bindings/power/rk3188-power.h"
> +  "include/dt-bindings/power/rk3228-power.h"
> +  "include/dt-bindings/power/rk3288-power.h"
> +  "include/dt-bindings/power/rk3328-power.h"
> +  "include/dt-bindings/power/rk3366-power.h"
> +  "include/dt-bindings/power/rk3368-power.h"
> +  "include/dt-bindings/power/rk3399-power.h"
> +
> +  clocks:
> +description: |
> +  A number of phandles to clocks that need to be enabled while power 
> domain
> +  switches state.
> +
> +  pm_qos:
> +description: |
> +  A number of phandles to qos blocks which need to be saved and 
> restored
> 

Re: [RFC PATCH 1/2] mm,drm/ttm: Block fast GUP to TTM huge pages

2021-03-24 Thread Daniel Vetter
On Tue, Mar 23, 2021 at 06:06:53PM +0100, Thomas Hellström (Intel) wrote:
> 
> On 3/23/21 5:37 PM, Jason Gunthorpe wrote:
> > On Tue, Mar 23, 2021 at 05:34:51PM +0100, Thomas Hellström (Intel) wrote:
> > 
> > > > > @@ -210,6 +211,20 @@ static vm_fault_t ttm_bo_vm_insert_huge(struct 
> > > > > vm_fault *vmf,
> > > > >   if ((pfn & (fault_page_size - 1)) != 0)
> > > > >   goto out_fallback;
> > > > > + /*
> > > > > +  * Huge entries must be special, that is marking them as devmap
> > > > > +  * with no backing device map range. If there is a backing
> > > > > +  * range, Don't insert a huge entry.
> > > > > +  * If this check turns out to be too much of a performance hit,
> > > > > +  * we can instead have drivers indicate whether they may have
> > > > > +  * backing device map ranges and if not, skip this lookup.
> > > > > +  */
> > > > I think we can do this statically:
> > > > - if it's system memory we know there's no devmap for it, and we do the
> > > > trick to block gup_fast
> > > Yes, that should work.
> > > > - if it's iomem, we know gup_fast wont work anyway if don't set PFN_DEV,
> > > > so might as well not do that
> > > I think gup_fast will unfortunately mistake a huge iomem page for an
> > > ordinary page and try to access a non-existant struct page for it, unless 
> > > we
> > > do the devmap trick.
> > > 
> > > And the lookup would then be for the rare case where a driver would have
> > > already registered a dev_pagemap for an iomem area which may also be 
> > > mapped
> > > through TTM (like the patch from Felix a couple of weeks ago). If a driver
> > > can promise not to do that, then we can safely remove the lookup.
> > Isn't the devmap PTE flag arch optional? Does this fall back to not
> > using huge pages on arches that don't support it?
> 
> Good point. No, currently it's only conditioned on transhuge page support.
> Need to condition it on also devmap support.
> 
> > 
> > Also, I feel like this code to install "pte_special" huge pages does
> > not belong in the drm subsystem..
> 
> I could add helpers in huge_memory.c:
> 
> vmf_insert_pfn_pmd_prot_special() and
> vmf_insert_pfn_pud_prot_special()

The somewhat annoying thing is that we'd need an error code so we fall
back to pte fault handling. That's at least my understanding of how
pud/pmd fault handling works. Not sure how awkward that is going to be
with the overall fault handling flow.

But aside from that I think this makes tons of sense.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH v2 04/12] module: Add printk format to add module build ID to stacktraces

2021-03-24 Thread Rasmus Villemoes
On 24/03/2021 03.04, Stephen Boyd wrote:

> @@ -2778,6 +2793,10 @@ static inline void layout_symtab(struct module *mod, 
> struct load_info *info)
>  static void add_kallsyms(struct module *mod, const struct load_info *info)
>  {
>  }
> +
> +static void init_build_id(struct module *mod, const struct load_info *info)
> +{
> +}
>  #endif /* CONFIG_KALLSYMS */
>  
>  static void dynamic_debug_setup(struct module *mod, struct _ddebug *debug, 
> unsigned int num)
> @@ -4004,6 +4023,7 @@ static int load_module(struct load_info *info, const 
> char __user *uargs,
>   goto free_arch_cleanup;
>   }
>  
> + init_build_id(mod, info);
>   dynamic_debug_setup(mod, info->debug, info->num_debug);
>  
>   /* Ftrace init must be called in the MODULE_STATE_UNFORMED state */
> @@ -4235,7 +4255,7 @@ void * __weak 
> dereference_module_function_descriptor(struct module *mod,
>  const char *module_address_lookup(unsigned long addr,
>   unsigned long *size,
>   unsigned long *offset,
> - char **modname,
> + char **modname, unsigned char **modbuildid,

It's an existing defect with modname, but surely this should take a
"const unsigned char **modbuildid", no?

>   char *namebuf)
>  {
>   const char *ret = NULL;
> @@ -4246,6 +4266,8 @@ const char *module_address_lookup(unsigned long addr,
>   if (mod) {
>   if (modname)
>   *modname = mod->name;
> + if (modbuildid)
> + *modbuildid = mod->build_id;
>  
>   ret = find_kallsyms_symbol(mod, addr, size, offset);
>   }
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 41ddc353ebb8..9cd62e84e4aa 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -961,13 +961,15 @@ char *symbol_string(char *buf, char *end, void *ptr,
>   char sym[KSYM_SYMBOL_LEN];
>  #endif
>  
> - if (fmt[1] == 'R')
> + if (fmt[1] == 'R' || fmt[1] == 'r')
>   ptr = __builtin_extract_return_addr(ptr);
>   value = (unsigned long)ptr;
>  
>  #ifdef CONFIG_KALLSYMS
>   if (*fmt == 'B')
>   sprint_backtrace(sym, value);
> + else if (*fmt == 'S' && (fmt[1] == 'b' || fmt[1] == 'r'))
> + sprint_symbol_stacktrace(sym, value);
>   else if (*fmt != 's')
>   sprint_symbol(sym, value);
>   else
> @@ -2129,6 +2131,8 @@ early_param("no_hash_pointers", 
> no_hash_pointers_enable);
>   * - 'S' For symbolic direct pointers (or function descriptors) with offset
>   * - 's' For symbolic direct pointers (or function descriptors) without 
> offset
>   * - '[Ss]R' as above with __builtin_extract_return_addr() translation
> + * - '[Ss]r' as above with __builtin_extract_return_addr() translation and 
> module build ID
> + * - '[Ss]b' as above with module build ID (for use in backtraces)

The code doesn't quite match the comment. The lowercase s is not handled
(i.e., there's no way to say "without offset, with build ID"). You don't
have to fix the code to support that right now, the whole kallsyms
vsprintf code needs to be reworked inside-out anyway (having vsnprint
call sprint_symbol* which builds the output using snprintf() calls makes
me cringe), so please just replace [Ss] by S to make the comment match
the code - I notice that you did only document the S variant in
printk-formats.rst.

Is there any reason you didn't just make b an optional flag that could
be specified with or without R? I suppose the parsing is more difficult
with several orthogonal flags (see escaped_string()), but it's a little
easier to understand. Dunno, it's not like we're gonna think of 10 other
things that could be printed for a symbol, so perhaps it's fine.

Rasmus


Re: [kbuild-all] Re: include/linux/compiler_types.h:315:38: error: call to '__compiletime_assert_536' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct can_frame, len) != offsetof(st

2021-03-24 Thread Marc Kleine-Budde
On 24.03.2021 10:09:22, Oliver Hartkopp wrote:
> @Marc: Looks like we can not get around the __packed() fix :-(
> 
> At least we now have some more documentation to be referenced and I would
> suggest to point out that some compilers handle the union alignment like
> this.

It's not the compiler, but the ABI.

> To make clear in the comments what we are suppressing here any why.

Feel free to post an updated patch description.

Marc

-- 
Pengutronix e.K. | Marc Kleine-Budde   |
Embedded Linux   | https://www.pengutronix.de  |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917- |


signature.asc
Description: PGP signature


Re: CHECKPATCH: missing a warning soon after include files decl -c

2021-03-24 Thread Fabio Aiuto
On Sat, Mar 20, 2021 at 04:28:51AM -0700, Joe Perches wrote:
> 
> Actually, these would seem to be better as one or multiple functions with
> local statics or even as static inlines functions in the .h file
> 
> $ git grep -w RTW_WPA_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c:if (!memcmp(RTW_WPA_OUI, oui, 
> 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char RTW_WPA_OUI[] = 
> {0x00, 0x50, 0xf2, 0x01};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:  if 
> ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c:extern unsigned char 
> RTW_WPA_OUI[];
> drivers/staging/rtl8723bs/core/rtw_wlan_util.c: if 
> ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) && (!memcmp((pIE->data + 12), 
> WPA_TKIP_CIPHER, 4)))
> 
> $ git grep -w WMM_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WMM_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c:else if (!memcmp(WMM_OUI, 
> oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WMM_OUI[] = 
> {0x00, 0x50, 0xf2, 0x02};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:
>   (!memcmp(pIE->data, WMM_OUI, 4)) ||
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:  if 
> (!memcmp(pIE->data, WMM_OUI, 4))
> drivers/staging/rtl8723bs/include/rtw_mlme_ext.h:extern unsigned char 
> WMM_OUI[];
> 
> $ git grep -w WPS_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char WPS_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c:else if (!memcmp(WPS_OUI, 
> oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char WPS_OUI[] = 
> {0x00, 0x50, 0xf2, 0x04};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:
>   (!memcmp(pIE->data, WPS_OUI, 4))) {
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:  if 
> ((!padapter->registrypriv.wifi_spec) && (!memcmp(pIE->data, WPS_OUI, 4))) {
> 
> $ git grep -w P2P_OUI drivers/staging/rtl8723bs/core
> drivers/staging/rtl8723bs/core/rtw_ap.c:extern unsigned char P2P_OUI[];
> drivers/staging/rtl8723bs/core/rtw_ap.c:else if (!memcmp(P2P_OUI, 
> oui, 4))
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:unsigned char P2P_OUI[] = 
> {0x50, 0x6F, 0x9A, 0x09};
> drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:  if (!memcmp(frame_body + 2, 
> P2P_OUI, 4)) {
> 
> So maybe something like the below (written in email client, maybe typos)
> 
> enum oui_type {
>   RTW_WPA,
>   WMM,
>   WPS,
>   P2P
> };
> 
> bool is_oui_type(const u8 *mem, enum oui_type type)
> {
>   static const u8 rtw_wpa[] = {0x00, 0x50, 0xf2, 0x01};
>   static const u8 wmm[] = {0x00, 0x50, 0xf2, 0x02};
>   static const u8 wps[] = {0x00, 0x50, 0xf2, 0x04};
>   static const u8 p2p[] = {0x50, 0x6F, 0x9A, 0x09};
> 
>   const u8 *oui;
> 
>   if (type == RTW_WPA)
>   oui = rtw_wpa;
>   else if (type == WMM)
>   oui = wmm;
>   else if (type == WPS)
>   oui = wps;
>   else if (type == P2P)
>   oui = p2p;
>   else
>   return false;
> 
>   return !memcmp(mem, oui, 4);
> }
> 
> so for instance the P2P uses would become
> 
>   else if (is_oui_type(oui, P2P))
> and
>   if (is_oui_type(frame_body + 2, P2P)) {
> 
> though I think 4 byte OUIs are just odd.
> 
> https://en.wikipedia.org/wiki/Organizationally_unique_identifier
> 
> An organizationally unique identifier (OUI) is a 24-bit number that uniquely 
> identifies a vendor, manufacturer, or other organization.
> 
> 
> 

Hi,

is that good? May I do the same for others ouis? One small inline for each oui 
type instead
of a switch...

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c 
b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 3cd9c61eec99..7d31f359cf37 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1664,7 +1664,7 @@ static void update_bcn_p2p_ie(struct adapter *padapter)
 
 static void update_bcn_vendor_spec_ie(struct adapter *padapter, u8 *oui)
 {
-   if (!memcmp(RTW_WPA_OUI, oui, 4))
+   if (is_rtw_wpa_oui(oui))
update_bcn_wpa_ie(padapter);
 
else if (!memcmp(WMM_OUI, oui, 4))
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 8aadcf72a7ba..e05f70e434a2 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -57,7 +57,6 @@ static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0};
 /**
 OUI definitions for the vendor specific IE
 ***/
-unsigned char RTW_WPA_OUI[] = {0x00, 0x50, 0xf2, 0x01};
 unsigned char WMM_O

Re: [RFC PATCH 1/2] mm,drm/ttm: Block fast GUP to TTM huge pages

2021-03-24 Thread Daniel Vetter
On Tue, Mar 23, 2021 at 09:42:18PM +0100, Thomas Hellström (Intel) wrote:
> 
> On 3/23/21 8:52 PM, Williams, Dan J wrote:
> > On Sun, 2021-03-21 at 19:45 +0100, Thomas Hellström (Intel) wrote:
> > > TTM sets up huge page-table-entries both to system- and device
> > > memory,
> > > and we don't want gup to assume there are always valid backing struct
> > > pages for these. For PTEs this is handled by setting the pte_special
> > > bit,
> > > but for the huge PUDs and PMDs, we have neither pmd_special nor
> > > pud_special. Normally, huge TTM entries are identified by looking at
> > > vma_is_special_huge(), but fast gup can't do that, so as an
> > > alternative
> > > define _devmap entries for which there are no backing dev_pagemap as
> > > special, update documentation and make huge TTM entries _devmap,
> > > after
> > > verifying that there is no backing dev_pagemap.
> > Please do not abuse p{m,u}d_devmap like this. I'm in the process of
> > removing get_devpagemap() from the gup-fast path [1]. Instead there
> > should be space for p{m,u}d_special in the page table entries (at least
> > for x86-64). So the fix is to remove that old assumption that huge
> > pages can never be special.
> > 
> > [1]:
> > http://lore.kernel.org/r/161604050866.1463742.7759521510383551055.st...@dwillia2-desk3.amr.corp.intel.com
> > 
> Hmm, yes with that patch it will obviously not work as intended.
> 
> Given that, I think we'll need to disable the TTM huge pages for now until
> we can sort out and agree on using a page table entry bit.

Yeah :-/

I think going full pud/pmd_mkspecial should then also mesh well with
Jason's request to wrap it all up into a vmf_insert_* helper, so at least
it would all look rather pretty in the end.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [syzbot] KASAN: use-after-free Read in disk_part_iter_next (2)

2021-03-24 Thread syzbot
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an 
issue:
KASAN: use-after-free Read in bdgrab

==
BUG: KASAN: use-after-free in bdgrab+0x4c/0x50 fs/block_dev.c:929
Read of size 8 at addr 88801639a2a8 by task syz-executor.0/10133

CPU: 1 PID: 10133 Comm: syz-executor.0 Not tainted 5.12.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
 bdgrab+0x4c/0x50 fs/block_dev.c:929
 first_partition+0xfa/0x230 block/partitions/core.c:538
 blk_drop_partitions+0xb5/0xf0 block/partitions/core.c:555
 bdev_disk_changed+0x238/0x430 fs/block_dev.c:1237
 __loop_clr_fd+0x7c7/0xff0 drivers/block/loop.c:1271
 lo_release+0x1ac/0x1f0 drivers/block/loop.c:1923
 __blkdev_put+0x54e/0x800 fs/block_dev.c:1579
 blkdev_put+0x92/0x580 fs/block_dev.c:1632
 blkdev_close+0x8c/0xb0 fs/block_dev.c:1640
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:140
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:174 [inline]
 exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x41926b
Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 
63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 
44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:7fff13e6a990 EFLAGS: 0293 ORIG_RAX: 0003
RAX:  RBX: 0004 RCX: 0041926b
RDX:  RSI: 0001 RDI: 0003
RBP: 0001 R08:  R09: 001b2fb20070
R10:  R11: 0293 R12: 0056c9e0
R13: 0056c9e0 R14: 0056bf60 R15: 0001383c

Allocated by task 10136:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 __kasan_slab_alloc+0x75/0x90 mm/kasan/common.c:460
 kasan_slab_alloc include/linux/kasan.h:223 [inline]
 slab_post_alloc_hook mm/slab.h:516 [inline]
 slab_alloc_node mm/slub.c:2907 [inline]
 slab_alloc mm/slub.c:2915 [inline]
 kmem_cache_alloc+0x155/0x370 mm/slub.c:2920
 bdev_alloc_inode+0x18/0x80 fs/block_dev.c:786
 alloc_inode+0x61/0x230 fs/inode.c:234
 new_inode_pseudo fs/inode.c:928 [inline]
 new_inode+0x27/0x2f0 fs/inode.c:957
 bdev_alloc+0x20/0x2f0 fs/block_dev.c:876
 add_partition+0x1ab/0x8a0 block/partitions/core.c:348
 bdev_add_partition+0xb6/0x130 block/partitions/core.c:451
 blkpg_do_ioctl+0x2d0/0x340 block/ioctl.c:43
 blkpg_ioctl block/ioctl.c:60 [inline]
 blkdev_ioctl+0x577/0x6d0 block/ioctl.c:548
 block_ioctl+0xf9/0x140 fs/block_dev.c:1658
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 4849:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 kasan_slab_free mm/kasan/common.c:360 [inline]
 kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xf5/0x130 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x92/0x210 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kmem_cache_free+0x8a/0x740 mm/slub.c:3177
 i_callback+0x3f/0x70 fs/inode.c:223
 rcu_do_batch kernel/rcu/tree.c:2559 [inline]
 rcu_core+0x74a/0x12f0 kernel/rcu/tree.c:2794
 __do_softirq+0x29b/0x9f6 kernel/softirq.c:345

Last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345
 __call_rcu kernel/rcu/tree.c:3039 [inline]
 call_rcu+0xb1/0x740 kernel/rcu/tree.c:3114
 destroy_inode+0x129/0x1b0 fs/inode.c:289
 iput_final fs/inode.c:1654 [inline]
 iput.part.0+0x57e/0x810 fs/inode.c:1680
 iput+0x58/0x70 fs/inode.c:1670
 blk_drop_partitions+0x9d/0xf0 block/partitions/core.c:557
 bdev_disk_changed+0x238/0x430 fs/block_dev.c:1237
 loop_reread_partitions+0x29/0x50 drivers/block/loop.c:655
 loop_set_status+0x704/0x1050 drivers/block/loop.c:1418
 loop_set_status64 drivers/block/loop.c:1538 [inline]
 lo_ioctl+0x4ca/0x1620 drivers/block/loop.c:1706
 blkdev_ioctl+0x2a1/0x6d0 block/ioctl.c:583
 block_ioctl+0xf9/0x140 fs/block_dev.c:

Re: [PATCH] i915_vma: Rename vma_lookup to i915_vma_lookup

2021-03-24 Thread Daniel Vetter
On Tue, Mar 23, 2021 at 01:42:21PM +, Liam Howlett wrote:
> Use i915 prefix to avoid name collision with future vma_lookup() in mm.
> 
> Signed-off-by: Liam R. Howlett 
> Reviewed-by: Matthew Wilcox (Oracle) 

Applied to i915-gem-next branch for 5.13. We have a bit a branch shuffling
going on right now so unusal path, it should show up in linux-next through
drm-next hopefully this week still.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_vma.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index caa9b041616b..ee0028c697f6 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -230,7 +230,7 @@ vma_create(struct drm_i915_gem_object *obj,
>  }
>  
>  static struct i915_vma *
> -vma_lookup(struct drm_i915_gem_object *obj,
> +i915_vma_lookup(struct drm_i915_gem_object *obj,
>  struct i915_address_space *vm,
>  const struct i915_ggtt_view *view)
>  {
> @@ -278,7 +278,7 @@ i915_vma_instance(struct drm_i915_gem_object *obj,
>   GEM_BUG_ON(!atomic_read(&vm->open));
>  
>   spin_lock(&obj->vma.lock);
> - vma = vma_lookup(obj, vm, view);
> + vma = i915_vma_lookup(obj, vm, view);
>   spin_unlock(&obj->vma.lock);
>  
>   /* vma_create() will resolve the race if another creates the vma */
> -- 
> 2.30.0

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


Re: [PATCH 4/4] PCI/sysfs: Allow userspace to query and set device reset mechanism

2021-03-24 Thread Leon Romanovsky
On Mon, Mar 22, 2021 at 11:10:03AM -0600, Alex Williamson wrote:
> On Sun, 21 Mar 2021 10:40:55 +0200
> Leon Romanovsky  wrote:
> 
> > On Sat, Mar 20, 2021 at 08:59:42AM -0600, Alex Williamson wrote:
> > > On Sat, 20 Mar 2021 11:10:08 +0200
> > > Leon Romanovsky  wrote:  
> > > > On Fri, Mar 19, 2021 at 10:23:13AM -0600, Alex Williamson wrote:   
> > > > > 
> > > > > What if we taint the kernel or pci_warn() for cases where either all
> > > > > the reset methods are disabled, ie. 'echo none > reset_method', or any
> > > > > time a device specific method is disabled?
> > > > 
> > > > What does it mean "none"? Does it mean nothing supported? If yes, I 
> > > > think that
> > > > pci_warn() will be enough. At least for me, taint is usable during 
> > > > debug stages,
> > > > probably if device doesn't crash no one will look to see 
> > > > /proc/sys/kernel/tainted.  
> > > 
> > > "none" as implemented in this patch, clearing the enabled function
> > > reset methods.  
> > 
> > It is far from intuitive, the empty string will be easier to understand,
> > because "none" means no reset at all.
> 
> "No reset at all" is what "none" achieves, the
> pci_dev.reset_methods_enabled bitmap is cleared.  We can use an empty
> string, but I think we want a way to clear all enabled resets and a way
> to return it to the default.  I could see arguments for an empty string
> serving either purpose, so this version proposed explicitly using
> "none" and "default", as included in the ABI update.

I will stick with "default" only and leave "none" for something else.

> 
> > > > > I'd almost go so far as to prevent disabling a device specific reset
> > > > > altogether, but for example should a device specific reset that fixes
> > > > > an aspect of FLR behavior prevent using a bus reset?  I'd prefer in 
> > > > > that
> > > > > case if direct FLR were disabled via a device flag introduced with the
> > > > > quirk and the remaining resets can still be selected by preference.   
> > > > >  
> > > > 
> > > > I don't know enough to discuss the PCI details, but you raised good 
> > > > point.
> > > > This sysfs is user visible API that is presented as is from device point
> > > > of view. It can be easily run into problems if PCI/core doesn't work 
> > > > with
> > > > user's choice.
> > > >   
> > > > > 
> > > > > Theoretically all the other reset methods work and are available, it's
> > > > > only a policy decision which to use, right?
> > > > 
> > > > But this patch was presented as a way to overcome situations where
> > > > supported != working and user magically knows which reset type to set.  
> > > 
> > > It's not magic, the new sysfs attributes expose which resets are
> > > enabled and the order that they're used, the user can simply select the
> > > next one.  Being able to bypass a broken reset method is a helpful side
> > > effect of getting to select a preferred reset method.  
> > 
> > Magic in a sense that user has no idea what those resets mean, the
> > expectation is that he will blindly iterate till something works.
> 
> Which ought to actually be a safe thing to do.  We should have quirks to
> exclude resets that are known broken but still probe as present and I'd
> be perfectly fine if we issue a warning if the user disables all resets
> for a given device.
>  
> > > > If you want to take this patch to be policy decision tool,
> > > > it will need to accept "reset_type1,reset_type2,..." sort of input,
> > > > so fallback will work natively.  
> > > 
> > > I don't see that as a requirement.  We have fall-through support in the
> > > kernel, but for a given device we're really only ever going to make use
> > > of one of those methods.  If a user knows enough about a device to have
> > > a preference, I think it can be singular.  That also significantly
> > > simplifies the interface and supporting code.  Thanks,  
> > 
> > I'm struggling to get requirements from this thread. You talked about
> > policy decision to overtake fallback mechanism, Amey wanted to avoid
> > quirks.
> > 
> > Do you have an example of such devices or we are talking about
> > theoretical case?
> 
> Look at any device that already has a reset quirk and the process it
> took to get there.  Those are more than just theoretical cases.

So let's fix the process. The long standing kernel policy is that kernel
bugs (and missing quirk can be seen as such bug) should be fixed in the
kernel and not workaround by the users.

> 
> For policy preference, I already described how I've configured QEMU to
> prefer a bus reset rather than a PM reset due to lack of specification
> regarding the scope of a PM "soft reset".  This interface would allow a
> system policy to do that same thing.
> 
> I don't think anyone is suggesting this as a means to avoid quirks that
> would resolve reset issues and create the best default general behavior.
> This provides a mechanism to test various reset methods, and thereby
> identify broken methods, and set a policy. 

Re: [PATCH] treewide: remove editor modelines and cruft

2021-03-24 Thread Geert Uytterhoeven
On Wed, Mar 24, 2021 at 10:58 AM Masahiro Yamada  wrote:
> The section "19) Editor modelines and other cruft" in
> Documentation/process/coding-style.rst clearly says,
> "Do not include any of these in source files."
>
> I recently receive a patch to explicitly add a new one.
>
> Let's do treewide cleanups, otherwise some people follow the existing
> code and attempt to upstream their favoriate editor setups.
>
> It is even nicer if scripts/checkpatch.pl can check it.
>
> If we like to impose coding style in an editor-independent manner,
> I think editorconfig (patch [1]) is a saner solution.
>
> [1] https://lore.kernel.org/lkml/20200703073143.423557-1-da...@kdrag0n.dev/
>
> Signed-off-by: Masahiro Yamada 

>  arch/m68k/atari/time.c|  7 ---

Acked-by: Geert Uytterhoeven 

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


Re: [RFC PATCH 1/2] mm,drm/ttm: Block fast GUP to TTM huge pages

2021-03-24 Thread Intel



On 3/24/21 10:58 AM, Daniel Vetter wrote:

On Tue, Mar 23, 2021 at 09:42:18PM +0100, Thomas Hellström (Intel) wrote:

On 3/23/21 8:52 PM, Williams, Dan J wrote:

On Sun, 2021-03-21 at 19:45 +0100, Thomas Hellström (Intel) wrote:

TTM sets up huge page-table-entries both to system- and device
memory,
and we don't want gup to assume there are always valid backing struct
pages for these. For PTEs this is handled by setting the pte_special
bit,
but for the huge PUDs and PMDs, we have neither pmd_special nor
pud_special. Normally, huge TTM entries are identified by looking at
vma_is_special_huge(), but fast gup can't do that, so as an
alternative
define _devmap entries for which there are no backing dev_pagemap as
special, update documentation and make huge TTM entries _devmap,
after
verifying that there is no backing dev_pagemap.

Please do not abuse p{m,u}d_devmap like this. I'm in the process of
removing get_devpagemap() from the gup-fast path [1]. Instead there
should be space for p{m,u}d_special in the page table entries (at least
for x86-64). So the fix is to remove that old assumption that huge
pages can never be special.

[1]:
http://lore.kernel.org/r/161604050866.1463742.7759521510383551055.st...@dwillia2-desk3.amr.corp.intel.com


Hmm, yes with that patch it will obviously not work as intended.

Given that, I think we'll need to disable the TTM huge pages for now until
we can sort out and agree on using a page table entry bit.

Yeah :-/

I think going full pud/pmd_mkspecial should then also mesh well with
Jason's request to wrap it all up into a vmf_insert_* helper, so at least
it would all look rather pretty in the end.


Yes, I agree. Seems like the special (SW1) is available also for huge 
page table entries on x86 AFAICT, although just not implemented. 
Otherwise the SW bits appear completely used up.


The PTE size vmf_insert_pfn__xxx functions either insert one of devmap 
or special.  I think the only users of the huge insert functions apart 
form TTM currently insert devmap so we should probably be able to do the 
same, and then DRM / TTM wouldn't need to care at all about special or not.


/Thomas




-Daniel


[PATCH] misc: rtsx: check the value returned from a function for errors before being used

2021-03-24 Thread Yang Li
Add missing return value check in pm_runtime_get disabling the
sensor. The issue is reported by coverity with the following error:

Medium:Unchecked return value(CHECKED_RETURN)
CWE252: Value returned from a function is not checked for errors before
being used.
Calling "pm_runtime_get" without checking return value.

Reported-by: Abaci Robot 
Signed-off-by: Yang Li 
---
 drivers/misc/cardreader/rtsx_pcr.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c 
b/drivers/misc/cardreader/rtsx_pcr.c
index 2733111..2cc37fd 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -142,13 +142,16 @@ static void rtsx_pm_full_on(struct rtsx_pcr *pcr)
 
 void rtsx_pci_start_run(struct rtsx_pcr *pcr)
 {
+   int status;
/* If pci device removed, don't queue idle work any more */
if (pcr->remove_pci)
return;
 
if (pcr->rtd3_en)
if (pcr->is_runtime_suspended) {
-   pm_runtime_get(&(pcr->pci->dev));
+   status = pm_runtime_get(&(pcr->pci->dev));
+   if (status < 0 && status != -EINPROGRESS)
+   pm_runtime_put_noidle(&(pcr->pci->dev));
pcr->is_runtime_suspended = false;
}
 
-- 
1.8.3.1



linux-next: Tree for Mar 24

2021-03-24 Thread Stephen Rothwell
Hi all,

Changes since 20210323:

New tree: clk-imx

The net-next tree gained conflicts against the net tree.

The akpm-current tree still had its its build failure.

Non-merge commits (relative to Linus' tree): 6151
 6042 files changed, 383707 insertions(+), 129419 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc, an allmodconfig for x86_64, a
multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), I do an x86_64 modules_install followed by
builds for x86_64 allnoconfig, powerpc allnoconfig (32 and 64 bit),
ppc44x_defconfig, allyesconfig and pseries_le_defconfig and i386, sparc
and sparc64 defconfig and htmldocs. And finally, a simple boot test
of the powerpc pseries_le_defconfig kernel in qemu (with and without
kvm enabled).

Below is a summary of the state of the merge.

I am currently merging 335 trees (counting Linus' and 87 trees of bug
fix patches pending for the current merge release).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

-- 
Cheers,
Stephen Rothwell

$ git checkout master
$ git reset --hard stable
Merging origin/master (7acac4b3196c Merge tag 
'linux-kselftest-kunit-fixes-5.12-rc5.1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest)
Merging fixes/fixes (e71ba9452f0b Linux 5.11-rc2)
Merging kbuild-current/fixes (bcbcf50f5218 kbuild: fix ld-version.sh to not be 
affected by locale)
Merging arc-current/for-curr (83520d62cc5a ARC: treewide: avoid the pointer 
addition with NULL pointer)
Merging arm-current/fixes (a38fd8748464 Linux 5.12-rc2)
Merging arm64-fixes/for-next/fixes (7011d72588d1 kselftest/arm64: sve: Do not 
use non-canonical FFR register value)
Merging arm-soc-fixes/arm/fixes (67335b8d28cd Merge tag 'imx-fixes-5.12' of 
git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/fixes)
Merging drivers-memory-fixes/fixes (a38fd8748464 Linux 5.12-rc2)
Merging m68k-current/for-linus (a65a802aadba m68k: Fix virt_addr_valid() W=1 
compiler warnings)
Merging powerpc-fixes/fixes (274cb1ca2e7c powerpc/pseries/mobility: handle 
premature return from H_JOIN)
Merging s390-fixes/fixes (0d02ec6b3136 Linux 5.12-rc4)
Merging sparc/master (05a59d79793d Merge 
git://git.kernel.org:/pub/scm/linux/kernel/git/netdev/net)
Merging fscrypt-current/for-stable (d19d8d345eec fscrypt: fix inline encryption 
not used on new files)
Merging net/master (6ab4c3117aec net: bridge: don't notify switchdev for local 
FDB addresses)
Merging bpf/master (87d77e59d1eb docs: networking: Fix a typo)
Merging ipsec/master (154deab6a3ba esp: delete NETIF_F_SCTP_CRC bit from 
features for esp offload)
CONFLICT (content): Merge conflict in net/ipv6/ip6_vti.c
CONFLICT (content): Merge conflict in net/ipv4/ip_vti.c
Merging netfilter/master (c79a707072fe net: cdc-phonet: fix data-interface 
release on probe failure)
Merging ipvs/master (b58f33d49e42 netfilter: ctnetlink: fix dump of the expect 
mask attribute)
Merging wireless-drivers/master (bd83a2fc05ed brcmfmac: p2p: Fix recently 
introduced deadlock issue)
Merging mac80211/master (87d77e59d1eb docs: networking: Fix a typo)
Merging rdma-fixes/for-rc (af06b628a6bd RDMA/hns: Fix bug during CMDQ 
initialization)
Merging sound-current/for-linus (e54f30befa79 ALSA: hda/realtek: call 
alc_update_headset_mode() in hp_automute_hook)
Merging sound-asoc-fixes/for-linus (3fcef2d205f9 Merge remote-tracking branch 
'asoc/for-5.12' into asoc-linus)
Merging regmap-fixes/for-linus (f29fd6d5a08d Merge remote-tracking branch 
'regmap/for-5.12' into regmap-linus)
Merging regulator-fixes/for-linus (595bd434897b Merge remote-tracking branch 
'regulator/for-5.12' into regulator-linus)
Merging spi-fixes/for-linus (e5d94e0160f7 Merge remote-tracking branch 
'spi/for-5.12' into spi-linus)
Merging pci-current/for-linus (fd4162f05194 PCI: dwc: Move iATU detection 
earlier)
Merging driver-core.current/driver-core-linus (f0acf637d60f driver core: clear 
deferred probe reason on probe retry)
Merging tty.cur

Re: [PATCH 0/2] MIPS: SiByte: Update SWARM defconfig for PATA support

2021-03-24 Thread Thomas Bogendoerfer
On Sun, Mar 21, 2021 at 08:55:37PM +0100, Maciej W. Rozycki wrote:
> Hi,
> 
>  In the course of looking into Christoph's recent proposal to drop legacy 
> IDE drivers I have noticed that SiByte SWARM's defconfig does not enable 
> the pata_platform driver for the onboard PATA interface.  I think default 
> configuration ought to enable all the supported onboard devices unless 
> there are specific reasons so as not to, and the PATA interface is one of 
> the boot devices supported by the CFE firmware, so I think even more then 
> that it should be included by default.
> 
>  Change split into two because the defconfig has become stale since the 
> last update, so 1/2 first regenerates it, and then 2/2 applies the actual 
> modification.
> 
>  Sadly I'm currently away from my SWARM board for the foreseeable future 
> and I have no remote access to it either, but this is supposed not to need 
> run-time verification.  Build-tested only then.
> 
>  Please apply.

series applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH v5 5/7] irqchip/loongson-liointc: irqchip add 2.0 version

2021-03-24 Thread Thomas Bogendoerfer
On Mon, Mar 15, 2021 at 03:50:02PM +0800, Qing Zhang wrote:
> Add IO interrupt controller support for Loongson-2K1000, different
> from the Loongson-3A series is that Loongson-2K1000 has 64 interrupt
> sources, 0-31 correspond to the device tree liointc0 device node, and
> the other correspond to liointc1 node.
> 
> Signed-off-by: Jiaxun Yang 
> Signed-off-by: Qing Zhang 
> Tested-by: Ming Wang 
> ---
> 
> v4-v5:
> - No change
> 
>  drivers/irqchip/irq-loongson-liointc.c | 58 ++
>  1 file changed, 49 insertions(+), 9 deletions(-)

Marc, if you are ok with this change, I'd like to apply the series
to mips-next...

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH 05/10] MIPS: switch workpad_defconfig from legacy IDE to libata

2021-03-24 Thread Thomas Bogendoerfer
On Thu, Mar 18, 2021 at 05:57:01AM +0100, Christoph Hellwig wrote:
> Use libata instead of the deprecated legacy ide driver in
> workpad_defconfig.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/mips/configs/workpad_defconfig | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH 07/10] MIPS: disable CONFIG_IDE in bigsur_defconfig

2021-03-24 Thread Thomas Bogendoerfer
On Thu, Mar 18, 2021 at 05:57:03AM +0100, Christoph Hellwig wrote:
> bigsur_defconfig enables CONFIG_IDE for the tc86c001 ide driver, which
> is a Toshiba plug in card that does not make much sense to use on bigsur
> platforms.  For all other ATA cards libata support is already enabled.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/mips/configs/bigsur_defconfig | 4 
>  1 file changed, 4 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH 06/10] MIPS: disable CONFIG_IDE in rbtx49xx_defconfig

2021-03-24 Thread Thomas Bogendoerfer
On Thu, Mar 18, 2021 at 05:57:02AM +0100, Christoph Hellwig wrote:
> rbtx49xx_defconfig enables CONFIG_IDE for the tx4938 and tx4939 ide
> drivers, but those aren't actually used by the last known remaining user:
> 
> https://lore.kernel.org/lkml/20210107.101729.1936921832901251107.an...@mba.ocn.ne.jp/
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/mips/configs/rbtx49xx_defconfig | 3 ---
>  1 file changed, 3 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH V2] mips: asm: octeon: A typo fix in the file cvmx-address.h

2021-03-24 Thread Thomas Bogendoerfer
On Tue, Mar 16, 2021 at 10:03:34AM +0530, Bhaskar Chowdhury wrote:
> 
> s/techically/technically/
> 
> Signed-off-by: Bhaskar Chowdhury 
> ---
>  Changes from V1:
>  Meh, missed the changelog text, so added :)
> 
>  arch/mips/include/asm/octeon/cvmx-address.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH] MIPS: PCI: Fix a typo

2021-03-24 Thread Thomas Bogendoerfer
On Fri, Mar 19, 2021 at 10:45:14AM +0530, Bhaskar Chowdhury wrote:
> 
> s/packt/packet/
> 
> Signed-off-by: Bhaskar Chowdhury 
> ---
>  arch/mips/pci/pci-xtalk-bridge.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH 04/10] MIPS: disable CONFIG_IDE in sb1250_swarm_defconfig

2021-03-24 Thread Thomas Bogendoerfer
On Thu, Mar 18, 2021 at 05:57:00AM +0100, Christoph Hellwig wrote:
> sb1250_swarm_defconfig enables CONFIG_IDE but no actual host controller
> driver, so just drop CONFIG_IDE, CONFIG_BLK_DEV_IDECD and
> CONFIG_BLK_DEV_IDETAPE as they are useless.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/mips/configs/sb1250_swarm_defconfig | 3 ---
>  1 file changed, 3 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


Re: [PATCH 08/10] MIPS: disable CONFIG_IDE in malta*_defconfig

2021-03-24 Thread Thomas Bogendoerfer
On Thu, Mar 18, 2021 at 05:57:04AM +0100, Christoph Hellwig wrote:
> Various malta defconfigs enable CONFIG_IDE for the tc86c001 ide driver,
> hich is a Toshiba plug in card that does not make much sense to use on
> bigsur platforms.  For all other ATA cards libata support is already
> enabled.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  arch/mips/configs/malta_kvm_defconfig   | 3 ---
>  arch/mips/configs/malta_kvm_guest_defconfig | 3 ---
>  arch/mips/configs/maltaup_xpa_defconfig | 3 ---
>  3 files changed, 9 deletions(-)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.[ RFC1925, 2.3 ]


[tip: x86/sgx] selftests/sgx: Use getauxval() to simplify test code

2021-03-24 Thread tip-bot2 for Tianjia Zhang
The following commit has been merged into the x86/sgx branch of tip:

Commit-ID: f33dece70e11ce82a09cb1ea2d7c32347b82c67e
Gitweb:
https://git.kernel.org/tip/f33dece70e11ce82a09cb1ea2d7c32347b82c67e
Author:Tianjia Zhang 
AuthorDate:Sun, 14 Mar 2021 19:16:21 +08:00
Committer: Borislav Petkov 
CommitterDate: Wed, 24 Mar 2021 10:59:09 +01:00

selftests/sgx: Use getauxval() to simplify test code

Use the library function getauxval() instead of a custom function to get
the base address of the vDSO.

 [ bp: Massage commit message. ]

Signed-off-by: Tianjia Zhang 
Signed-off-by: Borislav Petkov 
Reviewed-by: Jarkko Sakkinen 
Acked-by: Shuah Khan 
Link: 
https://lkml.kernel.org/r/20210314111621.68428-1-tianjia.zh...@linux.alibaba.com
---
 tools/testing/selftests/sgx/main.c | 24 
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/tools/testing/selftests/sgx/main.c 
b/tools/testing/selftests/sgx/main.c
index b117bb8..d304a40 100644
--- a/tools/testing/selftests/sgx/main.c
+++ b/tools/testing/selftests/sgx/main.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "defines.h"
 #include "main.h"
 #include "../kselftest.h"
@@ -28,24 +29,6 @@ struct vdso_symtab {
Elf64_Word *elf_hashtab;
 };
 
-static void *vdso_get_base_addr(char *envp[])
-{
-   Elf64_auxv_t *auxv;
-   int i;
-
-   for (i = 0; envp[i]; i++)
-   ;
-
-   auxv = (Elf64_auxv_t *)&envp[i + 1];
-
-   for (i = 0; auxv[i].a_type != AT_NULL; i++) {
-   if (auxv[i].a_type == AT_SYSINFO_EHDR)
-   return (void *)auxv[i].a_un.a_val;
-   }
-
-   return NULL;
-}
-
 static Elf64_Dyn *vdso_get_dyntab(void *addr)
 {
Elf64_Ehdr *ehdr = addr;
@@ -162,7 +145,7 @@ static int user_handler(long rdi, long rsi, long rdx, long 
ursp, long r8, long r
return 0;
 }
 
-int main(int argc, char *argv[], char *envp[])
+int main(int argc, char *argv[])
 {
struct sgx_enclave_run run;
struct vdso_symtab symtab;
@@ -203,7 +186,8 @@ int main(int argc, char *argv[], char *envp[])
memset(&run, 0, sizeof(run));
run.tcs = encl.encl_base;
 
-   addr = vdso_get_base_addr(envp);
+   /* Get vDSO base address */
+   addr = (void *)getauxval(AT_SYSINFO_EHDR);
if (!addr)
goto err;
 


Re: [PATCH v3 03/25] x86/sgx: Wipe out EREMOVE from sgx_free_epc_page()

2021-03-24 Thread Paolo Bonzini

On 24/03/21 10:38, Kai Huang wrote:

Hi Sean, Boris, Paolo,

Thanks for the discussion. I tried to digest all your conversations and
hopefully I have understood you correctly. I pasted the new patch here
(not full patch, but relevant part only). I modified the error msg, added
some writeup to Documentation/x86/sgx.rst, and put Sean's explanation of this
bug to the commit msg (per Paolo). I am terrible Documentation writer, so
please help to check and give comments. Thanks!


I have some phrasing suggestions below but that was actually pretty good.


---
commit 1e297a535bcb4f51a08343c40207520017d85efe (HEAD)
Author: Kai Huang 
Date:   Wed Jan 20 03:40:53 2021 +0200

 x86/sgx: Wipe out EREMOVE from sgx_free_epc_page()
 
 EREMOVE takes a page and removes any association between that page and

 an enclave.  It must be run on a page before it can be added into
 another enclave.  Currently, EREMOVE is run as part of pages being freed
 into the SGX page allocator.  It is not expected to fail.
 
 KVM does not track how guest pages are used, which means that SGX

 virtualization use of EREMOVE might fail.  Specifically, it is
 legitimate that EREMOVE returns SGX_CHILD_PRESENT for EPC assigned to
 KVM guest, because KVM/kernel doesn't track SECS pages.

 Break out the EREMOVE call from the SGX page allocator.  This will allow
 the SGX virtualization code to use the allocator directly.  (SGX/KVM
 will also introduce a more permissive EREMOVE helper).


Ok, I think I got the source of my confusion.  The part in parentheses
is the key.  It was not clear that KVM can deal with EREMOVE failures
*without printing the error*.  Good!


 Implement original sgx_free_epc_page() as sgx_encl_free_epc_page() to be
 more specific that it is used to free EPC page assigned host enclave.
 Replace sgx_free_epc_page() with sgx_encl_free_epc_page() in all call
 sites so there's no functional change.
 
 Improve error message when EREMOVE fails, and kernel is about to leak

 EPC page, which is likely a kernel bug.  This is effectively a kernel
 use-after-free of EPC, and due to the way SGX works, the bug is detected
 at freeing.  Rather than add the page back to the pool of available EPC,
 the kernel intentionally leaks the page to avoid additional errors in
 the future.
 
 Also add documentation to explain to user what is the bug and suggest

 user what to do when this bug happens, although extremely unlikely.


Rewritten:

EREMOVE takes a page and removes any association between that page and
an enclave.  It must be run on a page before it can be added into
another enclave.  Currently, EREMOVE is run as part of pages being freed
into the SGX page allocator.  It is not expected to fail, as it would
indicate a use-after-free of EPC.  Rather than add the page back to the
pool of available EPC, the kernel intentionally leaks the page to avoid
additional errors in the future.

However, KVM does not track how guest pages are used, which means that SGX
virtualization use of EREMOVE might fail.  Specifically, it is
legitimate that EREMOVE returns SGX_CHILD_PRESENT for EPC assigned to
KVM guest, because KVM/kernel doesn't track SECS pages.

To allow SGX/KVM to introduce a more permissive EREMOVE helper and to
let the SGX virtualization code use the allocator directly,
break out the EREMOVE call from the SGX page allocator.  Rename the
original sgx_free_epc_page() to sgx_encl_free_epc_page(),
indicating that it is used to free EPC page assigned host enclave.
Replace sgx_free_epc_page() with sgx_encl_free_epc_page() in all call
sites so there's no functional change.

At the same time improve error message when EREMOVE fails, and add
documentation to explain to user what is the bug and suggest user what
to do when this bug happens, although extremely unlikely.


+Although extremely unlikely, EPC leaks can happen if kernel SGX bug happens,
+when a WARNING with below message is shown in dmesg:


Remove "Although extremely unlikely".


+"...EREMOVE returned ..., kernel bug likely.  EPC page leaked, SGX may become
+unusuable.  Please refer to Documentation/x86/sgx.rst for more information."
+
+This is effectively a kernel use-after-free of EPC, and due to the way SGX
+works, the bug is detected at freeing. Rather than add the page back to the 
pool
+of available EPC, the kernel intentionally leaks the page to avoid additional
+errors in the future.
+
+When this happens, kernel will likely soon leak majority of EPC pages, and SGX
+will likely become unusable. However while this may be fatal to SGX, other
+kernel functionalities are unlikely to be impacted, and should continue to 
work.
+
+As a result, when this happpens, user should stop running any new SGX 
workloads,
+(or just any new workloads), and migrate all valuable workloads, for instance,
+virtual machines, to other places.


Remove everything starting with "for instance".

 Although

Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized

2021-03-24 Thread Tetsuo Handa
On 2021/03/24 1:13, Mimi Zohar wrote:
> On Wed, 2021-03-24 at 00:14 +0900, Tetsuo Handa wrote:
>> On 2021/03/23 23:47, Mimi Zohar wrote:
>>> Initially I also questioned making "integrity" an LSM.  Perhaps it's
>>> time to reconsider.   For now, it makes sense to just fix the NULL
>>> pointer dereferencing.
>>
>> Do we think calling panic() as "fix the NULL pointer dereferencing" ?
> 
> Not supplying "integrity" as an "lsm=" option is a user error.  There
> are only two options - allow or deny the caller to proceed.   If the
> user is expecting the integrity subsystem to be properly working,
> returning a NULL and allowing the system to boot (RFC patch version)
> does not make sense.   Better to fail early.

What does the "user" mean? Those who load the vmlinux?
Only the "root" user (so called administrators)?
Any users including other than "root" user?

If the user means those who load the vmlinux, that user is explicitly asking
for disabling "integrity" for some reason. In that case, it is a bug if
booting with "integrity" disabled is impossible.

If the user means something other than those who load the vmlinux,
is there a possibility that that user (especially non "root" users) is
allowed to try to use "integrity" ? If processes other than global init
process can try to use "integrity", wouldn't it be a DoS attack vector?
Please explain in the descripotion why calling panic() does not cause
DoS attack vector.



Re: [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge

2021-03-24 Thread Maxime Ripard
On Wed, Mar 24, 2021 at 11:55:35AM +0200, Laurent Pinchart wrote:
> Hi Jagan,
> 
> On Wed, Mar 24, 2021 at 03:19:10PM +0530, Jagan Teki wrote:
> > On Wed, Mar 24, 2021 at 3:09 PM Laurent Pinchart wrote:
> > > On Wed, Mar 24, 2021 at 02:44:57PM +0530, Jagan Teki wrote:
> > > > On Wed, Mar 24, 2021 at 8:18 AM Samuel Holland wrote:
> > > > > On 3/23/21 5:53 PM, Laurent Pinchart wrote:
> > > > > > On Mon, Mar 22, 2021 at 07:31:49PM +0530, Jagan Teki wrote:
> > > > > >> Replace of_drm_find_panel with drm_of_find_panel_or_bridge
> > > > > >> for finding panel, this indeed help to find the bridge if
> > > > > >> bridge support added.
> > > > > >>
> > > > > >> Added NULL in bridge argument, same will replace with bridge
> > > > > >> parameter once bridge supported.
> > > > > >>
> > > > > >> Signed-off-by: Jagan Teki 
> > > > > >
> > > > > > Looks good, there should be no functional change.
> > > > >
> > > > > Actually this breaks all existing users of this driver, see below.
> > > > >
> > > > > > Reviewed-by: Laurent Pinchart 
> > > > > >
> > > > > >> ---
> > > > > >> Changes for v4, v3:
> > > > > >> - none
> > > > > >>
> > > > > >>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ---
> > > > > >>  1 file changed, 8 insertions(+), 3 deletions(-)
> > > > > >>
> > > > > >> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > > > >> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > >> index 4f5efcace68e..2e9e7b2d4145 100644
> > > > > >> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > >> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > > > >> @@ -21,6 +21,7 @@
> > > > > >>
> > > > > >>  #include 
> > > > > >>  #include 
> > > > > >> +#include 
> > > > > >>  #include 
> > > > > >>  #include 
> > > > > >>  #include 
> > > > > >> @@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct 
> > > > > >> mipi_dsi_host *host,
> > > > > >>  struct mipi_dsi_device *device)
> > > > > >>  {
> > > > > >>  struct sun6i_dsi *dsi = host_to_sun6i_dsi(host);
> > > > > >> -struct drm_panel *panel = 
> > > > > >> of_drm_find_panel(device->dev.of_node);
> > > > >
> > > > > This is using the OF node of the DSI device, which is a direct child 
> > > > > of
> > > > > the DSI host's OF node. There is no OF graph involved.
> > > > >
> > > > > >> +struct drm_panel *panel;
> > > > > >> +int ret;
> > > > > >> +
> > > > > >> +ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0,
> > > > > >> +  &panel, NULL);
> > > > >
> > > > > However, this function expects to find the panel using OF graph. This
> > > > > does not work with existing device trees (PinePhone, PineTab) which do
> > > > > not use OF graph to connect the panel. And it cannot work, because the
> > > > > DSI host's binding specifies a single port: the input port from the
> > > > > display engine.
> > > >
> > > > Thanks for noticing this. I did understand your point and yes, I did
> > > > mention the updated pipeline in previous versions and forgot to add it
> > > > to this series.
> > > >
> > > > Here is the updated pipeline to make it work:
> > > >
> > > > https://patchwork.kernel.org/project/dri-devel/patch/20190524104252.20236-1-ja...@amarulasolutions.com/
> > > >
> > > > Let me know your comments on this, so I will add a patch for the
> > > > above-affected DTS files.
> > >
> > > DT is an ABI, we need to ensure backward compatibility. Changes in
> > > kernel drivers can't break devices that have an old DT.
> > 
> > Thanks for your point.
> > 
> > So, we need to choose APIs that would compatible with the old DT and
> > new DT changes. Am I correct?
> 
> Yes, that's correct.

However, I see no particular reason to change the DT binding in this
case. The DSI devices are supposed to be described through a subnode of
their DSI controller, that's the generic binding and except for very odd
devices (and a bridge like this one is certainly not one), I see no
reason to deviate from that.

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v5 1/5] mm,memory_hotplug: Allocate memmap from the added memory range

2021-03-24 Thread Oscar Salvador
On Tue, Mar 23, 2021 at 11:11:58AM +0100, Michal Hocko wrote:
> [Sorry for a long overdue review. I didn't have time to follow previous
> versions so I am sorry if some of my concerns have been discussed
> already]

No worries, let's go ;-)

> I was playing with movable_node and performance implications back in
> 2017 (unfortunately I do not have specific numbers anymore) and the
> setup was a bit extreme - a single node (0) with normal zones and all
> other nodes with movable memory only. So not only struct pages but any
> other kernel metadata were on a remote node. I remember I could see
> clear performance drop scaling with the distance from node 0 somewhere
> betweem 5-10% on kbuild bound on a movable node.

I see. Yes, it is a rather extreme case, but I think it clearly shows the impact
of having metadata structures on a non-local node.

 
> In fact beginning of the memory block should be sufficient as sections
> cannot be hotremoved without the rest of the memory block.

Sorry, I meant memory block here.

> > struct pages which back the allocated space then just need to be treated
> > carefully.
> > 
> > Implementation wise we will reuse vmem_altmap infrastructure to override
> > the default allocator used by __populate_section_memmap.
> > Part of the implementation also relies on memory_block structure gaining
> > a new field which specifies the number of vmemmap_pages at the beginning.
> 
> Here you are talking about memory block rather than section.

Yes, see above, it should have been memory block in both cases.

> > Hot-remove:
> > 
> >  We need to be careful when removing memory, as adding and
> >  removing memory needs to be done with the same granularity.
> >  To check that this assumption is not violated, we check the
> >  memory range we want to remove and if a) any memory block has
> >  vmemmap pages and b) the range spans more than a single memory
> >  block, we scream out loud and refuse to proceed.
> 
> Is this a real problem? If each memory block has its own vmemmap then we
> should be just fine, no?

Not entirely.

Assume this:

- memory_block_size = 128MB
- add_memory(256MB) : no uses altmap because size != memory_block_size
- add_memory(128MB) : uses altmap

Now, when trying to remove the memory, we should construct the altmap to let
remove_pmd_table->free_hugepage_table() know that it needs to call 
vmem_altmap_free()
instead of free_pagetable() for those sections that were populated using altmap.

But that becomes trickier to handle if user does remove_memory(384MB) at once.

The only reasonable way I can think of is something like:

/*
 * Try to diferentiate which ranges used altmap when populating vmemmap,
 * and construct the altmap for those
 */
 loop(size / section_size)
  if (range_used altmap)
   arch_remove_memory(nid, start, size, altmap);
  else
   arch_remove_memory(nid, start, size, NULL);
   
But I do not think this is any better than make this scenario completely a 
NO-NO,
because in the end, this is asking for trouble.
And yes, normal qemu/barematal users does not have the hability to play these
kind of tricks, as baremetal has HW limitations and qemu creates a device for
every range you hot-add (so you are tied to that device when removing memory
as well), but other users e.g: virtio-mem can do that.

> I would appreciate some more description of the patch itself. The above
> outlines a highlevel problems and design. The patch is quite large and
> it acts on several layers - physical hotplug, {on,off}lining and sysfs
> layer.

Ok, will try to come up with something more complete wrt changelog.

> Let me capture my thinking:
> - from the top level 
> - sysfs interfaces - memory block is extended to contain the number of
>   vmemmap pages reserved from the beginning of the block for all
>   memory sections belonging to the block.
yes

> - add_memory_resource is the entry point to reserve the vmemmap space
>   for the block. This is an opt-in feature (MHP_MEMMAP_ON_MEMORY) and
>   there is no current user at this stage.
yes

> - vmem_altmap is instructed to use the reserved vmemmap space as the
>   backing storage for the vmemmap struct pages. Via arch_add_memory->
>   __populate_section_memmap.
yes

> - online_pages for some reason needs to know about the reserved vmemmap
>   space. Why? It already knows the intial pfn to online. Why cannot
>   caller simply alter both start pfn and nr_pages to online everything
>   after the vmemmap space? This is somehow conflating the mem block
>   concept deeper into onlining.
> - the same applies to offlining.

Because some counters need not only the buddy_nr_pages, but the complete
range.

So, let us see what online_pages() do (offline_pages() as well but slightly
different in some areas)

- move_pfn_range_to_zone():
  1) Resize node and zone spanned pages
 * If we were only to pass the nr_pages without the vmemmap pages,
   node/zone's spanned pages would be wrong as vmemmap pages would not
   be accounted in ther

[PATCH 1/6] ASoC: fsl_esai: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with bus clock,

The call flow:
devm_regmap_init_mmio_clk
- clk_prepare()
   - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_esai.c | 48 ++--
 1 file changed, 36 insertions(+), 12 deletions(-)

diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 41b154417b92..c0d4f3c5dbb1 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -945,6 +945,9 @@ static const struct regmap_config fsl_esai_regmap_config = {
.cache_type = REGCACHE_FLAT,
 };
 
+static int fsl_esai_runtime_resume(struct device *dev);
+static int fsl_esai_runtime_suspend(struct device *dev);
+
 static int fsl_esai_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
@@ -969,8 +972,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
 
-   esai_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
-   "core", regs, &fsl_esai_regmap_config);
+   esai_priv->regmap = devm_regmap_init_mmio(&pdev->dev, regs, 
&fsl_esai_regmap_config);
if (IS_ERR(esai_priv->regmap)) {
dev_err(&pdev->dev, "failed to init regmap: %ld\n",
PTR_ERR(esai_priv->regmap));
@@ -1039,11 +1041,23 @@ static int fsl_esai_probe(struct platform_device *pdev)
}
 
dev_set_drvdata(&pdev->dev, esai_priv);
-
spin_lock_init(&esai_priv->lock);
+   pm_runtime_enable(&pdev->dev);
+   if (!pm_runtime_enabled(&pdev->dev)) {
+   ret = fsl_esai_runtime_resume(&pdev->dev);
+   if (ret)
+   goto err_pm_disable;
+   }
+
+   ret = pm_runtime_get_sync(&pdev->dev);
+   if (ret < 0) {
+   pm_runtime_put_noidle(&pdev->dev);
+   goto err_pm_get_sync;
+   }
+
ret = fsl_esai_hw_init(esai_priv);
if (ret)
-   return ret;
+   goto err_pm_get_sync;
 
esai_priv->tx_mask = 0x;
esai_priv->rx_mask = 0x;
@@ -1054,24 +1068,33 @@ static int fsl_esai_probe(struct platform_device *pdev)
regmap_write(esai_priv->regmap, REG_ESAI_RSMA, 0);
regmap_write(esai_priv->regmap, REG_ESAI_RSMB, 0);
 
+   ret = pm_runtime_put_sync(&pdev->dev);
+   if (ret < 0)
+   goto err_pm_get_sync;
+
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_esai_component,
  &fsl_esai_dai, 1);
if (ret) {
dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
-   return ret;
+   goto err_pm_get_sync;
}
 
INIT_WORK(&esai_priv->work, fsl_esai_hw_reset);
 
-   pm_runtime_enable(&pdev->dev);
-
-   regcache_cache_only(esai_priv->regmap, true);
-
ret = imx_pcm_dma_init(pdev, IMX_ESAI_DMABUF_SIZE);
-   if (ret)
+   if (ret) {
dev_err(&pdev->dev, "failed to init imx pcm dma: %d\n", ret);
+   goto err_pm_get_sync;
+   }
 
return ret;
+
+err_pm_get_sync:
+   if (!pm_runtime_status_suspended(&pdev->dev))
+   fsl_esai_runtime_suspend(&pdev->dev);
+err_pm_disable:
+   pm_runtime_disable(&pdev->dev);
+   return ret;
 }
 
 static int fsl_esai_remove(struct platform_device *pdev)
@@ -1079,6 +1102,9 @@ static int fsl_esai_remove(struct platform_device *pdev)
struct fsl_esai *esai_priv = platform_get_drvdata(pdev);
 
pm_runtime_disable(&pdev->dev);
+   if (!pm_runtime_status_suspended(&pdev->dev))
+   fsl_esai_runtime_suspend(&pdev->dev);
+
cancel_work_sync(&esai_priv->work);
 
return 0;
@@ -1092,7 +1118,6 @@ static const struct of_device_id fsl_esai_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, fsl_esai_dt_ids);
 
-#ifdef CONFIG_PM
 static int fsl_esai_runtime_resume(struct device *dev)
 {
struct fsl_esai *esai = dev_get_drvdata(dev);
@@ -1160,7 +1185,6 @@ static int fsl_esai_runtime_suspend(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops fsl_esai_pm_ops = {
SET_RUNTIME_PM_OPS(fsl_esai_runtime_suspend,
-- 
2.27.0



[PATCH 2/6] ASoC: fsl_spdif: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with core clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
   - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_spdif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index 1cd3441d1c03..c631de325a6e 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1294,8 +1294,7 @@ static int fsl_spdif_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
 
-   spdif_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
-   "core", regs, &fsl_spdif_regmap_config);
+   spdif_priv->regmap = devm_regmap_init_mmio(&pdev->dev, regs, 
&fsl_spdif_regmap_config);
if (IS_ERR(spdif_priv->regmap)) {
dev_err(&pdev->dev, "regmap init failed\n");
return PTR_ERR(spdif_priv->regmap);
-- 
2.27.0



[PATCH 0/6] ASoC: fsl: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with ipg clock,

The call flow:
devm_regmap_init_mmio_clk
- clk_prepare()
- clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk.

Shengjiu Wang (6):
  ASoC: fsl_esai: Don't use devm_regmap_init_mmio_clk
  ASoC: fsl_spdif: Don't use devm_regmap_init_mmio_clk
  ASoC: fsl_asrc: Don't use devm_regmap_init_mmio_clk
  ASoC: fsl_easrc: Don't use devm_regmap_init_mmio_clk
  ASoC: fsl_audmix: Don't use devm_regmap_init_mmio_clk
  ASoC: fsl_micfil: Don't use devm_regmap_init_mmio_clk

 sound/soc/fsl/fsl_asrc.c   | 57 +-
 sound/soc/fsl/fsl_audmix.c |  3 +-
 sound/soc/fsl/fsl_easrc.c  |  3 +-
 sound/soc/fsl/fsl_esai.c   | 48 
 sound/soc/fsl/fsl_micfil.c | 25 +
 sound/soc/fsl/fsl_spdif.c  |  3 +-
 6 files changed, 103 insertions(+), 36 deletions(-)

-- 
2.27.0



[PATCH 4/6] ASoC: fsl_easrc: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with mem clock,

The call flow:
devm_regmap_init_mmio_clk
  - clk_prepare()
  - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_easrc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 600e0d670ca6..5e33afe87c4a 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1896,8 +1896,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
 
easrc->paddr = res->start;
 
-   easrc->regmap = devm_regmap_init_mmio_clk(dev, "mem", regs,
- &fsl_easrc_regmap_config);
+   easrc->regmap = devm_regmap_init_mmio(dev, regs, 
&fsl_easrc_regmap_config);
if (IS_ERR(easrc->regmap)) {
dev_err(dev, "failed to init regmap");
return PTR_ERR(easrc->regmap);
-- 
2.27.0



Re: [PATCH V3 1/2] soc: qcom-geni-se: Cleanup the code to remove proxy votes

2021-03-24 Thread rojay

On 2021-03-23 15:00, Greg KH wrote:

On Mon, Mar 22, 2021 at 04:34:28PM +0530, Roja Rani Yarubandi wrote:

This reverts commit 048eb908a1f2 ("soc: qcom-geni-se: Add interconnect
support to fix earlycon crash")

ICC core and platforms drivers supports sync_state feature with
commit 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state") which
ensures that the default ICC BW votes from the bootloader is not
removed until all it's consumers are probes.

The proxy votes were needed in case other QUP child drivers
I2C, SPI probes before UART, they can turn off the QUP-CORE clock
which is shared resources for all QUP driver, this causes unclocked
access to HW from earlycon.

Given above support from ICC there is no longer need to maintain
proxy votes on QUP-CORE ICC node from QUP wrapper driver for early
console usecase, the default votes won't be removed until real
console is probed.

Signed-off-by: Roja Rani Yarubandi 
Signed-off-by: Akash Asthana 
Reviewed-by: Matthias Kaehlcke 


Should this have a "Fixes:" tag, and also be cc: sta...@vger.kernel.org
so that it will be properly backported?

If so, please add and resend.



Okay, will add and resend.


thanks,

greg k-h


[PATCH 5/6] ASoC: fsl_audmix: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with ipg clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
   - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_audmix.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_audmix.c b/sound/soc/fsl/fsl_audmix.c
index 8dc44dec7956..f931288e256c 100644
--- a/sound/soc/fsl/fsl_audmix.c
+++ b/sound/soc/fsl/fsl_audmix.c
@@ -476,8 +476,7 @@ static int fsl_audmix_probe(struct platform_device *pdev)
if (IS_ERR(regs))
return PTR_ERR(regs);
 
-   priv->regmap = devm_regmap_init_mmio_clk(dev, "ipg", regs,
-&fsl_audmix_regmap_config);
+   priv->regmap = devm_regmap_init_mmio(dev, regs, 
&fsl_audmix_regmap_config);
if (IS_ERR(priv->regmap)) {
dev_err(dev, "failed to init regmap\n");
return PTR_ERR(priv->regmap);
-- 
2.27.0



[PATCH 6/6] ASoC: fsl_micfil: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with ipg_clk clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
  - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
Reviewed-by: Viorel Suman 
---
 sound/soc/fsl/fsl_micfil.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index 2b9edd4bb94d..3cf789ed6cbe 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -31,6 +31,7 @@ struct fsl_micfil {
struct platform_device *pdev;
struct regmap *regmap;
const struct fsl_micfil_soc_data *soc;
+   struct clk *busclk;
struct clk *mclk;
struct snd_dmaengine_dai_dma_data dma_params_rx;
unsigned int dataline;
@@ -660,16 +661,22 @@ static int fsl_micfil_probe(struct platform_device *pdev)
return PTR_ERR(micfil->mclk);
}
 
+   micfil->busclk = devm_clk_get(&pdev->dev, "ipg_clk");
+   if (IS_ERR(micfil->busclk)) {
+   dev_err(&pdev->dev, "failed to get ipg clock: %ld\n",
+   PTR_ERR(micfil->busclk));
+   return PTR_ERR(micfil->busclk);
+   }
+
/* init regmap */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(regs))
return PTR_ERR(regs);
 
-   micfil->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
-  "ipg_clk",
-  regs,
-  &fsl_micfil_regmap_config);
+   micfil->regmap = devm_regmap_init_mmio(&pdev->dev,
+  regs,
+  &fsl_micfil_regmap_config);
if (IS_ERR(micfil->regmap)) {
dev_err(&pdev->dev, "failed to init MICFIL regmap: %ld\n",
PTR_ERR(micfil->regmap));
@@ -729,6 +736,7 @@ static int fsl_micfil_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, micfil);
 
pm_runtime_enable(&pdev->dev);
+   regcache_cache_only(micfil->regmap, true);
 
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_micfil_component,
  &fsl_micfil_dai, 1);
@@ -752,6 +760,7 @@ static int __maybe_unused fsl_micfil_runtime_suspend(struct 
device *dev)
regcache_cache_only(micfil->regmap, true);
 
clk_disable_unprepare(micfil->mclk);
+   clk_disable_unprepare(micfil->busclk);
 
return 0;
 }
@@ -761,10 +770,16 @@ static int __maybe_unused 
fsl_micfil_runtime_resume(struct device *dev)
struct fsl_micfil *micfil = dev_get_drvdata(dev);
int ret;
 
-   ret = clk_prepare_enable(micfil->mclk);
+   ret = clk_prepare_enable(micfil->busclk);
if (ret < 0)
return ret;
 
+   ret = clk_prepare_enable(micfil->mclk);
+   if (ret < 0) {
+   clk_disable_unprepare(micfil->busclk);
+   return ret;
+   }
+
regcache_cache_only(micfil->regmap, false);
regcache_mark_dirty(micfil->regmap);
regcache_sync(micfil->regmap);
-- 
2.27.0



[PATCH 3/6] ASoC: fsl_asrc: Don't use devm_regmap_init_mmio_clk

2021-03-24 Thread Shengjiu Wang
When there is power domain bind with mem clock,

The call flow:
devm_regmap_init_mmio_clk
   - clk_prepare()
   - clk_pm_runtime_get()

cause the power domain of clock always be enabled after
regmap_init(). which impact the power consumption.

So use devm_regmap_init_mmio instead of
devm_regmap_init_mmio_clk,but explicitly enable
clock when it is used.

Signed-off-by: Shengjiu Wang 
---
 sound/soc/fsl/fsl_asrc.c | 57 +++-
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 63d236ef5c4d..0e1ad8efebd3 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -1008,6 +1008,9 @@ static int fsl_asrc_get_fifo_addr(u8 dir, enum 
asrc_pair_index index)
return REG_ASRDx(dir, index);
 }
 
+static int fsl_asrc_runtime_resume(struct device *dev);
+static int fsl_asrc_runtime_suspend(struct device *dev);
+
 static int fsl_asrc_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
@@ -1039,8 +1042,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
 
asrc->paddr = res->start;
 
-   asrc->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "mem", regs,
-&fsl_asrc_regmap_config);
+   asrc->regmap = devm_regmap_init_mmio(&pdev->dev, regs, 
&fsl_asrc_regmap_config);
if (IS_ERR(asrc->regmap)) {
dev_err(&pdev->dev, "failed to init regmap\n");
return PTR_ERR(asrc->regmap);
@@ -1117,12 +1119,6 @@ static int fsl_asrc_probe(struct platform_device *pdev)
}
}
 
-   ret = fsl_asrc_init(asrc);
-   if (ret) {
-   dev_err(&pdev->dev, "failed to init asrc %d\n", ret);
-   return ret;
-   }
-
asrc->channel_avail = 10;
 
ret = of_property_read_u32(np, "fsl,asrc-rate",
@@ -1161,21 +1157,56 @@ static int fsl_asrc_probe(struct platform_device *pdev)
}
 
platform_set_drvdata(pdev, asrc);
-   pm_runtime_enable(&pdev->dev);
spin_lock_init(&asrc->lock);
-   regcache_cache_only(asrc->regmap, true);
+   pm_runtime_enable(&pdev->dev);
+   if (!pm_runtime_enabled(&pdev->dev)) {
+   ret = fsl_asrc_runtime_resume(&pdev->dev);
+   if (ret)
+   goto err_pm_disable;
+   }
+
+   ret = pm_runtime_get_sync(&pdev->dev);
+   if (ret < 0) {
+   pm_runtime_put_noidle(&pdev->dev);
+   goto err_pm_get_sync;
+   }
+
+   ret = fsl_asrc_init(asrc);
+   if (ret) {
+   dev_err(&pdev->dev, "failed to init asrc %d\n", ret);
+   goto err_pm_get_sync;
+   }
+
+   ret = pm_runtime_put_sync(&pdev->dev);
+   if (ret < 0)
+   goto err_pm_get_sync;
 
ret = devm_snd_soc_register_component(&pdev->dev, &fsl_asrc_component,
  &fsl_asrc_dai, 1);
if (ret) {
dev_err(&pdev->dev, "failed to register ASoC DAI\n");
-   return ret;
+   goto err_pm_get_sync;
}
 
return 0;
+
+err_pm_get_sync:
+   if (!pm_runtime_status_suspended(&pdev->dev))
+   fsl_asrc_runtime_suspend(&pdev->dev);
+err_pm_disable:
+   pm_runtime_disable(&pdev->dev);
+   return ret;
+}
+
+static int fsl_asrc_remove(struct platform_device *pdev)
+{
+   pm_runtime_disable(&pdev->dev);
+   if (!pm_runtime_status_suspended(&pdev->dev))
+   fsl_asrc_runtime_suspend(&pdev->dev);
+
+   return 0;
 }
 
-#ifdef CONFIG_PM
 static int fsl_asrc_runtime_resume(struct device *dev)
 {
struct fsl_asrc *asrc = dev_get_drvdata(dev);
@@ -1252,7 +1283,6 @@ static int fsl_asrc_runtime_suspend(struct device *dev)
 
return 0;
 }
-#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops fsl_asrc_pm = {
SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, 
NULL)
@@ -1291,6 +1321,7 @@ MODULE_DEVICE_TABLE(of, fsl_asrc_ids);
 
 static struct platform_driver fsl_asrc_driver = {
.probe = fsl_asrc_probe,
+   .remove = fsl_asrc_remove,
.driver = {
.name = "fsl-asrc",
.of_match_table = fsl_asrc_ids,
-- 
2.27.0



Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread elaine.zhang

Hi, Johan:

在 2021/3/24 下午5:17, Johan Jonker 写道:

Hi Elaine,

>From Rob's build log it turns out that 2 more properties must be added.
Add these new properties in separate patch.
Retest with commands below.

See rk3288.dtsi

assigned-clocks = <&cru SCLK_EDP_24M>;
assigned-clock-parents = <&xin24m>;

This should not be in the power node.
It should be on the CRU node, or on the EDP's own node.
I could have added it just to solve dtbs_check .


https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210324071609.7531-3-zhangq...@rock-chips.com/

make ARCH=arm dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/power/rockchip,power-controller.yaml

make ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/power/rockchip,power-controller.yaml

On 3/24/21 8:16 AM, Elaine Zhang wrote:

Convert the soc/rockchip/power_domain.txt binding document to
json-schema and move to the power bindings directory.

Signed-off-by: Enric Balletbo i Serra 
Signed-off-by: Elaine Zhang 
---
  .../power/rockchip,power-controller.yaml  | 284 ++
  .../bindings/soc/rockchip/power_domain.txt| 136 -
  2 files changed, 284 insertions(+), 136 deletions(-)
  create mode 100644 
Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
  delete mode 100644 
Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

diff --git 
a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml 
b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
new file mode 100644
index ..a220322c5139
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
@@ -0,0 +1,284 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip Power Domains
+
+maintainers:
+  - Elaine Zhang 
+  - Rob Herring 
+  - Heiko Stuebner 
+
+description: |
+  Rockchip processors include support for multiple power domains which can be
+  powered up/down by software based on different application scenarios to save 
power.
+
+  Power domains contained within power-controller node are generic power domain
+  providers documented in 
Documentation/devicetree/bindings/power/power-domain.yaml.
+
+  IP cores belonging to a power domain should contain a "power-domains"
+  property that is a phandle for the power domain node representing the domain.
+
+properties:
+  $nodename:
+const: power-controller
+
+  compatible:
+enum:
+  - rockchip,px30-power-controller
+  - rockchip,rk3036-power-controller
+  - rockchip,rk3066-power-controller
+  - rockchip,rk3128-power-controller
+  - rockchip,rk3188-power-controller
+  - rockchip,rk3228-power-controller
+  - rockchip,rk3288-power-controller
+  - rockchip,rk3328-power-controller
+  - rockchip,rk3366-power-controller
+  - rockchip,rk3368-power-controller
+  - rockchip,rk3399-power-controller
+
+  "#power-domain-cells":
+const: 1
+
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0


assigned-clocks:
   maxItems: 1

assigned-clock-parents:
   maxItems: 1


+
+patternProperties:
+  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
+type: object
+description: |
+  Represents the power domains within the power controller node as 
documented
+  in Documentation/devicetree/bindings/power/power-domain.yaml.
+
+properties:
+
+  "#power-domain-cells":
+description:
+  Must be 0 for nodes representing a single PM domain and 1 for nodes
+  providing multiple PM domains.
+
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  reg:
+maxItems: 1
+description: |
+  Power domain index. Valid values are defined in
+  "include/dt-bindings/power/px30-power.h"
+  "include/dt-bindings/power/rk3036-power.h"
+  "include/dt-bindings/power/rk3066-power.h"
+  "include/dt-bindings/power/rk3128-power.h"
+  "include/dt-bindings/power/rk3188-power.h"
+  "include/dt-bindings/power/rk3228-power.h"
+  "include/dt-bindings/power/rk3288-power.h"
+  "include/dt-bindings/power/rk3328-power.h"
+  "include/dt-bindings/power/rk3366-power.h"
+  "include/dt-bindings/power/rk3368-power.h"
+  "include/dt-bindings/power/rk3399-power.h"
+
+  clocks:
+description: |
+  A number of phandles to clocks that need to be enabled while power 
domain
+  switches state.
+
+  pm_qos:
+description: |
+  A number of phandles to qos blocks which need to be saved and 
restored
+  while power domain switches state.
+
+patternProperties:
+  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
+type: object
+description: |
+  Rep

Re: [PATCH] irqchip/gic-v3: fix OF_BAD_ADDR error handling

2021-03-24 Thread Marc Zyngier
On Tue, 23 Mar 2021 22:06:22 +,
Nick Desaulniers  wrote:
> 
> On Tue, Mar 23, 2021 at 6:18 AM Arnd Bergmann  wrote:
> >
> > From: Arnd Bergmann 
> >
> > When building with extra warnings enabled, clang points out a
> > mistake in the error handling:
> >
> > drivers/irqchip/irq-gic-v3-mbi.c:306:21: error: result of comparison of 
> > constant 18446744073709551615 with expression of type 'phys_addr_t' (aka 
> > 'unsigned int') is always false 
> > [-Werror,-Wtautological-constant-out-of-range-compare]
> 
> Looks like based on CONFIG_PHYS_ADDR_T_64BIT, phys_addr_t can be u64
> or u32, but of_translate_address always returns a u64.  This is fine
> for the current value of OF_BAD_ADDR, but I think there's a risk of
> losing the top 32b of the return value of of_translate_address() here?

If the DT describes a 64bit physical address, and that the (32bit)
kernel isn't built to grok these addresses, then I'd say that the
kernel cannot run on this HW, and that we don't need to worry much
about this case.

In general, CONFIG_PHYS_ADDR_T_64BIT must be selected by the arch code
if anything above 32bit can be described in the PA space.

Thanks,

M.

-- 
Without deviation from the norm, progress is not possible.


[PATCH] riscv: locks: introduce ticket-based spinlock implementation

2021-03-24 Thread guoren
From: Guo Ren 

This patch introduces a ticket lock implementation for riscv, along the
same lines as the implementation for arch/arm & arch/csky.

Signed-off-by: Guo Ren 
Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Peter Zijlstra 
Cc: Palmer Dabbelt 
Cc: Anup Patel 
Cc: Arnd Bergmann 
---
 arch/riscv/Kconfig  |   1 +
 arch/riscv/include/asm/Kbuild   |   1 +
 arch/riscv/include/asm/spinlock.h   | 158 
 arch/riscv/include/asm/spinlock_types.h |  19 ++--
 4 files changed, 74 insertions(+), 105 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 87d7b52..7c56a20 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -30,6 +30,7 @@ config RISCV
select ARCH_HAS_STRICT_KERNEL_RWX if MMU
select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
+   select ARCH_USE_QUEUED_RWLOCKS
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild
index 445ccc9..e57ef80 100644
--- a/arch/riscv/include/asm/Kbuild
+++ b/arch/riscv/include/asm/Kbuild
@@ -3,5 +3,6 @@ generic-y += early_ioremap.h
 generic-y += extable.h
 generic-y += flat.h
 generic-y += kvm_para.h
+generic-y += qrwlock.h
 generic-y += user.h
 generic-y += vmlinux.lds.h
diff --git a/arch/riscv/include/asm/spinlock.h 
b/arch/riscv/include/asm/spinlock.h
index f4f7fa1..2c81764 100644
--- a/arch/riscv/include/asm/spinlock.h
+++ b/arch/riscv/include/asm/spinlock.h
@@ -7,129 +7,91 @@
 #ifndef _ASM_RISCV_SPINLOCK_H
 #define _ASM_RISCV_SPINLOCK_H
 
-#include 
-#include 
-#include 
-
 /*
- * Simple spin lock operations.  These provide no fairness guarantees.
+ * Ticket-based spin-locking.
  */
+static inline void arch_spin_lock(arch_spinlock_t *lock)
+{
+   arch_spinlock_t lockval;
+   u32 tmp;
+
+   asm volatile (
+   "1: lr.w%0, %2  \n"
+   "   mv  %1, %0  \n"
+   "   addw%0, %0, %3  \n"
+   "   sc.w%0, %0, %2  \n"
+   "   bnez%0, 1b  \n"
+   : "=&r" (tmp), "=&r" (lockval), "+A" (lock->lock)
+   : "r" (1 << TICKET_NEXT)
+   : "memory");
 
-/* FIXME: Replace this with a ticket lock, like MIPS. */
-
-#define arch_spin_is_locked(x) (READ_ONCE((x)->lock) != 0)
+   while (lockval.tickets.next != lockval.tickets.owner) {
+   /*
+* FIXME - we need wfi/wfe here to prevent:
+*  - cache line bouncing
+*  - saving cpu pipeline in multi-harts-per-core
+*processor
+*/
+   lockval.tickets.owner = READ_ONCE(lock->tickets.owner);
+   }
 
-static inline void arch_spin_unlock(arch_spinlock_t *lock)
-{
-   smp_store_release(&lock->lock, 0);
+   __atomic_acquire_fence();
 }
 
 static inline int arch_spin_trylock(arch_spinlock_t *lock)
 {
-   int tmp = 1, busy;
-
-   __asm__ __volatile__ (
-   "   amoswap.w %0, %2, %1\n"
-   RISCV_ACQUIRE_BARRIER
-   : "=r" (busy), "+A" (lock->lock)
-   : "r" (tmp)
+   u32 tmp, contended, res;
+
+   do {
+   asm volatile (
+   "   lr.w%0, %3  \n"
+   "   srliw   %1, %0, %5  \n"
+   "   slliw   %2, %0, %5  \n"
+   "   or  %1, %2, %1  \n"
+   "   li  %2, 0   \n"
+   "   sub %1, %1, %0  \n"
+   "   bnez%1, 1f  \n"
+   "   addw%0, %0, %4  \n"
+   "   sc.w%2, %0, %3  \n"
+   "1: \n"
+   : "=&r" (tmp), "=&r" (contended), "=&r" (res),
+ "+A" (lock->lock)
+   : "r" (1 << TICKET_NEXT), "I" (TICKET_NEXT)
: "memory");
+   } while (res);
 
-   return !busy;
-}
-
-static inline void arch_spin_lock(arch_spinlock_t *lock)
-{
-   while (1) {
-   if (arch_spin_is_locked(lock))
-   continue;
-
-   if (arch_spin_trylock(lock))
-   break;
+   if (!contended) {
+   __atomic_acquire_fence();
+   return 1;
+   } else {
+   return 0;
}
 }
 
-/***/
-
-static inline void arch_read_lock(arch_rwlock_t *lock)
+static inline void arch_spin_unlock(arch_spinlock_t *lock)
 {
-   int tmp;
-
-   __asm__ __volatile__(
-   "1: lr.w%1, %0\n"
-   "   bltz%1, 1b\n"
-   "   addi%1, %1, 1\n"
-   "   sc.w%1, %1, %0\n"
-  

Re: [PATCH] misc: rtsx: check the value returned from a function for errors before being used

2021-03-24 Thread Greg KH
On Wed, Mar 24, 2021 at 06:05:58PM +0800, Yang Li wrote:
> Add missing return value check in pm_runtime_get disabling the
> sensor. The issue is reported by coverity with the following error:
> 
> Medium:Unchecked return value(CHECKED_RETURN)
> CWE252: Value returned from a function is not checked for errors before
> being used.
> Calling "pm_runtime_get" without checking return value.
> 
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 
> ---
>  drivers/misc/cardreader/rtsx_pcr.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/cardreader/rtsx_pcr.c 
> b/drivers/misc/cardreader/rtsx_pcr.c
> index 2733111..2cc37fd 100644
> --- a/drivers/misc/cardreader/rtsx_pcr.c
> +++ b/drivers/misc/cardreader/rtsx_pcr.c
> @@ -142,13 +142,16 @@ static void rtsx_pm_full_on(struct rtsx_pcr *pcr)
>  
>  void rtsx_pci_start_run(struct rtsx_pcr *pcr)
>  {
> + int status;
>   /* If pci device removed, don't queue idle work any more */
>   if (pcr->remove_pci)
>   return;
>  
>   if (pcr->rtd3_en)
>   if (pcr->is_runtime_suspended) {
> - pm_runtime_get(&(pcr->pci->dev));
> + status = pm_runtime_get(&(pcr->pci->dev));
> + if (status < 0 && status != -EINPROGRESS)
> + pm_runtime_put_noidle(&(pcr->pci->dev));
>   pcr->is_runtime_suspended = false;
>   }
>  
> -- 
> 1.8.3.1
> 

Please always run scripts/checkpatch.pl on your patch before submitting
it.

thanks,

greg k-h


Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread elaine.zhang

Hi,  Enric

在 2021/3/24 下午5:56, Enric Balletbo i Serra 写道:

Hi Elaine,

This is not the exact version I sent, and you reintroduced a "problem" that were
already solved/discussed on previous versions. See below:

On 24/3/21 8:16, Elaine Zhang wrote:

Convert the soc/rockchip/power_domain.txt binding document to
json-schema and move to the power bindings directory.

Signed-off-by: Enric Balletbo i Serra 

If you do significant is a good practice shortly describe them within [] here.


Signed-off-by: Elaine Zhang 

Note that my last version already had the

Reviewed-by: Rob Herring 

Which should be fine for merging (with probably only minor changes) and you
could maintain if you don't do significant changes, but that's not the case, as
I said, you are reintroducing one problem. Please review the comments already
received on this patchset or similar patchsets to avoid this.


---
  .../power/rockchip,power-controller.yaml  | 284 ++
  .../bindings/soc/rockchip/power_domain.txt| 136 -
  2 files changed, 284 insertions(+), 136 deletions(-)
  create mode 100644 
Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
  delete mode 100644 
Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

diff --git 
a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml 
b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
new file mode 100644
index ..a220322c5139
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
@@ -0,0 +1,284 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip Power Domains
+
+maintainers:
+  - Elaine Zhang 
+  - Rob Herring 

Up to Rob, but I don't think Rob would like to be the maintainer. I think you
can only include yourself and Heiko.



+  - Heiko Stuebner 
+
+description: |
+  Rockchip processors include support for multiple power domains which can be
+  powered up/down by software based on different application scenarios to save 
power.
+
+  Power domains contained within power-controller node are generic power domain
+  providers documented in 
Documentation/devicetree/bindings/power/power-domain.yaml.
+
+  IP cores belonging to a power domain should contain a "power-domains"
+  property that is a phandle for the power domain node representing the domain.
+
+properties:
+  $nodename:
+const: power-controller
+
+  compatible:
+enum:
+  - rockchip,px30-power-controller
+  - rockchip,rk3036-power-controller
+  - rockchip,rk3066-power-controller
+  - rockchip,rk3128-power-controller
+  - rockchip,rk3188-power-controller
+  - rockchip,rk3228-power-controller
+  - rockchip,rk3288-power-controller
+  - rockchip,rk3328-power-controller
+  - rockchip,rk3366-power-controller
+  - rockchip,rk3368-power-controller
+  - rockchip,rk3399-power-controller
+
+  "#power-domain-cells":
+const: 1
+
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+patternProperties:
+  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
+type: object
+description: |
+  Represents the power domains within the power controller node as 
documented
+  in Documentation/devicetree/bindings/power/power-domain.yaml.
+

The node names must be generic, as this is power-domain must be in the form:

+patternProperties:
+  "^power-domain@[0-9a-f]+$":
In this way, dtbs_check cannot be passed, and all the usage methods in 
dts of Rockchip need to be corrected, which I think is a bigger change.




+properties:
+
+  "#power-domain-cells":
+description:
+  Must be 0 for nodes representing a single PM domain and 1 for nodes
+  providing multiple PM domains.
+
+  "#address-cells":
+const: 1
+
+  "#size-cells":
+const: 0
+
+  reg:
+maxItems: 1
+description: |
+  Power domain index. Valid values are defined in
+  "include/dt-bindings/power/px30-power.h"
+  "include/dt-bindings/power/rk3036-power.h"
+  "include/dt-bindings/power/rk3066-power.h"
+  "include/dt-bindings/power/rk3128-power.h"
+  "include/dt-bindings/power/rk3188-power.h"
+  "include/dt-bindings/power/rk3228-power.h"
+  "include/dt-bindings/power/rk3288-power.h"
+  "include/dt-bindings/power/rk3328-power.h"
+  "include/dt-bindings/power/rk3366-power.h"
+  "include/dt-bindings/power/rk3368-power.h"
+  "include/dt-bindings/power/rk3399-power.h"
+
+  clocks:
+description: |
+  A number of phandles to clocks that need to be enabled while power 
domain
+  switches state.
+
+  pm_qos:
+description: |
+  A number of phandles to qos blocks which need to be saved and 
restored
+  while power domain swit

Re: [PATCH v3 3/4] kernel/smp: add more data to CSD lock debugging

2021-03-24 Thread Jürgen Groß

On 02.03.21 07:28, Juergen Gross wrote:

In order to help identifying problems with IPI handling and remote
function execution add some more data to IPI debugging code.

There have been multiple reports of cpus looping long times (many
seconds) in smp_call_function_many() waiting for another cpu executing
a function like tlb flushing. Most of these reports have been for
cases where the kernel was running as a guest on top of KVM or Xen
(there are rumours of that happening under VMWare, too, and even on
bare metal).

Finding the root cause hasn't been successful yet, even after more than
2 years of chasing this bug by different developers.

Commit 35feb60474bf4f7 ("kernel/smp: Provide CSD lock timeout
diagnostics") tried to address this by adding some debug code and by
issuing another IPI when a hang was detected. This helped mitigating
the problem (the repeated IPI unlocks the hang), but the root cause is
still unknown.

Current available data suggests that either an IPI wasn't sent when it
should have been, or that the IPI didn't result in the target cpu
executing the queued function (due to the IPI not reaching the cpu,
the IPI handler not being called, or the handler not seeing the queued
request).

Try to add more diagnostic data by introducing a global atomic counter
which is being incremented when doing critical operations (before and
after queueing a new request, when sending an IPI, and when dequeueing
a request). The counter value is stored in percpu variables which can
be printed out when a hang is detected.

The data of the last event (consisting of sequence counter, source
cpu, target cpu, and event type) is stored in a global variable. When
a new event is to be traced, the data of the last event is stored in
the event related percpu location and the global data is updated with
the new event's data. This allows to track two events in one data
location: one by the value of the event data (the event before the
current one), and one by the location itself (the current event).

A typical printout with a detected hang will look like this:

csd: Detected non-responsive CSD lock (#1) on CPU#1, waiting 53 ns for 
CPU#06 scf_handler_1+0x0/0x50(0xa2a881bb1410).
csd: CSD lock (#1) handling prior 
scf_handler_1+0x0/0x50(0xa2a8813823c0) request.
 csd: cnt(8cc): -> dequeue (src cpu 0 == empty)
 csd: cnt(8cd): ->0006 idle
 csd: cnt(0003668): 0001->0006 queue
 csd: cnt(0003669): 0001->0006 ipi
 csd: cnt(0003e0f): 0007->000a queue
 csd: cnt(0003e10): 0001-> ping
 csd: cnt(0003e71): 0003-> ping
 csd: cnt(0003e72): ->0006 gotipi
 csd: cnt(0003e73): ->0006 handle
 csd: cnt(0003e74): ->0006 dequeue (src cpu 0 == empty)
 csd: cnt(0003e7f): 0004->0006 ping
 csd: cnt(0003e80): 0001-> pinged
 csd: cnt(0003eb2): 0005->0001 noipi
 csd: cnt(0003eb3): 0001->0006 queue
 csd: cnt(0003eb4): 0001->0006 noipi
 csd: cnt now: 0003f00

This example (being an artificial one, produced with a previous version
of this patch without the "hdlend" event), shows that cpu#6 started to
handle an IPI (cnt 3e72-3e74), bit didn't start to handle another IPI
(sent by cpu#4, cnt 3e7f). The next request from cpu#1 for cpu#6 was
queued (3eb3), but no IPI was needed (cnt 3eb4, there was the event
from cpu#4 in the queue already).

The idea is to print only relevant entries. Those are all events which
are associated with the hang (so sender side events for the source cpu
of the hanging request, and receiver side events for the target cpu),
and the related events just before those (for adding data needed to
identify a possible race). Printing all available data would be
possible, but this would add large amounts of data printed on larger
configurations.

Signed-off-by: Juergen Gross 
Tested-by: Paul E. McKenney 


Just an update regarding current status with debugging the underlying
issue:

On a customer's machine with a backport of this patch applied we've
seen another case of the hang. In the logs we've found:

smp: csd: Detected non-responsive CSD lock (#1) on CPU#18, waiting 
500046 ns for CPU#06 do_flush_tlb_all+0x0/0x30(  (null)).

smp:csd: CSD lock (#1) unresponsive.
smp:csd: cnt(000): -> queue
smp:csd: cnt(001): ->0006 idle
smp:csd: cnt(0025dba): 0012->0006 queue
smp:csd: cnt(0025dbb): 0012->0006 noipi
smp:csd: cnt(01d1333): 001a->0006 pinged
smp:csd: cnt(01d1334): ->0006 gotipi
smp:csd: cnt(01d1335): ->0006 handle
smp:csd: cnt(01d1336): ->0006 dequeue (src cpu 0 == empty)
smp:csd: cnt(01d1337): ->0006 hdlend (src cpu 0 == early)
smp:csd: cnt(01d16cb): 0012->0005 ipi
smp:csd: cnt(01d16cc): 0012->0006 queue
smp:csd: cnt(01d16cd): 0012->0006 ipi
smp:csd: cnt(01d16f3): 0012->001a ipi
smp:csd: cnt(01d16f4): 0012-> ping
smp:csd: cnt(01d1750

[RESEND PATCH V3 2/2] arm64: dts: qcom: sc7180: Remove QUP-CORE ICC path

2021-03-24 Thread Roja Rani Yarubandi
We had introduced the QUP-CORE ICC path to put proxy votes from
QUP wrapper on behalf of earlycon, if other users of QUP-CORE turn
off this clock before the real console is probed, unclocked access
to HW was seen from earlycon.

With ICC sync state support proxy votes are no longer need as ICC
will ensure that the default bootloader votes are not removed until
all it's consumer are probed.

We can safely remove ICC path for QUP-CORE clock from QUP wrapper
device.

Signed-off-by: Roja Rani Yarubandi 
Signed-off-by: Akash Asthana 
Reviewed-by: Matthias Kaehlcke 
---
Changes in V3:
 - No change

Changes in V2:
 - No change

 arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 83fbb481cae5..2709051740d1 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -768,8 +768,6 @@ qupv3_id_0: geniqup@8c {
#size-cells = <2>;
ranges;
iommus = <&apps_smmu 0x43 0x0>;
-   interconnects = <&qup_virt MASTER_QUP_CORE_0 0 
&qup_virt SLAVE_QUP_CORE_0 0>;
-   interconnect-names = "qup-core";
status = "disabled";
 
i2c0: i2c@88 {
@@ -1059,8 +1057,6 @@ qupv3_id_1: geniqup@ac {
#size-cells = <2>;
ranges;
iommus = <&apps_smmu 0x4c3 0x0>;
-   interconnects = <&qup_virt MASTER_QUP_CORE_1 0 
&qup_virt SLAVE_QUP_CORE_1 0>;
-   interconnect-names = "qup-core";
status = "disabled";
 
i2c6: i2c@a8 {
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation



[RESEND PATCH V3 0/2] Separate out earlycon

2021-03-24 Thread Roja Rani Yarubandi
Resending V3 with adding Fixes and cc tag.

This patch depends on both the below patches:
interconnect: qcom: Ensure that the floor bandwidth value is enforced
interconnect: qcom: Use icc_sync_state 

Roja Rani Yarubandi (2):
  soc: qcom-geni-se: Cleanup the code to remove proxy votes
  arm64: dts: qcom: sc7180: Remove QUP-CORE ICC path

 arch/arm64/boot/dts/qcom/sc7180.dtsi  |  4 --
 drivers/soc/qcom/qcom-geni-se.c   | 74 ---
 drivers/tty/serial/qcom_geni_serial.c |  7 ---
 include/linux/qcom-geni-se.h  |  2 -
 4 files changed, 87 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation



Linux 4.4.263

2021-03-24 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.4.263 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.4.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 arch/x86/kernel/apic/io_apic.c  |   10 
 drivers/pci/hotplug/rpadlpar_sysfs.c|   14 ++
 drivers/platform/chrome/cros_ec_dev.c   |4 +
 drivers/platform/chrome/cros_ec_proto.c |4 -
 drivers/scsi/lpfc/lpfc_debugfs.c|4 -
 drivers/usb/gadget/composite.c  |4 -
 drivers/usb/gadget/configfs.c   |   16 ---
 drivers/usb/gadget/usbstring.c  |4 -
 fs/btrfs/ctree.c|2 
 fs/ext4/block_validity.c|   71 ++--
 fs/ext4/ext4.h  |6 +-
 fs/ext4/extents.c   |   16 ++-
 fs/ext4/indirect.c  |6 --
 fs/ext4/inode.c |   13 ++---
 fs/ext4/mballoc.c   |4 -
 fs/ext4/namei.c |   29 -
 fs/ext4/super.c |5 +-
 include/linux/mfd/cros_ec.h |6 +-
 include/uapi/linux/usb/ch9.h|3 +
 kernel/irq/manage.c |4 +
 net/sunrpc/svc_xprt.c   |4 -
 22 files changed, 138 insertions(+), 93 deletions(-)

Dan Carpenter (1):
  scsi: lpfc: Fix some error codes in debugfs

Filipe Manana (1):
  btrfs: fix race when cloning extent buffer during rewind of an old root

Greg Kroah-Hartman (1):
  Linux 4.4.263

Gwendal Grignou (1):
  platform/chrome: cros_ec_dev - Fix security issue

Jan Kara (3):
  ext4: handle error of ext4_setup_system_zone() on remount
  ext4: don't allow overlapping system zones
  ext4: check journal inode extents more carefully

Jim Lin (1):
  usb: gadget: configfs: Fix KASAN use-after-free

Joe Korty (1):
  NFSD: Repair misuse of sv_lock in 5.10.16-rt30.

Macpaul Lin (1):
  USB: replace hardcode maximum usb string length by definition

Shijie Luo (1):
  ext4: fix potential error in ext4_do_update_inode

Thomas Gleixner (2):
  x86/ioapic: Ignore IRQ2 again
  genirq: Disable interrupts for force threaded handlers

Tyrel Datwyler (1):
  PCI: rpadlpar: Fix potential drc_name corruption in store functions

zhangyi (F) (1):
  ext4: find old entry again if failed to rename whiteout



[RESEND PATCH V3 1/2] soc: qcom-geni-se: Cleanup the code to remove proxy votes

2021-03-24 Thread Roja Rani Yarubandi
This reverts commit 048eb908a1f2 ("soc: qcom-geni-se: Add interconnect
support to fix earlycon crash")

ICC core and platforms drivers supports sync_state feature, which
ensures that the default ICC BW votes from the bootloader is not
removed until all it's consumers are probes.

The proxy votes were needed in case other QUP child drivers
I2C, SPI probes before UART, they can turn off the QUP-CORE clock
which is shared resources for all QUP driver, this causes unclocked
access to HW from earlycon.

Given above support from ICC there is no longer need to maintain
proxy votes on QUP-CORE ICC node from QUP wrapper driver for early
console usecase, the default votes won't be removed until real
console is probed.

Cc: sta...@vger.kernel.org
Fixes: 266cd33b5913 ("interconnect: qcom: Ensure that the floor bandwidth value 
is enforced")
Fixes: 7d3b0b0d8184 ("interconnect: qcom: Use icc_sync_state")
Signed-off-by: Roja Rani Yarubandi 
Signed-off-by: Akash Asthana 
Reviewed-by: Matthias Kaehlcke 
---
Changes in V3:
 - As per Matthias comments, updated commit text with adding
   icc sync_state and geni icc earlycon commits info

Changes in V2:
 - No change

 drivers/soc/qcom/qcom-geni-se.c   | 74 ---
 drivers/tty/serial/qcom_geni_serial.c |  7 ---
 include/linux/qcom-geni-se.h  |  2 -
 3 files changed, 83 deletions(-)

diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index c7c03ccfe888..5bdfb1565c14 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -3,7 +3,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -92,14 +91,11 @@ struct geni_wrapper {
struct device *dev;
void __iomem *base;
struct clk_bulk_data ahb_clks[NUM_AHB_CLKS];
-   struct geni_icc_path to_core;
 };
 
 static const char * const icc_path_names[] = {"qup-core", "qup-config",
"qup-memory"};
 
-static struct geni_wrapper *earlycon_wrapper;
-
 #define QUP_HW_VER_REG 0x4
 
 /* Common SE registers */
@@ -846,44 +842,11 @@ int geni_icc_disable(struct geni_se *se)
 }
 EXPORT_SYMBOL(geni_icc_disable);
 
-void geni_remove_earlycon_icc_vote(void)
-{
-   struct platform_device *pdev;
-   struct geni_wrapper *wrapper;
-   struct device_node *parent;
-   struct device_node *child;
-
-   if (!earlycon_wrapper)
-   return;
-
-   wrapper = earlycon_wrapper;
-   parent = of_get_next_parent(wrapper->dev->of_node);
-   for_each_child_of_node(parent, child) {
-   if (!of_device_is_compatible(child, "qcom,geni-se-qup"))
-   continue;
-
-   pdev = of_find_device_by_node(child);
-   if (!pdev)
-   continue;
-
-   wrapper = platform_get_drvdata(pdev);
-   icc_put(wrapper->to_core.path);
-   wrapper->to_core.path = NULL;
-
-   }
-   of_node_put(parent);
-
-   earlycon_wrapper = NULL;
-}
-EXPORT_SYMBOL(geni_remove_earlycon_icc_vote);
-
 static int geni_se_probe(struct platform_device *pdev)
 {
struct device *dev = &pdev->dev;
struct resource *res;
struct geni_wrapper *wrapper;
-   struct console __maybe_unused *bcon;
-   bool __maybe_unused has_earlycon = false;
int ret;
 
wrapper = devm_kzalloc(dev, sizeof(*wrapper), GFP_KERNEL);
@@ -906,43 +869,6 @@ static int geni_se_probe(struct platform_device *pdev)
}
}
 
-#ifdef CONFIG_SERIAL_EARLYCON
-   for_each_console(bcon) {
-   if (!strcmp(bcon->name, "qcom_geni")) {
-   has_earlycon = true;
-   break;
-   }
-   }
-   if (!has_earlycon)
-   goto exit;
-
-   wrapper->to_core.path = devm_of_icc_get(dev, "qup-core");
-   if (IS_ERR(wrapper->to_core.path))
-   return PTR_ERR(wrapper->to_core.path);
-   /*
-* Put minmal BW request on core clocks on behalf of early console.
-* The vote will be removed earlycon exit function.
-*
-* Note: We are putting vote on each QUP wrapper instead only to which
-* earlycon is connected because QUP core clock of different wrapper
-* share same voltage domain. If core1 is put to 0, then core2 will
-* also run at 0, if not voted. Default ICC vote will be removed ASA
-* we touch any of the core clock.
-* core1 = core2 = max(core1, core2)
-*/
-   ret = icc_set_bw(wrapper->to_core.path, GENI_DEFAULT_BW,
-   GENI_DEFAULT_BW);
-   if (ret) {
-   dev_err(&pdev->dev, "%s: ICC BW voting failed for core: %d\n",
-   __func__, ret);
-   return ret;
-   }
-
-   if (of_get_compatible_child(pdev->dev.of_node, "qcom,geni-debug-uart"))
-   earlycon_wrapper = wrapper;
-   of_node_p

Re: Linux 4.9.263

2021-03-24 Thread Greg Kroah-Hartman
diff --git a/Makefile b/Makefile
index be5eac0a12d3..80b265a383bb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 262
+SUBLEVEL = 263
 EXTRAVERSION =
 NAME = Roaring Lionus
 
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index f562ddbeb20c..f39838d78976 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1473,7 +1473,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs 
*iregs)
 */
if (!pebs_status && cpuc->pebs_enabled &&
!(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
-   pebs_status = cpuc->pebs_enabled;
+   pebs_status = p->status = cpuc->pebs_enabled;
 
bit = find_first_bit((unsigned long *)&pebs_status,
x86_pmu.max_pebs_events);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 7aa9a9bd9d98..f606ef598917 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -461,15 +461,6 @@ struct thread_struct {
 */
 };
 
-/*
- * Thread-synchronous status.
- *
- * This is different from the flags in that nobody else
- * ever touches our thread-synchronous status, so we don't
- * have to worry about atomic accesses.
- */
-#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
-
 /*
  * Set IOPL bits in EFLAGS from given mask
  */
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index 0438f7fbb383..3ba5e2fce171 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -221,10 +221,31 @@ static inline int arch_within_stack_frames(const void * 
const stack,
 
 #endif
 
+/*
+ * Thread-synchronous status.
+ *
+ * This is different from the flags in that nobody else
+ * ever touches our thread-synchronous status, so we don't
+ * have to worry about atomic accesses.
+ */
+#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
+
+#ifndef __ASSEMBLY__
 #ifdef CONFIG_COMPAT
 #define TS_I386_REGS_POKED 0x0004  /* regs poked by 32-bit ptracer */
+#define TS_COMPAT_RESTART  0x0008
+
+#define arch_set_restart_data  arch_set_restart_data
+
+static inline void arch_set_restart_data(struct restart_block *restart)
+{
+   struct thread_info *ti = current_thread_info();
+   if (ti->status & TS_COMPAT)
+   ti->status |= TS_COMPAT_RESTART;
+   else
+   ti->status &= ~TS_COMPAT_RESTART;
+}
 #endif
-#ifndef __ASSEMBLY__
 
 #ifdef CONFIG_X86_32
 #define in_ia32_syscall() true
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 3401b28f1312..f398612e8a81 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1042,6 +1042,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int 
ioapic, int pin,
if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
irq = mp_irqs[idx].srcbusirq;
legacy = mp_is_legacy_irq(irq);
+   /*
+* IRQ2 is unusable for historical reasons on systems which
+* have a legacy PIC. See the comment vs. IRQ2 further down.
+*
+* If this gets removed at some point then the related code
+* in lapic_assign_system_vectors() needs to be adjusted as
+* well.
+*/
+   if (legacy && irq == PIC_CASCADE_IR)
+   return -EINVAL;
}
 
mutex_lock(&ioapic_mutex);
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index ca010dfb9682..4050d5092c86 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -767,30 +767,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 
 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
 {
-   /*
-* This function is fundamentally broken as currently
-* implemented.
-*
-* The idea is that we want to trigger a call to the
-* restart_block() syscall and that we want in_ia32_syscall(),
-* in_x32_syscall(), etc. to match whatever they were in the
-* syscall being restarted.  We assume that the syscall
-* instruction at (regs->ip - 2) matches whatever syscall
-* instruction we used to enter in the first place.
-*
-* The problem is that we can get here when ptrace pokes
-* syscall-like values into regs even if we're not in a syscall
-* at all.
-*
-* For now, we maintain historical behavior and guess based on
-* stored state.  We could do better by saving the actual
-* syscall arch in restart_block or (with caveats on x32) by
-* checking if regs->ip points to 'int $0x80'.  The current
-* behavior is incorrect if a tracer has a different bitness
-*

Re: Linux 4.4.263

2021-03-24 Thread Greg Kroah-Hartman
diff --git a/Makefile b/Makefile
index 11acd6dd024a..3f578adbe7fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 262
+SUBLEVEL = 263
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 5e8fc9809da3..497ad354e123 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1040,6 +1040,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int 
ioapic, int pin,
if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
irq = mp_irqs[idx].srcbusirq;
legacy = mp_is_legacy_irq(irq);
+   /*
+* IRQ2 is unusable for historical reasons on systems which
+* have a legacy PIC. See the comment vs. IRQ2 further down.
+*
+* If this gets removed at some point then the related code
+* in lapic_assign_system_vectors() needs to be adjusted as
+* well.
+*/
+   if (legacy && irq == PIC_CASCADE_IR)
+   return -EINVAL;
}
 
mutex_lock(&ioapic_mutex);
diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c 
b/drivers/pci/hotplug/rpadlpar_sysfs.c
index a796301ea03f..ca9d832bd9f8 100644
--- a/drivers/pci/hotplug/rpadlpar_sysfs.c
+++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
@@ -39,12 +39,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct 
kobj_attribute *attr,
if (nbytes >= MAX_DRC_NAME_LEN)
return 0;
 
-   memcpy(drc_name, buf, nbytes);
+   strscpy(drc_name, buf, nbytes + 1);
 
end = strchr(drc_name, '\n');
-   if (!end)
-   end = &drc_name[nbytes];
-   *end = '\0';
+   if (end)
+   *end = '\0';
 
rc = dlpar_add_slot(drc_name);
if (rc)
@@ -70,12 +69,11 @@ static ssize_t remove_slot_store(struct kobject *kobj,
if (nbytes >= MAX_DRC_NAME_LEN)
return 0;
 
-   memcpy(drc_name, buf, nbytes);
+   strscpy(drc_name, buf, nbytes + 1);
 
end = strchr(drc_name, '\n');
-   if (!end)
-   end = &drc_name[nbytes];
-   *end = '\0';
+   if (end)
+   *end = '\0';
 
rc = dlpar_remove_slot(drc_name);
if (rc)
diff --git a/drivers/platform/chrome/cros_ec_dev.c 
b/drivers/platform/chrome/cros_ec_dev.c
index 2b331d5b9e79..e16d82bb36a9 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/platform/chrome/cros_ec_dev.c
@@ -137,6 +137,10 @@ static long ec_device_ioctl_xcmd(struct cros_ec_dev *ec, 
void __user *arg)
if (copy_from_user(&u_cmd, arg, sizeof(u_cmd)))
return -EFAULT;
 
+   if ((u_cmd.outsize > EC_MAX_MSG_BYTES) ||
+   (u_cmd.insize > EC_MAX_MSG_BYTES))
+   return -EINVAL;
+
s_cmd = kmalloc(sizeof(*s_cmd) + max(u_cmd.outsize, u_cmd.insize),
GFP_KERNEL);
if (!s_cmd)
diff --git a/drivers/platform/chrome/cros_ec_proto.c 
b/drivers/platform/chrome/cros_ec_proto.c
index 5c285f2b3a65..d20190c8f0c0 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -311,8 +311,8 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
ec_dev->max_response = EC_PROTO2_MAX_PARAM_SIZE;
ec_dev->max_passthru = 0;
ec_dev->pkt_xfer = NULL;
-   ec_dev->din_size = EC_MSG_BYTES;
-   ec_dev->dout_size = EC_MSG_BYTES;
+   ec_dev->din_size = EC_PROTO2_MSG_BYTES;
+   ec_dev->dout_size = EC_PROTO2_MSG_BYTES;
} else {
/*
 * It's possible for a test to occur too early when
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 25aa9b98d53a..034d09f8d341 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -1061,7 +1061,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char 
__user *buf,
memset(dstbuf, 0, 32);
size = (nbytes < 32) ? nbytes : 32;
if (copy_from_user(dstbuf, buf, size))
-   return 0;
+   return -EFAULT;
 
if (dent == phba->debug_InjErrLBA) {
if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
@@ -1069,7 +1069,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char 
__user *buf,
}
 
if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
-   return 0;
+   return -EINVAL;
 
if (dent == phba->debug_writeGuard)
phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 5688df02d9ab..bb72d55a58b5 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -933,7 +933,7 @@ static vo

Linux 4.9.263

2021-03-24 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.9.263 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile  |2 
 arch/x86/events/intel/ds.c|2 
 arch/x86/include/asm/processor.h  |9 ---
 arch/x86/include/asm/thread_info.h|   23 
 arch/x86/kernel/apic/io_apic.c|   10 +++
 arch/x86/kernel/signal.c  |   24 
 drivers/iio/imu/adis16400_core.c  |3 -
 drivers/net/dsa/b53/b53_common.c  |   20 +++
 drivers/net/dsa/b53/b53_regs.h|1 
 drivers/net/dsa/bcm_sf2.c |5 +
 drivers/net/dsa/bcm_sf2_regs.h|2 
 drivers/net/ethernet/intel/ixgbe/ixgbe.h  |1 
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |4 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c  |   27 +
 drivers/nvme/target/core.c|   17 +-
 drivers/pci/hotplug/rpadlpar_sysfs.c  |   14 ++---
 drivers/scsi/lpfc/lpfc_debugfs.c  |4 -
 drivers/usb/gadget/composite.c|4 -
 drivers/usb/gadget/configfs.c |   16 -
 drivers/usb/gadget/usbstring.c|4 -
 fs/btrfs/ctree.c  |2 
 fs/ext4/block_validity.c  |   71 --
 fs/ext4/ext4.h|6 +-
 fs/ext4/extents.c |   16 ++---
 fs/ext4/indirect.c|6 --
 fs/ext4/inode.c   |   13 ++--
 fs/ext4/mballoc.c |4 -
 fs/ext4/namei.c   |   29 +-
 fs/ext4/super.c   |5 +
 fs/select.c   |   10 +--
 include/linux/thread_info.h   |   13 
 include/uapi/linux/usb/ch9.h  |3 +
 kernel/futex.c|3 -
 kernel/irq/manage.c   |4 +
 kernel/time/alarmtimer.c  |2 
 kernel/time/hrtimer.c |2 
 kernel/time/posix-cpu-timers.c|2 
 net/qrtr/qrtr.c   |2 
 net/sunrpc/svc.c  |6 +-
 net/sunrpc/svc_xprt.c |4 -
 net/sunrpc/xprtrdma/svc_rdma_backchannel.c|6 +-
 41 files changed, 255 insertions(+), 146 deletions(-)

Dan Carpenter (2):
  scsi: lpfc: Fix some error codes in debugfs
  iio: adis16400: Fix an error code in adis16400_initial_setup()

Daniel Kobras (1):
  sunrpc: fix refcount leak for rpc auth modules

Filipe Manana (1):
  btrfs: fix race when cloning extent buffer during rewind of an old root

Florian Fainelli (1):
  net: dsa: b53: Support setting learning on port

Greg Kroah-Hartman (1):
  Linux 4.9.263

Jacob Keller (2):
  ixgbe: check for Tx timestamp timeouts during watchdog
  ixgbe: prevent ptp_rx_hang from running when in FILTER_ALL mode

Jan Kara (3):
  ext4: handle error of ext4_setup_system_zone() on remount
  ext4: don't allow overlapping system zones
  ext4: check journal inode extents more carefully

Jim Lin (1):
  usb: gadget: configfs: Fix KASAN use-after-free

Joe Korty (1):
  NFSD: Repair misuse of sv_lock in 5.10.16-rt30.

Kan Liang (1):
  perf/x86/intel: Fix a crash caused by zero PEBS status

Macpaul Lin (1):
  USB: replace hardcode maximum usb string length by definition

Oleg Nesterov (3):
  kernel, fs: Introduce and use set_restart_fn() and arch_set_restart_data()
  x86: Move TS_COMPAT back to asm/thread_info.h
  x86: Introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall()

Pavel Skripkin (1):
  net/qrtr: fix __netdev_alloc_skb call

Sagi Grimberg (1):
  nvmet: don't check iosqes,iocqes for discovery controllers

Shijie Luo (1):
  ext4: fix potential error in ext4_do_update_inode

Thomas Gleixner (2):
  x86/ioapic: Ignore IRQ2 again
  genirq: Disable interrupts for force threaded handlers

Timo Rothenpieler (1):
  svcrdma: disable timeouts on rdma backchannel

Tyrel Datwyler (1):
  PCI: rpadlpar: Fix potential drc_name corruption in store functions

zhangyi (F) (1):
  ext4: find old entry again if failed to rename whiteout



[PATCH v1] MAINTAINERS: Update Maintainers of DRM Bridge Drivers

2021-03-24 Thread Robert Foss
Add myself as co-maintainer of DRM Bridge Drivers. Repository
commit access has already been granted.

https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/338

Cc: Neil Armstrong 
Cc: Laurent Pinchart 
Cc: Jonas Karlman 
Cc: Andrzej Hajda 
Cc: Jernej Škrabec 
Cc: Daniel Vetter 
Signed-off-by: Robert Foss 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4b705ba51c54..16ace8f58649 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5902,6 +5902,7 @@ F:drivers/gpu/drm/atmel-hlcdc/
 DRM DRIVERS FOR BRIDGE CHIPS
 M: Andrzej Hajda 
 M: Neil Armstrong 
+M: Robert Foss 
 R: Laurent Pinchart 
 R: Jonas Karlman 
 R: Jernej Skrabec 
-- 
2.31.0.30.g398dba342d.dirty



Re: [PATCH] ia64: mca: allocate early mca with GFP_ATOMIC

2021-03-24 Thread John Paul Adrian Glaubitz
Hi Sergei!

On 3/23/21 6:47 PM, Sergei Trofimovich wrote:
> On Tue, 23 Mar 2021 16:15:06 +0100
> John Paul Adrian Glaubitz  wrote:
> 
>> Hi Andrew!
>>
>> On 3/15/21 9:50 AM, Sergei Trofimovich wrote:
>>> The sleep warning happens at early boot right at
>>> secondary CPU activation bootup:
>>>
>>> smp: Bringing up secondary CPUs ...
>>> BUG: sleeping function called from invalid context at 
>>> mm/page_alloc.c:4942
>>> in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 0, name: 
>>> swapper/1
>>> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 
>>> 5.12.0-rc2-7-g79e228d0b611-dirty #99
>>>
>>> Call Trace:
>>>  [] show_stack+0x90/0xc0
>>>  [] dump_stack+0x150/0x1c0
>>>  [] ___might_sleep+0x1c0/0x2a0
>>>  [] __might_sleep+0xa0/0x160
>>>  [] __alloc_pages_nodemask+0x1a0/0x600
>>>  [] alloc_page_interleave+0x30/0x1c0
>>>  [] alloc_pages_current+0x2c0/0x340
>>>  [] __get_free_pages+0x30/0xa0
>>>  [] ia64_mca_cpu_init+0x2d0/0x3a0
>>>  [] cpu_init+0x8b0/0x1440
>>>  [] start_secondary+0x60/0x700
>>>  [] start_ap+0x750/0x780
>>> Fixed BSP b0 value from CPU 1
>>>
>>> As I understand interrupts are not enabled yet and system has a lot
>>> of memory. There is little chance to sleep and switch to GFP_ATOMIC
>>> should be a no-op.
>>>
>>> CC: Andrew Morton 
>>> CC: linux-i...@vger.kernel.org
>>> Signed-off-by: Sergei Trofimovich 
>>> ---
>>>  arch/ia64/kernel/mca.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
>>> index d4cae2fc69ca..adf6521525f4 100644
>>> --- a/arch/ia64/kernel/mca.c
>>> +++ b/arch/ia64/kernel/mca.c
>>> @@ -1824,7 +1824,7 @@ ia64_mca_cpu_init(void *cpu_data)
>>> data = mca_bootmem();
>>> first_time = 0;
>>> } else
>>> -   data = (void *)__get_free_pages(GFP_KERNEL,
>>> +   data = (void *)__get_free_pages(GFP_ATOMIC,
>>> get_order(sz));
>>> if (!data)
>>> panic("Could not allocate MCA memory for cpu %d\n",
>>>   
>>
>> Has this one been picked up for your tree already?
> 
> Should be there: https://www.ozlabs.org/~akpm/mmotm/series
> 
>> #NEXT_PATCHES_START mainline-later (next week, approximately)
>> ia64-mca-allocate-early-mca-with-gfp_atomic.patch

Great, thanks. We're still missing Valentin's patch for the NUMA enumeration 
issue
though. Should Valentin send the patch again with Andrew CC'ed?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: [PATCH v3] mmc: sdhci-of-dwcmshc: add ACPI support for BlueField-3 SoC

2021-03-24 Thread Ulf Hansson
On Mon, 22 Mar 2021 at 23:47, Liming Sun  wrote:
>
> This commit adds ACPI support in the sdhci-of-dwcmshc driver for
> BlueField-3 SoC. It has changes to only use the clock hierarchy
> for Deviec Tree since the clk is not supported by ACPI. Instead,
> ACPI can define 'clock-frequency' which is parsed by existing
> sdhci_get_property(). This clock value will be returned in function
> dwcmshc_get_max_clock().
>
> Signed-off-by: Liming Sun 
> Reviewed-by: Khalil Blaiech 

Applied for next, thanks!

Kind regards
Uffe


> ---
> v2->v3:
>Rebase to mmc next.
> v1->v2:
>Changes for comments from Adrian Hunter :
>- Make changes in sdhci-of-dwcmshc instead.
> v1: Initial version which was done in sdhci-acpi.c
> ---
>  drivers/mmc/host/sdhci-of-dwcmshc.c | 50 
> ++---
>  1 file changed, 36 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c 
> b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 0687368..1113a56 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -7,6 +7,7 @@
>   * Author: Jisheng Zhang 
>   */
>
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -94,6 +95,16 @@ static void dwcmshc_adma_write_desc(struct sdhci_host 
> *host, void **desc,
> sdhci_adma_write_desc(host, desc, addr, len, cmd);
>  }
>
> +static unsigned int dwcmshc_get_max_clock(struct sdhci_host *host)
> +{
> +   struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> +   if (pltfm_host->clk)
> +   return sdhci_pltfm_clk_get_max_clock(host);
> +   else
> +   return pltfm_host->clock;
> +}
> +
>  static void dwcmshc_check_auto_cmd23(struct mmc_host *mmc,
>  struct mmc_request *mrq)
>  {
> @@ -248,7 +259,7 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host 
> *host, unsigned int clock
> .set_clock  = sdhci_set_clock,
> .set_bus_width  = sdhci_set_bus_width,
> .set_uhs_signaling  = dwcmshc_set_uhs_signaling,
> -   .get_max_clock  = sdhci_pltfm_clk_get_max_clock,
> +   .get_max_clock  = dwcmshc_get_max_clock,
> .reset  = sdhci_reset,
> .adma_write_desc= dwcmshc_adma_write_desc,
>  };
> @@ -323,8 +334,16 @@ static int dwcmshc_rk3568_init(struct sdhci_host *host, 
> struct dwcmshc_priv *dwc
>  };
>  MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids);
>
> +#ifdef CONFIG_ACPI
> +static const struct acpi_device_id sdhci_dwcmshc_acpi_ids[] = {
> +   { .id = "MLNXBF30" },
> +   {}
> +};
> +#endif
> +
>  static int dwcmshc_probe(struct platform_device *pdev)
>  {
> +   struct device *dev = &pdev->dev;
> struct sdhci_pltfm_host *pltfm_host;
> struct sdhci_host *host;
> struct dwcmshc_priv *priv;
> @@ -347,7 +366,7 @@ static int dwcmshc_probe(struct platform_device *pdev)
> /*
>  * extra adma table cnt for cross 128M boundary handling.
>  */
> -   extra = DIV_ROUND_UP_ULL(dma_get_required_mask(&pdev->dev), SZ_128M);
> +   extra = DIV_ROUND_UP_ULL(dma_get_required_mask(dev), SZ_128M);
> if (extra > SDHCI_MAX_SEGS)
> extra = SDHCI_MAX_SEGS;
> host->adma_table_cnt += extra;
> @@ -355,19 +374,21 @@ static int dwcmshc_probe(struct platform_device *pdev)
> pltfm_host = sdhci_priv(host);
> priv = sdhci_pltfm_priv(pltfm_host);
>
> -   pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
> -   if (IS_ERR(pltfm_host->clk)) {
> -   err = PTR_ERR(pltfm_host->clk);
> -   dev_err(&pdev->dev, "failed to get core clk: %d\n", err);
> -   goto free_pltfm;
> -   }
> -   err = clk_prepare_enable(pltfm_host->clk);
> -   if (err)
> -   goto free_pltfm;
> +   if (dev->of_node) {
> +   pltfm_host->clk = devm_clk_get(dev, "core");
> +   if (IS_ERR(pltfm_host->clk)) {
> +   err = PTR_ERR(pltfm_host->clk);
> +   dev_err(dev, "failed to get core clk: %d\n", err);
> +   goto free_pltfm;
> +   }
> +   err = clk_prepare_enable(pltfm_host->clk);
> +   if (err)
> +   goto free_pltfm;
>
> -   priv->bus_clk = devm_clk_get(&pdev->dev, "bus");
> -   if (!IS_ERR(priv->bus_clk))
> -   clk_prepare_enable(priv->bus_clk);
> +   priv->bus_clk = devm_clk_get(dev, "bus");
> +   if (!IS_ERR(priv->bus_clk))
> +   clk_prepare_enable(priv->bus_clk);
> +   }
>
> err = mmc_of_parse(host->mmc);
> if (err)
> @@ -489,6 +510,7 @@ static int dwcmshc_resume(struct device *dev)
> .name   = "sdhci-dwcmshc",
> .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> .of_match_table = sdhci_dwcmshc_dt_ids,
> +   .acpi_match_table = ACPI_PTR(sdhc

Re: [PATCH] mmc: sdhci-of-dwcmshc: set MMC_CAP_WAIT_WHILE_BUSY

2021-03-24 Thread Ulf Hansson
On Wed, 24 Mar 2021 at 08:47, Jisheng Zhang  wrote:
>
> The host supports HW busy detection of the device busy signaling over
> dat0 line. Set MMC_CAP_wAIT_WHILE_BUSY host capability.
>
> Signed-off-by: Jisheng Zhang 

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-of-dwcmshc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c 
> b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 06873686d5e9..b6ceb1b92b3f 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -393,6 +393,8 @@ static int dwcmshc_probe(struct platform_device *pdev)
> goto err_clk;
> }
>
> +   host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
> +
> err = sdhci_add_host(host);
> if (err)
> goto err_clk;
> --
> 2.31.0
>


[tip:tmp.tmp 15/21] kernel/rcu/../locking/rtmutex_common.h:58:28: error: no member named 'pi_waiters' in 'struct task_struct'

2021-03-24 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tmp
head:   5965a7adbd72dd9b288c0911cb73719fed1efa08
commit: 18970ac4e37011fd0c709b6c2a640f01eecf2dd7 [15/21] locking/rtmutex: 
Remove pointless CONFIG_RT_MUTEXES=n stubs
config: s390-randconfig-r034-20210324 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
a4fb88669cd98db6fef7dcac88e3ec425d40c00d)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# 
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=18970ac4e37011fd0c709b6c2a640f01eecf2dd7
git remote add tip 
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip tmp.tmp
git checkout 18970ac4e37011fd0c709b6c2a640f01eecf2dd7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All errors (new ones prefixed by >>):

   In file included from kernel/rcu/tree.c:48:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:22:
   In file included from include/linux/writeback.h:14:
   In file included from include/linux/blk-cgroup.h:23:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   val = __raw_readb(PCI_IOBASE + addr);
 ~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
   ~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro 
'__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
 ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
   In file included from kernel/rcu/tree.c:48:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:22:
   In file included from include/linux/writeback.h:14:
   In file included from include/linux/blk-cgroup.h:23:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
   ~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro 
'__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
 ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
   In file included from kernel/rcu/tree.c:48:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:22:
   In file included from include/linux/writeback.h:14:
   In file included from include/linux/blk-cgroup.h:23:
   In file included from include/linux/blkdev.h:26:
   In file included from include/linux/scatterlist.h:9:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   __raw_writeb(value, PCI_IOBASE + addr);
   ~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a 
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
 ~~ ^
   include/asm-generic/io.h:521:59: war

Re: [PATCH] mmc: sdhci: replace mmc->parent with mmc_dev() for consistency

2021-03-24 Thread Ulf Hansson
On Wed, 24 Mar 2021 at 08:50, Jisheng Zhang  wrote:
>
> As pointed out by Ulf, "both "mmc->parent" and mmc_dev(mmc) are being
> used in the entire c-file". Convert all the mmc->parent usage in all
> sdhci host driver to mmc_dev() for consistency.
>
> Suggested-by: Ulf Hansson 
> Signed-off-by: Jisheng Zhang 

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-esdhc-mcf.c |  8 +++
>  drivers/mmc/host/sdhci-of-aspeed.c |  2 +-
>  drivers/mmc/host/sdhci-tegra.c | 34 +++---
>  drivers/mmc/host/sdhci.c   | 24 ++---
>  drivers/mmc/host/sdhci_am654.c |  2 +-
>  5 files changed, 35 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-mcf.c 
> b/drivers/mmc/host/sdhci-esdhc-mcf.c
> index ca7a1690b2a8..05926bf5ecf9 100644
> --- a/drivers/mmc/host/sdhci-esdhc-mcf.c
> +++ b/drivers/mmc/host/sdhci-esdhc-mcf.c
> @@ -367,14 +367,14 @@ static int esdhc_mcf_plat_init(struct sdhci_host *host,
>struct pltfm_mcf_data *mcf_data)
>  {
> struct mcf_esdhc_platform_data *plat_data;
> +   struct device *dev = mmc_dev(host->mmc);
>
> -   if (!host->mmc->parent->platform_data) {
> -   dev_err(mmc_dev(host->mmc), "no platform data!\n");
> +   if (!dev->platform_data) {
> +   dev_err(dev, "no platform data!\n");
> return -EINVAL;
> }
>
> -   plat_data = (struct mcf_esdhc_platform_data *)
> -   host->mmc->parent->platform_data;
> +   plat_data = (struct mcf_esdhc_platform_data *)dev->platform_data;
>
> /* Card_detect */
> switch (plat_data->cd_type) {
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c 
> b/drivers/mmc/host/sdhci-of-aspeed.c
> index 7d8692e90996..d001c51074a0 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -181,7 +181,7 @@ aspeed_sdhci_configure_phase(struct sdhci_host *host, 
> unsigned long rate)
> struct aspeed_sdhci *sdhci;
> struct device *dev;
>
> -   dev = host->mmc->parent;
> +   dev = mmc_dev(host->mmc);
> sdhci = sdhci_pltfm_priv(sdhci_priv(host));
>
> if (!sdhci->phase_desc)
> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index 41d193fa77bb..c61f797a853f 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -596,49 +596,49 @@ static void tegra_sdhci_parse_pad_autocal_dt(struct 
> sdhci_host *host)
> &tegra_host->autocal_offsets;
> int err;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-up-offset-3v3",
> &autocal->pull_up_3v3);
> if (err)
> autocal->pull_up_3v3 = 0;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-down-offset-3v3",
> &autocal->pull_down_3v3);
> if (err)
> autocal->pull_down_3v3 = 0;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-up-offset-1v8",
> &autocal->pull_up_1v8);
> if (err)
> autocal->pull_up_1v8 = 0;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-down-offset-1v8",
> &autocal->pull_down_1v8);
> if (err)
> autocal->pull_down_1v8 = 0;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-up-offset-sdr104",
> &autocal->pull_up_sdr104);
> if (err)
> autocal->pull_up_sdr104 = autocal->pull_up_1v8;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-down-offset-sdr104",
> &autocal->pull_down_sdr104);
> if (err)
> autocal->pull_down_sdr104 = autocal->pull_down_1v8;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,pad-autocal-pull-up-offset-hs400",
> &autocal->pull_up_hs400);
> if (err)
> autocal->pull_up_hs400 = autocal->pull_up_1v8;
>
> -   err = device_property_read_u32(host->mmc->parent,
> +   err = device_property_read_u32(mmc_dev(host->mmc),
> "nvidia,

Re: [PATCH v1] MAINTAINERS: Update Maintainers of DRM Bridge Drivers

2021-03-24 Thread Neil Armstrong
Hi !

On 24/03/2021 11:20, Robert Foss wrote:
> Add myself as co-maintainer of DRM Bridge Drivers. Repository
> commit access has already been granted.
> 
> https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/338
> 
> Cc: Neil Armstrong 
> Cc: Laurent Pinchart 
> Cc: Jonas Karlman 
> Cc: Andrzej Hajda 
> Cc: Jernej Škrabec 
> Cc: Daniel Vetter 
> Signed-off-by: Robert Foss 

+ CC: dri-de...@lists.freedesktop.org

> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4b705ba51c54..16ace8f58649 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5902,6 +5902,7 @@ F:  drivers/gpu/drm/atmel-hlcdc/
>  DRM DRIVERS FOR BRIDGE CHIPS
>  M:   Andrzej Hajda 
>  M:   Neil Armstrong 
> +M:   Robert Foss 
>  R:   Laurent Pinchart 
>  R:   Jonas Karlman 
>  R:   Jernej Skrabec 
> 

Acked-by: Neil Armstrong 

Welcome to the team, help is needed !

Neil


Linux 4.19.183

2021-03-24 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.19.183 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/powerpc/include/asm/cpu_has_feature.h   |4 -
 arch/powerpc/kernel/vmlinux.lds.S|1 
 arch/x86/events/intel/ds.c   |2 
 arch/x86/include/asm/processor.h |9 ---
 arch/x86/include/asm/thread_info.h   |   23 
 arch/x86/kernel/apic/apic.c  |5 +
 arch/x86/kernel/apic/io_apic.c   |   10 +++
 arch/x86/kernel/signal.c |   24 
 drivers/base/power/runtime.c |   62 +--
 drivers/iio/adc/Kconfig  |1 
 drivers/iio/adc/qcom-spmi-vadc.c |2 
 drivers/iio/gyro/mpu3050-core.c  |2 
 drivers/iio/humidity/hid-sensor-humidity.c   |   12 ++--
 drivers/iio/imu/adis16400_core.c |3 -
 drivers/iio/light/hid-sensor-prox.c  |   13 
 drivers/iio/temperature/hid-sensor-temperature.c |   14 ++---
 drivers/misc/lkdtm/Makefile  |2 
 drivers/misc/lkdtm/rodata.c  |2 
 drivers/nvme/host/rdma.c |7 +-
 drivers/nvme/target/core.c   |   17 +-
 drivers/pci/hotplug/rpadlpar_sysfs.c |   14 ++---
 drivers/scsi/lpfc/lpfc_debugfs.c |4 -
 drivers/usb/gadget/composite.c   |4 -
 drivers/usb/gadget/configfs.c|   16 -
 drivers/usb/gadget/usbstring.c   |4 -
 drivers/usb/storage/transport.c  |7 ++
 drivers/usb/storage/unusual_devs.h   |   12 
 drivers/usb/usbip/vudc_sysfs.c   |2 
 fs/btrfs/ctree.c |2 
 fs/btrfs/inode.c |2 
 fs/cifs/transport.c  |7 ++
 fs/ext4/inode.c  |8 +-
 fs/ext4/namei.c  |   29 ++
 fs/ext4/xattr.c  |2 
 fs/select.c  |   10 +--
 include/asm-generic/sections.h   |3 +
 include/asm-generic/vmlinux.lds.h|   10 +++
 include/linux/compiler.h |   54 
 include/linux/compiler_types.h   |6 ++
 include/linux/thread_info.h  |   13 
 include/linux/usb_usual.h|2 
 include/uapi/linux/usb/ch9.h |3 +
 kernel/futex.c   |3 -
 kernel/irq/manage.c  |4 +
 kernel/time/alarmtimer.c |2 
 kernel/time/hrtimer.c|2 
 kernel/time/posix-cpu-timers.c   |2 
 net/qrtr/qrtr.c  |2 
 net/sunrpc/svc.c |6 +-
 net/sunrpc/svc_xprt.c|4 -
 net/sunrpc/xprtrdma/svc_rdma_backchannel.c   |6 +-
 scripts/mod/modpost.c|2 
 sound/pci/hda/hda_generic.c  |2 
 sound/soc/codecs/ak4458.c|1 
 sound/soc/codecs/ak5558.c|1 
 sound/soc/fsl/fsl_ssi.c  |6 +-
 tools/build/Makefile.feature |3 +
 tools/build/feature/Makefile |   12 
 tools/build/feature/test-all.c   |   15 +
 tools/build/feature/test-eventfd.c   |9 +++
 tools/build/feature/test-get_current_dir_name.c  |   10 +++
 tools/build/feature/test-gettid.c|   11 
 tools/perf/Makefile.config   |   12 
 tools/perf/jvmti/jvmti_agent.c   |2 
 tools/perf/util/Build|1 
 tools/perf/util/expr.y   |3 -
 tools/perf/util/get_current_dir_name.c   |   18 ++
 tools/perf/util/parse-events.y   |2 
 tools/perf/util/util.h   |4 +
 70 files changed, 425 insertions(+), 151 deletions(-)

Alan Stern (1):
  usb-storage: Add quirk to defeat Kindle's automatic unload

Alexander Shiyan (1):
  ASoC: fsl_ssi: Fix TDM slot setup for I2S mode

Arnaldo Carvalho de Melo (3):
  tools build feature: Check if get_current_dir_name() is available
  tools build feature

Linux 4.14.227

2021-03-24 Thread Greg Kroah-Hartman
I'm announcing the release of the 4.14.227 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/x86/events/intel/ds.c   |2 
 arch/x86/include/asm/processor.h |9 --
 arch/x86/include/asm/thread_info.h   |   23 +++
 arch/x86/kernel/apic/io_apic.c   |   10 +++
 arch/x86/kernel/signal.c |   24 ---
 drivers/base/power/runtime.c |   62 
 drivers/iio/adc/Kconfig  |1 
 drivers/iio/adc/qcom-spmi-vadc.c |2 
 drivers/iio/gyro/mpu3050-core.c  |2 
 drivers/iio/humidity/hid-sensor-humidity.c   |   12 ++-
 drivers/iio/imu/adis16400_core.c |3 
 drivers/iio/light/hid-sensor-prox.c  |   13 +++-
 drivers/iio/temperature/hid-sensor-temperature.c |   14 ++--
 drivers/net/dsa/b53/b53_common.c |   20 ++
 drivers/net/dsa/b53/b53_regs.h   |1 
 drivers/net/dsa/bcm_sf2.c|5 +
 drivers/net/dsa/bcm_sf2_regs.h   |2 
 drivers/nvme/host/rdma.c |7 +-
 drivers/nvme/target/core.c   |   17 -
 drivers/pci/hotplug/rpadlpar_sysfs.c |   14 +---
 drivers/scsi/lpfc/lpfc_debugfs.c |4 -
 drivers/usb/gadget/composite.c   |4 -
 drivers/usb/gadget/configfs.c|   16 +++--
 drivers/usb/gadget/usbstring.c   |4 -
 drivers/usb/storage/transport.c  |7 ++
 drivers/usb/storage/unusual_devs.h   |   12 +++
 fs/btrfs/ctree.c |2 
 fs/ext4/block_validity.c |   71 ++-
 fs/ext4/ext4.h   |6 -
 fs/ext4/extents.c|   16 +
 fs/ext4/indirect.c   |6 -
 fs/ext4/inode.c  |   13 +---
 fs/ext4/mballoc.c|4 -
 fs/ext4/namei.c  |   29 -
 fs/ext4/super.c  |5 +
 fs/ext4/xattr.c  |2 
 fs/select.c  |   10 +--
 include/linux/thread_info.h  |   13 
 include/linux/usb_usual.h|2 
 include/uapi/linux/usb/ch9.h |3 
 kernel/bpf/verifier.c|   33 ++
 kernel/futex.c   |3 
 kernel/irq/manage.c  |4 +
 kernel/time/alarmtimer.c |2 
 kernel/time/hrtimer.c|2 
 kernel/time/posix-cpu-timers.c   |2 
 net/qrtr/qrtr.c  |2 
 net/sunrpc/svc.c |6 +
 net/sunrpc/svc_xprt.c|4 -
 net/sunrpc/xprtrdma/svc_rdma_backchannel.c   |6 -
 tools/build/Makefile.feature |4 +
 tools/build/feature/Makefile |   16 +
 tools/build/feature/test-all.c   |   20 ++
 tools/build/feature/test-eventfd.c   |9 ++
 tools/build/feature/test-get_current_dir_name.c  |   10 +++
 tools/build/feature/test-gettid.c|   11 +++
 tools/build/feature/test-pthread-barrier.c   |   12 +++
 tools/perf/Makefile.config   |   16 +
 tools/perf/jvmti/jvmti_agent.c   |2 
 tools/perf/util/Build|1 
 tools/perf/util/expr.y   |3 
 tools/perf/util/get_current_dir_name.c   |   18 +
 tools/perf/util/parse-events.y   |2 
 tools/perf/util/srcline.c|   16 -
 tools/perf/util/util.h   |4 +
 66 files changed, 468 insertions(+), 214 deletions(-)

Alan Stern (1):
  usb-storage: Add quirk to defeat Kindle's automatic unload

Arnaldo Carvalho de Melo (4):
  tools build feature: Check if get_current_dir_name() is available
  tools build feature: Check if eventfd() is available
  tools build: Check if gettid() is available before providing helper
  tools build feature: Check if pthread_barrier_t is available

Changbin Du (1):
  perf: Make perf able to build with latest libbfd

Dan Carpenter (2):
  scsi: lpfc: Fix some erro

Re: Linux 4.14.227

2021-03-24 Thread Greg Kroah-Hartman
diff --git a/Makefile b/Makefile
index 0e546913f1c4..60506b154d53 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 226
+SUBLEVEL = 227
 EXTRAVERSION =
 NAME = Petit Gorille
 
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 550b7814ef92..49dd12997a21 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1515,7 +1515,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs 
*iregs)
 */
if (!pebs_status && cpuc->pebs_enabled &&
!(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
-   pebs_status = cpuc->pebs_enabled;
+   pebs_status = p->status = cpuc->pebs_enabled;
 
bit = find_first_bit((unsigned long *)&pebs_status,
x86_pmu.max_pebs_events);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 56a89519dc14..be441d520d63 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -511,15 +511,6 @@ struct thread_struct {
 */
 };
 
-/*
- * Thread-synchronous status.
- *
- * This is different from the flags in that nobody else
- * ever touches our thread-synchronous status, so we don't
- * have to worry about atomic accesses.
- */
-#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
-
 /*
  * Set IOPL bits in EFLAGS from given mask
  */
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index bf9175d87844..a77f0ad96d94 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -229,10 +229,31 @@ static inline int arch_within_stack_frames(const void * 
const stack,
 
 #endif
 
+/*
+ * Thread-synchronous status.
+ *
+ * This is different from the flags in that nobody else
+ * ever touches our thread-synchronous status, so we don't
+ * have to worry about atomic accesses.
+ */
+#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
+
+#ifndef __ASSEMBLY__
 #ifdef CONFIG_COMPAT
 #define TS_I386_REGS_POKED 0x0004  /* regs poked by 32-bit ptracer */
+#define TS_COMPAT_RESTART  0x0008
+
+#define arch_set_restart_data  arch_set_restart_data
+
+static inline void arch_set_restart_data(struct restart_block *restart)
+{
+   struct thread_info *ti = current_thread_info();
+   if (ti->status & TS_COMPAT)
+   ti->status |= TS_COMPAT_RESTART;
+   else
+   ti->status &= ~TS_COMPAT_RESTART;
+}
 #endif
-#ifndef __ASSEMBLY__
 
 #ifdef CONFIG_X86_32
 #define in_ia32_syscall() true
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index be226cdd08d3..de74bca6a8ff 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1042,6 +1042,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int 
ioapic, int pin,
if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
irq = mp_irqs[idx].srcbusirq;
legacy = mp_is_legacy_irq(irq);
+   /*
+* IRQ2 is unusable for historical reasons on systems which
+* have a legacy PIC. See the comment vs. IRQ2 further down.
+*
+* If this gets removed at some point then the related code
+* in lapic_assign_system_vectors() needs to be adjusted as
+* well.
+*/
+   if (legacy && irq == PIC_CASCADE_IR)
+   return -EINVAL;
}
 
mutex_lock(&ioapic_mutex);
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 01741834fd6a..a18632b4da83 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -769,30 +769,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 
 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
 {
-   /*
-* This function is fundamentally broken as currently
-* implemented.
-*
-* The idea is that we want to trigger a call to the
-* restart_block() syscall and that we want in_ia32_syscall(),
-* in_x32_syscall(), etc. to match whatever they were in the
-* syscall being restarted.  We assume that the syscall
-* instruction at (regs->ip - 2) matches whatever syscall
-* instruction we used to enter in the first place.
-*
-* The problem is that we can get here when ptrace pokes
-* syscall-like values into regs even if we're not in a syscall
-* at all.
-*
-* For now, we maintain historical behavior and guess based on
-* stored state.  We could do better by saving the actual
-* syscall arch in restart_block or (with caveats on x32) by
-* checking if regs->ip points to 'int $0x80'.  The current
-* behavior is incorrect if a trace

Re: Linux 4.19.183

2021-03-24 Thread Greg Kroah-Hartman
diff --git a/Makefile b/Makefile
index 5956638e0f4d..9347445b2027 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 182
+SUBLEVEL = 183
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/arch/powerpc/include/asm/cpu_has_feature.h 
b/arch/powerpc/include/asm/cpu_has_feature.h
index 7897d16e0990..727d4b321937 100644
--- a/arch/powerpc/include/asm/cpu_has_feature.h
+++ b/arch/powerpc/include/asm/cpu_has_feature.h
@@ -7,7 +7,7 @@
 #include 
 #include 
 
-static inline bool early_cpu_has_feature(unsigned long feature)
+static __always_inline bool early_cpu_has_feature(unsigned long feature)
 {
return !!((CPU_FTRS_ALWAYS & feature) ||
  (CPU_FTRS_POSSIBLE & cur_cpu_spec->cpu_features & feature));
@@ -46,7 +46,7 @@ static __always_inline bool cpu_has_feature(unsigned long 
feature)
return static_branch_likely(&cpu_feature_keys[i]);
 }
 #else
-static inline bool cpu_has_feature(unsigned long feature)
+static __always_inline bool cpu_has_feature(unsigned long feature)
 {
return early_cpu_has_feature(feature);
 }
diff --git a/arch/powerpc/kernel/vmlinux.lds.S 
b/arch/powerpc/kernel/vmlinux.lds.S
index 695432965f20..9b346f3d2814 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -99,6 +99,7 @@ SECTIONS
 #endif
/* careful! __ftr_alt_* sections need to be close to .text */
*(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup 
__ftr_alt_* .ref.text);
+   NOINSTR_TEXT
SCHED_TEXT
CPUIDLE_TEXT
LOCK_TEXT
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 79caeba8b6f0..b3279feff458 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1557,7 +1557,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs 
*iregs)
 */
if (!pebs_status && cpuc->pebs_enabled &&
!(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
-   pebs_status = cpuc->pebs_enabled;
+   pebs_status = p->status = cpuc->pebs_enabled;
 
bit = find_first_bit((unsigned long *)&pebs_status,
x86_pmu.max_pebs_events);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 0f750e7b2407..cc4bb218f1c6 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -521,15 +521,6 @@ static inline void arch_thread_struct_whitelist(unsigned 
long *offset,
*size = fpu_kernel_xstate_size;
 }
 
-/*
- * Thread-synchronous status.
- *
- * This is different from the flags in that nobody else
- * ever touches our thread-synchronous status, so we don't
- * have to worry about atomic accesses.
- */
-#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
-
 /*
  * Set IOPL bits in EFLAGS from given mask
  */
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index 82b73b75d67c..b5e4c357523e 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -227,10 +227,31 @@ static inline int arch_within_stack_frames(const void * 
const stack,
 
 #endif
 
+/*
+ * Thread-synchronous status.
+ *
+ * This is different from the flags in that nobody else
+ * ever touches our thread-synchronous status, so we don't
+ * have to worry about atomic accesses.
+ */
+#define TS_COMPAT  0x0002  /* 32bit syscall active (64BIT)*/
+
+#ifndef __ASSEMBLY__
 #ifdef CONFIG_COMPAT
 #define TS_I386_REGS_POKED 0x0004  /* regs poked by 32-bit ptracer */
+#define TS_COMPAT_RESTART  0x0008
+
+#define arch_set_restart_data  arch_set_restart_data
+
+static inline void arch_set_restart_data(struct restart_block *restart)
+{
+   struct thread_info *ti = current_thread_info();
+   if (ti->status & TS_COMPAT)
+   ti->status |= TS_COMPAT_RESTART;
+   else
+   ti->status &= ~TS_COMPAT_RESTART;
+}
 #endif
-#ifndef __ASSEMBLY__
 
 #ifdef CONFIG_X86_32
 #define in_ia32_syscall() true
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index e891b33ccfe5..da6b52c70964 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2279,6 +2279,11 @@ static int cpuid_to_apicid[] = {
[0 ... NR_CPUS - 1] = -1,
 };
 
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+   return phys_id == cpuid_to_apicid[cpu];
+}
+
 #ifdef CONFIG_SMP
 /**
  * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary 
thread
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 15234885e60b..a89dac380243 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1043,6 +1043,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int 
ioapic, int pin,
if (idx >= 0 && test_bit(mp_irqs[i

[PATCH v1 0/3] drivers/char: remove /dev/kmem for good

2021-03-24 Thread David Hildenbrand
Let's remove /dev/kmem, which is unused and obsolete. Description from
patch #1:

"
Exploring /dev/kmem and /dev/mem in the context of memory hot(un)plug and
memory ballooning, I started questioning the existance of /dev/kmem.

Comparing it with the /proc/kcore implementation, it does not seem to be
able to deal with things like
a) Pages unmapped from the direct mapping (e.g., to be used by secretmem)
  -> kern_addr_valid(). virt_addr_valid() is not sufficient.
b) Special cases like gart aperture memory that is not to be touched
  -> mem_pfn_is_ram()
Unless I am missing something, it's at least broken in some cases and might
fault/crash the machine.

Looks like its existance has been questioned before in 2005 and 2010
[1], after ~11 additional years, it might make sense to revive the
discussion.

CONFIG_DEVKMEM is only enabled in a single defconfig (on purpose or by
mistake?). All distributions disable it: in Ubuntu it has been disabled
for more than 10 years, in Debian since 2.6.31, in Fedora at least starting
with FC3, in RHEL starting with RHEL4, in SUSE starting from 15sp2, and
OpenSUSE has it disabled as well.

1) /dev/kmem was popular for rootkits [2] before it got disabled
   basically everywhere. Ubuntu documents [3] "There is no modern user of
   /dev/kmem any more beyond attackers using it to load kernel rootkits.".
   RHEL documents in a BZ [5] "it served no practical purpose other than to
   serve as a potential security problem or to enable binary module drivers
   to access structures/functions they shouldn't be touching"

2) /proc/kcore is a decent interface to have a controlled way to read
   kernel memory for debugging puposes. (will need some extensions to
   deal with memory offlining/unplug, memory ballooning, and poisoned
   pages, though)

3) It might be useful for corner case debugging [1]. KDB/KGDB might be a
   better fit, especially, to write random memory; harder to shoot
   yourself into the foot.

4) "Kernel Memory Editor" [4] hasn't seen any updates since 2000 and seems
   to be incompatible with 64bit [1]. For educational purposes,
   /proc/kcore might be used to monitor value updates -- or older
   kernels can be used.

5) It's broken on arm64, and therefore, completely disabled there.

Looks like it's essentially unused and has been replaced by better
suited interfaces for individual tasks (/proc/kcore, KDB/KGDB). Let's
just remove it.

[1] https://lwn.net/Articles/147901/
[2] https://www.linuxjournal.com/article/10505
[3] https://wiki.ubuntu.com/Security/Features#A.2Fdev.2Fkmem_disabled
[4] https://sourceforge.net/projects/kme/
[5] https://bugzilla.redhat.com/show_bug.cgi?id=154796
"

RFC -> v1:
- "drivers/char: remove /dev/kmem for good"
-- Add more details to patch description regarding distributions
- "mm/vmalloc: remove vwrite()"
-- Also remove the nommu variant
- Compile-tested on more archs/configs

David Hildenbrand (3):
  drivers/char: remove /dev/kmem for good
  mm: remove xlate_dev_kmem_ptr()
  mm/vmalloc: remove vwrite()

 Documentation/admin-guide/devices.txt |   2 +-
 arch/alpha/include/asm/io.h   |   5 -
 arch/arm/configs/dove_defconfig   |   1 -
 arch/arm/configs/magician_defconfig   |   1 -
 arch/arm/configs/moxart_defconfig |   1 -
 arch/arm/configs/mps2_defconfig   |   1 -
 arch/arm/configs/mvebu_v5_defconfig   |   1 -
 arch/arm/configs/xcep_defconfig   |   1 -
 arch/arm/include/asm/io.h |   5 -
 arch/h8300/configs/edosk2674_defconfig|   1 -
 arch/h8300/configs/h8300h-sim_defconfig   |   1 -
 arch/h8300/configs/h8s-sim_defconfig  |   1 -
 arch/hexagon/configs/comet_defconfig  |   1 -
 arch/hexagon/include/asm/io.h |   1 -
 arch/ia64/include/asm/io.h|   1 -
 arch/ia64/include/asm/uaccess.h   |  18 --
 arch/m68k/configs/amcore_defconfig|   1 -
 arch/m68k/include/asm/io_mm.h |   5 -
 arch/mips/include/asm/io.h|   5 -
 arch/openrisc/configs/or1ksim_defconfig   |   1 -
 arch/parisc/include/asm/io.h  |   5 -
 arch/powerpc/include/asm/io.h |   5 -
 arch/s390/include/asm/io.h|   5 -
 arch/sh/configs/edosk7705_defconfig   |   1 -
 arch/sh/configs/se7206_defconfig  |   1 -
 arch/sh/configs/sh2007_defconfig  |   1 -
 arch/sh/configs/sh7724_generic_defconfig  |   1 -
 arch/sh/configs/sh7770_generic_defconfig  |   1 -
 arch/sh/configs/sh7785lcr_32bit_defconfig |   1 -
 arch/sh/include/asm/io.h  |   5 -
 arch/sparc/configs/sparc64_defconfig  |   1 -
 arch/sparc/include/asm/io_64.h|   5 -
 arch/xtensa/configs/xip_kc705_defconfig   |   1 -
 drivers/char/Kconfig  |  10 -
 drivers/char/mem.c| 231 --
 include/asm-generic/io.h  |  11 --
 include/linux/fs.h|   2 +-
 include/linux/vmalloc.h   |   3 +-
 kernel/config

[PATCH v1 1/3] drivers/char: remove /dev/kmem for good

2021-03-24 Thread David Hildenbrand
Exploring /dev/kmem and /dev/mem in the context of memory hot(un)plug and
memory ballooning, I started questioning the existance of /dev/kmem.

Comparing it with the /proc/kcore implementation, it does not seem to be
able to deal with things like
a) Pages unmapped from the direct mapping (e.g., to be used by secretmem)
  -> kern_addr_valid(). virt_addr_valid() is not sufficient.
b) Special cases like gart aperture memory that is not to be touched
  -> mem_pfn_is_ram()
Unless I am missing something, it's at least broken in some cases and might
fault/crash the machine.

Looks like its existance has been questioned before in 2005 and 2010
[1], after ~11 additional years, it might make sense to revive the
discussion.

CONFIG_DEVKMEM is only enabled in a single defconfig (on purpose or by
mistake?). All distributions disable it: in Ubuntu it has been disabled
for more than 10 years, in Debian since 2.6.31, in Fedora at least starting
with FC3, in RHEL starting with RHEL4, in SUSE starting from 15sp2, and
OpenSUSE has it disabled as well.

1) /dev/kmem was popular for rootkits [2] before it got disabled
   basically everywhere. Ubuntu documents [3] "There is no modern user of
   /dev/kmem any more beyond attackers using it to load kernel rootkits.".
   RHEL documents in a BZ [5] "it served no practical purpose other than to
   serve as a potential security problem or to enable binary module drivers
   to access structures/functions they shouldn't be touching"

2) /proc/kcore is a decent interface to have a controlled way to read
   kernel memory for debugging puposes. (will need some extensions to
   deal with memory offlining/unplug, memory ballooning, and poisoned
   pages, though)

3) It might be useful for corner case debugging [1]. KDB/KGDB might be a
   better fit, especially, to write random memory; harder to shoot
   yourself into the foot.

4) "Kernel Memory Editor" [4] hasn't seen any updates since 2000 and seems
   to be incompatible with 64bit [1]. For educational purposes,
   /proc/kcore might be used to monitor value updates -- or older
   kernels can be used.

5) It's broken on arm64, and therefore, completely disabled there.

Looks like it's essentially unused and has been replaced by better
suited interfaces for individual tasks (/proc/kcore, KDB/KGDB). Let's
just remove it.

[1] https://lwn.net/Articles/147901/
[2] https://www.linuxjournal.com/article/10505
[3] https://wiki.ubuntu.com/Security/Features#A.2Fdev.2Fkmem_disabled
[4] https://sourceforge.net/projects/kme/
[5] https://bugzilla.redhat.com/show_bug.cgi?id=154796

Cc: Linus Torvalds 
Cc: Greg Kroah-Hartman 
Cc: Andrew Morton 
Cc: "Alexander A. Klimov" 
Cc: Alexander Viro 
Cc: Alexandre Belloni 
Cc: Andrew Lunn 
Cc: Andrey Zhizhikin 
Cc: Arnd Bergmann 
Cc: Benjamin Herrenschmidt 
Cc: Brian Cain 
Cc: Christian Borntraeger 
Cc: Christophe Leroy 
Cc: Chris Zankel 
Cc: Corentin Labbe 
Cc: "David S. Miller" 
Cc: "Eric W. Biederman" 
Cc: Geert Uytterhoeven 
Cc: Gerald Schaefer 
Cc: Greentime Hu 
Cc: Gregory Clement 
Cc: Heiko Carstens 
Cc: Helge Deller 
Cc: Hillf Danton 
Cc: huang ying 
Cc: Ingo Molnar 
Cc: Ivan Kokshaysky 
Cc: "James E.J. Bottomley" 
Cc: James Troup 
Cc: Jiaxun Yang 
Cc: Jonas Bonn 
Cc: Jonathan Corbet 
Cc: Kairui Song 
Cc: Krzysztof Kozlowski 
Cc: Kuninori Morimoto 
Cc: Liviu Dudau 
Cc: Lorenzo Pieralisi 
Cc: Luc Van Oostenryck 
Cc: Luis Chamberlain 
Cc: Matthew Wilcox 
Cc: Matt Turner 
Cc: Max Filippov 
Cc: Michael Ellerman 
Cc: Michal Hocko 
Cc: Mike Rapoport 
Cc: Mikulas Patocka 
Cc: Minchan Kim 
Cc: Niklas Schnelle 
Cc: Oleksiy Avramchenko 
Cc: openr...@lists.librecores.org
Cc: Palmer Dabbelt 
Cc: Paul Mackerras 
Cc: "Pavel Machek (CIP)" 
Cc: Pavel Machek 
Cc: "Peter Zijlstra (Intel)" 
Cc: Pierre Morel 
Cc: Randy Dunlap 
Cc: Richard Henderson 
Cc: Rich Felker 
Cc: Robert Richter 
Cc: Rob Herring 
Cc: Russell King 
Cc: Sam Ravnborg 
Cc: Sebastian Andrzej Siewior 
Cc: Sebastian Hesselbarth 
Cc: sparcli...@vger.kernel.org
Cc: Stafford Horne 
Cc: Stefan Kristiansson 
Cc: Steven Rostedt 
Cc: Sudeep Holla 
Cc: Theodore Dubois 
Cc: Thomas Bogendoerfer 
Cc: Thomas Gleixner 
Cc: uclinux-h8-de...@lists.sourceforge.jp
Cc: Vasily Gorbik 
Cc: Viresh Kumar 
Cc: William Cohen 
Cc: Xiaoming Ni 
Cc: Yoshinori Sato 
Cc: linux-al...@vger.kernel.org
Cc: Linux API 
Cc: linux-a...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-...@vger.kernel.org
Cc: linux-fsde...@vger.kernel.org
Cc: linux-hexa...@vger.kernel.org
Cc: linux-i...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-m...@lists.linux-m68k.org
Cc: linux-m...@vger.kernel.org
Cc: linux-par...@vger.kernel.org
Cc: linuxppc-...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org
Cc: linux...@vger.kernel.org
Cc: linux-xte...@linux-xtensa.org
Signed-off-by: David Hildenbrand 
---
 Documentation/admin-guide/devices.txt |   2 +-
 arch/arm/configs/dove_defconfig   |   1 -
 arch/arm/configs/magician_defconfig   |   1 -
 arch/arm/configs/moxart_defconfig 

[PATCH v1 3/3] mm/vmalloc: remove vwrite()

2021-03-24 Thread David Hildenbrand
The last user (/dev/kmem) is gone. Let's drop it.

Cc: Linus Torvalds 
Cc: Greg Kroah-Hartman 
Cc: Andrew Morton 
Cc: Hillf Danton 
Cc: Michal Hocko 
Cc: Matthew Wilcox 
Cc: Oleksiy Avramchenko 
Cc: Steven Rostedt 
Cc: Minchan Kim 
Cc: huang ying 
Signed-off-by: David Hildenbrand 
---
 include/linux/vmalloc.h |   1 -
 mm/nommu.c  |  10 
 mm/vmalloc.c| 116 +---
 3 files changed, 1 insertion(+), 126 deletions(-)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 390af680e916..9c1b17c7dd95 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -200,7 +200,6 @@ static inline void set_vm_flush_reset_perms(void *addr)
 
 /* for /proc/kcore */
 extern long vread(char *buf, char *addr, unsigned long count);
-extern long vwrite(char *buf, char *addr, unsigned long count);
 
 /*
  * Internals.  Dont't use..
diff --git a/mm/nommu.c b/mm/nommu.c
index 5c9ab799c0e6..85a3a68dffb6 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -210,16 +210,6 @@ long vread(char *buf, char *addr, unsigned long count)
return count;
 }
 
-long vwrite(char *buf, char *addr, unsigned long count)
-{
-   /* Don't allow overflow */
-   if ((unsigned long) addr + count < count)
-   count = -(unsigned long) addr;
-
-   memcpy(addr, buf, count);
-   return count;
-}
-
 /*
  * vmalloc  -  allocate virtually contiguous memory
  *
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index ccb405b82581..434f61c9c466 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2802,10 +2802,7 @@ static int aligned_vread(char *buf, char *addr, unsigned 
long count)
 * kmap() and get small overhead in this access function.
 */
if (p) {
-   /*
-* we can expect USER0 is not used (see vread/vwrite's
-* function description)
-*/
+   /* We can expect USER0 is not used -- see vread() */
void *map = kmap_atomic(p);
memcpy(buf, map + offset, length);
kunmap_atomic(map);
@@ -2820,43 +2817,6 @@ static int aligned_vread(char *buf, char *addr, unsigned 
long count)
return copied;
 }
 
-static int aligned_vwrite(char *buf, char *addr, unsigned long count)
-{
-   struct page *p;
-   int copied = 0;
-
-   while (count) {
-   unsigned long offset, length;
-
-   offset = offset_in_page(addr);
-   length = PAGE_SIZE - offset;
-   if (length > count)
-   length = count;
-   p = vmalloc_to_page(addr);
-   /*
-* To do safe access to this _mapped_ area, we need
-* lock. But adding lock here means that we need to add
-* overhead of vmalloc()/vfree() calles for this _debug_
-* interface, rarely used. Instead of that, we'll use
-* kmap() and get small overhead in this access function.
-*/
-   if (p) {
-   /*
-* we can expect USER0 is not used (see vread/vwrite's
-* function description)
-*/
-   void *map = kmap_atomic(p);
-   memcpy(map + offset, buf, length);
-   kunmap_atomic(map);
-   }
-   addr += length;
-   buf += length;
-   copied += length;
-   count -= length;
-   }
-   return copied;
-}
-
 /**
  * vread() - read vmalloc area in a safe way.
  * @buf: buffer for reading data
@@ -2936,80 +2896,6 @@ long vread(char *buf, char *addr, unsigned long count)
return buflen;
 }
 
-/**
- * vwrite() - write vmalloc area in a safe way.
- * @buf:  buffer for source data
- * @addr: vm address.
- * @count:number of bytes to be read.
- *
- * This function checks that addr is a valid vmalloc'ed area, and
- * copy data from a buffer to the given addr. If specified range of
- * [addr...addr+count) includes some valid address, data is copied from
- * proper area of @buf. If there are memory holes, no copy to hole.
- * IOREMAP area is treated as memory hole and no copy is done.
- *
- * If [addr...addr+count) doesn't includes any intersects with alive
- * vm_struct area, returns 0. @buf should be kernel's buffer.
- *
- * Note: In usual ops, vwrite() is never necessary because the caller
- * should know vmalloc() area is valid and can use memcpy().
- * This is for routines which have to access vmalloc area without
- * any information, as /dev/kmem.
- *
- * Return: number of bytes for which addr and buf should be
- * increased (same number as @count) or %0 if [addr...addr+count)
- * doesn't include any intersection with valid vmalloc area
- */
-long vwrite(char *buf, char *addr, unsigned long count)

Re: [PATCH 2/2] power: supply: axp20x_usb_power: fix work-queue init

2021-03-24 Thread Sebastian Reichel
Hi,

On Wed, Mar 24, 2021 at 11:21:34AM +0200, Matti Vaittinen wrote:
> The commit 6d0c5de2fd84
> ("power: supply: Clean-up few drivers by using managed work init")
> Re-introduced wrong order of initializing work-queue and requesting
> the IRQs which was originally fixed by the commit b5e8642ed95f
> ("power: supply: axp20x_usb_power: Init work before enabling IRQs")
> 
> In addition this caused the work queue to be initialized twice.
> 
> Fix it again.
> 
> Fixes: 6d0c5de2fd84 ("power: supply: Clean-up few drivers by using managed 
> work init")
> 
> Signed-off-by: Matti Vaittinen 
> Reported-by: Chen-Yu Tsai 
> ---

Acked-by: Sebastian Reichel 

Needs to be merged by Greg, since I do not have 6d0c5de2fd84 in
my tree.

-- Sebastian

>  drivers/power/supply/axp20x_usb_power.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/axp20x_usb_power.c 
> b/drivers/power/supply/axp20x_usb_power.c
> index 4259709e3491..e954970b50e6 100644
> --- a/drivers/power/supply/axp20x_usb_power.c
> +++ b/drivers/power/supply/axp20x_usb_power.c
> @@ -594,7 +594,11 @@ static int axp20x_usb_power_probe(struct platform_device 
> *pdev)
>   power->axp20x_id = axp_data->axp20x_id;
>   power->regmap = axp20x->regmap;
>   power->num_irqs = axp_data->num_irq_names;
> - INIT_DELAYED_WORK(&power->vbus_detect, axp20x_usb_power_poll_vbus);
> +
> + ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect,
> +axp20x_usb_power_poll_vbus);
> + if (ret)
> + return ret;
>  
>   if (power->axp20x_id == AXP202_ID) {
>   /* Enable vbus valid checking */
> @@ -647,10 +651,6 @@ static int axp20x_usb_power_probe(struct platform_device 
> *pdev)
>   }
>   }
>  
> - ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect,
> -axp20x_usb_power_poll_vbus);
> - if (ret)
> - return ret;
>   if (axp20x_usb_vbus_needs_polling(power))
>   queue_delayed_work(system_power_efficient_wq, 
> &power->vbus_detect, 0);
>  
> -- 
> 2.25.4
> 
> 
> -- 
> Matti Vaittinen, Linux device drivers
> ROHM Semiconductors, Finland SWDC
> Kiviharjunlenkki 1E
> 90220 OULU
> FINLAND
> 
> ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~
> Simon says - in Latin please.
> ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~
> Thanks to Simon Glass for the translation =] 


signature.asc
Description: PGP signature


Re: RE: [PATCH] video/fbdev: Fix a double free in hvfb_probe

2021-03-24 Thread lyl2019



> -原始邮件-
> 发件人: "Michael Kelley" 
> 发送时间: 2021-03-24 02:52:07 (星期三)
> 收件人: "Lv Yunlong" , "KY Srinivasan" 
> , "Haiyang Zhang" , "Stephen 
> Hemminger" , "wei@kernel.org" 
> 抄送: "linux-hyp...@vger.kernel.org" , 
> "dri-de...@lists.freedesktop.org" , 
> "linux-fb...@vger.kernel.org" , 
> "linux-kernel@vger.kernel.org" 
> 主题: RE: [PATCH] video/fbdev: Fix a double free in hvfb_probe
> 
> From: Lv Yunlong  Sent: Tuesday, March 23, 2021 
> 12:34 AM
> > 
> > In function hvfb_probe in hyperv_fb.c, it calls hvfb_getmem(hdev, info)
> > and return err when info->apertures is freed.
> > 
> > In the error1 label of hvfb_probe, info->apertures will be freed twice
> > by framebuffer_release(info).
> > 
> > My patch sets info->apertures to NULL after it was freed to avoid
> > double free.
> > 
> > Signed-off-by: Lv Yunlong 
> > ---
> >  drivers/video/fbdev/hyperv_fb.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/video/fbdev/hyperv_fb.c 
> > b/drivers/video/fbdev/hyperv_fb.c
> > index c8b0ae676809..2fc9b507e73a 100644
> > --- a/drivers/video/fbdev/hyperv_fb.c
> > +++ b/drivers/video/fbdev/hyperv_fb.c
> > @@ -1032,6 +1032,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
> > fb_info
> > *info)
> > if (!pdev) {
> > pr_err("Unable to find PCI Hyper-V video\n");
> > kfree(info->apertures);
> > +   info->apertures = NULL;
> > return -ENODEV;
> > }
> > 
> > @@ -1130,6 +1131,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
> > fb_info
> > *info)
> > pci_dev_put(pdev);
> > }
> > kfree(info->apertures);
> > +   info->apertures = NULL;
> > 
> > return 0;
> > 
> > @@ -1142,6 +1144,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
> > fb_info
> > *info)
> > if (!gen2vm)
> > pci_dev_put(pdev);
> > kfree(info->apertures);
> > +   info->apertures = NULL;
> > 
> > return -ENOMEM;
> >  }
> > --
> > 2.25.1
> > 
> 
> While I think this works, a slightly better solution might be to remove
> all calls to kfree(info->apertures) in hvfb_getmem(),  and just let
> framebuffer_release() handle freeing the memory.  That's what is
> done in other drivers that follow the fbdev pattern, and it's less
> code overall.  
> 
> Michael

Ok, i agree with you. Remove all calls to kfree(info->apertures)
in hvfb_getmem() is a better solution.

I will subimt a PATCH v2 for you to review. Thanks.


Re: [PATCH v4] mfd: ntxec: Support for EC in Tolino Shine 2 HD

2021-03-24 Thread Lee Jones
On Mon, 15 Mar 2021, Andreas Kemnade wrote:

> Add the version of the EC in the Tolino Shine 2 HD
> to the supported versions. It seems not to have an RTC
> and does not ack data written to it.
> The vendor kernel happily ignores write errors, using
> I2C via userspace i2c-set also shows the error.
> So add a quirk to ignore that error.
> 
> PWM can be successfully configured despite of that error.
> 
> Signed-off-by: Andreas Kemnade 
> Reviewed-by: Jonathan Neuschäfer 
> ---
> Changes in v4:
> - rename subdevices back to v2 (suggested by Jonathan)
> - initialize subdevs in switch
> 
> Changes in v3:
> - remove have_rtc variable
> - rename subdevices again
> 
> Changes in v2:
> - more comments about stacking regmap construction
> - fix accidential line removal
> - better naming for subdevices
> 
>  drivers/mfd/ntxec.c   | 56 ---
>  include/linux/mfd/ntxec.h |  1 +
>  2 files changed, 54 insertions(+), 3 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread Enric Balletbo i Serra
Hi Elaine,

On 24/3/21 11:18, elaine.zhang wrote:
> Hi,  Enric
> 
> 在 2021/3/24 下午5:56, Enric Balletbo i Serra 写道:
>> Hi Elaine,
>>
>> This is not the exact version I sent, and you reintroduced a "problem" that 
>> were
>> already solved/discussed on previous versions. See below:
>>
>> On 24/3/21 8:16, Elaine Zhang wrote:
>>> Convert the soc/rockchip/power_domain.txt binding document to
>>> json-schema and move to the power bindings directory.
>>>
>>> Signed-off-by: Enric Balletbo i Serra 
>> If you do significant is a good practice shortly describe them within [] 
>> here.
>>
>>> Signed-off-by: Elaine Zhang 
>> Note that my last version already had the
>>
>> Reviewed-by: Rob Herring 
>>
>> Which should be fine for merging (with probably only minor changes) and you
>> could maintain if you don't do significant changes, but that's not the case, 
>> as
>> I said, you are reintroducing one problem. Please review the comments already
>> received on this patchset or similar patchsets to avoid this.
>>
>>> ---
>>>   .../power/rockchip,power-controller.yaml  | 284 ++
>>>   .../bindings/soc/rockchip/power_domain.txt    | 136 -
>>>   2 files changed, 284 insertions(+), 136 deletions(-)
>>>   create mode 100644
>>> Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>>   delete mode 100644
>>> Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> new file mode 100644
>>> index ..a220322c5139
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> @@ -0,0 +1,284 @@
>>> +# SPDX-License-Identifier: GPL-2.0-only
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Rockchip Power Domains
>>> +
>>> +maintainers:
>>> +  - Elaine Zhang 
>>> +  - Rob Herring 
>> Up to Rob, but I don't think Rob would like to be the maintainer. I think you
>> can only include yourself and Heiko.
>>
>>
>>> +  - Heiko Stuebner 
>>> +
>>> +description: |
>>> +  Rockchip processors include support for multiple power domains which can 
>>> be
>>> +  powered up/down by software based on different application scenarios to
>>> save power.
>>> +
>>> +  Power domains contained within power-controller node are generic power 
>>> domain
>>> +  providers documented in
>>> Documentation/devicetree/bindings/power/power-domain.yaml.
>>> +
>>> +  IP cores belonging to a power domain should contain a "power-domains"
>>> +  property that is a phandle for the power domain node representing the 
>>> domain.
>>> +
>>> +properties:
>>> +  $nodename:
>>> +    const: power-controller
>>> +
>>> +  compatible:
>>> +    enum:
>>> +  - rockchip,px30-power-controller
>>> +  - rockchip,rk3036-power-controller
>>> +  - rockchip,rk3066-power-controller
>>> +  - rockchip,rk3128-power-controller
>>> +  - rockchip,rk3188-power-controller
>>> +  - rockchip,rk3228-power-controller
>>> +  - rockchip,rk3288-power-controller
>>> +  - rockchip,rk3328-power-controller
>>> +  - rockchip,rk3366-power-controller
>>> +  - rockchip,rk3368-power-controller
>>> +  - rockchip,rk3399-power-controller
>>> +
>>> +  "#power-domain-cells":
>>> +    const: 1
>>> +
>>> +  "#address-cells":
>>> +    const: 1
>>> +
>>> +  "#size-cells":
>>> +    const: 0
>>> +
>>> +patternProperties:
>>> +  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
>>> +    type: object
>>> +    description: |
>>> +  Represents the power domains within the power controller node as
>>> documented
>>> +  in Documentation/devicetree/bindings/power/power-domain.yaml.
>>> +
>> The node names must be generic, as this is power-domain must be in the form:
>>
>> +patternProperties:
>> +  "^power-domain@[0-9a-f]+$":
> In this way, dtbs_check cannot be passed, and all the usage methods in dts of
> Rockchip need to be corrected, which I think is a bigger change.

Well, the problem is in the Rockchip dtbs, so needs to be fixed there. The
bindings must describe hardware in a generic way, not describe the actual dtbs
to not report errors.

Thanks,
 Enric

>>
>>
>>> +    properties:
>>> +
>>> +  "#power-domain-cells":
>>> +    description:
>>> +  Must be 0 for nodes representing a single PM domain and 1 for 
>>> nodes
>>> +  providing multiple PM domains.
>>> +
>>> +  "#address-cells":
>>> +    const: 1
>>> +
>>> +  "#size-cells":
>>> +    const: 0
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +    description: |
>>> +  Power domain index. Valid values are defined in
>>> +  "include/dt-bindings/power/px30-power.h"
>>> +  "include/dt-bindings/power/rk3036-power.h"
>>> +  "include/dt-bindings/power/rk3066-power.h"
>>

[PATCH] ceph: convert {n}ref from atomic_t to refcount_t

2021-03-24 Thread Yejune Deng
refcount_t type should be used instead of atomic_t when the variable
is used as a reference counter. This is because the implementation of
refcount_t can prevent overflows and detect possible use-after-free.

Signed-off-by: Yejune Deng 
---
 fs/ceph/mds_client.h |  2 +-
 fs/ceph/snap.c   | 27 +++
 fs/ceph/super.h  |  2 +-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index eaa7c5422116..bf99c5ba47fc 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -351,7 +351,7 @@ struct ceph_pool_perm {
 struct ceph_snapid_map {
struct rb_node node;
struct list_head lru;
-   atomic_t ref;
+   refcount_t ref;
u64 snap;
dev_t dev;
unsigned long last_used;
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 0728b01d4d43..c0fbbb56b259 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -66,14 +66,15 @@ void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
 struct ceph_snap_realm *realm)
 {
dout("get_realm %p %d -> %d\n", realm,
-atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
+refcount_read(&realm->nref), refcount_read(&realm->nref)+1);
/*
 * since we _only_ increment realm refs or empty the empty
 * list with snap_rwsem held, adjusting the empty list here is
 * safe.  we do need to protect against concurrent empty list
 * additions, however.
 */
-   if (atomic_inc_return(&realm->nref) == 1) {
+   refcount_inc(&realm->nref);
+   if (refcount_read(&realm->nref) == 1) {
spin_lock(&mdsc->snap_empty_lock);
list_del_init(&realm->empty_item);
spin_unlock(&mdsc->snap_empty_lock);
@@ -117,7 +118,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
if (!realm)
return ERR_PTR(-ENOMEM);
 
-   atomic_set(&realm->nref, 1);/* for caller */
+   refcount_set(&realm->nref, 1);/* for caller */
realm->ino = ino;
INIT_LIST_HEAD(&realm->children);
INIT_LIST_HEAD(&realm->child_item);
@@ -199,8 +200,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
 struct ceph_snap_realm *realm)
 {
dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
-atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
-   if (atomic_dec_and_test(&realm->nref))
+refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
+   if (refcount_dec_and_test(&realm->nref))
__destroy_snap_realm(mdsc, realm);
 }
 
@@ -211,8 +212,8 @@ void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
 struct ceph_snap_realm *realm)
 {
dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
-atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
-   if (!atomic_dec_and_test(&realm->nref))
+refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
+   if (!refcount_dec_and_test(&realm->nref))
return;
 
if (down_write_trylock(&mdsc->snap_rwsem)) {
@@ -1034,7 +1035,8 @@ struct ceph_snapid_map* ceph_get_snapid_map(struct 
ceph_mds_client *mdsc,
} else if (snap < exist->snap) {
p = &(*p)->rb_right;
} else {
-   if (atomic_inc_return(&exist->ref) == 1)
+   refcount_inc(&exist->ref);
+   if (refcount_read(&exist->ref) == 1)
list_del_init(&exist->lru);
break;
}
@@ -1057,7 +1059,7 @@ struct ceph_snapid_map* ceph_get_snapid_map(struct 
ceph_mds_client *mdsc,
}
 
INIT_LIST_HEAD(&sm->lru);
-   atomic_set(&sm->ref, 1);
+   refcount_set(&sm->ref, 1);
sm->snap = snap;
 
exist = NULL;
@@ -1076,7 +1078,8 @@ struct ceph_snapid_map* ceph_get_snapid_map(struct 
ceph_mds_client *mdsc,
exist = NULL;
}
if (exist) {
-   if (atomic_inc_return(&exist->ref) == 1)
+   refcount_inc(&exist->ref);
+   if (refcount_read(&exist->ref) == 1)
list_del_init(&exist->lru);
} else {
rb_link_node(&sm->node, parent, p);
@@ -1099,7 +1102,7 @@ void ceph_put_snapid_map(struct ceph_mds_client* mdsc,
 {
if (!sm)
return;
-   if (atomic_dec_and_lock(&sm->ref, &mdsc->snapid_map_lock)) {
+   if (refcount_dec_and_lock(&sm->ref, &mdsc->snapid_map_lock)) {
if (!RB_EMPTY_NODE(&sm->node)) {
sm->last_used = jiffies;
list_add_tail(&sm->lru, &mdsc->snapid_map_lru);
@@ -1161,7 +1164,7 @@ void ceph_cleanup_snapid_map(struct ceph_mds_client *mdsc)
sm = list_first_entry(&to_free, struct ceph_snapid_map, lru);
  

Re: [PATCH v1] MAINTAINERS: Update Maintainers of DRM Bridge Drivers

2021-03-24 Thread Maxime Ripard
On Wed, Mar 24, 2021 at 11:20:19AM +0100, Robert Foss wrote:
> Add myself as co-maintainer of DRM Bridge Drivers. Repository
> commit access has already been granted.
> 
> https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/338
> 
> Cc: Neil Armstrong 
> Cc: Laurent Pinchart 
> Cc: Jonas Karlman 
> Cc: Andrzej Hajda 
> Cc: Jernej Škrabec 
> Cc: Daniel Vetter 
> Signed-off-by: Robert Foss 

Acked-by: Maxime Ripard 

Maxime


signature.asc
Description: PGP signature


Re: [PATCH 5.4 00/24] 5.4.105-rc1 review

2021-03-24 Thread Greg KH
On Tue, Mar 23, 2021 at 10:20:27AM -0700, Florian Fainelli wrote:
> 
> 
> On 3/15/2021 2:50 AM, Pali Rohár wrote:
> > On Friday 12 March 2021 12:54:18 Alexander Lobakin wrote:
> >> From: Florian Fainelli 
> >> Date: Thu, 11 Mar 2021 09:41:27 -0800
> >>
> >> Hi Florian,
> >>
> >>> On 3/11/21 9:40 AM, Greg KH wrote:
>  On Thu, Mar 11, 2021 at 09:23:56AM -0800, Florian Fainelli wrote:
> > On 3/11/21 5:08 AM, Greg KH wrote:
> >> On Wed, Mar 10, 2021 at 08:19:45PM -0800, Florian Fainelli wrote:
> >>> +Alex,
> >>>
> >>> On 3/10/2021 5:24 AM, gre...@linuxfoundation.org wrote:
>  From: Greg Kroah-Hartman 
> 
>  This is the start of the stable review cycle for the 5.4.105 release.
>  There are 24 patches in this series, all will be posted as a response
>  to this one.  If anyone has any issues with these being applied, 
>  please
>  let me know.
> 
>  Responses should be made by Fri, 12 Mar 2021 13:23:09 +.
>  Anything received after that time might be too late.
> 
>  The whole patch series can be found in one patch at:
>   
>  https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.105-rc1.gz
>  or in the git tree and branch at:
>   
>  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>   linux-5.4.y
>  and the diffstat can be found below.
> 
>  thanks,
> 
>  greg k-h
> >>>
> >>> I believe you need to drop "net: dsa: add GRO support via gro_cells" 
> >>> as
> >>> it causes the following kernel panic on a DSA-enabled platform:
> >>>
> >>> Configuring rgmii_2 interface
> >>> [   10.170527] brcm-sf2 f0b0.ethernet_switch rgmii_2: configuring
> >>> for fixed/rgmii-txid link mode
> >>> [   10.179597] 8021q: adding VLAN 0 to HW filter on device rgmii_2
> >>> [   10.185608] brcm-sf2 f0b0.ethernet_switch rgmii_2: Link is Up -
> >>> 1Gbps/Full - flow control off
> >>> [   10.198631] IPv6: ADDRCONF(NETDEV_CHANGE): rgmii_2: link becomes 
> >>> ready
> >>> Configuring sit0 interface
> >>> [   10.254346] 8<--- cut here ---
> >>> [   10.257438] Unable to handle kernel paging request at virtual 
> >>> address
> >>> d6df6190
> >>> [   10.264685] pgd = (ptrval)
> >>> [   10.267411] [d6df6190] *pgd=807003, *pmd=
> >>> [   10.272846] Internal error: Oops: 206 [#1] SMP ARM
> >>> [   10.277661] Modules linked in:
> >>> [   10.280739] CPU: 0 PID: 1886 Comm: sed Not tainted
> >>> 5.4.105-1.0pre-geff642e2af2b #4
> >>> [   10.288337] Hardware name: Broadcom STB (Flattened Device Tree)
> >>> [   10.294292] PC is at gro_cells_receive+0x90/0x11c
> >>> [   10.299020] LR is at dsa_switch_rcv+0x120/0x1d4
> >>> [   10.303562] pc : []lr : []psr: 600f0113
> >>> [   10.309841] sp : c1d33cd0  ip : 03e8  fp : c1d33ce4
> >>> [   10.315078] r10: c8901000  r9 : c8901000  r8 : c0b4a53c
> >>> [   10.320314] r7 : c2208920  r6 :   r5 :   r4 : 
> >>> 4000
> >>> [   10.326855] r3 : d6df6188  r2 : c4927000  r1 : c8adc300  r0 : 
> >>> c22069dc
> >>> [   10.98] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> >>> Segment user
> >>> [   10.340547] Control: 30c5387d  Table: 04ac4c80  DAC: fffd
> >>> [   10.346307] Process sed (pid: 1886, stack limit = 0x(ptrval))
> >>> [   10.352066] Stack: (0xc1d33cd0 to 0xc1d34000)
> >>> [   10.356434] 3cc0: c8adc300
> >>> c4927000 c1d33d04 c1d33ce8
> >>> [   10.364631] 3ce0: c0b4a65c c0a579a4 c1d33d24 c2208920 c1d33d24
> >>>  c1d33d5c c1d33d08
> >>> [   10.372827] 3d00: c0a0b38c c0b4a548 c021e070 c2204cc8 
> >>> c89015c0 04b87700 c89015c0
> >>> [   10.381023] 3d20: c2208920 c1d33d24 c1d33d24 00976ec2 04b87700
> >>> c8adc300 c89015c0 
> >>> [   10.389218] 3d40: c1d33d74 c1d32000  c230742c c1d33dac
> >>> c1d33d60 c0a0b5c0 c0a0b180
> >>> [   10.397414] 3d60:  c2204cc8  c1d33d6c c1d33d6c
> >>> c1d33d80 c029daf8 00976ec2
> >>> [   10.405610] 3d80: 0800 c8901540 c89015c0 c8901540 
> >>> 0001 016c 0162
> >>> [   10.413805] 3da0: c1d33dc4 c1d33db0 c0a0b7fc c0a0b3b8 
> >>> c8adc300 c1d33dfc c1d33dc8
> >>> [   10.422001] 3dc0: c0a0c660 c0a0b7e4 c8901540 c8adc300 c1d33dfc
> >>> c1d33de0 c8901540 c8adc300
> >>> [   10.430196] 3de0: 015e c8901000 0001 016c c1d33e74
> >>> c1d33e00 c083df00 c0a0c4fc
> >>> [   10.438391] 3e00: 012c c22b0f14 c1d33e4c c1d33e18 c0fbd9b8
> >>> c0fbd9cc c0fbd9e0 c0fbd98c
> >>> [   10.446586] 3e20: 0001 0040 c8901500 0001 
> >>>   
> >>> [   10.454780] 3e40:  00

Re: [PATCH v1] MAINTAINERS: Update Maintainers of DRM Bridge Drivers

2021-03-24 Thread Laurent Pinchart
Hi Rob,

On Wed, Mar 24, 2021 at 11:20:19AM +0100, Robert Foss wrote:
> Add myself as co-maintainer of DRM Bridge Drivers. Repository
> commit access has already been granted.
> 
> https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/338
> 
> Cc: Neil Armstrong 
> Cc: Laurent Pinchart 
> Cc: Jonas Karlman 
> Cc: Andrzej Hajda 
> Cc: Jernej Škrabec 
> Cc: Daniel Vetter 
> Signed-off-by: Robert Foss 

Acked-by: Laurent Pinchart 

and welcome :-)

> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4b705ba51c54..16ace8f58649 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5902,6 +5902,7 @@ F:  drivers/gpu/drm/atmel-hlcdc/
>  DRM DRIVERS FOR BRIDGE CHIPS
>  M:   Andrzej Hajda 
>  M:   Neil Armstrong 
> +M:   Robert Foss 
>  R:   Laurent Pinchart 
>  R:   Jonas Karlman 
>  R:   Jernej Skrabec 

-- 
Regards,

Laurent Pinchart


Re: [PATCH v2 2/2] mfd: intel_quark_i2c_gpio: enable MSI interrupt

2021-03-24 Thread Lee Jones
On Tue, 23 Mar 2021, Andy Shevchenko wrote:

> Allow interrupts to be MSI if supported by hardware.
> 
> Signed-off-by: Andy Shevchenko 
> ---
> v2: new patch
>  drivers/mfd/intel_quark_i2c_gpio.c | 21 +++--
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mfd/intel_quark_i2c_gpio.c 
> b/drivers/mfd/intel_quark_i2c_gpio.c
> index 52728a963c17..16ce9cb3aa2f 100644
> --- a/drivers/mfd/intel_quark_i2c_gpio.c
> +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> @@ -169,8 +169,8 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, 
> struct mfd_cell *cell)
>   res[INTEL_QUARK_IORES_MEM].end =
>   pci_resource_end(pdev, MFD_I2C_BAR);
>  
> - res[INTEL_QUARK_IORES_IRQ].start = pdev->irq;
> - res[INTEL_QUARK_IORES_IRQ].end = pdev->irq;
> + res[INTEL_QUARK_IORES_IRQ].start = pci_irq_vector(pdev, 0);
> + res[INTEL_QUARK_IORES_IRQ].end = pci_irq_vector(pdev, 0);
>  
>   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>   if (!pdata)
> @@ -217,7 +217,7 @@ static int intel_quark_gpio_setup(struct pci_dev *pdev, 
> struct mfd_cell *cell)
>   pdata->properties->idx  = 0;
>   pdata->properties->ngpio= INTEL_QUARK_MFD_NGPIO;
>   pdata->properties->gpio_base= INTEL_QUARK_MFD_GPIO_BASE;
> - pdata->properties->irq[0]   = pdev->irq;
> + pdata->properties->irq[0]   = pci_irq_vector(pdev, 0);
>  
>   cell->platform_data = pdata;
>   cell->pdata_size = sizeof(*pdata);
> @@ -245,22 +245,30 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,
>   if (ret)
>   return ret;
>  
> + pci_set_master(pdev);
> +
> + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);

Is there any way these magic number can be defined or sizeof()'ed?

[...]

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v2 1/2] mfd: intel_quark_i2c_gpio: Reuse BAR definitions for MFD cell indexing

2021-03-24 Thread Lee Jones
On Tue, 23 Mar 2021, Andy Shevchenko wrote:

> It's convenient and less error prone to use definitions to address
> different cells in an array. For this purpose we may reuse existing
> BAR definitions.
> 
> Signed-off-by: Andy Shevchenko 
> ---
> v2: used explicit indices for MFD cells in the array (Lee)
>  drivers/mfd/intel_quark_i2c_gpio.c | 22 +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [RFC] mm: activate access-more-than-once page via NUMA balancing

2021-03-24 Thread Mel Gorman
On Wed, Mar 24, 2021 at 04:32:09PM +0800, Huang Ying wrote:
> One idea behind the LRU page reclaiming algorithm is to put the
> access-once pages in the inactive list and access-more-than-once pages
> in the active list.  This is true for the file pages that are accessed
> via syscall (read()/write(), etc.), but not for the pages accessed via
> the page tables.  We can only activate them via page reclaim scanning
> now.  This may cause some problems.  For example, even if there are
> only hot file pages accessed via the page tables in the inactive list,
> we will enable the cache trim mode incorrectly to scan only the hot
> file pages instead of cold anon pages.
> 

I caution against this patch.

It's non-deterministic for a number of reasons. As it requires NUMA
balancing to be enabled, the pageout behaviour of a system changes when
NUMA balancing is active. If this led to pages being artificially and
inappropriately preserved, NUMA balancing could be disabled for the
wrong reasons.  It only applies to pages that have no target node so
memory policies affect which pages are activated differently. Similarly,
NUMA balancing does not scan all VMAs and some pages may never trap a
NUMA fault as a result. The timing of when an address space gets scanned
is driven by the locality of pages and so the timing of page activation
potentially becomes linked to whether pages are local or need to migrate
(although not right now for this patch as it only affects pages with a
target nid of NUMA_NO_NODE). In other words, changes in NUMA balancing
that affect migration potentially affect the aging rate.  Similarly,
the activate rate of a process with a single thread and multiple threads
potentially have different activation rates.

Finally, the NUMA balancing scan algorithm is sub-optimal. It potentially
scans the entire address space even though only a small number of pages
are scanned. This is particularly problematic when a process has a lot
of threads because threads are redundantly scanning the same regions. If
NUMA balancing ever introduced range tracking of faulted pages to limit
how much scanning it has to do, it would inadvertently cause a change in
page activation rate.

NUMA balancing is about page locality, it should not get conflated with
page aging.

-- 
Mel Gorman
SUSE Labs


Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread Johan Jonker
Hi all,

Could Heiko and Rob advise if all these power-controller dtsi subnode
names should be changed?

Thanks!

On 3/24/21 11:14 AM, elaine.zhang wrote:
> Hi, Johan:
> 
> 在 2021/3/24 下午5:17, Johan Jonker 写道:
>> Hi Elaine,
>>
>> >From Rob's build log it turns out that 2 more properties must be added.
>> Add these new properties in separate patch.
>> Retest with commands below.
>> 
>> See rk3288.dtsi
>>
>>     assigned-clocks = <&cru SCLK_EDP_24M>;
>>     assigned-clock-parents = <&xin24m>;
> This should not be in the power node.
> It should be on the CRU node, or on the EDP's own node.
> I could have added it just to solve dtbs_check .

If this should not be in the power node then could you add a patch
before the YAML conversion?

example:

- ARM: dts: Move assigned-clocks in rk3288.dtsi
- dt-bindings: power: rockchip: Convert to json-schema
- dt-bindings: power: rockchip: Add bindings for RK3568 Soc
- soc: rockchip: power-domain: add rk3568 powerdomains

When that regex must be changed then also change all dtsi files ;)

- ARM: dts: rk3288: change power-controller sub nodenames.
- etc...

>> 
>> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210324071609.7531-3-zhangq...@rock-chips.com/
>>
>>
>> make ARCH=arm dtbs_check
>> DT_SCHEMA_FILES=Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>
>>
>> make ARCH=arm64 dtbs_check
>> DT_SCHEMA_FILES=Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>
>>
>> On 3/24/21 8:16 AM, Elaine Zhang wrote:
>>> Convert the soc/rockchip/power_domain.txt binding document to
>>> json-schema and move to the power bindings directory.
>>>
>>> Signed-off-by: Enric Balletbo i Serra 
>>> Signed-off-by: Elaine Zhang 
>>> ---
>>>   .../power/rockchip,power-controller.yaml  | 284 ++
>>>   .../bindings/soc/rockchip/power_domain.txt    | 136 -
>>>   2 files changed, 284 insertions(+), 136 deletions(-)
>>>   create mode 100644
>>> Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>>   delete mode 100644
>>> Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> new file mode 100644
>>> index ..a220322c5139
>>> --- /dev/null
>>> +++
>>> b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
>>> @@ -0,0 +1,284 @@
>>> +# SPDX-License-Identifier: GPL-2.0-only
>>> +%YAML 1.2
>>> +---
>>> +$id:
>>> http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Rockchip Power Domains
>>> +
>>> +maintainers:
>>> +  - Elaine Zhang 
>>> +  - Rob Herring 
>>> +  - Heiko Stuebner 
>>> +
>>> +description: |
>>> +  Rockchip processors include support for multiple power domains
>>> which can be
>>> +  powered up/down by software based on different application
>>> scenarios to save power.
>>> +
>>> +  Power domains contained within power-controller node are generic
>>> power domain
>>> +  providers documented in
>>> Documentation/devicetree/bindings/power/power-domain.yaml.
>>> +
>>> +  IP cores belonging to a power domain should contain a "power-domains"
>>> +  property that is a phandle for the power domain node representing
>>> the domain.
>>> +
>>> +properties:
>>> +  $nodename:
>>> +    const: power-controller
>>> +
>>> +  compatible:
>>> +    enum:
>>> +  - rockchip,px30-power-controller
>>> +  - rockchip,rk3036-power-controller
>>> +  - rockchip,rk3066-power-controller
>>> +  - rockchip,rk3128-power-controller
>>> +  - rockchip,rk3188-power-controller
>>> +  - rockchip,rk3228-power-controller
>>> +  - rockchip,rk3288-power-controller
>>> +  - rockchip,rk3328-power-controller
>>> +  - rockchip,rk3366-power-controller
>>> +  - rockchip,rk3368-power-controller
>>> +  - rockchip,rk3399-power-controller
>>> +
>>> +  "#power-domain-cells":
>>> +    const: 1
>>> +
>>> +  "#address-cells":
>>> +    const: 1
>>> +
>>> +  "#size-cells":
>>> +    const: 0
>>
>> assigned-clocks:
>>    maxItems: 1
>>
>> assigned-clock-parents:
>>    maxItems: 1
>>
>>> +
>>> +patternProperties:
>>> +  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
>>> +    type: object
>>> +    description: |
>>> +  Represents the power domains within the power controller node
>>> as documented
>>> +  in Documentation/devicetree/bindings/power/power-domain.yaml.
>>> +
>>> +    properties:
>>> +
>>> +  "#power-domain-cells":
>>> +    description:
>>> +  Must be 0 for nodes representing a single PM domain and 1
>>> for nodes
>>> +  providing multiple PM domains.
>>> +
>>> +  "#address-cells":
>>> +    const: 1
>>> +
>>> +  "#size-cells":
>>> +    const: 0
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +    description: |
>>> + 

Re: [PATCH v4 2/4] dt-bindings: power: rockchip: Convert to json-schema

2021-03-24 Thread Enric Balletbo i Serra



On 24/3/21 11:25, Enric Balletbo i Serra wrote:
> Hi Elaine,
> 
> On 24/3/21 11:18, elaine.zhang wrote:
>> Hi,  Enric
>>
>> 在 2021/3/24 下午5:56, Enric Balletbo i Serra 写道:
>>> Hi Elaine,
>>>
>>> This is not the exact version I sent, and you reintroduced a "problem" that 
>>> were
>>> already solved/discussed on previous versions. See below:
>>>
>>> On 24/3/21 8:16, Elaine Zhang wrote:
 Convert the soc/rockchip/power_domain.txt binding document to
 json-schema and move to the power bindings directory.

 Signed-off-by: Enric Balletbo i Serra 
>>> If you do significant is a good practice shortly describe them within [] 
>>> here.
>>>
 Signed-off-by: Elaine Zhang 
>>> Note that my last version already had the
>>>
>>> Reviewed-by: Rob Herring 
>>>
>>> Which should be fine for merging (with probably only minor changes) and you
>>> could maintain if you don't do significant changes, but that's not the 
>>> case, as
>>> I said, you are reintroducing one problem. Please review the comments 
>>> already
>>> received on this patchset or similar patchsets to avoid this.
>>>
 ---
   .../power/rockchip,power-controller.yaml  | 284 ++
   .../bindings/soc/rockchip/power_domain.txt    | 136 -
   2 files changed, 284 insertions(+), 136 deletions(-)
   create mode 100644
 Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
   delete mode 100644
 Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

 diff --git
 a/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 new file mode 100644
 index ..a220322c5139
 --- /dev/null
 +++ 
 b/Documentation/devicetree/bindings/power/rockchip,power-controller.yaml
 @@ -0,0 +1,284 @@
 +# SPDX-License-Identifier: GPL-2.0-only
 +%YAML 1.2
 +---
 +$id: http://devicetree.org/schemas/power/rockchip,power-controller.yaml#
 +$schema: http://devicetree.org/meta-schemas/core.yaml#
 +
 +title: Rockchip Power Domains
 +
 +maintainers:
 +  - Elaine Zhang 
 +  - Rob Herring 
>>> Up to Rob, but I don't think Rob would like to be the maintainer. I think 
>>> you
>>> can only include yourself and Heiko.
>>>
>>>
 +  - Heiko Stuebner 
 +
 +description: |
 +  Rockchip processors include support for multiple power domains which 
 can be
 +  powered up/down by software based on different application scenarios to
 save power.
 +
 +  Power domains contained within power-controller node are generic power 
 domain
 +  providers documented in
 Documentation/devicetree/bindings/power/power-domain.yaml.
 +
 +  IP cores belonging to a power domain should contain a "power-domains"
 +  property that is a phandle for the power domain node representing the 
 domain.
 +
 +properties:
 +  $nodename:
 +    const: power-controller
 +
 +  compatible:
 +    enum:
 +  - rockchip,px30-power-controller
 +  - rockchip,rk3036-power-controller
 +  - rockchip,rk3066-power-controller
 +  - rockchip,rk3128-power-controller
 +  - rockchip,rk3188-power-controller
 +  - rockchip,rk3228-power-controller
 +  - rockchip,rk3288-power-controller
 +  - rockchip,rk3328-power-controller
 +  - rockchip,rk3366-power-controller
 +  - rockchip,rk3368-power-controller
 +  - rockchip,rk3399-power-controller
 +
 +  "#power-domain-cells":
 +    const: 1
 +
 +  "#address-cells":
 +    const: 1
 +
 +  "#size-cells":
 +    const: 0
 +
 +patternProperties:
 +  "^pd_[0-9a-z_]{2,10}@[0-9a-f]+$":
 +    type: object
 +    description: |
 +  Represents the power domains within the power controller node as
 documented
 +  in Documentation/devicetree/bindings/power/power-domain.yaml.
 +
>>> The node names must be generic, as this is power-domain must be in the form:
>>>
>>> +patternProperties:
>>> +  "^power-domain@[0-9a-f]+$":
>> In this way, dtbs_check cannot be passed, and all the usage methods in dts of
>> Rockchip need to be corrected, which I think is a bigger change.
> 
> Well, the problem is in the Rockchip dtbs, so needs to be fixed there. The
> bindings must describe hardware in a generic way, not describe the actual dtbs
> to not report errors.
> 

FWIW I remember I did something regarding this but never sent to upstream, feel
free to pick if you find useful.

*
https://gitlab.collabora.com/eballetbo/linux/-/commit/12499f223e3d33602449b9102404fe573fb804f5
*
https://gitlab.collabora.com/eballetbo/linux/-/commit/12499f223e3d33602449b9102404fe573fb804f5
*
https://gitlab.collabora.com/eballetbo/linux/-/commit/492bf2213c341152a1c2423242c5634b9e53ff27

> Thanks,
>  Enric
> 
>>>
>>>
 +    properties:
 +

Re: [PATCH v3] usb: dwc3: gadget: Prevent EP queuing while stopping transfers

2021-03-24 Thread Marek Szyprowski
Hi Wesley,

On 23.03.2021 22:53, Wesley Cheng wrote:
> On 3/23/2021 10:27 AM, Andy Shevchenko wrote:
>> On Tue, Mar 23, 2021 at 1:19 AM Wesley Cheng  wrote:
>>> On 3/22/2021 2:14 PM, Andy Shevchenko wrote:
 On Mon, Mar 22, 2021 at 10:06 PM Wesley Cheng  
 wrote:
> On 3/22/2021 12:34 PM, Andy Shevchenko wrote:
>> On Mon, Mar 22, 2021 at 8:49 PM Wesley Cheng  
>> wrote:
>>> On 3/22/2021 5:48 AM, Andy Shevchenko wrote:
 On Fri, Mar 12, 2021 at 2:01 AM Wesley Cheng  
 wrote:
> In the situations where the DWC3 gadget stops active transfers, once
> calling the dwc3_gadget_giveback(), there is a chance where a function
> driver can queue a new USB request in between the time where the dwc3
> lock has been released and re-aquired.  This occurs after we've 
> already
> issued an ENDXFER command.  When the stop active transfers continues
> to remove USB requests from all dep lists, the newly added request 
> will
> also be removed, while controller still has an active TRB for it.
> This can lead to the controller accessing an unmapped memory address.
>
> Fix this by ensuring parameters to prevent EP queuing are set before
> calling the stop active transfers API.

 commit f09ddcfcb8c569675066337adac2ac205113471f
 Author: Wesley Cheng 
 Date:   Thu Mar 11 15:59:02 2021 -0800

 usb: dwc3: gadget: Prevent EP queuing while stopping transfers

 effectively broke my gadget setup.

 The output of the kernel (followed by non responsive state of USB 
 controller):

 [  195.228586] using random self ethernet address
 [  195.233104] using random host ethernet address
 [  195.245306] usb0: HOST MAC aa:bb:cc:dd:ee:f2
 [  195.249732] usb0: MAC aa:bb:cc:dd:ee:f1
 # [  195.773594] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes 
 ready
 [  195.780585] [ cut here ]
 [  195.785217] dwc3 dwc3.0.auto: No resource for ep2in
 [  195.790162] WARNING: CPU: 0 PID: 217 at
 drivers/usb/dwc3/gadget.c:360 dwc3_send_gadget_ep_cmd+0x4b9/0x670
 [  195.799760] Modules linked in: usb_f_eem u_ether libcomposite
 brcmfmac brcmutil mmc_block pwm_lpss_pci pwm_lps
 s snd_sof_pci_intel_tng snd_sof_pci snd_sof_acpi_intel_byt
 snd_sof_intel_ipc snd_sof_acpi snd_sof snd_sof_nocodec
 spi_pxa2xx_platform snd_sof_xtensa_dsp spi_pxa2xx_pci
 extcon_intel_mrfld intel_mrfld_adc sdhci_pci cqhci sdhci m
 mc_core intel_mrfld_pwrbtn intel_soc_pmic_mrfld hci_uart btbcm btintel
 [  195.835604] CPU: 0 PID: 217 Comm: irq/16-dwc3 Not tainted 
 5.12.0-rc4+ #60
 [  195.842403] Hardware name: Intel Corporation Merrifield/BODEGA BAY,
 BIOS 542 2015.01.21:18.19.48
 [  195.851191] RIP: 0010:dwc3_send_gadget_ep_cmd+0x4b9/0x670
 [  195.856608] Code: cd 00 00 00 44 89 44 24 20 48 89 4c 24 18 e8 ee
 f7 e4 ff 48 8b 4c 24 18 4c 89 f2 48 c7 c7 b9
 ed 4f a0 48 89 c6 e8 ef 24 43 00 <0f> 0b 41 be ea ff ff ff 44 8b 44 24
 20 e9 80 fc ff ff 41 83 fe 92
 [  195.875381] RSP: :a53c00373ba8 EFLAGS: 00010086
 [  195.880617] RAX:  RBX: 1387 RCX: 
 dfff
 [  195.887755] RDX: dfff RSI: ffea RDI: 
 
 [  195.894893] RBP: 9ce8c8f2b028 R08: a0732288 R09: 
 9ffb
 [  195.902034] R10: e000 R11: 3fff R12: 
 00041006
 [  195.909170] R13: a53c00373c24 R14: 9ce8c11dadb0 R15: 
 9ce8c2861700
 [  195.916310] FS:  () GS:9ce8fe20()
 knlGS:
 [  195.924409] CS:  0010 DS:  ES:  CR0: 80050033
 [  195.930161] CR2: f7f694a0 CR3: 38e0c000 CR4: 
 001006f0
 [  195.937300] Call Trace:
 [  195.939755]  __dwc3_gadget_ep_enable+0x2d4/0x4e0
 [  195.944393]  ? dwc3_remove_requests.constprop.0+0x86/0x170
>>> Odd that this change would affect the USB enablment path, as they were
>>> focused on the pullup disable path.  Would you happen to have any
>>> downstream changes on top of v5.12-rc4 we could review to see if they
>>> are still required? (ie where is the dwc3_remove_requests() coming from
>>> during ep enable)
>> You may check my branch [1] on GH. Basically you may be interested in
>> the commit:
>> 0f86df1294ee7523060cc16eafaf4898c693eab0 REVERTME: usb: dwc3: gadget:
>> skip endpoints ep[18]{in,out}
>> Otherwise it's a clean v5.12-rc4 with a revert and another USB PHY
>> suspend fix (which also shouldn't affect this).
> Ca

Re: [PATCH] block/rnbd-clt: fix overlapping snprintf arguments

2021-03-24 Thread Jinpu Wang
On Tue, Mar 23, 2021 at 1:55 PM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> The -Wrestrict warning (disabled by default) points out undefined
> behavior calling snprintf():
>
> drivers/block/rnbd/rnbd-clt-sysfs.c: In function 'rnbd_clt_get_path_name':
> drivers/block/rnbd/rnbd-clt-sysfs.c:486:8: error: 'snprintf' argument 4 
> overlaps destination object 'buf' [-Werror=restrict]
>   486 |  ret = snprintf(buf, len, "%s@%s", buf, dev->sess->sessname);
>   |^
> drivers/block/rnbd/rnbd-clt-sysfs.c:472:67: note: destination object 
> referenced by 'restrict'-qualified argument 1 was declared here
>   472 | static int rnbd_clt_get_path_name(struct rnbd_clt_dev *dev, char *buf,
>   | ~~^~~
>
> This can be simplified by using a single snprintf() to print the
> whole buffer, avoiding the undefined behavior.
>
> Fixes: 91f4acb2801c ("block/rnbd-clt: support mapping two devices with the 
> same name from different servers")
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/block/rnbd/rnbd-clt-sysfs.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c 
> b/drivers/block/rnbd/rnbd-clt-sysfs.c
> index d4aa6bfc9555..38251b749664 100644
> --- a/drivers/block/rnbd/rnbd-clt-sysfs.c
> +++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
> @@ -479,11 +479,7 @@ static int rnbd_clt_get_path_name(struct rnbd_clt_dev 
> *dev, char *buf,
> while ((s = strchr(pathname, '/')))
> s[0] = '!';
>
> -   ret = snprintf(buf, len, "%s", pathname);
> -   if (ret >= len)
> -   return -ENAMETOOLONG;
> -
> -   ret = snprintf(buf, len, "%s@%s", buf, dev->sess->sessname);
> +   ret = snprintf(buf, len, "%s@%s", pathname, dev->sess->sessname);
> if (ret >= len)
> return -ENAMETOOLONG;
>
> --
> 2.29.2
>
Thanks Arnd, We have a same patch will send out soon as part of a
bigger patchset.


Re: [PATCH 1/2] net: ipv4: route.c: add likely() statements

2021-03-24 Thread Leon Romanovsky
On Wed, Mar 24, 2021 at 11:09:22AM +0800, Yejune Deng wrote:
> Add likely() statements in ipv4_confirm_neigh() for 'rt->rt_gw_family
> == AF_INET'.

Why? Such macros are beneficial in only specific cases, most of the time,
likely/unlikely is cargo cult.

> 
> Signed-off-by: Yejune Deng 
> ---
>  net/ipv4/route.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index fa68c2612252..5762d9bc671c 100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -440,7 +440,7 @@ static void ipv4_confirm_neigh(const struct dst_entry 
> *dst, const void *daddr)
>   struct net_device *dev = dst->dev;
>   const __be32 *pkey = daddr;
>  
> - if (rt->rt_gw_family == AF_INET) {
> + if (likely(rt->rt_gw_family == AF_INET)) {
>   pkey = (const __be32 *)&rt->rt_gw4;
>   } else if (rt->rt_gw_family == AF_INET6) {
>   return __ipv6_confirm_neigh_stub(dev, &rt->rt_gw6);
> -- 
> 2.29.0
> 


Re: [RESEND 00/19] Rid GPU from W=1 warnings

2021-03-24 Thread Lee Jones
Daniel,

> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> This is a resend of the remaining patches.
> 
> All of these patches have been sent before.

Are you still keen to 'hoover these up'?

Just leave the one that requires work and take the rest perhaps?

> Lee Jones (19):
>   drm/nouveau/nvkm/subdev/bios/init: Demote obvious abuse of kernel-doc
>   drm/nouveau/dispnv50/disp: Remove unused variable 'ret'
>   drm/msm/dp/dp_display: Remove unused variable 'hpd'
>   include: drm: drm_atomic: Make use of 'new_plane_state'
>   drm/nouveau/nvkm/subdev/volt/gk20a: Demote non-conformant kernel-doc
> headers
>   drm/amd/display/dc/calcs/dce_calcs: Move some large variables from the
> stack to the heap
>   drm/amd/display/dc/calcs/dce_calcs: Remove some large variables from
> the stack
>   drm/amd/display/dc/dce80/dce80_resource: Make local functions static
>   drm/nouveau/nvkm/engine/gr/gf100: Demote non-conformant kernel-doc
> header
>   drm/nouveau/nouveau_bo: Remove unused variables 'dev'
>   drm/nouveau/nouveau_display: Remove set but unused variable 'width'
>   drm/nouveau/dispnv04/crtc: Demote non-conforming kernel-doc headers
>   drm/nouveau/dispnv50/disp: Remove unused variable 'ret' from function
> returning void
>   drm/nouveau/dispnv50/headc57d: Make local function 'headc57d_olut'
> static
>   drm/nouveau/nv50_display: Remove superfluous prototype for local
> static functions
>   drm/nouveau/dispnv50/disp: Include header containing our prototypes
>   drm/nouveau/nouveau_ioc32: File headers are not good candidates for
> kernel-doc
>   drm/nouveau/nouveau_svm: Remove unused variable 'ret' from void
> function
>   drm/nouveau/nouveau_ioc32: Demote kernel-doc abuse to standard comment
> block
> 
>  .../gpu/drm/amd/display/dc/calcs/dce_calcs.c  | 1154 +
>  .../drm/amd/display/dc/dce80/dce80_resource.c |   16 +-
>  drivers/gpu/drm/msm/dp/dp_display.c   |3 -
>  drivers/gpu/drm/nouveau/dispnv04/crtc.c   |4 +-
>  drivers/gpu/drm/nouveau/dispnv50/disp.c   |   10 +-
>  drivers/gpu/drm/nouveau/dispnv50/headc57d.c   |2 +-
>  drivers/gpu/drm/nouveau/nouveau_bo.c  |4 -
>  drivers/gpu/drm/nouveau/nouveau_display.c |8 +-
>  drivers/gpu/drm/nouveau/nouveau_ioc32.c   |4 +-
>  drivers/gpu/drm/nouveau/nouveau_svm.c |5 +-
>  drivers/gpu/drm/nouveau/nv50_display.h|3 -
>  .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c|2 +-
>  .../gpu/drm/nouveau/nvkm/subdev/bios/init.c   |  204 +--
>  .../gpu/drm/nouveau/nvkm/subdev/volt/gk20a.c  |4 +-
>  include/drm/drm_atomic.h  |3 +-
>  15 files changed, 692 insertions(+), 734 deletions(-)
> 
> Cc: Alex Deucher 
> Cc: amd-...@lists.freedesktop.org
> Cc: Anthony Koo 
> Cc: Ben Skeggs 
> Cc: "Christian König" 
> Cc: Colin Ian King 
> Cc: Daniel Vetter 
> Cc: David Airlie 
> Cc: dri-de...@lists.freedesktop.org
> Cc: freedr...@lists.freedesktop.org
> Cc: Harry Wentland 
> Cc: Jeremy Kolb 
> Cc: Kuogee Hsieh 
> Cc: Leo Li 
> Cc: linaro-mm-...@lists.linaro.org
> Cc: linux-arm-...@vger.kernel.org
> Cc: linux-me...@vger.kernel.org
> Cc: Lyude Paul 
> Cc: Maarten Lankhorst 
> Cc: Maxime Ripard 
> Cc: nouv...@lists.freedesktop.org
> Cc: Rob Clark 
> Cc: Sean Paul 
> Cc: Sumit Semwal 
> Cc: Thomas Zimmermann 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v7 0/5] clk: add driver for the SiFive FU740

2021-03-24 Thread Andreas Schwab
Were you able to reproduce the problem?

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


[PATCH v2] video: hyperv_fb: Fix a double free in hvfb_probe

2021-03-24 Thread Lv Yunlong
In function hvfb_probe in hyperv_fb.c, it calls hvfb_getmem(hdev, info)
and return err when info->apertures is freed.

In the error1 label of hvfb_probe, info->apertures will be freed for the
second time in framebuffer_release(info).

My patch removes all kfree(info->apertures) instead of set info->apertures
to NULL. It is because that let framebuffer_release() handle freeing the
memory flows the fbdev pattern, and less code overall.

Signed-off-by: Lv Yunlong 
---
 drivers/video/fbdev/hyperv_fb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index c8b0ae676809..4dc9077dd2ac 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1031,7 +1031,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
fb_info *info)
PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
if (!pdev) {
pr_err("Unable to find PCI Hyper-V video\n");
-   kfree(info->apertures);
return -ENODEV;
}
 
@@ -1129,7 +1128,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
fb_info *info)
} else {
pci_dev_put(pdev);
}
-   kfree(info->apertures);
 
return 0;
 
@@ -1141,7 +1139,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct 
fb_info *info)
 err1:
if (!gen2vm)
pci_dev_put(pdev);
-   kfree(info->apertures);
 
return -ENOMEM;
 }
-- 
2.25.1




Re: [RESEND 1/1] powerpc: asm: hvconsole: Move 'hvc_vio_init_early's prototype to shared location

2021-03-24 Thread Lee Jones
On Wed, 03 Mar 2021, Lee Jones wrote:

> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/tty/hvc/hvc_vio.c:385:13: warning: no previous prototype for 
> ‘hvc_vio_init_early’ [-Wmissing-prototypes]
>  385 | void __init hvc_vio_init_early(void)
>  | ^~
> 
> Cc: Michael Ellerman 
> Cc: Benjamin Herrenschmidt 
> Cc: Paul Mackerras 
> Cc: linuxppc-...@lists.ozlabs.org
> Signed-off-by: Lee Jones 
> Acked-by: Michael Ellerman 
> ---
>  arch/powerpc/include/asm/hvconsole.h | 3 +++
>  arch/powerpc/platforms/pseries/pseries.h | 3 ---
>  arch/powerpc/platforms/pseries/setup.c   | 1 +
>  3 files changed, 4 insertions(+), 3 deletions(-)

Any idea who might pick this up please?

It's been on the list for months.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v2 2/2] mfd: intel_quark_i2c_gpio: enable MSI interrupt

2021-03-24 Thread Andy Shevchenko
On Wed, Mar 24, 2021 at 10:29:31AM +, Lee Jones wrote:
> On Tue, 23 Mar 2021, Andy Shevchenko wrote:
> 
> > Allow interrupts to be MSI if supported by hardware.
> > 
> > Signed-off-by: Andy Shevchenko 
> > ---
> > v2: new patch
> >  drivers/mfd/intel_quark_i2c_gpio.c | 21 +++--
> >  1 file changed, 15 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/mfd/intel_quark_i2c_gpio.c 
> > b/drivers/mfd/intel_quark_i2c_gpio.c
> > index 52728a963c17..16ce9cb3aa2f 100644
> > --- a/drivers/mfd/intel_quark_i2c_gpio.c
> > +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> > @@ -169,8 +169,8 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, 
> > struct mfd_cell *cell)
> > res[INTEL_QUARK_IORES_MEM].end =
> > pci_resource_end(pdev, MFD_I2C_BAR);
> >  
> > -   res[INTEL_QUARK_IORES_IRQ].start = pdev->irq;
> > -   res[INTEL_QUARK_IORES_IRQ].end = pdev->irq;
> > +   res[INTEL_QUARK_IORES_IRQ].start = pci_irq_vector(pdev, 0);
> > +   res[INTEL_QUARK_IORES_IRQ].end = pci_irq_vector(pdev, 0);
> >  
> > pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > if (!pdata)
> > @@ -217,7 +217,7 @@ static int intel_quark_gpio_setup(struct pci_dev *pdev, 
> > struct mfd_cell *cell)
> > pdata->properties->idx  = 0;
> > pdata->properties->ngpio= INTEL_QUARK_MFD_NGPIO;
> > pdata->properties->gpio_base= INTEL_QUARK_MFD_GPIO_BASE;
> > -   pdata->properties->irq[0]   = pdev->irq;
> > +   pdata->properties->irq[0]   = pci_irq_vector(pdev, 0);
> >  
> > cell->platform_data = pdata;
> > cell->pdata_size = sizeof(*pdata);
> > @@ -245,22 +245,30 @@ static int intel_quark_mfd_probe(struct pci_dev *pdev,
> > if (ret)
> > return ret;
> >  
> > +   pci_set_master(pdev);
> > +
> > +   ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> 
> Is there any way these magic number can be defined or sizeof()'ed?

Grep for it in the kernel, it's rarely defined.

The semantic is min-max range and having two defines (*) here for these seems
to me as an utter overkill.

Of course, if you insist I may do it.

*) since value is the same, we might have one definition, but it will be even
   more confusion to have it as a min and max at the same time.

-- 
With Best Regards,
Andy Shevchenko




RE: [PATCH 02/11] x86: tboot: avoid Wstringop-overread-warning

2021-03-24 Thread David Laight
From: David Laight
> Sent: 24 March 2021 09:12
> 
> From: Martin Sebor
> > Sent: 22 March 2021 22:08
> ...
> > In GCC 11, all access warnings expect objects to be either declared
> > or allocated.  Pointers with constant values are taken to point to
> > nothing valid (as Arnd mentioned above, this is to detect invalid
> > accesses to members of structs at address zero).
> >
> > One possible solution to the known address problem is to extend GCC
> > attributes address and io that pin an object to a hardwired address
> > to all targets (at the moment they're supported on just one or two
> > targets).  I'm not sure this can still happen before GCC 11 releases
> > sometime in April or May.
> 
> A different solution is to define a normal C external data item
> and then assign a fixed address with an asm statement or in
> the linker script.

Or stop gcc tracking the value by using:
struct foo *foo = (void *)x;
asm ("", "+r" (foo));

If the address is used more than once forcing it into
a register is also likely to generate better code.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)


Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-24 Thread Pavel Machek
Hi!

> > From: Hermes Zhang 
> > 
> > Introduce a new multiple GPIOs LED driver. This LED will made of
> > multiple GPIOs (up to 8) and will map different brightness to different
> > GPIOs states which defined in dts file.
> 
> I wonder how many boards have such LEDs.
> 
> Also if it wouldn't be better to expand the original leds-gpio driver.
> Probably depends on how much larger would such expansion make the
> leds-gpio driver.

Let's start with separate.

> Use flexible array members. Allocate with
>   devm_kzalloc(dev, struct_size(priv, states, priv->nr_states),
>GFP_KERNEL)

Better yet, assume the brightness is 0..2^(num leds) and avoid this
complexity.

> Again LED_FULL and LED_OFF...
> What about default-state = "keep" ?
> 
> Hermes, do you actually have a device that controls LEDs this way? How
> many brightness options do they have?

He has two bits.

> Also I think this functionality could be easily incorporated into the
> existing leds-gpio driver, instead of creating new driver.

> Moreover your driver can control only one LED, so it needs to be
> probed multiple times for multiple LEDs. Meanwhile the leds-gpio driver
> can register multiple LEDs in one probe...

The current version is mostly fine. Let's not overcomplicate it.

Best regards,
Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-24 Thread Pavel Machek
On Wed 2021-03-24 15:56:30, Hermes Zhang wrote:
> From: Hermes Zhang 
> 
> Introduce a new multiple GPIOs LED driver. This LED will made of
> multiple GPIOs (up to 8) and will map different brightness to different
> GPIOs states which defined in dts file.
> 
> Signed-off-by: Hermes Zhang 
> ---
>  drivers/leds/Kconfig   |  12 +++
>  drivers/leds/Makefile  |   1 +
>  drivers/leds/leds-multi-gpio.c | 140 +
>  3 files changed, 153 insertions(+)
>  create mode 100644 drivers/leds/leds-multi-gpio.c

Let's put it into drivers/leds/simple. You may need to create it.

Best regards,
Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


Re: [PATCH 1/2] leds: leds-multi-gpio: Add multiple GPIOs LED driver

2021-03-24 Thread Pavel Machek
Hi!

> > +   of_property_read_string(node, "default-state", &state);
> > +   if (!strcmp(state, "on"))
> > +   multi_gpio_led_set(&priv->cdev, LED_FULL);
> > +   else
> > +   multi_gpio_led_set(&priv->cdev, LED_OFF);
> 
> Again LED_FULL and LED_OFF...
> What about default-state = "keep" ?

Let's not support default-state unless you need it.

Best regards,
Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


Re: [PATCH v1] MAINTAINERS: Update Maintainers of DRM Bridge Drivers

2021-03-24 Thread Andrzej Hajda
W dniu 24.03.2021 o 11:20, Robert Foss pisze:
> Add myself as co-maintainer of DRM Bridge Drivers. Repository
> commit access has already been granted.
>
> https://protect2.fireeye.com/v1/url?k=c3508e7b-9ccbb771-c3510534-0cc47a31384a-ef2b7fbec8aa658e&q=1&e=46fd05b7-d9d9-4737-99cd-cd44e40a7bc7&u=https%3A%2F%2Fgitlab.freedesktop.org%2Ffreedesktop%2Ffreedesktop%2F-%2Fissues%2F338
>
> Cc: Neil Armstrong 
> Cc: Laurent Pinchart 
> Cc: Jonas Karlman 
> Cc: Andrzej Hajda 
> Cc: Jernej Škrabec 
> Cc: Daniel Vetter 
> Signed-off-by: Robert Foss 

Great.


Acked-by: Andrzej Hajda 


Regards

Andrzej


> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4b705ba51c54..16ace8f58649 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5902,6 +5902,7 @@ F:  drivers/gpu/drm/atmel-hlcdc/
>   DRM DRIVERS FOR BRIDGE CHIPS
>   M:  Andrzej Hajda 
>   M:  Neil Armstrong 
> +M:   Robert Foss 
>   R:  Laurent Pinchart 
>   R:  Jonas Karlman 
>   R:  Jernej Skrabec 


Linux 5.4.108

2021-03-24 Thread Greg Kroah-Hartman
I'm announcing the release of the 5.4.108 kernel.

All users of the 5.4 kernel series must upgrade.

The updated 5.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-5.4.y
and can be browsed at the normal kernel.org git web browser:

https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |8 +-
 arch/arm/kernel/entry-armv.S |   25 ---
 arch/arm/vfp/entry.S |   17 -
 arch/arm/vfp/vfphw.S |5 -
 arch/arm/vfp/vfpmodule.c |   72 +--
 arch/riscv/Kconfig   |4 -
 arch/s390/kernel/vtime.c |2 
 arch/x86/events/intel/ds.c   |2 
 arch/x86/include/asm/processor.h |9 --
 arch/x86/include/asm/thread_info.h   |   23 +++
 arch/x86/kernel/apic/apic.c  |5 +
 arch/x86/kernel/apic/io_apic.c   |   10 +++
 arch/x86/kernel/signal.c |   24 ---
 drivers/base/power/runtime.c |   62 +++
 drivers/counter/stm32-timer-cnt.c|   44 +-
 drivers/firmware/efi/efi.c   |3 
 drivers/iio/adc/Kconfig  |1 
 drivers/iio/adc/ad7949.c |2 
 drivers/iio/adc/qcom-spmi-vadc.c |2 
 drivers/iio/gyro/mpu3050-core.c  |2 
 drivers/iio/humidity/hid-sensor-humidity.c   |   12 ++-
 drivers/iio/imu/adis16400.c  |3 
 drivers/iio/light/hid-sensor-prox.c  |   13 +++-
 drivers/iio/temperature/hid-sensor-temperature.c |   14 ++--
 drivers/nvme/host/core.c |   36 +++
 drivers/nvme/host/rdma.c |7 +-
 drivers/nvme/host/tcp.c  |   14 +++-
 drivers/nvme/target/core.c   |   17 -
 drivers/pci/hotplug/rpadlpar_sysfs.c |   14 +---
 drivers/scsi/lpfc/lpfc_debugfs.c |4 -
 drivers/scsi/myrs.c  |2 
 drivers/usb/gadget/composite.c   |4 -
 drivers/usb/gadget/configfs.c|   16 +++--
 drivers/usb/gadget/usbstring.c   |4 -
 drivers/usb/storage/transport.c  |7 ++
 drivers/usb/storage/unusual_devs.h   |   12 +++
 drivers/usb/typec/tcpm/tcpm.c|8 ++
 drivers/usb/usbip/vudc_sysfs.c   |2 
 drivers/vfio/Kconfig |2 
 fs/afs/dir.c |1 
 fs/afs/file.c|1 
 fs/afs/inode.c   |1 
 fs/afs/internal.h|1 
 fs/afs/mntpt.c   |1 
 fs/afs/xattr.c   |   23 ---
 fs/btrfs/ctree.c |2 
 fs/btrfs/inode.c |2 
 fs/cifs/transport.c  |7 +-
 fs/ext4/inode.c  |8 +-
 fs/ext4/namei.c  |   29 -
 fs/ext4/xattr.c  |2 
 fs/nfsd/filecache.c  |2 
 fs/select.c  |   10 +--
 include/linux/efi.h  |6 +
 include/linux/thread_info.h  |   13 
 include/linux/usb_usual.h|2 
 include/uapi/linux/usb/ch9.h |3 
 kernel/futex.c   |3 
 kernel/irq/manage.c  |4 +
 kernel/time/alarmtimer.c |2 
 kernel/time/hrtimer.c|2 
 kernel/time/posix-cpu-timers.c   |2 
 net/qrtr/qrtr.c  |2 
 net/sunrpc/svc.c |6 +
 net/sunrpc/svc_xprt.c|4 -
 net/sunrpc/xprtrdma/svc_rdma_backchannel.c   |6 -
 sound/firewire/dice/dice-stream.c|5 -
 sound/pci/hda/hda_generic.c  |2 
 sound/pci/hda/patch_realtek.c|2 
 sound/soc/codecs/ak4458.c|1 
 sound/soc/codecs/ak5558.c|1 
 sound/soc/fsl/fsl_ssi.c  |6 +
 sound/soc/generic/simple-card-utils.c|   13 ++--
 sound/soc/sof/intel/hda-dsp.c|2 
 sound/soc/sof/intel/hda.c|1 
 75 files changed, 406 insertions(+), 285 deletion

Re: Linux 5.4.108

2021-03-24 Thread Greg Kroah-Hartman
diff --git a/Makefile b/Makefile
index 43159b21a83f..b0abe257221a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 5
 PATCHLEVEL = 4
-SUBLEVEL = 107
+SUBLEVEL = 108
 EXTRAVERSION =
 NAME = Kleptomaniac Octopus
 
@@ -1177,15 +1177,17 @@ endef
 define filechk_version.h
if [ $(SUBLEVEL) -gt 255 ]; then \
echo \#define LINUX_VERSION_CODE $(shell \
-   expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255); \
+   expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + 255); \
else \
echo \#define LINUX_VERSION_CODE $(shell \
-   expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 
$(SUBLEVEL)); \
+   expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); 
\
fi;  \
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) +  \
((c) > 255 ? 255 : (c)))'
 endef
 
+$(version_h): PATCHLEVEL := $(if $(PATCHLEVEL), $(PATCHLEVEL), 0)
+$(version_h): SUBLEVEL := $(if $(SUBLEVEL), $(SUBLEVEL), 0)
 $(version_h): FORCE
$(call filechk,version.h)
$(Q)rm -f $(old_version_h)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index a874b753397e..b62d74a2c73a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -252,31 +252,10 @@ __und_svc:
 #else
svc_entry
 #endif
-   @
-   @ call emulation code, which returns using r9 if it has emulated
-   @ the instruction, or the more conventional lr if we are to treat
-   @ this as a real undefined instruction
-   @
-   @  r0 - instruction
-   @
-#ifndef CONFIG_THUMB2_KERNEL
-   ldr r0, [r4, #-4]
-#else
-   mov r1, #2
-   ldrhr0, [r4, #-2]   @ Thumb instruction at LR - 2
-   cmp r0, #0xe800 @ 32-bit instruction if xx >= 0
-   blo __und_svc_fault
-   ldrhr9, [r4]@ bottom 16 bits
-   add r4, r4, #2
-   str r4, [sp, #S_PC]
-   orr r0, r9, r0, lsl #16
-#endif
-   badrr9, __und_svc_finish
-   mov r2, r4
-   bl  call_fpe
 
mov r1, #4  @ PC correction to apply
-__und_svc_fault:
+ THUMB(tst r5, #PSR_T_BIT  )   @ exception taken in 
Thumb mode?
+ THUMB(movne   r1, #2  )   @ if so, fix up PC 
correction
mov r0, sp  @ struct pt_regs *regs
bl  __und_fault
 
diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
index 0186cf9da890..27b0a1f27fbd 100644
--- a/arch/arm/vfp/entry.S
+++ b/arch/arm/vfp/entry.S
@@ -37,20 +37,3 @@ ENDPROC(vfp_null_entry)
.align  2
 .LCvfp:
.word   vfp_vector
-
-@ This code is called if the VFP does not exist. It needs to flag the
-@ failure to the VFP initialisation code.
-
-   __INIT
-ENTRY(vfp_testing_entry)
-   dec_preempt_count_ti r10, r4
-   ldr r0, VFP_arch_address
-   str r0, [r0]@ set to non-zero value
-   ret r9  @ we have handled the fault
-ENDPROC(vfp_testing_entry)
-
-   .align  2
-VFP_arch_address:
-   .word   VFP_arch
-
-   __FINIT
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index b2e560290860..b530db8f2c6c 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -78,11 +78,6 @@
 ENTRY(vfp_support_entry)
DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10
 
-   ldr r3, [sp, #S_PSR]@ Neither lazy restore nor FP exceptions
-   and r3, r3, #MODE_MASK  @ are supported in kernel mode
-   teq r3, #USR_MODE
-   bne vfp_kmode_exception @ Returns through lr
-
VFPFMRX r1, FPEXC   @ Is the VFP enabled?
DBGSTR1 "fpexc %08x", r1
tst r1, #FPEXC_EN
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 8c9e7f9f0277..2cb355c1b5b7 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "vfpinstr.h"
@@ -31,7 +32,6 @@
 /*
  * Our undef handlers (in entry.S)
  */
-asmlinkage void vfp_testing_entry(void);
 asmlinkage void vfp_support_entry(void);
 asmlinkage void vfp_null_entry(void);
 
@@ -42,7 +42,7 @@ asmlinkage void (*vfp_vector)(void) = vfp_null_entry;
  * Used in startup: set to non-zero if VFP checks fail
  * After startup, holds VFP architecture
  */
-unsigned int VFP_arch;
+static unsigned int __initdata VFP_arch;
 
 /*
  * The pointer to the vfpstate structure of the thread which currently
@@ -436,7 +436,7 @@ static void vfp_enable(void *unused)
  * present on all CPUs within a SMP complex. Needs to be called prio

Re: [PATCH v2 2/2] mfd: intel_quark_i2c_gpio: enable MSI interrupt

2021-03-24 Thread Lee Jones
On Wed, 24 Mar 2021, Andy Shevchenko wrote:

> On Wed, Mar 24, 2021 at 10:29:31AM +, Lee Jones wrote:
> > On Tue, 23 Mar 2021, Andy Shevchenko wrote:
> > 
> > > Allow interrupts to be MSI if supported by hardware.
> > > 
> > > Signed-off-by: Andy Shevchenko 
> > > ---
> > > v2: new patch
> > >  drivers/mfd/intel_quark_i2c_gpio.c | 21 +++--
> > >  1 file changed, 15 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/drivers/mfd/intel_quark_i2c_gpio.c 
> > > b/drivers/mfd/intel_quark_i2c_gpio.c
> > > index 52728a963c17..16ce9cb3aa2f 100644
> > > --- a/drivers/mfd/intel_quark_i2c_gpio.c
> > > +++ b/drivers/mfd/intel_quark_i2c_gpio.c
> > > @@ -169,8 +169,8 @@ static int intel_quark_i2c_setup(struct pci_dev 
> > > *pdev, struct mfd_cell *cell)
> > >   res[INTEL_QUARK_IORES_MEM].end =
> > >   pci_resource_end(pdev, MFD_I2C_BAR);
> > >  
> > > - res[INTEL_QUARK_IORES_IRQ].start = pdev->irq;
> > > - res[INTEL_QUARK_IORES_IRQ].end = pdev->irq;
> > > + res[INTEL_QUARK_IORES_IRQ].start = pci_irq_vector(pdev, 0);
> > > + res[INTEL_QUARK_IORES_IRQ].end = pci_irq_vector(pdev, 0);
> > >  
> > >   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > >   if (!pdata)
> > > @@ -217,7 +217,7 @@ static int intel_quark_gpio_setup(struct pci_dev 
> > > *pdev, struct mfd_cell *cell)
> > >   pdata->properties->idx  = 0;
> > >   pdata->properties->ngpio= INTEL_QUARK_MFD_NGPIO;
> > >   pdata->properties->gpio_base= INTEL_QUARK_MFD_GPIO_BASE;
> > > - pdata->properties->irq[0]   = pdev->irq;
> > > + pdata->properties->irq[0]   = pci_irq_vector(pdev, 0);
> > >  
> > >   cell->platform_data = pdata;
> > >   cell->pdata_size = sizeof(*pdata);
> > > @@ -245,22 +245,30 @@ static int intel_quark_mfd_probe(struct pci_dev 
> > > *pdev,
> > >   if (ret)
> > >   return ret;
> > >  
> > > + pci_set_master(pdev);
> > > +
> > > + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> > 
> > Is there any way these magic number can be defined or sizeof()'ed?
> 
> Grep for it in the kernel, it's rarely defined.

I already did.  It is sometimes defined, other times not.

Also, past acceptance does not guarantee ideal/correct usage.

> The semantic is min-max range and having two defines (*) here for these seems
> to me as an utter overkill.
> 
> Of course, if you insist I may do it.
> 
> *) since value is the same, we might have one definition, but it will be even
>more confusion to have it as a min and max at the same time.

It's just tricky to decypher for people who do not know the API, which
is most people, myself included.  For APIs like usleep_range() et al.,
obviously this makes no sense at all.

What defines a vector?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog


Re: [PATCH v1 3/3] KEYS: trusted: Introduce support for NXP CAAM-based trusted keys

2021-03-24 Thread Sumit Garg
On Wed, 24 Mar 2021 at 14:56, Ahmad Fatoum  wrote:
>
> Hello Mimi,
>
> On 23.03.21 19:07, Mimi Zohar wrote:
> > On Tue, 2021-03-23 at 17:35 +0100, Ahmad Fatoum wrote:
> >> On 21.03.21 21:48, Horia Geantă wrote:
> >>> caam has random number generation capabilities, so it's worth using that
> >>> by implementing .get_random.
> >>
> >> If the CAAM HWRNG is already seeding the kernel RNG, why not use the 
> >> kernel's?
> >>
> >> Makes for less code duplication IMO.
> >
> > Using kernel RNG, in general, for trusted keys has been discussed
> > before.   Please refer to Dave Safford's detailed explanation for not
> > using it [1].
>
> The argument seems to boil down to:
>
>  - TPM RNG are known to be of good quality
>  - Trusted keys always used it so far
>
> Both are fine by me for TPMs, but the CAAM backend is new code and neither 
> point
> really applies.
>
> get_random_bytes_wait is already used for generating key material elsewhere.
> Why shouldn't new trusted key backends be able to do the same thing?
>

Please refer to documented trusted keys behaviour here [1]. New
trusted key backends should align to this behaviour and in your case
CAAM offers HWRNG so we should be better using that.

Also, do update documentation corresponding to CAAM as a trusted keys backend.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git/tree/Documentation/security/keys/trusted-encrypted.rst#n87

-Sumit

> Cheers,
> Ahmad
>
> >
> > thanks,
> >
> > Mimi
> >
> > [1]
> > https://lore.kernel.org/linux-integrity/bca04d5d9a3b764c9b7405bba4d4a3c035f2a...@alpmbapa12.e2k.ad.ge.com/
> >
> >
> >
>
> --
> Pengutronix e.K.   | |
> Steuerwalder Str. 21   | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany  | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


Re: [PATCH v3 03/25] x86/sgx: Wipe out EREMOVE from sgx_free_epc_page()

2021-03-24 Thread Kai Huang
On Wed, 24 Mar 2021 11:09:20 +0100 Paolo Bonzini wrote:
> On 24/03/21 10:38, Kai Huang wrote:
> > Hi Sean, Boris, Paolo,
> > 
> > Thanks for the discussion. I tried to digest all your conversations and
> > hopefully I have understood you correctly. I pasted the new patch here
> > (not full patch, but relevant part only). I modified the error msg, added
> > some writeup to Documentation/x86/sgx.rst, and put Sean's explanation of 
> > this
> > bug to the commit msg (per Paolo). I am terrible Documentation writer, so
> > please help to check and give comments. Thanks!
> 
> I have some phrasing suggestions below but that was actually pretty good.
> 
> > ---
> > commit 1e297a535bcb4f51a08343c40207520017d85efe (HEAD)
> > Author: Kai Huang 
> > Date:   Wed Jan 20 03:40:53 2021 +0200
> > 
> >  x86/sgx: Wipe out EREMOVE from sgx_free_epc_page()
> >  
> >  EREMOVE takes a page and removes any association between that page and
> >  an enclave.  It must be run on a page before it can be added into
> >  another enclave.  Currently, EREMOVE is run as part of pages being 
> > freed
> >  into the SGX page allocator.  It is not expected to fail.
> >  
> >  KVM does not track how guest pages are used, which means that SGX
> >  virtualization use of EREMOVE might fail.  Specifically, it is
> >  legitimate that EREMOVE returns SGX_CHILD_PRESENT for EPC assigned to
> >  KVM guest, because KVM/kernel doesn't track SECS pages.
> >
> >  Break out the EREMOVE call from the SGX page allocator.  This will 
> > allow
> >  the SGX virtualization code to use the allocator directly.  (SGX/KVM
> >  will also introduce a more permissive EREMOVE helper).
> 
> Ok, I think I got the source of my confusion.  The part in parentheses
> is the key.  It was not clear that KVM can deal with EREMOVE failures
> *without printing the error*.  Good!

Yes the "will also introduce a more premissive EREMOVE helper" is done in patch
5 (x86/sgx: Introduce virtual EPC for use by KVM guests).

> 
> >  Implement original sgx_free_epc_page() as sgx_encl_free_epc_page() to 
> > be
> >  more specific that it is used to free EPC page assigned host enclave.
> >  Replace sgx_free_epc_page() with sgx_encl_free_epc_page() in all call
> >  sites so there's no functional change.
> >  
> >  Improve error message when EREMOVE fails, and kernel is about to leak
> >  EPC page, which is likely a kernel bug.  This is effectively a kernel
> >  use-after-free of EPC, and due to the way SGX works, the bug is 
> > detected
> >  at freeing.  Rather than add the page back to the pool of available 
> > EPC,
> >  the kernel intentionally leaks the page to avoid additional errors in
> >  the future.
> >  
> >  Also add documentation to explain to user what is the bug and suggest
> >  user what to do when this bug happens, although extremely unlikely.
> 
> Rewritten:
> 
> EREMOVE takes a page and removes any association between that page and
> an enclave.  It must be run on a page before it can be added into
> another enclave.  Currently, EREMOVE is run as part of pages being freed
> into the SGX page allocator.  It is not expected to fail, as it would
> indicate a use-after-free of EPC.  Rather than add the page back to the
> pool of available EPC, the kernel intentionally leaks the page to avoid
> additional errors in the future.
> 
> However, KVM does not track how guest pages are used, which means that SGX
> virtualization use of EREMOVE might fail.  Specifically, it is
> legitimate that EREMOVE returns SGX_CHILD_PRESENT for EPC assigned to
> KVM guest, because KVM/kernel doesn't track SECS pages.
> 
> To allow SGX/KVM to introduce a more permissive EREMOVE helper and to
> let the SGX virtualization code use the allocator directly,
> break out the EREMOVE call from the SGX page allocator.  Rename the
> original sgx_free_epc_page() to sgx_encl_free_epc_page(),
> indicating that it is used to free EPC page assigned host enclave.
> Replace sgx_free_epc_page() with sgx_encl_free_epc_page() in all call
> sites so there's no functional change.
> 
> At the same time improve error message when EREMOVE fails, and add
> documentation to explain to user what is the bug and suggest user what
> to do when this bug happens, although extremely unlikely.

Thanks :)

> 
> > +Although extremely unlikely, EPC leaks can happen if kernel SGX bug 
> > happens,
> > +when a WARNING with below message is shown in dmesg:
> 
> Remove "Although extremely unlikely".

Will do.

> 
> > +"...EREMOVE returned ..., kernel bug likely.  EPC page leaked, SGX may 
> > become
> > +unusuable.  Please refer to Documentation/x86/sgx.rst for more 
> > information."
> > +
> > +This is effectively a kernel use-after-free of EPC, and due to the way SGX
> > +works, the bug is detected at freeing. Rather than add the page back to 
> > the pool
> > +of available EPC, the kernel intentionally leaks the page to avoid 
> 

Re: [PATCH] soundwire: intel: move to auxiliary bus

2021-03-24 Thread Vinod Koul
On 23-03-21, 12:29, Pierre-Louis Bossart wrote:
> Thanks Greg and Vinod for the reviews
> 
> > > > -static int intel_master_probe(struct platform_device *pdev)
> > > > +static int intel_link_probe(struct auxiliary_device *auxdev, const 
> > > > struct auxiliary_device_id *id)
> > > >   {
> > > > -   struct device *dev = &pdev->dev;
> > > > +   struct device *dev = &auxdev->dev;
> > > > +   struct sdw_intel_link_dev *ldev = 
> > > > auxiliary_dev_to_sdw_intel_link_dev(auxdev);
> > > 
> > > Do we need another abstractions for resources here, why not aux dev
> > > creation set the resources required and we skip this step...
> 
> Not sure what resources you are referring to?

Resources in the sdw_intel_link_dev which are sdw_intel_link_res. They
should be resources for auxdev and if you do that lets you get rid of
this abstraction.

> 
> this is just a container_of() and the documented way of extending the auxbus
> (see 
> https://www.kernel.org/doc/html/latest/driver-api/auxiliary_bus.html#example-usage)
> 
> 
> struct sdw_intel_link_dev {
>   struct auxiliary_device auxdev;
>   struct sdw_intel_link_res link_res;
> };
> 
> #define auxiliary_dev_to_sdw_intel_link_dev(auxiliary_dev) \
>   container_of(auxiliary_dev, struct sdw_intel_link_dev, auxdev)
> 
> > > > struct sdw_intel *sdw;
> > > > struct sdw_cdns *cdns;
> > > > struct sdw_bus *bus;
> > > > @@ -1346,14 +1347,14 @@ static int intel_master_probe(struct 
> > > > platform_device *pdev)
> > > > cdns = &sdw->cdns;
> > > > bus = &cdns->bus;
> > > > -   sdw->instance = pdev->id;
> > > > -   sdw->link_res = dev_get_platdata(dev);
> > > > +   sdw->instance = auxdev->id;
> > > 
> > > so auxdev has id and still we pass id as argument :( Not sure if folks
> > > can fix this now
> > 
> > That's odd, yeah, it should be fixed.
> 
> I think we are talking about different things?
> 
> this is defined in mod_devicetable.h:
> 
> struct auxiliary_device_id {
>   char name[AUXILIARY_NAME_SIZE];
>   kernel_ulong_t driver_data;
> };
> 
> and used for the driver probe:
> 
>   ret = auxdrv->probe(auxdev, auxiliary_match_id(auxdrv->id_table, 
> auxdev));
> 
> but there is a separate id:
> 
> struct auxiliary_device {
>   struct device dev;
>   const char *name;
>   u32 id;
> };
> 
> which is set during the device initialization in intel_init.c
> 
>   /* we don't use an IDA since we already have a link ID */
>   auxdev->id = link_id;
> 
> In the auxiliary bus design, the parent has to take care of managing this
> id, be it with an IDA or as we do here with a physical link ID that is
> unique.

Aha, maybe both of them should not be 'id' to avoid this confusion!

That also reminds me that we have duplicate info:

+   sdw->instance = auxdev->id;
+   bus->link_id = auxdev->id;

drop the local driver instance and use bus->link_id please

> in short, I don't see how I could change the code given the differences in
> concepts?

-- 
~Vinod


Regression v5.12-rc3: net: stmmac: re-init rx buffers when mac resume back

2021-03-24 Thread Jon Hunter
Hi Joakim,

Starting with v5.12-rc3 I noticed that one of our boards, Tegra186
Jetson TX2, was not long resuming from suspend. Bisect points to commit
9c63faaa931e ("net: stmmac: re-init rx buffers when mac resume back")
and reverting this on top of mainline fixes the problem.

Interestingly, the board appears to partially resume from suspend and I
see ethernet appear to resume ...

 dwc-eth-dwmac 249.ethernet eth0: configuring for phy/rgmii link
 mode
 dwmac4: Master AXI performs any burst length
 dwc-eth-dwmac 249.ethernet eth0: No Safety Features support found
 dwc-eth-dwmac 249.ethernet eth0: Link is Up - 1Gbps/Full - flow
 control rx/tx

I don't see any crash, but then it hangs at some point. Please note that
this board is using NFS for mounting the rootfs.

Let me know if there is any more info I can provide or tests I can run.

Thanks
Jon




[PATCH] ALSA: usb-audio: Apply sample rate quirk to Logitech Connect

2021-03-24 Thread Ikjoon Jang
Logitech ConferenceCam Connect is a compound USB device with UVC and
UAC. Not 100% reproducible but sometimes it keeps responding STALL to
every control transfer once it receives get_freq request.

This patch adds 046d:0x084c to a snd_usb_get_sample_rate_quirk list.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203419
Signed-off-by: Ikjoon Jang 

---

 sound/usb/quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index d3001fb18141..176437a441e6 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1521,6 +1521,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio 
*chip)
case USB_ID(0x21b4, 0x0081): /* AudioQuest DragonFly */
case USB_ID(0x2912, 0x30c8): /* Audioengine D1 */
case USB_ID(0x413c, 0xa506): /* Dell AE515 sound bar */
+   case USB_ID(0x046d, 0x084c): /* Logitech ConferenceCam Connect */
return true;
}
 
-- 
2.31.0.291.g576ba9dcdaf-goog



Re: arch/arm/mach-omap2/board-generic.c:36:28: warning: no previous prototype for 'omap_init_time_of'

2021-03-24 Thread Tony Lindgren
Hi,

* kernel test robot  [210226 13:11]:
> Hi Tony,
> 
> FYI, the error/warning still remains.

Thanks for the report and sorry for the delay in responding. I've posted
a fix for this at:

https://lore.kernel.org/linux-omap/20210324105102.7286-1-t...@atomide.com/T/#u

Regards,

Tony


> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   2c87f7a38f930ef6f6a7bdd04aeb82ce3971b54b
> commit: e69b4e1a7577c169e9f52edf977401734a6a29eb ARM: OMAP2+: Add 
> omap_init_time_of()
> date:   9 months ago
> config: arm-randconfig-r012-20210226 (attached as .config)
> compiler: arm-linux-gnueabi-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
> # 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e69b4e1a7577c169e9f52edf977401734a6a29eb
> git remote add linus 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout e69b4e1a7577c169e9f52edf977401734a6a29eb
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
> ARCH=arm 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot 
> 
> All warnings (new ones prefixed by >>):
> 
> >> arch/arm/mach-omap2/board-generic.c:36:28: warning: no previous prototype 
> >> for 'omap_init_time_of' [-Wmissing-prototypes]
>   36 | void __init __maybe_unused omap_init_time_of(void)
>  |^
> 
> 
> vim +/omap_init_time_of +36 arch/arm/mach-omap2/board-generic.c
> 
> 34
> 35/* Clocks are needed early, see drivers/clocksource for the 
> rest */
>   > 36void __init __maybe_unused omap_init_time_of(void)
> 37{
> 38omap_clk_init();
> 39timer_probe();
> 40}
> 41
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org




Re: [syzbot] INFO: task hung in walk_component (2)

2021-03-24 Thread Miklos Szeredi
#syz fix: fuse: fix live lock in fuse_iget()


  1   2   3   4   5   6   7   8   9   10   >