]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
2 years agocrypto: xts - Add softdep on ecb
Herbert Xu [Thu, 10 Feb 2022 02:09:40 +0000 (13:09 +1100)]
crypto: xts - Add softdep on ecb

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit dfe085d8dcd0bb1fe20cc2327e81c8064cead441 ]

The xts module needs ecb to be present as it's meant to work
on top of ecb.  This patch adds a softdep so ecb can be included
automatically into the initramfs.

Reported-by: rftc <rftc@gmx.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f84b1633004dbf63c00f8f04de8517a26e7d67e3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoblock/bfq_wf2q: correct weight to ioprio
Yahu Gao [Fri, 7 Jan 2022 06:58:59 +0000 (14:58 +0800)]
block/bfq_wf2q: correct weight to ioprio

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bcd2be763252f3a4d5fc4d6008d4d96c601ee74b ]

The return value is ioprio * BFQ_WEIGHT_CONVERSION_COEFF or 0.
What we want is ioprio or 0.
Correct this by changing the calculation.

Signed-off-by: Yahu Gao <gaoyahu19@gmail.com>
Acked-by: Paolo Valente <paolo.valente@linaro.org>
Link: https://lore.kernel.org/r/20220107065859.25689-1-gaoyahu19@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e11293de5cf6d072f2dea99abac0b2e2359b23a4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agorcu: Mark writes to the rcu_segcblist structure's ->flags field
Paul E. McKenney [Tue, 4 Jan 2022 18:34:34 +0000 (10:34 -0800)]
rcu: Mark writes to the rcu_segcblist structure's ->flags field

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c09929031018913b5783872a8b8cdddef4a543c7 ]

KCSAN reports data races between the rcu_segcblist_clear_flags() and
rcu_segcblist_set_flags() functions, though misreporting the latter
as a call to rcu_segcblist_is_enabled() from call_rcu().  This commit
converts the updates of this field to WRITE_ONCE(), relying on the
resulting unmarked reads to continue to detect buggy concurrent writes
to this field.

Reported-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e34806c6c29d7066ac8de17db6c3dc542a629f1b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: npcm: Fix broken references to chip->parent_device
Marc Zyngier [Tue, 1 Feb 2022 12:03:08 +0000 (12:03 +0000)]
pinctrl: npcm: Fix broken references to chip->parent_device

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f7e53e2255808ca3abcc8f38d18ad0823425e771 ]

The npcm driver has a bunch of references to the irq_chip parent_device
field, but never sets it.

Fix it by fishing that reference from somewhere else, but it is
obvious that these debug statements were never used. Also remove
an unused field in a local data structure.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Bartosz Golaszewski <brgl@bgdev.pl>
Link: https://lore.kernel.org/r/20220201120310.878267-11-maz@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 99780fcb5494a7e9498b7cf5fdacff7741724dec)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agogcc-plugins/stackleak: Exactly match strings instead of prefixes
Kees Cook [Sun, 6 Feb 2022 17:08:20 +0000 (09:08 -0800)]
gcc-plugins/stackleak: Exactly match strings instead of prefixes

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 27e9faf415dbf94af19b9c827842435edbc1fbbc ]

Since STRING_CST may not be NUL terminated, strncmp() was used for check
for equality. However, this may lead to mismatches for longer section
names where the start matches the tested-for string. Test for exact
equality by checking for the presences of NUL termination.

Cc: Alexander Popov <alex.popov@linux.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 999ee266531bb38497a1ddef03f482961f3ae0e4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agocrypto: hisilicon/qm - cleanup warning in qm_vf_read_qos
Kai Ye [Sat, 22 Jan 2022 09:30:42 +0000 (17:30 +0800)]
crypto: hisilicon/qm - cleanup warning in qm_vf_read_qos

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 05b3bade290d6c940701f97f3233c07cfe27205d ]

The kernel test rebot report this warning: Uninitialized variable: ret.
The code flow may return value of ret directly. This value is an
uninitialized variable, here is fix it.

Signed-off-by: Kai Ye <yekai13@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ca97dfbda5105f9b6220ff286c07367633ff2b55)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoregulator: rpi-panel: Handle I2C errors/timing to the Atmel
Dave Stevenson [Mon, 24 Jan 2022 22:01:22 +0000 (17:01 -0500)]
regulator: rpi-panel: Handle I2C errors/timing to the Atmel

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5665eee7a3800430e7dc3ef6f25722476b603186 ]

The Atmel is doing some things in the I2C ISR, during which
period it will not respond to further commands. This is
particularly true of the POWERON command.

Increase delays appropriately, and retry should I2C errors be
reported.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Link: https://lore.kernel.org/r/20220124220129.158891-3-detlev.casanova@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4941c21090c3f7398735d198deb0e37dcb29dd5d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoLSM: general protection fault in legacy_parse_param
Casey Schaufler [Thu, 27 Jan 2022 04:51:00 +0000 (04:51 +0000)]
LSM: general protection fault in legacy_parse_param

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ecff30575b5ad0eda149aadad247b7f75411fd47 ]

The usual LSM hook "bail on fail" scheme doesn't work for cases where
a security module may return an error code indicating that it does not
recognize an input.  In this particular case Smack sees a mount option
that it recognizes, and returns 0. A call to a BPF hook follows, which
returns -ENOPARAM, which confuses the caller because Smack has processed
its data.

The SELinux hook incorrectly returns 1 on success. There was a time
when this was correct, however the current expectation is that it
return 0 on success. This is repaired.

Reported-by: syzbot+d1e3b1d92d25abf97943@syzkaller.appspotmail.com
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: James Morris <jamorris@linux.microsoft.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f3f93a1aaafc3032e0a9655fb43deccfb3e953a3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agofs: fix fd table size alignment properly
Linus Torvalds [Wed, 30 Mar 2022 06:29:18 +0000 (23:29 -0700)]
fs: fix fd table size alignment properly

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d888c83fcec75194a8a48ccd283953bdba7b2550 ]

Jason Donenfeld reports that my commit 1c24a186398f ("fs: fd tables have
to be multiples of BITS_PER_LONG") doesn't work, and the reason is an
embarrassing brown-paper-bag bug.

Yes, we want to align the number of fds to BITS_PER_LONG, and yes, the
reason they might not be aligned is because the incoming 'max_fd'
argument might not be aligned.

But aligining the argument - while simple - will cause a "infinitely
big" maxfd (eg NR_OPEN_MAX) to just overflow to zero.  Which most
definitely isn't what we want either.

The obvious fix was always just to do the alignment last, but I had
moved it earlier just to make the patch smaller and the code look
simpler.  Duh.  It certainly made _me_ look simple.

Fixes: 1c24a186398f ("fs: fd tables have to be multiples of BITS_PER_LONG")
Reported-and-tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Fedor Pchelkin <aissur0002@gmail.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c331c9d1d2b7a5ce875f8f1ac53e3987f73ecc75)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agolib/test: use after free in register_test_dev_kmod()
Dan Carpenter [Thu, 24 Mar 2022 05:52:07 +0000 (08:52 +0300)]
lib/test: use after free in register_test_dev_kmod()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit dc0ce6cc4b133f5f2beb8b47dacae13a7d283c2c ]

The "test_dev" pointer is freed but then returned to the caller.

Fixes: d9c6a72d6fa2 ("kmod: add test driver to stress test the module loader")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 611170142b4244d7d6edba1e3400517d8625296b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agofs: fd tables have to be multiples of BITS_PER_LONG
Linus Torvalds [Tue, 29 Mar 2022 22:06:39 +0000 (15:06 -0700)]
fs: fd tables have to be multiples of BITS_PER_LONG

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1c24a186398f59c80adb9a967486b65c1423a59d ]

This has always been the rule: fdtables have several bitmaps in them,
and as a result they have to be sized properly for bitmaps.  We walk
those bitmaps in chunks of 'unsigned long' in serveral cases, but even
when we don't, we use the regular kernel bitops that are defined to work
on arrays of 'unsigned long', not on some byte array.

Now, the distinction between arrays of bytes and 'unsigned long'
normally only really ends up being noticeable on big-endian systems, but
Fedor Pchelkin and Alexey Khoroshilov reported that copy_fd_bitmaps()
could be called with an argument that wasn't even a multiple of
BITS_PER_BYTE.  And then it fails to do the proper copy even on
little-endian machines.

The bug wasn't in copy_fd_bitmap(), but in sane_fdtable_size(), which
didn't actually sanitize the fdtable size sufficiently, and never made
sure it had the proper BITS_PER_LONG alignment.

That's partly because the alignment historically came not from having to
explicitly align things, but simply from previous fdtable sizes, and
from count_open_files(), which counts the file descriptors by walking
them one 'unsigned long' word at a time and thus naturally ends up doing
sizing in the proper 'chunks of unsigned long'.

But with the introduction of close_range(), we now have an external
source of "this is how many files we want to have", and so
sane_fdtable_size() needs to do a better job.

This also adds that explicit alignment to alloc_fdtable(), although
there it is mainly just for documentation at a source code level.  The
arithmetic we do there to pick a reasonable fdtable size already aligns
the result sufficiently.

In fact,clang notices that the added ALIGN() in that function doesn't
actually do anything, and does not generate any extra code for it.

It turns out that gcc ends up confusing itself by combining a previous
constant-sized shift operation with the variable-sized shift operations
in roundup_pow_of_two().  And probably due to that doesn't notice that
the ALIGN() is a no-op.  But that's a (tiny) gcc misfeature that doesn't
matter.  Having the explicit alignment makes sense, and would actually
matter on a 128-bit architecture if we ever go there.

This also adds big comments above both functions about how fdtable sizes
have to have that BITS_PER_LONG alignment.

Fixes: 60997c3d45d9 ("close_range: add CLOSE_RANGE_UNSHARE")
Reported-by: Fedor Pchelkin <aissur0002@gmail.com>
Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Link: https://lore.kernel.org/all/20220326114009.1690-1-aissur0002@gmail.com/
Tested-and-acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 136736abcd35f51a4be76e6cb1a1c3544a4580fa)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: dsa: bcm_sf2_cfp: fix an incorrect NULL check on list iterator
Xiaomeng Tong [Mon, 28 Mar 2022 03:24:31 +0000 (11:24 +0800)]
net: dsa: bcm_sf2_cfp: fix an incorrect NULL check on list iterator

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6da69b1da130e7d96766042750cd9f902e890eba ]

The bug is here:
return rule;

The list iterator value 'rule' will *always* be set and non-NULL
by list_for_each_entry(), so it is incorrect to assume that the
iterator value will be NULL if the list is empty or no element
is found.

To fix the bug, return 'rule' when found, otherwise return NULL.

Fixes: ae7a5aff783c7 ("net: dsa: bcm_sf2: Keep copy of inserted rules")
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220328032431.22538-1-xiam0nd.tong@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit fd3f70b90772fe7a591e5290df1439a5313a9983)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFSv4/pNFS: Fix another issue with a list iterator pointing to the head
Trond Myklebust [Mon, 28 Mar 2022 12:36:34 +0000 (08:36 -0400)]
NFSv4/pNFS: Fix another issue with a list iterator pointing to the head

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7c9d845f0612e5bcd23456a2ec43be8ac43458f1 ]

In nfs4_callback_devicenotify(), if we don't find a matching entry for
the deviceid, we're left with a pointer to 'struct nfs_server' that
actually points to the list of super blocks associated with our struct
nfs_client.
Furthermore, even if we have a valid pointer, nothing pins the super
block, and so the struct nfs_server could end up getting freed while
we're using it.

Since all we want is a pointer to the struct pnfs_layoutdriver_type,
let's skip all the iteration over super blocks, and just use APIs to
find the layout driver directly.

Reported-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Fixes: 1be5683b03a7 ("pnfs: CB_NOTIFY_DEVICEID")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a738ff8143d89abccfeb458d07a9d559ade7f1a1)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet/sched: act_ct: fix ref leak when switching zones
Marcelo Ricardo Leitner [Thu, 24 Mar 2022 19:22:10 +0000 (16:22 -0300)]
net/sched: act_ct: fix ref leak when switching zones

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bcb74e132a76ce0502bb33d5b65533a4ed72d159 ]

When switching zones or network namespaces without doing a ct clear in
between, it is now leaking a reference to the old ct entry. That's
because tcf_ct_skb_nfct_cached() returns false and
tcf_ct_flow_table_lookup() may simply overwrite it.

The fix is to, as the ct entry is not reusable, free it already at
tcf_ct_skb_nfct_cached().

Reported-by: Florian Westphal <fw@strlen.de>
Fixes: 2f131de361f6 ("net/sched: act_ct: Fix flow table lookup after ct clear or switching zones")
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit bcbf4e5c3b5b373cd61528392dd1ec8e9c0fd33d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: prefer nf_ct_put instead of nf_conntrack_put
Florian Westphal [Fri, 7 Jan 2022 04:03:26 +0000 (05:03 +0100)]
net: prefer nf_ct_put instead of nf_conntrack_put

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 408bdcfce8dfd6902f75fbcd3b99d8b24b506597 ]

Its the same as nf_conntrack_put(), but without the
need for an indirect call.  The downside is a module dependency on
nf_conntrack, but all of these already depend on conntrack anyway.

Cc: Paul Blakey <paulb@mellanox.com>
Cc: dev@openvswitch.org
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 72dd9e61fa319bc44020c2d365275fc8f6799bff)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoocteontx2-af: initialize action variable
Tom Rix [Sat, 26 Mar 2022 16:03:06 +0000 (09:03 -0700)]
octeontx2-af: initialize action variable

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 33b5bc9e703383e396f275d51fc4bafa48dbae5a ]

Clang static analysis reports this representative issue
rvu_npc.c:898:15: warning: Assigned value is garbage
  or undefined
  req.match_id = action.match_id;
               ^ ~~~~~~~~~~~~~~~

The initial setting of action is conditional on
 if (is_mcam_entry_enabled(...))
The later check of action.op will sometimes be garbage.
So initialize action.

Reduce setting of
  *(u64 *)&action = 0x00;
to
  *(u64 *)&action = 0;

Fixes: 967db3529eca ("octeontx2-af: add support for multicast/promisc packet replication feature")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6b663fa23c7ec51489fc43cfd3ce395c46a4e976)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: sparx5: switchdev: fix possible NULL pointer dereference
Zheng Yongjun [Sat, 26 Mar 2022 08:12:39 +0000 (08:12 +0000)]
net: sparx5: switchdev: fix possible NULL pointer dereference

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0906f3a3df07835e37077d8971aac65347f2ed57 ]

As the possible failure of the allocation, devm_kzalloc() may return NULL
pointer.
Therefore, it should be better to check the 'db' in order to prevent
the dereference of NULL pointer.

Fixes: 10615907e9b51 ("net: sparx5: switchdev: adding frame DMA functionality")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b375ea083fa649092cd016ac1f89a2d1fd8f8e8b)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet/x25: Fix null-ptr-deref caused by x25_disconnect
Duoming Zhou [Sat, 26 Mar 2022 10:43:46 +0000 (18:43 +0800)]
net/x25: Fix null-ptr-deref caused by x25_disconnect

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7781607938c8371d4c2b243527430241c62e39c2 ]

When the link layer is terminating, x25->neighbour will be set to NULL
in x25_disconnect(). As a result, it could cause null-ptr-deref bugs in
x25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is
shown below.

    (Thread 1)                 |  (Thread 2)
x25_link_terminated()          | x25_recvmsg()
 x25_kill_by_neigh()           |  ...
  x25_disconnect()             |  lock_sock(sk)
   ...                         |  ...
   x25->neighbour = NULL //(1) |
   ...                         |  x25->neighbour->extended //(2)

The code sets NULL to x25->neighbour in position (1) and dereferences
x25->neighbour in position (2), which could cause null-ptr-deref bug.

This patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize
with x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the
sock held by lock_sock() is not NULL, because it is extracted from x25_list
and uses x25_list_lock to synchronize.

Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Lin Ma <linma@zju.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 409570a619c1cda2e0fde6018a256b9e3d3ba0ee)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoqlcnic: dcb: default to returning -EOPNOTSUPP
Tom Rix [Sat, 26 Mar 2022 17:20:03 +0000 (10:20 -0700)]
qlcnic: dcb: default to returning -EOPNOTSUPP

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1521db37f0d42334a88e8ff28198a27d1ed5cd7b ]

Clang static analysis reports this issue
qlcnic_dcb.c:382:10: warning: Assigned value is
  garbage or undefined
  mbx_out = *val;
          ^ ~~~~

val is set in the qlcnic_dcb_query_hw_capability() wrapper.
If there is no query_hw_capability op in dcp, success is
returned without setting the val.

For this and similar wrappers, return -EOPNOTSUPP.

Fixes: 14d385b99059 ("qlcnic: dcb: Query adapter DCB capabilities.")
Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c416e9bb85a647a12ae22df39ccc62b99f02a365)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: sparx5: depends on PTP_1588_CLOCK_OPTIONAL
Randy Dunlap [Sat, 26 Mar 2022 18:02:34 +0000 (11:02 -0700)]
net: sparx5: depends on PTP_1588_CLOCK_OPTIONAL

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 08be6b13db23f68146c600dd5adfd92e99d9ec6e ]

Fix build errors when PTP_1588_CLOCK=m and SPARX5_SWTICH=y.

arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.o: in function `sparx5_get_ts_info':
sparx5_ethtool.c:(.text+0x146): undefined reference to `ptp_clock_index'
arc-linux-ld: sparx5_ethtool.c:(.text+0x146): undefined reference to `ptp_clock_index'
arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o: in function `sparx5_ptp_init':
sparx5_ptp.c:(.text+0xd56): undefined reference to `ptp_clock_register'
arc-linux-ld: sparx5_ptp.c:(.text+0xd56): undefined reference to `ptp_clock_register'
arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o: in function `sparx5_ptp_deinit':
sparx5_ptp.c:(.text+0xf30): undefined reference to `ptp_clock_unregister'
arc-linux-ld: sparx5_ptp.c:(.text+0xf30): undefined reference to `ptp_clock_unregister'
arc-linux-ld: sparx5_ptp.c:(.text+0xf38): undefined reference to `ptp_clock_unregister'
arc-linux-ld: sparx5_ptp.c:(.text+0xf46): undefined reference to `ptp_clock_unregister'
arc-linux-ld: drivers/net/ethernet/microchip/sparx5/sparx5_ptp.o:sparx5_ptp.c:(.text+0xf46): more undefined references to `ptp_clock_unregister' follow

Fixes: 3cfa11bac9bb ("net: sparx5: add the basic sparx5 driver")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: UNGLinuxDriver@microchip.com
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Steen Hegelund <steen.hegelund@microchip.com>
Cc: Bjarni Jonasson <bjarni.jonasson@microchip.com>
Cc: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e87c47df21931ad358c3d799fdbfd0aa68f06347)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: clean residual vf config after disable sriov
Peng Li [Sat, 26 Mar 2022 09:51:02 +0000 (17:51 +0800)]
net: hns3: clean residual vf config after disable sriov

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 671cb8cbb9c9e24b681d21b1bfae991e2386ac73 ]

After disable sriov, VF still has some config and info need to be
cleaned, which configured by PF. This patch clean the HW config
and SW struct vport->vf_info.

Fixes: fa8d82e853e8 ("net: hns3: Add support of .sriov_configure in HNS3 driver")
Signed-off-by: Peng Li<lipeng321@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 34a5c64951c38ef227f41660a00ff4b92778fd79)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFS: Don't loop forever in nfs_do_recoalesce()
Trond Myklebust [Sat, 26 Mar 2022 01:51:03 +0000 (21:51 -0400)]
NFS: Don't loop forever in nfs_do_recoalesce()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d02d81efc7564b4d5446a02e0214a164cf00b1f3 ]

If __nfs_pageio_add_request() fails to add the request, it will return
with either desc->pg_error < 0, or mirror->pg_recoalesce will be set, so
we are guaranteed either to exit the function altogether, or to loop.

However if there is nothing left in mirror->pg_list to coalesce, we must
exit, so make sure that we clear mirror->pg_recoalesce every time we
loop.

Reported-by: Olga Kornievskaia <aglo@umich.edu>
Fixes: 70536bf4eb07 ("NFS: Clean up reset of the mirror accounting variables")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c95578235888431e61d36f212ad2236e0ff8b90f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: test_vxlan_under_vrf: Fix broken test case
Ido Schimmel [Thu, 24 Mar 2022 20:05:14 +0000 (22:05 +0200)]
selftests: test_vxlan_under_vrf: Fix broken test case

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b50d3b46f84282d795ae3076111acb75ae1031f3 ]

The purpose of the last test case is to test VXLAN encapsulation and
decapsulation when the underlay lookup takes place in a non-default VRF.
This is achieved by enslaving the physical device of the tunnel to a
VRF.

The binding of the VXLAN UDP socket to the VRF happens when the VXLAN
device itself is opened, not when its physical device is opened. This
was also mentioned in the cited commit ("tests that moving the underlay
from a VRF to another works when down/up the VXLAN interface"), but the
test did something else.

Fix it by reopening the VXLAN device instead of its physical device.

Before:

 # ./test_vxlan_under_vrf.sh
 Checking HV connectivity                                           [ OK ]
 Check VM connectivity through VXLAN (underlay in the default VRF)  [ OK ]
 Check VM connectivity through VXLAN (underlay in a VRF)            [FAIL]

After:

 # ./test_vxlan_under_vrf.sh
 Checking HV connectivity                                           [ OK ]
 Check VM connectivity through VXLAN (underlay in the default VRF)  [ OK ]
 Check VM connectivity through VXLAN (underlay in a VRF)            [ OK ]

Fixes: 03f1c26b1c56 ("test/net: Add script for VXLAN underlay in a VRF")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220324200514.1638326-1-idosch@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 667760fe01e96597ad7e56c7d011ad5ef7b81da5)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: phy: broadcom: Fix brcm_fet_config_init()
Florian Fainelli [Thu, 24 Mar 2022 23:24:38 +0000 (16:24 -0700)]
net: phy: broadcom: Fix brcm_fet_config_init()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bf8bfc4336f7a34e48b3bbd19b1542bf085bdc3d ]

A Broadcom AC201 PHY (same entry as 5241) would be flagged by the
Broadcom UniMAC MDIO controller as not completing the turn around
properly since the PHY expects 65 MDC clock cycles to complete a write
cycle, and the MDIO controller was only sending 64 MDC clock cycles as
determined by looking at a scope shot.

This would make the subsequent read fail with the UniMAC MDIO controller
command field having MDIO_READ_FAIL set and we would abort the
brcm_fet_config_init() function and thus not probe the PHY at all.

After issuing a software reset, wait for at least 1ms which is well
above the 1us reset delay advertised by the datasheet and issue a dummy
read to let the PHY turn around the line properly. This read
specifically ignores -EIO which would be returned by MDIO controllers
checking for the line being turned around.

If we have a genuine reaad failure, the next read of the interrupt
status register would pick it up anyway.

Fixes: d7a2ed9248a3 ("broadcom: Add AC131 phy support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220324232438.1156812-1-f.fainelli@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2d05a007096e26db70dbf0421ff701377c369075)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: refine the process when PF set VF VLAN
Jian Shen [Thu, 24 Mar 2022 12:54:50 +0000 (20:54 +0800)]
net: hns3: refine the process when PF set VF VLAN

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 190cd8a72b0181c543ecada6243be3a50636941b ]

Currently, when PF set VF VLAN, it sends notify mailbox to VF
if VF alive. VF stop its traffic, and send request mailbox
to PF, then PF updates VF VLAN. It's a bit complex. If VF is
killed before sending request, PF will not set VF VLAN without
any log.

This patch refines the process, PF can set VF VLAN direclty,
and then notify the VF. If VF is resetting at that time, the
notify may be dropped, so VF should query it after reset finished.

Fixes: 92f11ea177cd ("net: hns3: fix set port based VLAN issue for VF")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2dc73ba93202960aa6f81572e3de8c53ce8a42e8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: format the output of the MAC address
Yufeng Mo [Wed, 24 Nov 2021 01:06:52 +0000 (09:06 +0800)]
net: hns3: format the output of the MAC address

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4f331fda35f1695af8ddd8180edc948880def74b ]

Printing the whole MAC addresse may bring security risks. Therefore,
the MAC address is partially encrypted to improve security.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ee7e9a9d73d9e3cfe4304d53c3bff704ae4890ed)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: add vlan list lock to protect vlan list
Jian Shen [Thu, 24 Mar 2022 12:54:49 +0000 (20:54 +0800)]
net: hns3: add vlan list lock to protect vlan list

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1932a624ab88ff407d1a1d567fe581faa15dc725 ]

When adding port base VLAN, vf VLAN need to remove from HW and modify
the vlan state in vf VLAN list as false. If the periodicity task is
freeing the same node, it may cause "use after free" error.
This patch adds a vlan list lock to protect the vlan list.

Fixes: c6075b193462 ("net: hns3: Record VF vlan tables")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 30f0ff7176efe8ac6c55f85bce26ed58bb608758)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: fix port base vlan add fail when concurrent with reset
Jian Shen [Thu, 24 Mar 2022 12:54:48 +0000 (20:54 +0800)]
net: hns3: fix port base vlan add fail when concurrent with reset

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c0f46de30c965d4ba208b5bf1a6d3437a7556ee2 ]

Currently, Port base vlan is initiated by PF and configured to its VFs,
by using command "ip link set <pf name> vf <vf id> vlan <vlan id>".
When a global reset was triggered, the hardware vlan table and the soft
recorded vlan information will be cleared by PF, and restored them until
VFs were ready. There is a short time window between the table had been
cleared and before table restored. If configured a new port base vlan tag
at this moment, driver will check the soft recorded vlan information,
and find there hasn't the old tag in it, which causing a warning print.

Due to the port base vlan is managed by PF, so the VFs's port base vlan
restoring should be handled by PF when PF was ready.

This patch fixes it.

Fixes: 039ba863e8d7 ("net: hns3: optimize the filter table entries handling when resetting")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 02948e5782cea0585cad4831715468a09c13e106)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: hns3: fix bug when PF set the duplicate MAC address for VFs
Jian Shen [Thu, 24 Mar 2022 12:54:47 +0000 (20:54 +0800)]
net: hns3: fix bug when PF set the duplicate MAC address for VFs

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ccb18f05535c96d26e2d559d402acb87700fc5a7 ]

If the MAC address A is configured to vport A and then vport B. The MAC
address of vport A in the hardware becomes invalid. If the address of
vport A is changed to MAC address B, the driver needs to delete the MAC
address A of vport A. Due to the MAC address A of vport A has become
invalid in the hardware entry, so "-ENOENT" is returned. In this case, the
"used_umv_size" value recorded in driver is not updated. As a result, the
MAC entry status of the software is inconsistent with that of the hardware.

Therefore, the driver updates the umv size even if the MAC entry cannot be
found. Ensure that the software and hardware status is consistent.

Fixes: ee4bcd3b7ae4 ("net: hns3: refactor the MAC address configure")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 5e528c0e06188b5c1395b126ccd7854fb6d3bc88)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: enetc: report software timestamping via SO_TIMESTAMPING
Vladimir Oltean [Thu, 24 Mar 2022 16:12:10 +0000 (18:12 +0200)]
net: enetc: report software timestamping via SO_TIMESTAMPING

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit feb13dcb1818b775fbd9191f797be67cd605f03e ]

Let user space properly determine that the enetc driver provides
software timestamps.

Fixes: 4caefbce06d1 ("enetc: add software timestamping")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Link: https://lore.kernel.org/r/20220324161210.4122281-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit be6937a11b1c2c15fcb3d14a18304c6743fec43c)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoxen: fix is_xen_pmu()
Juergen Gross [Fri, 25 Mar 2022 14:20:02 +0000 (15:20 +0100)]
xen: fix is_xen_pmu()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit de2ae403b4c0e79a3410e63bc448542fbb9f9bfc ]

is_xen_pmu() is taking the cpu number as parameter, but it is not using
it. Instead it just tests whether the Xen PMU initialization on the
current cpu did succeed. As this test is done by checking a percpu
pointer, preemption needs to be disabled in order to avoid switching
the cpu while doing the test. While resuming from suspend() this seems
not to be the case:

[   88.082751] ACPI: PM: Low-level resume complete
[   88.087933] ACPI: EC: EC started
[   88.091464] ACPI: PM: Restoring platform NVS memory
[   88.097166] xen_acpi_processor: Uploading Xen processor PM info
[   88.103850] Enabling non-boot CPUs ...
[   88.108128] installing Xen timer for CPU 1
[   88.112763] BUG: using smp_processor_id() in preemptible [00000000] code: systemd-sleep/7138
[   88.122256] caller is is_xen_pmu+0x12/0x30
[   88.126937] CPU: 0 PID: 7138 Comm: systemd-sleep Tainted: G        W         5.16.13-2.fc32.qubes.x86_64 #1
[   88.137939] Hardware name: Star Labs StarBook/StarBook, BIOS 7.97 03/21/2022
[   88.145930] Call Trace:
[   88.148757]  <TASK>
[   88.151193]  dump_stack_lvl+0x48/0x5e
[   88.155381]  check_preemption_disabled+0xde/0xe0
[   88.160641]  is_xen_pmu+0x12/0x30
[   88.164441]  xen_smp_intr_init_pv+0x75/0x100

Fix that by replacing is_xen_pmu() by a simple boolean variable which
reflects the Xen PMU initialization state on cpu 0.

Modify xen_pmu_init() to return early in case it is being called for a
cpu other than cpu 0 and the boolean variable not being set.

Fixes: bf6dfb154d93 ("xen/PMU: PMU emulation code")
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/20220325142002.31789-1-jgross@suse.com
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit af884b276b08e2b7e74c2b9208df35f36fa6a54c)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: Initialize orphan req_rate
Maxime Ripard [Fri, 25 Mar 2022 16:11:42 +0000 (17:11 +0100)]
clk: Initialize orphan req_rate

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5f7e2af00807f2117650e711a58b7f0e986ce1df ]

When registering a clock that doesn't have a recalc_rate implementation,
and doesn't have its parent registered yet, we initialize the clk_core
rate and 'req_rate' fields to 0.

The rate field is later updated when the parent is registered in
clk_core_reparent_orphans_nolock() using __clk_recalc_rates(), but the
'req_rate' field is never updated.

This leads to an issue in clk_set_rate_range() and clk_put(), since
those functions will call clk_set_rate() with the content of 'req_rate'
to provide drivers with the opportunity to change the rate based on the
new boundaries. In this case, we would call clk_set_rate() with a rate
of 0, effectively enforcing the minimum allowed for this clock whenever
we would call one of those two functions, even though the actual rate
might be within range.

Let's fix this by setting 'req_rate' in
clk_core_reparent_orphans_nolock() with the rate field content just
updated by the call to __clk_recalc_rates().

Fixes: 1c8e600440c7 ("clk: Add rate constraints to clocks")
Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> # T30 Nexus7
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220325161144.1901695-2-maxime@cerno.tech
[sboyd@kernel.org: Reword comment]
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6c17fd7a6f5d9b6a14b82ca09eea961d685d95ef)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovsock/virtio: enable VQs early on probe
Stefano Garzarella [Wed, 23 Mar 2022 17:36:25 +0000 (18:36 +0100)]
vsock/virtio: enable VQs early on probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 88704454ef8b00ea91537ae0d47d9348077e0e72 ]

virtio spec requires drivers to set DRIVER_OK before using VQs.
This is set automatically after probe returns, but virtio-vsock
driver uses VQs in the probe function to fill rx and event VQs
with new buffers.

Let's fix this, calling virtio_device_ready() before using VQs
in the probe function.

Fixes: 0ea9e1d3a9e3 ("VSOCK: Introduce virtio_transport.ko")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8b320893461cfdfbdb89f183737e1d7df67d7d7a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovsock/virtio: read the negotiated features before using VQs
Stefano Garzarella [Wed, 23 Mar 2022 17:36:24 +0000 (18:36 +0100)]
vsock/virtio: read the negotiated features before using VQs

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c1011c0b3a9c8d2065f425407475cbcc812540b7 ]

Complete the driver configuration, reading the negotiated features,
before using the VQs in the virtio_vsock_probe().

Fixes: 53efbba12cc7 ("virtio/vsock: enable SEQPACKET for transport")
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b64bf5464ad56be06c4d6042be2284116db0ac48)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovsock/virtio: initialize vdev->priv before using VQs
Stefano Garzarella [Wed, 23 Mar 2022 17:36:23 +0000 (18:36 +0100)]
vsock/virtio: initialize vdev->priv before using VQs

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 4b5f1ad5566ada230aaa2ce861b28d1895f1ea68 ]

When we fill VQs with empty buffers and kick the host, it may send
an interrupt. `vdev->priv` must be initialized before this since it
is used in the virtqueue callbacks.

Fixes: 0deab087b16a ("vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock")
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 10c6cb867ffa827a8364d0c481ec1438cd594652)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: qcom: gcc-msm8994: Fix gpll4 width
Konrad Dybcio [Sat, 19 Mar 2022 17:49:40 +0000 (18:49 +0100)]
clk: qcom: gcc-msm8994: Fix gpll4 width

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 71021db1c532c2545ae53b9ee85b37b7154f51d4 ]

The gpll4 postdiv is actually a div4, so make sure that Linux is aware of
this.

This fixes the following error messages:

 mmc1: Card appears overclocked; req 200000000 Hz, actual 343999999 Hz
 mmc1: Card appears overclocked; req 400000000 Hz, actual 687999999 Hz

Fixes: aec89f78cf01 ("clk: qcom: Add support for msm8994 global clock controller")
Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Link: https://lore.kernel.org/r/20220319174940.341137-1-konrad.dybcio@somainline.org
Tested-by: Petr Vorel <petr.vorel@gmail.com>
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c07a9d2a1d1d4aa903c92032258531995fb211eb)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoperf stat: Fix forked applications enablement of counters
Thomas Richter [Thu, 17 Mar 2022 15:53:46 +0000 (16:53 +0100)]
perf stat: Fix forked applications enablement of counters

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d0a0a511493d269514fcbd852481cdca32c95350 ]

I have run into the following issue:

 # perf stat -a -e new_pmu/INSTRUCTION_7/ --  mytest -c1 7

 Performance counter stats for 'system wide':

                 0      new_pmu/INSTRUCTION_7/

       0.000366428 seconds time elapsed
 #

The new PMU for s390 counts the execution of certain CPU instructions.
The root cause is the extremely small run time of the mytest program. It
just executes some assembly instructions and then exits.

In above invocation the instruction is executed exactly one time (-c1
option). The PMU is expected to report this one time execution by a
counter value of one, but fails to do so in some cases, not all.

Debugging reveals the invocation of the child process is done
*before* the counter events are installed and enabled.

Tracing reveals that sometimes the child process starts and exits before
the event is installed on all CPUs. The more CPUs the machine has, the
more often this miscount happens.

Fix this by reversing the start of the work load after the events have
been installed on the specified CPUs. Now the comment also matches the
code.

Output after:

 # perf stat -a -e new_pmu/INSTRUCTION_7/ --  mytest -c1 7

 Performance counter stats for 'system wide':

                 1      new_pmu/INSTRUCTION_7/

       0.000366428 seconds time elapsed
 #

Now the correct result is reported rock solid all the time regardless
how many CPUs are online.

Reviewers notes:

Jiri:

Right, without -a the event has enable_on_exec so the race does not
matter, but it's a problem for system wide with fork.

Namhyung:

Agreed. Also we may move the enable_counters() and the clock code out of
the if block to be shared with the else block.

Fixes: acf2892270dcc428 ("perf stat: Use perf_evlist__prepare/start_workload()")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20220317155346.577384-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e16b5f07798042f197ea28f5700c0d1694951542)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agokdb: Fix the putarea helper function
Daniel Thompson [Fri, 28 Jan 2022 14:40:55 +0000 (14:40 +0000)]
kdb: Fix the putarea helper function

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c1cb81429df462eca1b6ba615cddd21dd3103c46 ]

Currently kdb_putarea_size() uses copy_from_kernel_nofault() to write *to*
arbitrary kernel memory. This is obviously wrong and means the memory
modify ('mm') command is a serious risk to debugger stability: if we poke
to a bad address we'll double-fault and lose our debug session.

Fix this the (very) obvious way.

Note that there are two Fixes: tags because the API was renamed and this
patch will only trivially backport as far as the rename (and this is
probably enough). Nevertheless Christoph's rename did not introduce this
problem so I wanted to record that!

Fixes: fe557319aa06 ("maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault")
Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20220128144055.207267-1-daniel.thompson@linaro.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c532caa7df8c5c6ce8d5d09c378d9e6e010c0058)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFSv4.1: don't retry BIND_CONN_TO_SESSION on session error
Olga Kornievskaia [Thu, 24 Mar 2022 14:38:42 +0000 (10:38 -0400)]
NFSv4.1: don't retry BIND_CONN_TO_SESSION on session error

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1d15d121cc2ad4d016a7dc1493132a9696f91fc5 ]

There is no reason to retry the operation if a session error had
occurred in such case result structure isn't filled out.

Fixes: dff58530c4ca ("NFSv4.1: fix handling of backchannel binding in BIND_CONN_TO_SESSION")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0445609a7acebfc4fe3849c62adae7893140e7ed)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoSUNRPC don't resend a task on an offlined transport
Olga Kornievskaia [Thu, 24 Mar 2022 14:22:58 +0000 (10:22 -0400)]
SUNRPC don't resend a task on an offlined transport

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 82ee41b85cef16b4be1f4732650012d9baaedddd ]

When a task is being retried, due to an NFS error, if the assigned
transport has been put offline and the task is relocatable pick a new
transport.

Fixes: 6f081693e7b2b ("sunrpc: remove an offlined xprt using sysfs")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4ee7a4b67770e2c0e62ff8fcc4cd31c0efe740bf)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonetfilter: nf_conntrack_tcp: preserve liberal flag in tcp options
Pablo Neira Ayuso [Mon, 21 Mar 2022 10:38:32 +0000 (11:38 +0100)]
netfilter: nf_conntrack_tcp: preserve liberal flag in tcp options

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f2dd495a8d589371289981d5ed33e6873df94ecc ]

Do not reset IP_CT_TCP_FLAG_BE_LIBERAL flag in out-of-sync scenarios
coming before the TCP window tracking, otherwise such connections will
fail in the window check.

Update tcp_options() to leave this flag in place and add a new helper
function to reset the tcp window state.

Based on patch from Sven Auhagen.

Fixes: c4832c7bbc3f ("netfilter: nf_ct_tcp: improve out-of-sync situation in TCP tracking")
Tested-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6195af5ad80198d43e8ec969d06731db2368c4c3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agojfs: fix divide error in dbNextAG
Pavel Skripkin [Sat, 19 Mar 2022 19:30:00 +0000 (22:30 +0300)]
jfs: fix divide error in dbNextAG

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 2cc7cc01c15f57d056318c33705647f87dcd4aab ]

Syzbot reported divide error in dbNextAG(). The problem was in missing
validation check for malicious image.

Syzbot crafted an image with bmp->db_numag equal to 0. There wasn't any
validation checks, but dbNextAG() blindly use bmp->db_numag in divide
expression

Fix it by validating bmp->db_numag in dbMount() and return an error if
image is malicious

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-and-tested-by: syzbot+46f5c25af73eb8330eb6@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 6bbfe9a715ea075114213c6c8b30dbd2adc9624d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodriver core: dd: fix return value of __setup handler
Randy Dunlap [Tue, 1 Mar 2022 04:18:29 +0000 (20:18 -0800)]
driver core: dd: fix return value of __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f2aad54703dbe630f9d8b235eb58e8c8cc78f37d ]

When "driver_async_probe=nulltty" is used on the kernel boot command line,
it causes an Unknown parameter message and the string is added to init's
environment strings, polluting them.

  Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc6
  driver_async_probe=nulltty", will be passed to user space.

 Run /sbin/init as init process
   with arguments:
     /sbin/init
   with environment:
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc6
     driver_async_probe=nulltty

Change the return value of the __setup function to 1 to indicate
that the __setup option has been handled.

Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Fixes: 1ea61b68d0f8 ("async: Add cmdline option to specify drivers to be async probed")
Cc: Feng Tang <feng.tang@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Reviewed-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20220301041829.15137-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 104852921ff6c87c84b782df46d269db8d2d0595)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agofirmware: google: Properly state IOMEM dependency
David Gow [Fri, 25 Feb 2022 04:15:02 +0000 (12:15 +0800)]
firmware: google: Properly state IOMEM dependency

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 37fd83916da2e4cae03d350015c82a67b1b334c4 ]

The Google Coreboot implementation requires IOMEM functions
(memmremap, memunmap, devm_memremap), but does not specify this is its
Kconfig. This results in build errors when HAS_IOMEM is not set, such as
on some UML configurations:

/usr/bin/ld: drivers/firmware/google/coreboot_table.o: in function `coreboot_table_probe':
coreboot_table.c:(.text+0x311): undefined reference to `memremap'
/usr/bin/ld: coreboot_table.c:(.text+0x34e): undefined reference to `memunmap'
/usr/bin/ld: drivers/firmware/google/memconsole-coreboot.o: in function `memconsole_probe':
memconsole-coreboot.c:(.text+0x12d): undefined reference to `memremap'
/usr/bin/ld: memconsole-coreboot.c:(.text+0x17e): undefined reference to `devm_memremap'
/usr/bin/ld: memconsole-coreboot.c:(.text+0x191): undefined reference to `memunmap'
/usr/bin/ld: drivers/firmware/google/vpd.o: in function `vpd_section_destroy.isra.0':
vpd.c:(.text+0x300): undefined reference to `memunmap'
/usr/bin/ld: drivers/firmware/google/vpd.o: in function `vpd_section_init':
vpd.c:(.text+0x382): undefined reference to `memremap'
/usr/bin/ld: vpd.c:(.text+0x459): undefined reference to `memunmap'
/usr/bin/ld: drivers/firmware/google/vpd.o: in function `vpd_probe':
vpd.c:(.text+0x59d): undefined reference to `memremap'
/usr/bin/ld: vpd.c:(.text+0x5d3): undefined reference to `memunmap'
collect2: error: ld returned 1 exit status

Fixes: a28aad66da8b ("firmware: coreboot: Collapse platform drivers into bus core")
Acked-By: anton ivanov <anton.ivanov@cambridgegreys.com>
Acked-By: Julius Werner <jwerner@chromium.org>
Signed-off-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/r/20220225041502.1901806-1-davidgow@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 20fab30930f368b0fe06ea2a934326bdb7d08dc8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agokgdbts: fix return value of __setup handler
Randy Dunlap [Tue, 8 Mar 2022 03:32:55 +0000 (19:32 -0800)]
kgdbts: fix return value of __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 96c9e802c64014a7716865332d732cc9c7f24593 ]

__setup() handlers should return 1 to indicate that the boot option
has been handled. A return of 0 causes the boot option/value to be
listed as an Unknown kernel parameter and added to init's (limited)
environment strings. So return 1 from kgdbts_option_setup().

Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc7
  kgdboc=kbd kgdbts=", will be passed to user space.

 Run /sbin/init as init process
   with arguments:
     /sbin/init
   with environment:
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc7
     kgdboc=kbd
     kgdbts=

Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Fixes: e8d31c204e36 ("kgdb: add kgdb internal test suite")
Cc: kgdb-bugreport@lists.sourceforge.net
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20220308033255.22118-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit af6e1b06d0ba37494d7cd821ae753342c5c1a629)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovirt: acrn: fix a memory leak in acrn_dev_ioctl()
Xiaolong Huang [Tue, 8 Mar 2022 09:20:47 +0000 (17:20 +0800)]
virt: acrn: fix a memory leak in acrn_dev_ioctl()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ecd1735f14d6ac868ae5d8b7a2bf193fa11f388b ]

The vm_param and cpu_regs need to be freed via kfree()
before return -EINVAL error.

Fixes: 9c5137aedd11 ("virt: acrn: Introduce VM management interfaces")
Fixes: 2ad2aaee1bc9 ("virt: acrn: Introduce an ioctl to set vCPU registers state")
Signed-off-by: Xiaolong Huang <butterflyhuangxx@gmail.com>
Signed-off-by: Fei Li <fei1.li@intel.com>
Link: https://lore.kernel.org/r/20220308092047.1008409-1-butterflyhuangxx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1d5103d9bb7d42fc220afe9f01ec6b9fe0ea5773)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agovirt: acrn: obtain pa from VMA with PFNMAP flag
Yonghua Huang [Mon, 28 Feb 2022 02:22:12 +0000 (05:22 +0300)]
virt: acrn: obtain pa from VMA with PFNMAP flag

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8a6e85f75a83d16a71077e41f2720c691f432002 ]

 acrn_vm_ram_map can't pin the user pages with VM_PFNMAP flag
 by calling get_user_pages_fast(), the PA(physical pages)
 may be mapped by kernel driver and set PFNMAP flag.

 This patch fixes logic to setup EPT mapping for PFN mapped RAM region
 by checking the memory attribute before adding EPT mapping for them.

Fixes: 88f537d5e8dd ("virt: acrn: Introduce EPT mapping management")
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Signed-off-by: Fei Li <fei1.li@intel.com>
Link: https://lore.kernel.org/r/20220228022212.419406-1-yonghua.huang@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b9c43aa0b18da5619aac347d54cb67fe30d1f884)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoserial: 8250: fix XOFF/XON sending when DMA is used
Ilpo Järvinen [Mon, 14 Mar 2022 09:14:32 +0000 (11:14 +0200)]
serial: 8250: fix XOFF/XON sending when DMA is used

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f58c252e30cf74f68b0054293adc03b5923b9f0e ]

When 8250 UART is using DMA, x_char (XON/XOFF) is never sent
to the wire. After this change, x_char is injected correctly.

Create uart_xchar_out() helper for sending the x_char out and
accounting related to it. It seems that almost every driver
does these same steps with x_char. Except for 8250, however,
almost all currently lack .serial_out so they cannot immediately
take advantage of this new helper.

The downside of this patch is that it might reintroduce
the problems some devices faced with mixed DMA/non-DMA transfer
which caused revert f967fc8f165f (Revert "serial: 8250_dma:
don't bother DMA with small transfers"). However, the impact
should be limited to cases with XON/XOFF (that didn't work
with DMA capable devices to begin with so this problem is not
very likely to cause a major issue, if any at all).

Fixes: 9ee4b83e51f74 ("serial: 8250: Add support for dmaengine")
Reported-by: Gilles Buloz <gilles.buloz@kontron.com>
Tested-by: Gilles Buloz <gilles.buloz@kontron.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220314091432.4288-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 16e3238047322c3967e601b2813a10837fb2acb9)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agokgdboc: fix return value of __setup handler
Randy Dunlap [Wed, 9 Mar 2022 03:30:18 +0000 (19:30 -0800)]
kgdboc: fix return value of __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ab818c7aa7544bf8d2dd4bdf68878b17a02eb332 ]

__setup() handlers should return 1 to obsolete_checksetup() in
init/main.c to indicate that the boot option has been handled.
A return of 0 causes the boot option/value to be listed as an Unknown
kernel parameter and added to init's (limited) environment strings.
So return 1 from kgdboc_option_setup().

Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc7
  kgdboc=kbd kgdbts=", will be passed to user space.

 Run /sbin/init as init process
   with arguments:
     /sbin/init
   with environment:
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc7
     kgdboc=kbd
     kgdbts=

Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Fixes: 1bd54d851f50 ("kgdboc: Passing ekgdboc to command line causes panic")
Fixes: f2d937f3bf00 ("consoles: polling support, kgdboc")
Cc: He Zhe <zhe.he@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: kgdb-bugreport@lists.sourceforge.net
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: linux-serial@vger.kernel.org
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20220309033018.17936-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a885e17cf5f2dd6606abe825a001fd09a5c29c2e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agotty: hvc: fix return value of __setup handler
Randy Dunlap [Tue, 8 Mar 2022 02:42:28 +0000 (18:42 -0800)]
tty: hvc: fix return value of __setup handler

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 53819a0d97aace1425bb042829e3446952a9e8a9 ]

__setup() handlers should return 1 to indicate that the boot option
has been handled or 0 to indicate that it was not handled.
Add a pr_warn() message if the option value is invalid and then
always return 1.

Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Fixes: 86b40567b917 ("tty: replace strict_strtoul() with kstrtoul()")
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Julian Wiedmann <jwi@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20220308024228.20477-1-rdunlap@infradead.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e1338178f35e9520bd406cdd1258709984da5c0a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl/rockchip: Add missing of_node_put() in rockchip_pinctrl_probe
Miaoqian Lin [Mon, 7 Mar 2022 12:02:34 +0000 (12:02 +0000)]
pinctrl/rockchip: Add missing of_node_put() in rockchip_pinctrl_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 89388f8730699c259f8090ec435fb43569efe4ac ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: 1e747e59cc4d ("pinctrl: rockchip: base regmap supplied by a syscon")
Fixes: 14dee8677e19 ("pinctrl: rockchip: let pmu registers be supplied by a syscon")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307120234.28657-1-linmq006@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e35a555b5a9d32479933507c7372424fa5294770)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe
Miaoqian Lin [Mon, 7 Mar 2022 11:51:16 +0000 (11:51 +0000)]
pinctrl: nomadik: Add missing of_node_put() in nmk_pinctrl_probe

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit c09ac191b1f97cfa06f394dbfd7a5db07986cefc ]

This node pointer is returned by of_parse_phandle() with refcount
incremented in this function. Calling of_node_put() to avoid
the refcount leak.

Fixes: 32e67eee670e ("pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307115116.25316-1-linmq006@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c52703355766c347f270df222a744e0c491a02f2)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: microchip-sgpio: lock RMW access
Michael Walle [Sat, 26 Feb 2022 20:45:03 +0000 (21:45 +0100)]
pinctrl: microchip-sgpio: lock RMW access

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7996c5f5ec7a20b3f6b8fae93fcf3cb8f1c01743 ]

Protect any RMW access to the registers by a spinlock.

Fixes: 7e5ea974e61c ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO")
Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20220226204507.2511633-2-michael@walle.cc
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 84940deb8dd35dc96385f8af3191dc91431b0831)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: microchip sgpio: use reset driver
Horatiu Vultur [Mon, 18 Oct 2021 08:57:54 +0000 (10:57 +0200)]
pinctrl: microchip sgpio: use reset driver

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0b90315af7602aeb40fe7b6255ab212a19dbd78e ]

On lan966x platform when the switch gets reseted then also the sgpio
gets reseted. The fix for this is to extend also the sgpio driver to
call the reset driver which will be reseted only once by the first
driver that is probed.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Steen Hegelund <steen.hegelund@microchip.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Link: https://lore.kernel.org/r/20211018085754.1066056-3-horatiu.vultur@microchip.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c6f009fe90f1648cd67c636bb495e80af915c115)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: mediatek: paris: Skip custom extra pin config dump for virtual GPIOs
Chen-Yu Tsai [Tue, 8 Mar 2022 10:09:51 +0000 (18:09 +0800)]
pinctrl: mediatek: paris: Skip custom extra pin config dump for virtual GPIOs

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1763933d377ecb05454f8d20e3c8922480db2ac0 ]

Virtual GPIOs do not have any hardware state associated with them. Any
attempt to read back hardware state for these pins result in error
codes.

Skip dumping extra pin config information for these virtual GPIOs.

Fixes: 184d8e13f9b1 ("pinctrl: mediatek: Add support for pin configuration dump via debugfs.")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308100956.2750295-7-wenst@chromium.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a843ba2e9c875b4ad5eb2e8ec822c46f6d8a5ece)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: mediatek: paris: Fix pingroup pin config state readback
Chen-Yu Tsai [Tue, 8 Mar 2022 10:09:49 +0000 (18:09 +0800)]
pinctrl: mediatek: paris: Fix pingroup pin config state readback

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 54fe55fb384ade630ef20b9a8b8f3b2a89ad97f2 ]

mtk_pconf_group_get(), used to read back pingroup pin config state,
simply returns a set of configs saved from a previous invocation of
mtk_pconf_group_set(). This is an unfiltered, unvalidated set passed
in from the pinconf core, which does not match the current hardware
state.

Since the driver library is designed to have one pin per group, pass
through mtk_pconf_group_get() to mtk_pinconf_get(), to read back the
current pin config state of the only pin in the group.

Also drop the assignment of pin config state to the group.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308100956.2750295-5-wenst@chromium.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 070d46aee1513210ad5471569508d6046ae1e3d4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: mediatek: paris: Fix "argument" argument type for mtk_pinconf_get()
Chen-Yu Tsai [Tue, 8 Mar 2022 10:09:48 +0000 (18:09 +0800)]
pinctrl: mediatek: paris: Fix "argument" argument type for mtk_pinconf_get()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 19bce7ce0a593c7024030a0cda9e23facea3c93d ]

For mtk_pinconf_get(), the "argument" argument is typically returned by
pinconf_to_config_argument(), which holds the value for a given pinconf
parameter. It certainly should not have the type of "enum pin_config_param",
which describes the type of the pinconf parameter itself.

Change the type to u32, which matches the return type of
pinconf_to_config_argument().

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308100956.2750295-4-wenst@chromium.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1190c1a5828a1d1e0eff8de1683495c0dcc6b69d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback
Chen-Yu Tsai [Tue, 8 Mar 2022 10:09:47 +0000 (18:09 +0800)]
pinctrl: mediatek: paris: Fix PIN_CONFIG_BIAS_* readback

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3e8c6bc608480010f360c4a59578d7841726137d ]

When reading back pin bias settings, if the pin is not in the
corresponding bias state, the function should return -EINVAL.

Fix this in the mediatek-paris pinctrl library so that the read back
state is not littered with bogus a "input bias disabled" combined with
"pull up" or "pull down" states.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308100956.2750295-3-wenst@chromium.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit a8d236a32934cb60377e933954289f1a70340c9a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: mediatek: Fix missing of_node_put() in mtk_pctrl_init
Miaoqian Lin [Tue, 8 Mar 2022 07:11:54 +0000 (07:11 +0000)]
pinctrl: mediatek: Fix missing of_node_put() in mtk_pctrl_init

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit dab4df9ca919f59e5b9dd84385eaf34d4f20dbb0 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: a6df410d420a ("pinctrl: mediatek: Add Pinctrl/GPIO driver for mt8135.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308071155.21114-1-linmq006@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3ddbb9ba7579d21ee646a41aea5dd9d2228c22e1)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging: mt7621-dts: fix GB-PC2 devicetree
Arınç ÜNAL [Fri, 11 Mar 2022 09:03:20 +0000 (12:03 +0300)]
staging: mt7621-dts: fix GB-PC2 devicetree

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5bc148649cf358d0cccf525452a4efbd4bc89a0f ]

Fix the GB-PC2 devicetree. Refer to the schematics of the device for more
information.

GB-PC2 devicetree fixes:
- Include mt7621.dtsi instead of gbpc1.dts. Add the missing definitions.
- Remove gpio-leds node as the system LED is not wired to anywhere on
the board and the power LED is directly wired to GND.
- Remove uart3 pin group from gpio-pinmux node as it's not used as GPIO.
- Use reg 7 for the external phy to be on par with
Documentation/devicetree/bindings/net/dsa/mt7530.txt.
- Use the status value "okay".

Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC2_V1.1_schematic.pdf
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220311090320.3068-2-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 127a5d3e732df7d7fb5bdbbaca3acdd679003605)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging: mt7621-dts: fix pinctrl properties for ethernet
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:03 +0000 (18:39 +0300)]
staging: mt7621-dts: fix pinctrl properties for ethernet

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0a93c0d75809582893e82039143591b9265b520e ]

Add pinctrl properties with rgmii1 & mdio pins under ethernet node which
was wrongfully put under an external phy node.
GMAC1 will start working with this fix.

Link: https://lore.kernel.org/netdev/02ecce91-7aad-4392-c9d7-f45ca1b31e0b@arinc9.com/T/
Move GB-PC2 specific phy_external node to its own device tree.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-5-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b24dfa54d6e80e6f30fe6bdc2b0fcea48f041092)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging: mt7621-dts: fix formatting
Arınç ÜNAL [Tue, 25 Jan 2022 15:39:00 +0000 (18:39 +0300)]
staging: mt7621-dts: fix formatting

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7eeec44d33f6be7caca4fe9ca4e653cf315a36c1 ]

Fix formatting on mt7621.dtsi.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220125153903.1469-2-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 97d01fabee69aa38967fa85e8f0280345dc69c27)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging: mt7621-dts: fix LEDs and pinctrl on GB-PC1 devicetree
Arınç ÜNAL [Fri, 11 Mar 2022 09:03:19 +0000 (12:03 +0300)]
staging: mt7621-dts: fix LEDs and pinctrl on GB-PC1 devicetree

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6256e18686158fa49e019297f990f1c1817aabf1 ]

Fix LED and pinctrl definitions on the GB-PC1 devicetree. Refer to the
schematics of the device for more information.

LED fixes:
- Change GPIO6 LED label from system to power as GPIO6 is connected to
PLED.
- Add default-on default-trigger to power LED.
- Change GPIO8 LED label from status to system as GPIO8 is connected to
SYS_LED.
- Add disk-activity default-trigger to system LED.
- Switch to the color:function naming scheme.
- Remove lan1 and lan2 LEDs as they don't exist.

Pinctrl fixes:
- Claim state_default node under pinctrl node.
- Change pinctrl0 node name to state-default.
- Change gpio node name to gpio-pinmux to respect
Documentation/devicetree/bindings/pinctrl/ralink,rt2880-pinmux.yaml.
- Sort pin groups alphabetically.

Misc fixes:
- Fix formatting.
- Use the status value "okay".
- Define hexadecimal addresses in lower case.
- Make hexadecimal addresses for memory easier to read.

Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC1_V1.0_Schematic.pdf
Tested-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Link: https://lore.kernel.org/r/20220311090320.3068-1-arinc.unal@arinc9.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 1293b7481d733319d7a1ae3250ade40d5374ee47)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFS: remove unneeded check in decode_devicenotify_args()
Alexey Khoroshilov [Tue, 15 Feb 2022 10:17:04 +0000 (13:17 +0300)]
NFS: remove unneeded check in decode_devicenotify_args()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit cb8fac6d2727f79f211e745b16c9abbf4d8be652 ]

[You don't often get email from khoroshilov@ispras.ru. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]

Overflow check in not needed anymore after we switch to kmalloc_array().

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Fixes: a4f743a6bb20 ("NFSv4.1: Convert open-coded array allocation calls to kmalloc_array()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 75ee75cc360a8ce0ba3a3e796658152f9b3c4694)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomailbox: imx: fix crash in resume on i.mx8ulp
Robin Gong [Mon, 7 Feb 2022 01:52:07 +0000 (09:52 +0800)]
mailbox: imx: fix crash in resume on i.mx8ulp

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8219efd08a0aa1d7944bdb66d84ba57549258968 ]

check 'priv->clk' before 'imx_mu_read()' otherwise crash happens on
i.mx8ulp, since clock not enabled.

Fixes: 4f0b776ef5831 ("mailbox: imx-mailbox: support i.MX8ULP MU")
Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8bddc0227e78edea1da2da357d1e184ccd2c25e8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver
Miaoqian Lin [Wed, 12 Jan 2022 10:45:01 +0000 (10:45 +0000)]
clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6d6ef58c2470da85a99119f74d34216c8074b9f0 ]

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling path.

Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20220112104501.30655-1-linmq006@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 613e1b253f6dfa9e68c14e2b7db1bf170ddff2e8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: Fix clk_hw_get_clk() when dev is NULL
Maxime Ripard [Fri, 25 Feb 2022 14:35:23 +0000 (15:35 +0100)]
clk: Fix clk_hw_get_clk() when dev is NULL

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 0c1b56df451716ba207bbf59f303473643eee4fd ]

Any registered clk_core structure can have a NULL pointer in its dev
field. While never actually documented, this is evidenced by the wide
usage of clk_register and clk_hw_register with a NULL device pointer,
and the fact that the core of_clk_hw_register() function also passes a
NULL device pointer.

A call to clk_hw_get_clk() on a clk_hw struct whose clk_core is in that
case will result in a NULL pointer derefence when it calls dev_name() on
that NULL device pointer.

Add a test for this case and use NULL as the dev_id if the device
pointer is NULL.

Fixes: 30d6f8c15d2c ("clk: add api to get clk consumer from clk_hw")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220225143534.405820-2-maxime@cerno.tech
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4be3e4c05d8dd1b83b75652cad88c9e752ec7054)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: clps711x: Terminate clk_div_table with sentinel element
Jonathan Neuschäfer [Fri, 18 Feb 2022 00:09:20 +0000 (01:09 +0100)]
clk: clps711x: Terminate clk_div_table with sentinel element

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8bed4ed5aa3431085d9d27afc35d684856460eda ]

In order that the end of a clk_div_table can be detected, it must be
terminated with a sentinel element (.div = 0).

Fixes: 631c53478973d ("clk: Add CLPS711X clk driver")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220218000922.134857-5-j.neuschaefer@gmx.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 071c958f8e1b5be8113e05cf600db3a4907680bb)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: hisilicon: Terminate clk_div_table with sentinel element
Jonathan Neuschäfer [Fri, 18 Feb 2022 00:09:19 +0000 (01:09 +0100)]
clk: hisilicon: Terminate clk_div_table with sentinel element

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 113b261bdf2b4fd34e7769a147a7acd0a4d9137f ]

In order that the end of a clk_div_table can be detected, it must be
terminated with a sentinel element (.div = 0).

Fixes: 6c81966107dc0 ("clk: hisilicon: Add clock driver for hi3559A SoC")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220218000922.134857-4-j.neuschaefer@gmx.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 0415dce6228c38717bacb8fe4755152eda397c73)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: loongson1: Terminate clk_div_table with sentinel element
Jonathan Neuschäfer [Fri, 18 Feb 2022 00:09:18 +0000 (01:09 +0100)]
clk: loongson1: Terminate clk_div_table with sentinel element

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3eb00f89162e80083dfcaa842468b510462cfeaa ]

In order that the end of a clk_div_table can be detected, it must be
terminated with a sentinel element (.div = 0).

Fixes: b4626a7f4892 ("CLK: Add Loongson1C clock support")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Link: https://lore.kernel.org/r/20220218000922.134857-3-j.neuschaefer@gmx.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit f4aee7714a1cc6776eb8f4608d9e88536efc4863)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: actions: Terminate clk_div_table with sentinel element
Jonathan Neuschäfer [Fri, 18 Feb 2022 00:09:17 +0000 (01:09 +0100)]
clk: actions: Terminate clk_div_table with sentinel element

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d8a441e53e2434b1401e52dfd66b05263e442edc ]

In order that the end of a clk_div_table can be detected, it must be
terminated with a sentinel element (.div = 0).

In owl-s900.s, the { 0, 8 } element was probably meant to be just that,
so this patch changes { 0, 8 } to { 0, 0 }.

Fixes: d47317ca4ade1 ("clk: actions: Add S700 SoC clock support")
Fixes: d85d20053e195 ("clk: actions: Add S900 SoC clock support")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Link: https://lore.kernel.org/r/20220218000922.134857-2-j.neuschaefer@gmx.net
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7608a654a2943fc3fcc67e4b94c3a781c5f9be8c)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonvdimm/region: Fix default alignment for small regions
Dan Williams [Thu, 10 Mar 2022 03:49:21 +0000 (19:49 -0800)]
nvdimm/region: Fix default alignment for small regions

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit d9d290d7e659e9db3e4518040cc18b97f5535f4a ]

In preparation for removing BLK aperture support the NVDIMM unit tests
discovered that the default alignment can be set higher than the
capacity of the region. Fall back to PAGE_SIZE in that case.

Given this has not been seen in the wild, elide notifying -stable.

Fixes: 2522afb86a8c ("libnvdimm/region: Introduce an 'align' attribute")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/164688416128.2879318.17890707310125575258.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit be8ab90a3a77d0a7471655a719cce0ba1fcb0450)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoremoteproc: qcom_q6v5_mss: Fix some leaks in q6v5_alloc_memory_region
Miaoqian Lin [Tue, 8 Mar 2022 06:45:21 +0000 (06:45 +0000)]
remoteproc: qcom_q6v5_mss: Fix some leaks in q6v5_alloc_memory_region

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 07a5dcc4bed9d7cae54adf5aa10ff9f037a3204b ]

The device_node pointer is returned by of_parse_phandle() or
of_get_child_by_name() with refcount incremented.
We should use of_node_put() on it when done.

This function only call of_node_put(node) when of_address_to_resource
succeeds, missing error cases.

Fixes: 278d744c46fd ("remoteproc: qcom: Fix potential device node leaks")
Fixes: 051fb70fd4ea ("remoteproc: qcom: Driver for the self-authenticating Hexagon v5")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220308064522.13804-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit bd4771ba2cf9e18473a42b5b70175e50d67a64bb)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoremoteproc: qcom_wcnss: Add missing of_node_put() in wcnss_alloc_memory_region
Miaoqian Lin [Tue, 8 Mar 2022 06:31:02 +0000 (06:31 +0000)]
remoteproc: qcom_wcnss: Add missing of_node_put() in wcnss_alloc_memory_region

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 8f90161a66bc3d6b9fe8dde4d9028d20eae1b62a ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: aed361adca9f ("remoteproc: qcom: Introduce WCNSS peripheral image loader")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220308063102.10049-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9c28309d6a5e5c46d7af89f86fa264478ce0676a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoremoteproc: qcom: Fix missing of_node_put in adsp_alloc_memory_region
Miaoqian Lin [Tue, 8 Mar 2022 03:12:19 +0000 (03:12 +0000)]
remoteproc: qcom: Fix missing of_node_put in adsp_alloc_memory_region

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 505b5b1616e200042999de715dbe7c1e2735cd65 ]

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: dc160e449122 ("remoteproc: qcom: Introduce Non-PAS ADSP PIL driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220308031219.4718-1-linmq006@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 9a809b902e1df9939f72a24061d0c514f8ae8d1d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodmaengine: hisi_dma: fix MSI allocate fail when reload hisi_dma
Jie Hai [Wed, 16 Feb 2022 07:21:01 +0000 (15:21 +0800)]
dmaengine: hisi_dma: fix MSI allocate fail when reload hisi_dma

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b95044b38425f563404234d96bbb20cc6360c7e1 ]

Remove the loaded hisi_dma driver and reload it, the driver fails
to work properly. The following error is reported in the kernel log:

[ 1475.597609] hisi_dma 0000:7b:00.0: Failed to allocate MSI vectors!
[ 1475.604915] hisi_dma: probe of 0000:7b:00.0 failed with error -28

As noted in "The MSI Driver Guide HOWTO"[1], the number of MSI
interrupt must be a power of two. The Kunpeng DMA driver allocates 30
MSI interrupts. As a result, no space left on device is reported
when the driver is reloaded and allocates interrupt vectors from the
interrupt domain.

This patch changes the number of interrupt vectors allocated by
hisi_dma driver to 32 to avoid this problem.

[1] https://www.kernel.org/doc/html/latest/PCI/msi-howto.html

Fixes: e9f08b65250d ("dmaengine: hisilicon: Add Kunpeng DMA engine support")
Signed-off-by: Jie Hai <haijie1@huawei.com>
Acked-by: Zhou Wang <wangzhou1@hisilicon.com>
Link: https://lore.kernel.org/r/20220216072101.34473-1-haijie1@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 95deff8996fb67f2c33b99c5f86db522157f14ef)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: qcom: clk-rcg2: Update the frac table for pixel clock
Taniya Das [Sun, 27 Feb 2022 17:55:36 +0000 (23:25 +0530)]
clk: qcom: clk-rcg2: Update the frac table for pixel clock

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b527358cb4cd58a8279c9062b0786f1fab628fdc ]

Support the new numerator and denominator for pixel clock on SM8350 and
support rgb101010, RGB888 use cases on SM8450.

Fixes: 99cbd064b059f ("clk: qcom: Support display RCG clocks")
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220227175536.3131-2-tdas@codeaurora.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 2a9b575627fcc12120a6ef33447ca2490fc600bc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: qcom: clk-rcg2: Update logic to calculate D value for RCG
Taniya Das [Sun, 27 Feb 2022 17:55:35 +0000 (23:25 +0530)]
clk: qcom: clk-rcg2: Update logic to calculate D value for RCG

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 58922910add18583d5273c2edcdb9fd7bf4eca02 ]

The display pixel clock has a requirement on certain newer platforms to
support M/N as (2/3) and the final D value calculated results in
underflow errors.
As the current implementation does not check for D value is within
the accepted range for a given M & N value. Update the logic to
calculate the final D value based on the range.

Fixes: 99cbd064b059f ("clk: qcom: Support display RCG clocks")
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220227175536.3131-1-tdas@codeaurora.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 34dca60982e93e69ae442aa2d36ce61c9a3bb563)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: at91: sama7g5: fix parents of PDMCs' GCLK
Codrin Ciubotariu [Fri, 4 Mar 2022 18:26:16 +0000 (20:26 +0200)]
clk: at91: sama7g5: fix parents of PDMCs' GCLK

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1a944729d8635fa59638f24e8727d5ccaa0c8c19 ]

Audio PLL can be used as parent by the GCLKs of PDMCs.

Fixes: cb783bbbcf54 ("clk: at91: sama7g5: add clock support for sama7g5")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20220304182616.1920392-1-codrin.ciubotariu@microchip.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7a778371f9f2d8c8d6301b4207188a0ef9d9eb16)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: imx: off by one in imx_lpcg_parse_clks_from_dt()
Dan Carpenter [Mon, 28 Feb 2022 07:50:14 +0000 (10:50 +0300)]
clk: imx: off by one in imx_lpcg_parse_clks_from_dt()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 135efc3a76d127691afaf1864e4ab627bf09d53d ]

The > needs to be >= to prevent an off by one access.

Fixes: d5f1e6a2bb61 ("clk: imx: imx8qxp-lpcg: add parsing clocks from device tree")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Link: https://lore.kernel.org/r/20220228075014.GD13685@kili
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4b8a71f206c94445317179b79d7f91996f40dcfc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: imx7d: Remove audio_mclk_root_clk
Abel Vesa [Thu, 27 Jan 2022 14:10:52 +0000 (16:10 +0200)]
clk: imx7d: Remove audio_mclk_root_clk

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit eccac77ede3946c90143447cdc785dc16aec4b24 ]

The audio_mclk_root_clk was added as a gate with the CCGR121 (0x4790),
but according to the reference manual, there is no such gate. The
CCGR121 belongs to ECSPI2 and it is not shared.

Fixes: 8f6d8094b215b57 ("ARM: imx: add imx7d clk tree support")
Reported-by: David Wolfe <david.wolfe@nxp.com>
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220127141052.1900174-2-abel.vesa@nxp.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4bd979ee9927ba06f9156eea57c5b9d5e4b748ff)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodma-debug: fix return value of __setup handlers
Randy Dunlap [Mon, 28 Feb 2022 22:04:53 +0000 (14:04 -0800)]
dma-debug: fix return value of __setup handlers

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 80e4390981618e290616dbd06ea190d4576f219d ]

When valid kernel command line parameters
  dma_debug=off dma_debug_entries=100
are used, they are reported as Unknown parameters and added to init's
environment strings, polluting it.

  Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
    dma_debug=off dma_debug_entries=100", will be passed to user space.

and

 Run /sbin/init as init process
   with arguments:
     /sbin/init
   with environment:
     HOME=/
     TERM=linux
     BOOT_IMAGE=/boot/bzImage-517rc5
     dma_debug=off
     dma_debug_entries=100

Return 1 from these __setup handlers to indicate that the command line
option has been handled.

Fixes: 59d3daafa1726 ("dma-debug: add kernel command line parameters")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: iommu@lists.linux-foundation.org
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c39a750b61f7b3a37243461f066b969ed27d1094)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging: r8188eu: fix endless loop in recv_func
Martin Kaiser [Sat, 26 Feb 2022 18:14:53 +0000 (19:14 +0100)]
staging: r8188eu: fix endless loop in recv_func

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 1327fcf175fa63d3b7a058b8148ed7714acdc035 ]

Fix an endless loop in recv_func. If pending_frame is not NULL, we're
stuck in the while loop forever. We have to call rtw_alloc_recvframe
each time we loop.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Reported-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220226181457.1138035-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 872a7b12af43fa6e5de0ff51b6ee9590f05d28a3)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFS: Return valid errors from nfs2/3_decode_dirent()
Trond Myklebust [Thu, 24 Feb 2022 15:59:37 +0000 (10:59 -0500)]
NFS: Return valid errors from nfs2/3_decode_dirent()

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 64cfca85bacde54caa64e0ab855c48734894fa37 ]

Valid return values for decode_dirent() callback functions are:
 0: Success
 -EBADCOOKIE: End of directory
 -EAGAIN: End of xdr_stream

All errors need to map into one of those three values.

Fixes: 573c4e1ef53a ("NFS: Simplify ->decode_dirent() calling sequence")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 18dc19571210ca5a8b505234719f6b6c61c2b2a8)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agohabanalabs: Add check for pci_enable_device
Jiasheng Jiang [Thu, 24 Feb 2022 06:58:05 +0000 (14:58 +0800)]
habanalabs: Add check for pci_enable_device

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 ]

As the potential failure of the pci_enable_device(),
it should be better to check the return value and return
error if fails.

Fixes: 70b2f993ea4a ("habanalabs: create common folder")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8a842f88d0e2eb9988e1a35c2d52cb9d26e99d14)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoiio: adc: Add check for devm_request_threaded_irq
Jiasheng Jiang [Thu, 24 Feb 2022 06:28:49 +0000 (14:28 +0800)]
iio: adc: Add check for devm_request_threaded_irq

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b30537a4cedcacf0ade2f33ebb7610178ed1e7d7 ]

As the potential failure of the devm_request_threaded_irq(),
it should be better to check the return value and return
error if fails.

Fixes: fa659a40b80b ("iio: adc: twl6030-gpadc: Use devm_* API family")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220224062849.3280966-1-jiasheng@iscas.ac.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 82546d91d588e8a9f9821fbc1359b3ad6739f57a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoserial: 8250: Fix race condition in RTS-after-send handling
Uwe Kleine-König [Tue, 15 Feb 2022 16:02:36 +0000 (17:02 +0100)]
serial: 8250: Fix race condition in RTS-after-send handling

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit dedab69fd650ea74710b2e626e63fd35584ef773 ]

Set em485->active_timer = NULL isn't always enough to take out the stop
timer. While there is a check that it acts in the right state (i.e.
waiting for RTS-after-send to pass after sending some chars) but the
following might happen:

 - CPU1: some chars send, shifter becomes empty, stop tx timer armed
 - CPU0: more chars send before RTS-after-send expired
 - CPU0: shifter empty irq, port lock taken
 - CPU1: tx timer triggers, waits for port lock
 - CPU0: em485->active_timer = &em485->stop_tx_timer, hrtimer_start(),
   releases lock()
 - CPU1: get lock, see em485->active_timer == &em485->stop_tx_timer,
   tear down RTS too early

This fix bases on research done by Steffen Trumtrar.

Fixes: b86f86e8e7c5 ("serial: 8250: fix potential deadlock in rs485-mode")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220215160236.344236-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3e843460fb4252368bef6c9c8897a40a1268d5a0)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoNFS: Use of mapping_set_error() results in spurious errors
Trond Myklebust [Tue, 15 Feb 2022 20:58:38 +0000 (15:58 -0500)]
NFS: Use of mapping_set_error() results in spurious errors

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 6c984083ec2453dfd3fcf98f392f34500c73e3f2 ]

The use of mapping_set_error() in conjunction with calls to
filemap_check_errors() is problematic because every error gets reported
as either an EIO or an ENOSPC by filemap_check_errors() in functions
such as filemap_write_and_wait() or filemap_write_and_wait_range().
In almost all cases, we prefer to use the more nuanced wb errors.

Fixes: b8946d7bfb94 ("NFS: Revalidate the file mapping on all fatal writeback errors")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ba3a3390c9b17abd71ac44f4a8f7647f3e4e01fc)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoserial: 8250_lpss: Balance reference count for PCI DMA device
Andy Shevchenko [Wed, 23 Feb 2022 15:12:40 +0000 (17:12 +0200)]
serial: 8250_lpss: Balance reference count for PCI DMA device

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 5318f70da7e82649d794fc27d8a127c22aa3566e ]

The pci_get_slot() increases its reference count, the caller
must decrement the reference count by calling pci_dev_put().

Fixes: 9a1870ce812e ("serial: 8250: don't use slave_id of dma_slave_config")
Depends-on: a13e19cf3dc1 ("serial: 8250_lpss: split LPSS driver to separate module")
Reported-by: Qing Wang <wangqing@vivo.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220223151240.70248-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b59173ff16fbfa94223457cc97cce943867a27db)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoserial: 8250_mid: Balance reference count for PCI DMA device
Andy Shevchenko [Tue, 15 Feb 2022 10:09:20 +0000 (12:09 +0200)]
serial: 8250_mid: Balance reference count for PCI DMA device

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 67ec6dd0b257bd81b4e9fcac89b29da72f6265e5 ]

The pci_get_slot() increases its reference count, the caller
must decrement the reference count by calling pci_dev_put().

Fixes: 90b9aacf912a ("serial: 8250_pci: add Intel Tangier support")
Fixes: f549e94effa1 ("serial: 8250_pci: add Intel Penwell ports")
Reported-by: Qing Wang <wangqing@vivo.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Depends-on: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver")
Link: https://lore.kernel.org/r/20220215100920.41984-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 3a1131f7d2a86131aae4f0fb27802ae6c46ae26a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agophy: phy-brcm-usb: fixup BCM4908 support
Rafał Miłecki [Fri, 18 Feb 2022 17:24:59 +0000 (18:24 +0100)]
phy: phy-brcm-usb: fixup BCM4908 support

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 32942d33d63d27714ed16a4176e5a99547adb6e0 ]

Just like every other family BCM4908 should get its own enum value. That
is required to properly handle it in chipset conditional code.

The real change is excluding BCM4908 from the PLL reprogramming code
(see brcmusb_usb3_pll_54mhz()). I'm not sure what's the BCM4908
reference clock frequency but:
1. BCM4908 custom driver from Broadcom's SDK doesn't reprogram PLL
2. Doing that in Linux driver stopped PHY handling some USB 3.0 devices

This change makes USB 3.0 PHY recognize e.g.:
1. 04e8:6860 - Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode)
2. 1058:259f - Western Digital My Passport 259F

Broadcom's STB SoCs come with a set of SUN_TOP_CTRL_* registers that
allow reading chip family and product ids. Such a block & register is
missing on BCM4908 so this commit introduces "compatible" string
specific binding.

Fixes: 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220218172459.10431-1-zajec5@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 675216a820ec49563e1804d22624504421c15742)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agophy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure})
Liu Ying [Wed, 16 Feb 2022 07:12:57 +0000 (15:12 +0800)]
phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure})

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 3153fa38e38af566cf6454a03b1dbadaf6f323c0 ]

According to the comment of the function phy_mipi_dphy_get_default_config(),
it uses minimum D-PHY timings based on MIPI D-PHY specification.  They are
derived from the valid ranges specified in Section 6.9, Table 14, Page 41
of the D-PHY specification (v1.2).  The table 14 explicitly mentions that
the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE
parameter is T-LPX nanoseconds.  Likewise, the kernel doc of the 'lpx' and
'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that
the minimum values are 50000 picoseconds and @lpx picoseconds respectively.
Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is
less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx,
which hints the same minimum values.

Without this patch, the function phy_mipi_dphy_get_default_config()
wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx.
So, let's correct them to 50000 picoseconds and cfg->lpx respectively.

Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK.
Help is needed to test with other i.MX8mq, Meson and Rockchip platforms,
as I don't have the hardwares.

Fixes: dddc97e82303 ("phy: dphy: Add configuration helpers")
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
Link: https://lore.kernel.org/r/20220216071257.1647703-1-victor.liu@nxp.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d9a3c2949d04715f802c10351efbee940e4c9f7a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoclk: qcom: ipq8074: Use floor ops for SDCC1 clock
Dirk Buchwalder [Thu, 10 Feb 2022 17:31:00 +0000 (18:31 +0100)]
clk: qcom: ipq8074: Use floor ops for SDCC1 clock

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit b77d8306d84f83d1da68028a68c91da9c867b6f6 ]

Use floor ops on SDCC1 APPS clock in order to round down selected clock
frequency and avoid overclocking SD/eMMC cards.

For example, currently HS200 cards were failling tuning as they were
actually being clocked at 384MHz instead of 192MHz.
This caused some boards to disable 1.8V I/O and force the eMMC into the
standard HS mode (50MHz) and that appeared to work despite the eMMC being
overclocked to 96Mhz in that case.

There was a previous commit to use floor ops on SDCC clocks, but it looks
to have only covered SDCC2 clock.

Fixes: 9607f6224b39 ("clk: qcom: ipq8074: add PCIE, USB and SDCC clocks")
Signed-off-by: Dirk Buchwalder <buchwalder@posteo.de>
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220210173100.505128-1-robimarko@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit ca3d7cf53d8f6e83759afc25cf763888a07a8b33)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: renesas: checker: Fix miscalculation of number of states
Geert Uytterhoeven [Mon, 21 Feb 2022 16:21:58 +0000 (17:21 +0100)]
pinctrl: renesas: checker: Fix miscalculation of number of states

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit de9b861018d46af27a5edff8b6baef35c0c0ad4f ]

The checker failed to validate all enum IDs in the description of a
register with fixed-width register fields, due to a miscalculation of
the number of described states: each register field of n bits can have
"1 << n" possible states, not "1".

Increase SH_PFC_MAX_ENUMS accordingly, now more enum IDs are checked
(SH-Mobile AG5 has more than 4000 enum IDs defined).

Fixes: 12d057bad683b1c6 ("pinctrl: sh-pfc: checker: Add check for enum ID conflicts")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/6d8a6a05564f38f9d20464c1c17f96e52740cf6a.1645460429.git.geert+renesas@glider.be
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 8c54f6c900d12dcdb0781263df76009c09fddf8a)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agopinctrl: renesas: r8a77470: Reduce size for narrow VIN1 channel
Geert Uytterhoeven [Thu, 23 Dec 2021 14:41:11 +0000 (15:41 +0100)]
pinctrl: renesas: r8a77470: Reduce size for narrow VIN1 channel

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 9e04a0eda84fccab0ac22a33825ad53f47c968c7 ]

The second video-in channel on RZ/G1C has only 12 data lanes, but the
pin control driver uses the vin_data union, which is meant for 24 data
lanes, thus wasting space.

Fix this by using the vin_data12 union instead.

This reduces kernel size by 96 bytes.

Fixes: 50f3f2d73e3426ba ("pinctrl: sh-pfc: Reduce kernel size for narrow VIN channels")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/52716fa89139f6f92592633edb52804d4c5e18f0.1640269757.git.geert+renesas@glider.be
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d19fb1d659babcbbe2fe96da5528012c837e99bb)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agostaging:iio:adc:ad7280a: Fix handing of device address bit reversing.
Jonathan Cameron [Sun, 6 Feb 2022 19:03:09 +0000 (19:03 +0000)]
staging:iio:adc:ad7280a: Fix handing of device address bit reversing.

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit f281e4ddbbc0b60f061bc18a2834e9363ba85f9f ]

The bit reversal was wrong for bits 1 and 3 of the 5 bits.
Result is driver failure to probe if you have more than 2 daisy-chained
devices.  Discovered via QEMU based device emulation.

Fixes tag is for when this moved from a macro to a function, but it
was broken before that.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 065a7c0b1fec ("Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse")
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-2-jic23@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 157a22ca80c50f64c495767331045d501c9ff013)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoserial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type
Zev Weiss [Fri, 11 Feb 2022 00:42:03 +0000 (16:42 -0800)]
serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a603ca60cebff8589882427a67f870ed946b3fc8 ]

Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to
set up register mapping") fixed a bug that had, as a side-effect,
prevented the 8250_aspeed_vuart driver from enabling the VUART's
FIFOs.  However, fixing that (and hence enabling the FIFOs) has in
turn revealed what appears to be a hardware bug in the ASPEED VUART in
which the host-side THRE bit doesn't get if the BMC-side receive FIFO
trigger level is set to anything but one byte.  This causes problems
for polled-mode writes from the host -- for example, Linux kernel
console writes proceed at a glacial pace (less than 100 bytes per
second) because the write path waits for a 10ms timeout to expire
after every character instead of being able to continue on to the next
character upon seeing THRE asserted.  (GRUB behaves similarly.)

As a workaround, introduce a new port type for the ASPEED VUART that's
identical to PORT_16550A as it had previously been using, but with
UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to
one byte, which (experimentally) seems to avoid the problematic THRE
behavior.

Fixes: 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to set up register mapping")
Tested-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Link: https://lore.kernel.org/r/20220211004203.14915-1-zev@bewilderbeest.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d6c4fc0d903fbcc8e1190ed12bfd80f5d031c41f)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoiio: mma8452: Fix probe failing when an i2c_device_id is used
Hans de Goede [Tue, 8 Feb 2022 12:43:35 +0000 (13:43 +0100)]
iio: mma8452: Fix probe failing when an i2c_device_id is used

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit a47ac019e7e8129b93a0b991e04b2a59872e053d ]

The mma8452_driver declares both of_match_table and i2c_driver.id_table
match-tables, but its probe() function only checked for of matches.

Add support for i2c_device_id matches. This fixes the driver not loading
on some x86 tablets (e.g. the Nextbook Ares 8) where the i2c_client is
instantiated by platform code using an i2c_device_id.

Drop of_match_ptr() protection to avoid unused warning.

Fixes: c3cdd6e48e35 ("iio: mma8452: refactor for seperating chip specific data")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220208124336.511884-1-hdegoede@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 011e841cd11b85d7f67997f3ed2f2abaad3b8bf7)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodmaengine: idxd: restore traffic class defaults after wq reset
Dave Jiang [Mon, 24 Jan 2022 16:20:33 +0000 (09:20 -0700)]
dmaengine: idxd: restore traffic class defaults after wq reset

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit ea7c8f598c323f6ebaf9ddae01fb2a981fe8c56a ]

When clearing the group configurations, the driver fails to restore the
default setting for DSA 1.x based devices. Add defaults in
idxd_groups_clear_state() for traffic class configuration.

Fixes: ade8a86b512c ("dmaengine: idxd: Set defaults for GRPCFG traffic class")
Reported-by: Binuraj Ravindran <binuraj.ravindran@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/164304123369.824298.6952463420266592087.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit cad1a3b1f4810ddfb32be9813aec8d051b897734)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodmaengine: idxd: change bandwidth token to read buffers
Dave Jiang [Tue, 14 Dec 2021 20:23:09 +0000 (13:23 -0700)]
dmaengine: idxd: change bandwidth token to read buffers

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 7ed6f1b85fb613e5e44ef3e14d73f2dc96860935 ]

DSA spec v1.2 has changed the term of "bandwidth tokens" to "read buffers"
in order to make the concept clearer. Deprecate bandwidth token
naming in the driver and convert to read buffers in order to match with
the spec and reduce confusion when reading the spec.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/163951338932.2988321.6162640806935567317.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7bebc95196915caa8a020d7cbf736ac278de51b4)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>