]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/log
mirror_ubuntu-jammy-kernel.git
2 years agoNFS: Fix initialisation of nfs_client cl_flags field
Trond Myklebust [Wed, 2 Feb 2022 23:52:01 +0000 (18:52 -0500)]
NFS: Fix initialisation of nfs_client cl_flags field

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 468d126dab45718feeb728319be20bd869a5eaa7 upstream.

For some long forgotten reason, the nfs_client cl_flags field is
initialised in nfs_get_client() instead of being initialised at
allocation time. This quirk was harmless until we moved the call to
nfs_create_rpc_client().

Fixes: dd99e9f98fbf ("NFSv4: Initialise connection to the server in nfs4_alloc_client()")
Cc: stable@vger.kernel.org # 4.8.x
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs
Pavel Parkhomenko [Sat, 5 Feb 2022 21:49:51 +0000 (00:49 +0300)]
net: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs

BugLink: https://bugs.launchpad.net/bugs/1963889
commit aec12836e7196e4d360b2cbf20cf7aa5139ad2ec upstream.

When setting up autonegotiation for 88E1118R and compatible PHYs,
a software reset of PHY is issued before setting up polarity.
This is incorrect as changes of MDI Crossover Mode bits are
disruptive to the normal operation and must be followed by a
software reset to take effect. Let's patch m88e1118_config_aneg()
to fix the issue mentioned before by invoking software reset
of the PHY just after setting up MDI-x polarity.

Fixes: 605f196efbf8 ("phy: Add support for Marvell 88E1118 PHY")
Signed-off-by: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Cc: stable@vger.kernel.org
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agonet: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYs
Pavel Parkhomenko [Sat, 5 Feb 2022 20:39:32 +0000 (23:39 +0300)]
net: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYs

BugLink: https://bugs.launchpad.net/bugs/1963889
commit fe4f57bf7b585dca58f1496c4e2481ecbae18126 upstream.

It is mandatory for a software to issue a reset upon modifying RGMII
Receive Timing Control and RGMII Transmit Timing Control bit fields of MAC
Specific Control register 2 (page 2, register 21) otherwise the changes
won't be perceived by the PHY (the same is applicable for a lot of other
registers). Not setting the RGMII delays on the platforms that imply it'
being done on the PHY side will consequently cause the traffic loss. We
discovered that the denoted soft-reset is missing in the
m88e1121_config_aneg() method for the case if the RGMII delays are
modified but the MDIx polarity isn't changed or the auto-negotiation is
left enabled, thus causing the traffic loss on our platform with Marvell
Alaska 88E1510 installed. Let's fix that by issuing the soft-reset if the
delays have been actually set in the m88e1121_config_aneg_rgmii_delays()
method.

Cc: stable@vger.kernel.org
Fixes: d6ab93364734 ("net: phy: marvell: Avoid unnecessary soft reset")
Signed-off-by: Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20220205203932.26899-1-Pavel.Parkhomenko@baikalelectronics.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agocan: isotp: fix error path in isotp_sendmsg() to unlock wait queue
Oliver Hartkopp [Wed, 9 Feb 2022 07:36:01 +0000 (08:36 +0100)]
can: isotp: fix error path in isotp_sendmsg() to unlock wait queue

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 8375dfac4f683e1b2c5956d919d36aeedad46699 upstream.

Commit 43a08c3bdac4 ("can: isotp: isotp_sendmsg(): fix TX buffer concurrent
access in isotp_sendmsg()") introduced a new locking scheme that may render
the userspace application in a locking state when an error is detected.
This issue shows up under high load on simultaneously running isotp channels
with identical configuration which is against the ISO specification and
therefore breaks any reasonable PDU communication anyway.

Fixes: 43a08c3bdac4 ("can: isotp: isotp_sendmsg(): fix TX buffer concurrent access in isotp_sendmsg()")
Link: https://lore.kernel.org/all/20220209073601.25728-1-socketcan@hartkopp.net
Cc: stable@vger.kernel.org
Cc: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agocan: isotp: fix potential CAN frame reception race in isotp_rcv()
Oliver Hartkopp [Tue, 8 Feb 2022 20:00:26 +0000 (21:00 +0100)]
can: isotp: fix potential CAN frame reception race in isotp_rcv()

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 7c759040c1dd03954f650f147ae7175476d51314 upstream.

When receiving a CAN frame the current code logic does not consider
concurrently receiving processes which do not show up in real world
usage.

Ziyang Xuan writes:

The following syz problem is one of the scenarios. so->rx.len is
changed by isotp_rcv_ff() during isotp_rcv_cf(), so->rx.len equals
0 before alloc_skb() and equals 4096 after alloc_skb(). That will
trigger skb_over_panic() in skb_put().

=======================================================
CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc8-syzkaller #0
RIP: 0010:skb_panic+0x16c/0x16e net/core/skbuff.c:113
Call Trace:
 <TASK>
 skb_over_panic net/core/skbuff.c:118 [inline]
 skb_put.cold+0x24/0x24 net/core/skbuff.c:1990
 isotp_rcv_cf net/can/isotp.c:570 [inline]
 isotp_rcv+0xa38/0x1e30 net/can/isotp.c:668
 deliver net/can/af_can.c:574 [inline]
 can_rcv_filter+0x445/0x8d0 net/can/af_can.c:635
 can_receive+0x31d/0x580 net/can/af_can.c:665
 can_rcv+0x120/0x1c0 net/can/af_can.c:696
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5465
 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5579

Therefore we make sure the state changes and data structures stay
consistent at CAN frame reception time by adding a spin_lock in
isotp_rcv(). This fixes the issue reported by syzkaller but does not
affect real world operation.

Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol")
Link: https://lore.kernel.org/linux-can/d7e69278-d741-c706-65e1-e87623d9a8e8@huawei.com/T/
Link: https://lore.kernel.org/all/20220208200026.13783-1-socketcan@hartkopp.net
Cc: stable@vger.kernel.org
Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com
Reported-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agommc: core: Wait for command setting 'Power Off Notification' bit to complete
Andrey Skvortsov [Sat, 15 Jan 2022 12:14:46 +0000 (15:14 +0300)]
mmc: core: Wait for command setting 'Power Off Notification' bit to complete

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 379f56c24e698f14242f532b1d0a0f1747725e08 upstream.

SD card is allowed to signal busy on DAT0 up to 1s after the
CMD49. According to SD spec (version 6.0 section 5.8.1.3) first host
waits until busy of CMD49 is released and only then polls Power
Management Status register up to 1s until the card indicates ready to
power off.

Without waiting for busy before polling status register sometimes card
becomes unresponsive and system fails to suspend:

  [  205.907459] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
  [  206.421274] sunxi-mmc 1c0f000.mmc: data error, sending stop command
  [  206.421321] sunxi-mmc 1c0f000.mmc: send stop command failed
  [  206.421347] mmc0: error -110 reading status reg of PM func
  [  206.421366] PM: dpm_run_callback(): mmc_bus_suspend+0x0/0x74 returns -110
  [  206.421402] mmcblk mmc0:aaaa: PM: failed to suspend async: error -110
  [  206.437064] PM: Some devices failed to suspend, or early wake event detected

Tested with Sandisk Extreme PRO A2 64GB on Allwinner A64 system.

Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fixes: 2c5d42769038 ("mmc: core: Add support for Power Off Notification for SD cards")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220115121447.641524-1-andrej.skvortzov@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agommc: sdhci-of-esdhc: Check for error num after setting mask
Jiasheng Jiang [Wed, 12 Jan 2022 08:31:56 +0000 (16:31 +0800)]
mmc: sdhci-of-esdhc: Check for error num after setting mask

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 40c67c291a93f8846c4a972c9ef1b7ba4544c8d0 upstream.

Because of the possible failure of the dma_supported(), the
dma_set_mask_and_coherent() may return error num.
Therefore, it should be better to check it and return the error if
fails.
And since the sdhci_setup_host() has already checked the return value of
the enable_dma, we need not check it in sdhci_resume_host() again.

Fixes: 5552d7ad596c ("mmc: sdhci-of-esdhc: set proper dma mask for ls104x chips")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220112083156.1124782-1-jiasheng@iscas.ac.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoima: Do not print policy rule with inactive LSM labels
Stefan Berger [Tue, 1 Feb 2022 20:37:10 +0000 (15:37 -0500)]
ima: Do not print policy rule with inactive LSM labels

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 89677197ae709eb1ab3646952c44f6a171c9e74c upstream.

Before printing a policy rule scan for inactive LSM labels in the policy
rule. Inactive LSM labels are identified by args_p != NULL and
rule == NULL.

Fixes: 483ec26eed42 ("ima: ima/lsm policy rule loading logic bug fixes")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Cc: <stable@vger.kernel.org> # v5.6+
Acked-by: Christian Brauner <brauner@kernel.org>
[zohar@linux.ibm.com: Updated "Fixes" tag]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoima: Allow template selection with ima_template[_fmt]= after ima_hash=
Roberto Sassu [Mon, 31 Jan 2022 17:11:39 +0000 (18:11 +0100)]
ima: Allow template selection with ima_template[_fmt]= after ima_hash=

BugLink: https://bugs.launchpad.net/bugs/1963889
commit bb8e52e4906f148c2faf6656b5106cf7233e9301 upstream.

Commit c2426d2ad5027 ("ima: added support for new kernel cmdline parameter
ima_template_fmt") introduced an additional check on the ima_template
variable to avoid multiple template selection.

Unfortunately, ima_template could be also set by the setup function of the
ima_hash= parameter, when it calls ima_template_desc_current(). This causes
attempts to choose a new template with ima_template= or with
ima_template_fmt=, after ima_hash=, to be ignored.

Achieve the goal of the commit mentioned with the new static variable
template_setup_done, so that template selection requests after ima_hash=
are not ignored.

Finally, call ima_init_template_list(), if not already done, to initialize
the list of templates before lookup_template_desc() is called.

Reported-by: Guo Zihua <guozihua@huawei.com>
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Cc: stable@vger.kernel.org
Fixes: c2426d2ad5027 ("ima: added support for new kernel cmdline parameter ima_template_fmt")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoima: Remove ima_policy file before directory
Stefan Berger [Tue, 25 Jan 2022 22:46:23 +0000 (17:46 -0500)]
ima: Remove ima_policy file before directory

BugLink: https://bugs.launchpad.net/bugs/1963889
commit f7333b9572d0559e00352a926c92f29f061b4569 upstream.

The removal of ima_dir currently fails since ima_policy still exists, so
remove the ima_policy file before removing the directory.

Fixes: 4af4662fa4a9 ("integrity: IMA policy")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Cc: <stable@vger.kernel.org>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoima: fix reference leak in asymmetric_verify()
Eric Biggers [Thu, 13 Jan 2022 19:44:38 +0000 (11:44 -0800)]
ima: fix reference leak in asymmetric_verify()

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 926fd9f23b27ca6587492c3f58f4c7f4cd01dad5 upstream.

Don't leak a reference to the key if its algorithm is unknown.

Fixes: 947d70597236 ("ima: Support EC keys for signature verification")
Cc: <stable@vger.kernel.org> # v5.13+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agointegrity: check the return value of audit_log_start()
Xiaoke Wang [Sat, 15 Jan 2022 01:11:11 +0000 (09:11 +0800)]
integrity: check the return value of audit_log_start()

BugLink: https://bugs.launchpad.net/bugs/1963889
commit 83230351c523b04ff8a029a4bdf97d881ecb96fc upstream.

audit_log_start() returns audit_buffer pointer on success or NULL on
error, so it is better to check the return value of it.

Fixes: 3323eec921ef ("integrity: IMA as an integrity service provider")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoLinux 5.15.23
Greg Kroah-Hartman [Fri, 11 Feb 2022 08:10:27 +0000 (09:10 +0100)]
Linux 5.15.23

BugLink: https://bugs.launchpad.net/bugs/1963888
Link: https://lore.kernel.org/r/20220209191249.980911721@linuxfoundation.org
Tested-by: Fox Chen <foxhlchen@gmail.com>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Slade Watkins <slade@sladewatkins.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agocrypto: api - Move cryptomgr soft dependency into algapi
Herbert Xu [Wed, 2 Feb 2022 06:46:48 +0000 (17:46 +1100)]
crypto: api - Move cryptomgr soft dependency into algapi

BugLink: https://bugs.launchpad.net/bugs/1963888
commit c6ce9c5831cae515d375a01b97ae1778689acf19 upstream.

The soft dependency on cryptomgr is only needed in algapi because
if algapi isn't present then no algorithms can be loaded.  This
also fixes the case where api is built-in but algapi is built as
a module as the soft dependency would otherwise get lost.

Fixes: 8ab23d547f65 ("crypto: api - Add softdep on cryptomgr")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoksmbd: fix SMB 3.11 posix extension mount failure
Namjae Jeon [Sat, 22 Jan 2022 01:47:22 +0000 (10:47 +0900)]
ksmbd: fix SMB 3.11 posix extension mount failure

BugLink: https://bugs.launchpad.net/bugs/1963888
commit 9ca8581e79e51c57e60b3b8e3b89d816448f49fe upstream.

cifs client set 4 to DataLength of create_posix context, which mean
Mode variable of create_posix context is only available. So buffer
validation of ksmbd should check only the size of Mode except for
the size of Reserved variable.

Fixes: 8f77150c15f8 ("ksmbd: add buffer validation for SMB2_CREATE_CONTEXT")
Cc: stable@vger.kernel.org # v5.15+
Reported-by: Steve French <smfrench@gmail.com>
Tested-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoarm64: Add Cortex-A510 CPU part definition
Anshuman Khandual [Tue, 25 Jan 2022 14:20:31 +0000 (19:50 +0530)]
arm64: Add Cortex-A510 CPU part definition

BugLink: https://bugs.launchpad.net/bugs/1963888
commit 53960faf2b731dd2f9ed6e1334634b8ba6286850 upstream.

Add the CPU Partnumbers for the new Arm designs.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/1643120437-14352-2-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomoxart: fix potential use-after-free on remove path
Greg Kroah-Hartman [Thu, 27 Jan 2022 07:16:38 +0000 (08:16 +0100)]
moxart: fix potential use-after-free on remove path

BugLink: https://bugs.launchpad.net/bugs/1963888
commit bd2db32e7c3e35bd4d9b8bbff689434a50893546 upstream.

It was reported that the mmc host structure could be accessed after it
was freed in moxart_remove(), so fix this by saving the base register of
the device and using it instead of the pointer dereference.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Cc: Xin Xiong <xiongx18@fudan.edu.cn>
Cc: Xin Tan <tanxin.ctf@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Yang Li <yang.lee@linux.alibaba.com>
Cc: linux-mmc@vger.kernel.org
Cc: stable <stable@vger.kernel.org>
Reported-by: whitehat002 <hackyzh002@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220127071638.4057899-1-gregkh@linuxfoundation.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoRevert "UBUNTU: [Config] x86-64: SYSFB_SIMPLEFB=y"
Paolo Pisati [Wed, 2 Mar 2022 16:26:01 +0000 (17:26 +0100)]
Revert "UBUNTU: [Config] x86-64: SYSFB_SIMPLEFB=y"

SYSFB_SIMPLEFB was confirmed to break the fb on several x86-64 kit, revert it
for now.

This reverts commit 0bf2a2472f71a3001a8a9a0849b6bed7e7069a7b.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoKVM: s390: Add missing vm MEM_OP size check
Janis Schoetterl-Glausch [Mon, 21 Feb 2022 16:32:37 +0000 (17:32 +0100)]
KVM: s390: Add missing vm MEM_OP size check

BugLink: https://bugs.launchpad.net/bugs/1933179
Check that size is not zero, preventing the following warning:

WARNING: CPU: 0 PID: 9692 at mm/vmalloc.c:3059 __vmalloc_node_range+0x528/0x648
Modules linked in:
CPU: 0 PID: 9692 Comm: memop Not tainted 5.17.0-rc3-e4+ #80
Hardware name: IBM 8561 T01 701 (LPAR)
Krnl PSW : 0704c00180000000 0000000082dc584c (__vmalloc_node_range+0x52c/0x648)
           R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
Krnl GPRS: 0000000000000083 ffffffffffffffff 0000000000000000 0000000000000001
           0000038000000000 000003ff80000000 0000000000000cc0 000000008ebb8000
           0000000087a8a700 000000004040aeb1 000003ffd9f7dec8 000000008ebb8000
           000000009d9b8000 000000000102a1b4 00000380035afb68 00000380035afaa8
Krnl Code: 0000000082dc583ed028a7f4ff80        trtr    2036(41,%r10),3968(%r15)
           0000000082dc5844af000000            mc      0,0
          #0000000082dc5848af000000            mc      0,0
          >0000000082dc584ca7d90000            lghi    %r13,0
           0000000082dc5850b904002d            lgr     %r2,%r13
           0000000082dc5854eb6ff1080004        lmg     %r6,%r15,264(%r15)
           0000000082dc585a: 07fe                bcr     15,%r14
           0000000082dc585c47000700            bc      0,1792
Call Trace:
 [<0000000082dc584c>] __vmalloc_node_range+0x52c/0x648
 [<0000000082dc5b62>] vmalloc+0x5a/0x68
 [<000003ff8067f4ca>] kvm_arch_vm_ioctl+0x2da/0x2a30 [kvm]
 [<000003ff806705bc>] kvm_vm_ioctl+0x4ec/0x978 [kvm]
 [<0000000082e562fe>] __s390x_sys_ioctl+0xbe/0x100
 [<000000008360a9bc>] __do_syscall+0x1d4/0x200
 [<0000000083618bd2>] system_call+0x82/0xb0
Last Breaking-Event-Address:
 [<0000000082dc5348>] __vmalloc_node_range+0x28/0x648

Other than the warning, there is no ill effect from the missing check,
the condition is detected by subsequent code and causes a return
with ENOMEM.

Fixes: ef11c9463ae0 (KVM: s390: Add vm IOCTL for key checked guest absolute memory access)
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Link: https://lore.kernel.org/r/20220221163237.4122868-1-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 3d9042f8b923810c169ece02d91c70ec498eff0b linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Clarify key argument for MEM_OP in api docs
Janis Schoetterl-Glausch [Mon, 21 Feb 2022 14:36:57 +0000 (15:36 +0100)]
KVM: s390: Clarify key argument for MEM_OP in api docs

BugLink: https://bugs.launchpad.net/bugs/1933179
Clarify that the key argument represents the access key, not the whole
storage key.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Link: https://lore.kernel.org/r/20220221143657.3712481-1-scgl@linux.ibm.com
Fixes: 5e35d0eb472b ("KVM: s390: Update api documentation for memop ioctl")
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit cbf9b8109d32a53395369c0dabde005cb8fa3852 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Update api documentation for memop ioctl
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:14 +0000 (19:22 +0100)]
KVM: s390: Update api documentation for memop ioctl

BugLink: https://bugs.launchpad.net/bugs/1933179
Document all currently existing operations, flags and explain under
which circumstances they are available. Document the recently
introduced absolute operations and the storage key protection flag,
as well as the existing SIDA operations.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-10-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 5e35d0eb472b48ac9c8ef7017753b8a1f765aa01 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Add capability for storage key extension of MEM_OP IOCTL
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:13 +0000 (19:22 +0100)]
KVM: s390: Add capability for storage key extension of MEM_OP IOCTL

BugLink: https://bugs.launchpad.net/bugs/1933179
Availability of the KVM_CAP_S390_MEM_OP_EXTENSION capability signals that:
* The vcpu MEM_OP IOCTL supports storage key checking.
* The vm MEM_OP IOCTL exists.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-9-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit d004079edc166ff19605475211305923c708b4d5 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Rename existing vcpu memop functions
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:12 +0000 (19:22 +0100)]
KVM: s390: Rename existing vcpu memop functions

BugLink: https://bugs.launchpad.net/bugs/1933179
Makes the naming consistent, now that we also have a vm ioctl.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-8-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 0e1234c02b77ef22d9cf78f86b98347ceb170090 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Add vm IOCTL for key checked guest absolute memory access
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:11 +0000 (19:22 +0100)]
KVM: s390: Add vm IOCTL for key checked guest absolute memory access

BugLink: https://bugs.launchpad.net/bugs/1933179
Channel I/O honors storage keys and is performed on absolute memory.
For I/O emulation user space therefore needs to be able to do key
checked accesses.
The vm IOCTL supports read/write accesses, as well as checking
if an access would succeed.
Unlike relying on KVM_S390_GET_SKEYS for key checking would,
the vm IOCTL performs the check in lockstep with the read or write,
by, ultimately, mapping the access to move instructions that
support key protection checking with a supplied key.
Fetch and storage protection override are not applicable to absolute
accesses and so are not applied as they are when using the vcpu memop.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-7-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit ef11c9463ae006302ce170a401854a48ea0532ca linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Add optional storage key checking to MEMOP IOCTL
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:10 +0000 (19:22 +0100)]
KVM: s390: Add optional storage key checking to MEMOP IOCTL

BugLink: https://bugs.launchpad.net/bugs/1933179
User space needs a mechanism to perform key checked accesses when
emulating instructions.

The key can be passed as an additional argument.
Having an additional argument is flexible, as user space can
pass the guest PSW's key, in order to make an access the same way the
CPU would, or pass another key if necessary.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-6-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit e9e9feebcbc14b174fef862842f8cc9a388e1db3 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: selftests: Test TEST PROTECTION emulation
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:09 +0000 (19:22 +0100)]
KVM: s390: selftests: Test TEST PROTECTION emulation

BugLink: https://bugs.launchpad.net/bugs/1933179
Test the emulation of TEST PROTECTION in the presence of storage keys.
Emulation only occurs under certain conditions, one of which is the host
page being protected.
Trigger this by protecting the test pages via mprotect.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-5-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit c7ef9ebbed20b860f70cc7bece65622b570a8a93 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: handle_tprot: Honor storage keys
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:08 +0000 (19:22 +0100)]
KVM: s390: handle_tprot: Honor storage keys

BugLink: https://bugs.launchpad.net/bugs/1933179
Use the access key operand to check for key protection when
translating guest addresses.
Since the translation code checks for accessing exceptions/error hvas,
we can remove the check here and simplify the control flow.
Keep checking if the memory is read-only even if such memslots are
currently not supported.

handle_tprot was the last user of guest_translate_address,
so remove it.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-4-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 61380a7adfce1524b8cd16c0ce4f46abce587f95 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Honor storage keys when accessing guest memory
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:07 +0000 (19:22 +0100)]
KVM: s390: Honor storage keys when accessing guest memory

BugLink: https://bugs.launchpad.net/bugs/1933179
Storage key checking had not been implemented for instructions emulated
by KVM. Implement it by enhancing the functions used for guest access,
in particular those making use of access_guest which has been renamed
to access_guest_with_key.
Accesses via access_guest_real should not be key checked.

For actual accesses, key checking is done by
copy_from/to_user_key (which internally uses MVCOS/MVCP/MVCS).
In cases where accessibility is checked without an actual access,
this is performed by getting the storage key and checking if the access
key matches. In both cases, if applicable, storage and fetch protection
override are honored.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-3-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit e613d83454d7da1c37d78edb278db9c20afb21a2 linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agos390/uaccess: Add copy_from/to_user_key functions
Janis Schoetterl-Glausch [Fri, 11 Feb 2022 18:22:06 +0000 (19:22 +0100)]
s390/uaccess: Add copy_from/to_user_key functions

BugLink: https://bugs.launchpad.net/bugs/1933179
Add copy_from/to_user_key functions, which perform storage key checking.
These functions can be used by KVM for emulating instructions that need
to be key checked.
These functions differ from their non _key counterparts in
include/linux/uaccess.h only in the additional key argument and must be
kept in sync with those.

Since the existing uaccess implementation on s390 makes use of move
instructions that support having an additional access key supplied,
we can implement raw_copy_from/to_user_key by enhancing the
existing implementation.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20220211182215.2730017-2-scgl@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 1a82f6ab23659aa01a796d9d444ec9cc63ded26c linux-next)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agos390/uaccess: fix compile error
Heiko Carstens [Sat, 22 Jan 2022 09:24:31 +0000 (10:24 +0100)]
s390/uaccess: fix compile error

BugLink: https://bugs.launchpad.net/bugs/1933179
Compiling with e.g MARCH=z900 results in compile errors:

   arch/s390/lib/uaccess.c: In function 'copy_from_user_mvcos':
>> arch/s390/lib/uaccess.c:65:15: error: variable 'spec' has initializer but incomplete type
      65 |         union oac spec = {

Therefore make definition of union oac visible for all MARCHs.

Reported-by: kernel test robot <lkp@intel.com>
Cc: Nico Boehr <nrb@linux.ibm.com>
Cc: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Fixes: 012a224e1fa3 ("s390/uaccess: introduce bit field for OAC specifier")
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
(cherry picked from commit 3d787b392d169d4a2e3aee6ac6dfd6ec39722cf2)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agos390/uaccess: introduce bit field for OAC specifier
Nico Boehr [Tue, 11 Jan 2022 10:00:03 +0000 (11:00 +0100)]
s390/uaccess: introduce bit field for OAC specifier

BugLink: https://bugs.launchpad.net/bugs/1933179
Previously, we've used  magic values to specify the OAC
(operand-access control) for mvcos.

Instead we introduce a bit field for it.

When using a bit field, we cannot use an immediate value with K
constraint anymore, since GCC older than 10 doesn't recognize
the bit field union as a compile time constant.
To make things work with older compilers,
load the OAC value through a register.

Bloat-o-meter reports a slight increase in kernel size with this change:
Total: Before=15692135, After=15693015, chg +0.01%

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
Co-developed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Link: https://lore.kernel.org/r/20220111100003.743116-1-scgl@linux.ibm.com
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
(cherry picked from commit 012a224e1fa31fc256aab921f691598e03db6018)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: gaccess: Cleanup access to guest pages
Janis Schoetterl-Glausch [Fri, 26 Nov 2021 16:45:49 +0000 (17:45 +0100)]
KVM: s390: gaccess: Cleanup access to guest pages

BugLink: https://bugs.launchpad.net/bugs/1933179
Introduce a helper function for guest frame access.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20211126164549.7046-4-scgl@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
(cherry picked from commit bad13799e0305deb258372b7298a86be4c78aaba)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: gaccess: Refactor access address range check
Janis Schoetterl-Glausch [Fri, 26 Nov 2021 16:45:48 +0000 (17:45 +0100)]
KVM: s390: gaccess: Refactor access address range check

BugLink: https://bugs.launchpad.net/bugs/1933179
Do not round down the first address to the page boundary, just translate
it normally, which gives the value we care about in the first place.
Given this, translating a single address is just the special case of
translating a range spanning a single page.

Make the output optional, so the function can be used to just check a
range.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20211126164549.7046-3-scgl@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
(cherry picked from commit 7faa543df19bf62d4583a64d3902705747f2ad29)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: gaccess: Refactor gpa and length calculation
Janis Schoetterl-Glausch [Fri, 26 Nov 2021 16:45:47 +0000 (17:45 +0100)]
KVM: s390: gaccess: Refactor gpa and length calculation

BugLink: https://bugs.launchpad.net/bugs/1933179
Improve readability by renaming the length variable and
not calculating the offset manually.

Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20211126164549.7046-2-scgl@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
(cherry picked from commit 416e7f0c9d613bf84e182eba9547ae8f9f5bfa4c)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agonetfilter: nf_tables_offload: incorrect flow offload action array size
Pablo Neira Ayuso [Tue, 22 Feb 2022 17:49:16 +0000 (14:49 -0300)]
netfilter: nf_tables_offload: incorrect flow offload action array size

immediate verdict expression needs to allocate one slot in the flow offload
action array, however, immediate data expression does not need to do so.

fwd and dup expression need to allocate one slot, this is missing.

Add a new offload_action interface to report if this expression needs to
allocate one slot in the flow offload action array.

Fixes: be2861dc36d7 ("netfilter: nft_{fwd,dup}_netdev: add offload support")
Reported-and-tested-by: Nick Gregory <Nick.Gregory@Sophos.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit b1a5983f56e371046dcf164f90bfaf704d2b89f6 net.git)
CVE-2022-25636
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoselftests/ftrace: Do not trace do_softirq because of PREEMPT_RT
Krzysztof Kozlowski [Thu, 17 Feb 2022 10:38:44 +0000 (11:38 +0100)]
selftests/ftrace: Do not trace do_softirq because of PREEMPT_RT

BugLink: https://bugs.launchpad.net/bugs/1959610
The PREEMPT_RT patchset does not use do_softirq() function thus trying
to filter for do_softirq fails for such kernel:

  echo do_softirq
  ftracetest: 81: echo: echo: I/O error

Choose some other visible function for the test.  The function does not
have to be actually executed during the test, because it is only testing
filter API interface.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
(cherry picked from commit 6fec1ab67f8d60704cc7de64abcfd389ab131542 linux-next)
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Joseph Salisbury <joseph.salisbury@canonical.com>
2 years agoUBUNTU: [Config] set AUFS as disabled
Andrea Righi [Tue, 22 Feb 2022 07:06:43 +0000 (08:06 +0100)]
UBUNTU: [Config] set AUFS as disabled

We want to maintain AUFS for focal for the backport kernels, but we do
not need it in jammy, so set it as disabled in the config.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoUBUNTU: SAUCE: aufs: switch to 64-bit ino_t for s390x
Andrea Righi [Wed, 25 Aug 2021 09:40:39 +0000 (11:40 +0200)]
UBUNTU: SAUCE: aufs: switch to 64-bit ino_t for s390x

After commit 96c0a6a72d18 ("s390,alpha: switch to 64-bit ino_t") all the
architectures are now using 64-bit ino_t, so we don't need to explicitly
exclude alpha and s390x anymore.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoUBUNTU: SAUCE: AUFS
Andrea Righi [Fri, 14 Jan 2022 16:33:14 +0000 (17:33 +0100)]
UBUNTU: SAUCE: AUFS

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agosched/fair: Consider SMT in ASYM_PACKING load balance
Ricardo Neri [Sat, 11 Sep 2021 01:18:19 +0000 (18:18 -0700)]
sched/fair: Consider SMT in ASYM_PACKING load balance

When deciding to pull tasks in ASYM_PACKING, it is necessary not only to
check for the idle state of the destination CPU, dst_cpu, but also of
its SMT siblings.

If dst_cpu is idle but its SMT siblings are busy, performance suffers
if it pulls tasks from a medium priority CPU that does not have SMT
siblings.

Implement asym_smt_can_pull_tasks() to inspect the state of the SMT
siblings of both dst_cpu and the CPUs in the candidate busiest group.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-7-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit 4006a72bdd93b1ffedc2bd8646dee18c822a2c26)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agosched/fair: Carve out logic to mark a group for asymmetric packing
Ricardo Neri [Sat, 11 Sep 2021 01:18:18 +0000 (18:18 -0700)]
sched/fair: Carve out logic to mark a group for asymmetric packing

Create a separate function, sched_asym(). A subsequent changeset will
introduce logic to deal with SMT in conjunction with asmymmetric
packing. Such logic will need the statistics of the scheduling
group provided as argument. Update them before calling sched_asym().

Co-developed-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-6-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit aafc917a3c31dcc76cb0279cd7617dda11b15f2a)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agosched/fair: Provide update_sg_lb_stats() with sched domain statistics
Ricardo Neri [Sat, 11 Sep 2021 01:18:17 +0000 (18:18 -0700)]
sched/fair: Provide update_sg_lb_stats() with sched domain statistics

Before deciding to pull tasks when using asymmetric packing of tasks,
on some architectures (e.g., x86) it is necessary to know not only the
state of dst_cpu but also of its SMT siblings. The decision to classify
a candidate busiest group as group_asym_packing is done in
update_sg_lb_stats(). Give this function access to the scheduling domain
statistics, which contains the statistics of the local group.

Originally-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-5-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit c0d14b57fe0c11b65ce8a1a4a58a48f3f324ca0f)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agosched/fair: Optimize checking for group_asym_packing
Ricardo Neri [Sat, 11 Sep 2021 01:18:16 +0000 (18:18 -0700)]
sched/fair: Optimize checking for group_asym_packing

sched_asmy_prefer() always returns false when called on the local group. By
checking local_group, we can avoid additional checks and invoking
sched_asmy_prefer() when it is not needed. No functional changes are
introduced.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-4-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit 6025643596895695956c27119c6b0bfa40d8035b)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agosched/topology: Introduce sched_group::flags
Ricardo Neri [Sat, 11 Sep 2021 01:18:15 +0000 (18:18 -0700)]
sched/topology: Introduce sched_group::flags

There exist situations in which the load balance needs to know the
properties of the CPUs in a scheduling group. When using asymmetric
packing, for instance, the load balancer needs to know not only the
state of dst_cpu but also of its SMT siblings, if any.

Use the flags of the child scheduling domains to initialize scheduling
group flags. This will reflect the properties of the CPUs in the
group.

A subsequent changeset will make use of these new flags. No functional
changes are introduced.

Originally-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-3-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit 16d364ba6ef2aa59b409df70682770f3ed23f7c0)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agox86/sched: Decrease further the priorities of SMT siblings
Ricardo Neri [Sat, 11 Sep 2021 01:18:14 +0000 (18:18 -0700)]
x86/sched: Decrease further the priorities of SMT siblings

When scheduling, it is better to prefer a separate physical core rather
than the SMT sibling of a high priority core. The existing formula to
compute priorities takes such fact in consideration. There may exist,
however, combinations of priorities (i.e., maximum frequencies) in which
the priority of high-numbered SMT siblings of high-priority cores collides
with the priority of low-numbered SMT siblings of low-priority cores.

Consider for instance an SMT2 system with CPUs [0, 1] with priority 60 and
[2, 3] with priority 30(CPUs in brackets are SMT siblings. In such a case,
the resulting priorities would be [120, 60], [60, 30]. Thus, to ensure
that CPU2 has higher priority than CPU1, divide the raw priority by the
squared SMT iterator. The resulting priorities are [120, 30]. [60, 15].

Originally-by: Len Brown <len.brown@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-2-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit 183b8ec38f1ec6c1f8419375303bf1d09a2b8369)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
2 years agoUBUNTU: SAUCE: Makefile: Fix compiler warnings
Juerg Haefliger [Mon, 14 Feb 2022 10:29:36 +0000 (11:29 +0100)]
UBUNTU: SAUCE: Makefile: Fix compiler warnings

When building out-of-tree (which we do for package builds), the compiler
emits the following warning:

cc1: warning: ubuntu/include: No such file or directory [-Wmissing-include-dirs]

Fix that by (always) using the absolute path of the include directory.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: SAUCE: Makefile: Remove inclusion of lbm header files
Juerg Haefliger [Mon, 14 Feb 2022 10:29:35 +0000 (11:29 +0100)]
UBUNTU: SAUCE: Makefile: Remove inclusion of lbm header files

We haven't produced linux-headers-lbm packages in ages so stop trying
to include their header files.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agotipc: improve size validations for received domain records
Jon Maloy [Mon, 14 Feb 2022 14:25:16 +0000 (11:25 -0300)]
tipc: improve size validations for received domain records

The function tipc_mon_rcv() allows a node to receive and process
domain_record structs from peer nodes to track their views of the
network topology.

This patch verifies that the number of members in a received domain
record does not exceed the limit defined by MAX_MON_DOMAIN, something
that may otherwise lead to a stack overflow.

tipc_mon_rcv() is called from the function tipc_link_proto_rcv(), where
we are reading a 32 bit message data length field into a uint16.  To
avert any risk of bit overflow, we add an extra sanity check for this in
that function.  We cannot see that happen with the current code, but
future designers being unaware of this risk, may introduce it by
allowing delivery of very large (> 64k) sk buffers from the bearer
layer.  This potential problem was identified by Eric Dumazet.

This fixes CVE-2022-0435

Reported-by: Samuel Page <samuel.page@appgate.com>
Reported-by: Eric Dumazet <edumazet@google.com>
Fixes: 35c55c9877f8 ("tipc: add neighbor monitoring framework")
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
Reviewed-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Samuel Page <samuel.page@appgate.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 9aa422ad326634b76309e8ff342c246800621216)
CVE-2022-0435
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoKVM: s390: Return error on SIDA memop on normal guest
Janis Schoetterl-Glausch [Mon, 14 Feb 2022 14:08:42 +0000 (11:08 -0300)]
KVM: s390: Return error on SIDA memop on normal guest

Refuse SIDA memops on guests which are not protected.
For normal guests, the secure instruction data address designation,
which determines the location we access, is not under control of KVM.

Fixes: 19e122776886 (KVM: S390: protvirt: Introduce instruction data area bounce buffer)
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
(cherry picked from commit 2c212e1baedcd782b2535a3f86bc491977677c0e)
CVE-2022-0516
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoEDAC/amd64: Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh
Yazen Ghannam [Mon, 14 Feb 2022 23:31:28 +0000 (18:31 -0500)]
EDAC/amd64: Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh

BugLink: http://bugs.launchpad.net/bugs/1960362
Add a new family type for AMD Family 19h Models 10h to 1Fh. Use this new
family type for Models A0h to AFh also.

Increase the maximum number of controllers from 8 to 12.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211208174356.1997855-3-yazen.ghannam@amd.com
(cherry picked from commit e2be5955a88664421b25e463c28a910b8dbd534c)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agoEDAC: Add RDDR5 and LRDDR5 memory types
Yazen Ghannam [Mon, 14 Feb 2022 23:31:27 +0000 (18:31 -0500)]
EDAC: Add RDDR5 and LRDDR5 memory types

BugLink: http://bugs.launchpad.net/bugs/1960362
Include Registered-DDR5 and Load-Reduced DDR5 in the list of memory
types.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20211208174356.1997855-2-yazen.ghannam@amd.com
(cherry picked from commit f95711242390d759f69fd67ad46b31491fe904d6)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agohwmon: (k10temp) Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh
Babu Moger [Mon, 14 Feb 2022 23:16:11 +0000 (18:16 -0500)]
hwmon: (k10temp) Add support for AMD Family 19h Models 10h-1Fh and A0h-AFh

BugLink: http://bugs.launchpad.net/bugs/1960361
Add thermal info support for AMD Family 19h Models 10h-1Fh and A0h-AFh.
Thermal info is supported via a new PCI device ID at offset 0x300h.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/163640829419.955062.12539219969781039915.stgit@bmoger-ubuntu
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit 3cf90efa13678d2de2f9f7e44e26353996db842a)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agohwmon: (k10temp) Support up to 12 CCDs on AMD Family of processors
Babu Moger [Mon, 14 Feb 2022 23:16:10 +0000 (18:16 -0500)]
hwmon: (k10temp) Support up to 12 CCDs on AMD Family of processors

BugLink: http://bugs.launchpad.net/bugs/1960361
The current driver can read the temperatures from upto 8 CCDs
(Core-Complex Die).

The newer AMD Family 19h Models 10h-1Fh and A0h-AFh can support up to
12 CCDs. Update the driver to read up to 12 CCDs.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/163776976762.904164.5618896687524494215.stgit@bmoger-ubuntu
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit 8bb050cd5cf494f3d0cb45a6b54a476af09edb8d)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agohwmon: (k10temp) Remove unused definitions
Babu Moger [Mon, 14 Feb 2022 23:16:09 +0000 (18:16 -0500)]
hwmon: (k10temp) Remove unused definitions

BugLink: http://bugs.launchpad.net/bugs/1960361
Usage of these definitions were removed after the commit 0a4e668b5d52
("hwmon: (k10temp) Remove support for displaying voltage and current on Zen CPUs").
So, cleanup them up.

Signed-off-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/163640828776.955062.15863375803675701204.stgit@bmoger-ubuntu
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit f707bcb5d1cb4c47d27c688c859dcdb70e3c7065)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agox86/amd_nb: Add AMD Family 19h Models (10h-1Fh) and (A0h-AFh) PCI IDs
Yazen Ghannam [Mon, 8 Nov 2021 21:51:21 +0000 (15:51 -0600)]
x86/amd_nb: Add AMD Family 19h Models (10h-1Fh) and (A0h-AFh) PCI IDs

BugLink: http://bugs.launchpad.net/bugs/1960361
Add the new PCI Device IDs to support new generation of AMD 19h family of
processors.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Acked-by: Krzysztof Wilczyński <kw@linux.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci_ids.h
Link: https://lore.kernel.org/r/163640828133.955062.18349019796157170473.stgit@bmoger-ubuntu
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit 4fb0abfee424b05f0ec6d2d09e38f04ee2b82a8a)
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2 years agomt76: mt7921: introduce 160 MHz channel bandwidth support
Deren Wu [Mon, 14 Feb 2022 07:11:26 +0000 (15:11 +0800)]
mt76: mt7921: introduce 160 MHz channel bandwidth support

BugLink: https://bugs.launchpad.net/bugs/1958151
Introduce the basic configuration for BW160 capability in 7922

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 7f96905068ab826b270b41d70d46e2849e5db7df)
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomt76: mt7921: add support for PCIe ID 0x0608/0x0616
Deren Wu [Mon, 14 Feb 2022 07:11:25 +0000 (15:11 +0800)]
mt76: mt7921: add support for PCIe ID 0x0608/0x0616

BugLink: https://bugs.launchpad.net/bugs/1958151
New mt7921 serials chip support

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit f395d41f2a0343fa9d989d8f53e5640329554dd8)
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agomt76: mt7921: Add mt7922 support
Deren Wu [Mon, 14 Feb 2022 07:11:24 +0000 (15:11 +0800)]
mt76: mt7921: Add mt7922 support

BugLink: https://bugs.launchpad.net/bugs/1958151
Add new chip mt7922 in mt7921 module with following items
1. new chip ID / fw bin name
2. is_mt7922()
check chip type for different fw files
3. mt7921_get_data_mode()
check security type of fw (backward compatible)

Co-developed-by: Jimmy Hu <Jimmy.Hu@mediatek.com>
Signed-off-by: Jimmy Hu <Jimmy.Hu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry picked from commit 688088728bd3226ef24a2986e2fac2ae01cfbdd9)
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoACPI: PM: Revert "Only mark EC GPE for wakeup on Intel systems"
Mario Limonciello [Mon, 14 Feb 2022 04:37:30 +0000 (12:37 +0800)]
ACPI: PM: Revert "Only mark EC GPE for wakeup on Intel systems"

BugLink: https://bugs.launchpad.net/bugs/1960771
Testing on various upcoming OEM systems shows commit 7b167c4cb48e ("ACPI:
PM: Only mark EC GPE for wakeup on Intel systems") was short
sighted and the symptoms were indicative of other problems. Some OEMs
do have the dedicated GPIOs for the power button but also rely upon
an interrupt to the EC SCI to let the lid work.

The original commit showed spurious activity on Lenovo systems:
     * On both Lenovo T14 and P14s the keyboard wakeup doesn't work, and
       sometimes the power button event doesn't work.

This was confirmed on my end at that time.

However further development in the kernel showed that the issue was
actually the IRQ for the GPIO controller was also shared with the EC SCI.
This was actually fixed by commit 2d54067fcd23 ("pinctrl: amd: Fix
wakeups when IRQ is shared with SCI").

The original commit also showed problems with AC adapter:
     * On HP 635 G7 detaching or attaching AC during suspend will cause
       the system not to wakeup
     * On Asus vivobook to prevent detaching AC causing resume problems
     * On Lenovo 14ARE05 to prevent detaching AC causing resume problems
     * On HP ENVY x360  to prevent detaching AC causing resume problems

Detaching AC adapter causing problems appears to have been a problem
because the EC SCI went off to notify the OS of the power adapter change
but the SCI was ignored and there was no other way to wake up this system
since GPIO controller wasn't properly enabled.  The wakeups were fixed by
enabling the GPIO controller in commit acd47b9f28e5 ("pinctrl: amd: Handle
wake-up interrupt").

I've confirmed on a variety of OEM notebooks with the following test

 1) echo 1 | sudo tee /sys/power/pm_debug_messages
 2) sudo systemctl suspend
 3) unplug AC adapter, make sure system is still asleep
 4) wake system from lid (which is provided by ACPI SCI on some of them)
 5) dmesg
    a) see the EC GPE dispatched, timekeeping for X seconds (matching ~time
       until AC adapter plug out)
    b) see timekeeping for Y seconds until woke (matching ~time from AC
       adapter until lid event)
 6) Look at /sys/kernel/debug/amd_pmc/s0ix_stats
    "Time (in us) in S0i3" = X + Y - firmware processing time

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit d6ebb17ccc7b37872a32bc25b4a21f1e5af8c7e3)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Update lpfc version to 14.0.0.4
James Smart [Tue, 8 Feb 2022 14:20:14 +0000 (09:20 -0500)]
scsi: lpfc: Update lpfc version to 14.0.0.4

BugLink: https://bugs.launchpad.net/bugs/1956982
Update lpfc version to 14.0.0.4.

Link: https://lore.kernel.org/r/20211204002644.116455-10-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 4437503bfbec2f02b41b2492520fe627715889a7)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Add additional debugfs support for CMF
James Smart [Tue, 8 Feb 2022 14:20:13 +0000 (09:20 -0500)]
scsi: lpfc: Add additional debugfs support for CMF

BugLink: https://bugs.launchpad.net/bugs/1956982
Dump raw CMF parameter information in debugfs cgn_buffer.

Link: https://lore.kernel.org/r/20211204002644.116455-9-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6014a2468f0e49194f612b1f09f99eacee0a409a)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Cap CMF read bytes to MBPI
James Smart [Tue, 8 Feb 2022 14:20:12 +0000 (09:20 -0500)]
scsi: lpfc: Cap CMF read bytes to MBPI

BugLink: https://bugs.launchpad.net/bugs/1956982
Ensure read bytes data does not go over MBPI for CMF timer intervals that
are purposely shortened.

Link: https://lore.kernel.org/r/20211204002644.116455-8-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 05116ef9c4b444f7fdbb56f9e13c2ec941726639)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Adjust CMF total bytes and rxmonitor
James Smart [Tue, 8 Feb 2022 14:20:11 +0000 (09:20 -0500)]
scsi: lpfc: Adjust CMF total bytes and rxmonitor

BugLink: https://bugs.launchpad.net/bugs/1956982
Calculate any extra bytes needed to account for timer accuracy. If we are
less than LPFC_CMF_INTERVAL, then calculate the adjustment needed for total
to reflect a full LPFC_CMF_INTERVAL.

Add additional info to rxmonitor, and adjust some log formatting.

Link: https://lore.kernel.org/r/20211204002644.116455-7-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a6269f837045acb02904f31f05acde847ec8f8a7)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Fix NPIV port deletion crash
James Smart [Tue, 8 Feb 2022 14:20:10 +0000 (09:20 -0500)]
scsi: lpfc: Fix NPIV port deletion crash

BugLink: https://bugs.launchpad.net/bugs/1956982
The driver is calling schedule_timeout after the DA_ID nameserver request
and LOGO commands are issued to the fabric by the initiator virtual
endport.  These fixed delay functions are causing long delays in the
driver's worker thread when processing discovery I/Os in a serialized
fashion, which is then triggering mailbox timeout errors artificially.

To fix this, don't wait on the DA_ID request to complete and call
wait_event_timeout to allow the vport delete thread to make progress on an
event driven basis rather than fixing the wait time.

Link: https://lore.kernel.org/r/20211204002644.116455-5-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8ed190a91950564775cbaae9e8e8083a69a8da23)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscsi: lpfc: Change return code on I/Os received during link bounce
James Smart [Tue, 8 Feb 2022 14:20:09 +0000 (09:20 -0500)]
scsi: lpfc: Change return code on I/Os received during link bounce

BugLink: https://bugs.launchpad.net/bugs/1956982
During heavy I/O testing with issue_lip to bounce the link, occasionally
I/O is terminated with status 3 result 9, which means the RPI is suspended.
The I/O is completed and this type of error will result in immediate retry
by the SCSI layer. The retry count expires and the I/O fails and returns
error to the application.

To avoid these quick retry/retries exhausted scenarios change the return
code given to the midlayer to DID_REQUEUE rather than DID_ERROR. This gets
them retried, and eventually succeed when the link recovers.

Link: https://lore.kernel.org/r/20211204002644.116455-3-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2e81b1a374da5d6024208c16c4a5224a70cafa64)
Signed-off-by: Jeff Lane <jeffrey.lane@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/adlp: Remove require_force_probe protection
Clint Taylor [Tue, 8 Feb 2022 10:09:43 +0000 (12:09 +0200)]
drm/i915/adlp: Remove require_force_probe protection

BugLink: https://bugs.launchpad.net/bugs/1960298
Remove force probe protection from ADL_P platform. Did not obsevre
warnings, errors, flickering or any visual defects while doing ordinary
tasks like browsing and editing documents in a two monitor setup.

For more info drm-tip idle run results :
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip.html?

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Jon Bloomfield <jon.bloomfield@intel.com>
Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211204010140.22839-1-clinton.a.taylor@intel.com
(backported from commit dfb924e33927ffa51e197acd58ad1c5edf1b5ff5)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/adl_s: Remove require_force_probe protection
ravitejax [Tue, 8 Feb 2022 10:09:42 +0000 (12:09 +0200)]
drm/i915/adl_s: Remove require_force_probe protection

BugLink: https://bugs.launchpad.net/bugs/1960298
Removing force probe protection from ADLS platform. Did
not observe warnings, errors, flickering or any visual
defects while doing ordinary tasks like browsing and
editing documents in a two monitor setup.

For more info drm-tip idle run results :
https://intel-gfx-ci.01.org/tree/drm-tip/bat-all.html?

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: ravitejax <ravitejax.goud.talla@intel.com>
Reviewed-by: Ayaz A Siddiqui <ayaz.siddiqui@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210903182034.668467-1-ravitejax.gpud.talla@intel.com
(cherry picked from commit f5392e5f8ef300c5d8fb97fb441aad217e44f394)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/display/adlp: Disable underrun recovery
José Roberto de Souza [Tue, 8 Feb 2022 10:09:41 +0000 (12:09 +0200)]
drm/i915/display/adlp: Disable underrun recovery

BugLink: https://bugs.launchpad.net/bugs/1960298
It was also defeatured for ADL-P and other platforms.

BSpec: 55424
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211104010858.43559-1-jose.souza@intel.com
(cherry picked from commit 4fe7907f3775034140a518d1582580926da98ee2)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Fix system hang on ADL-P during TypeC PHY disconnect
Imre Deak [Tue, 8 Feb 2022 10:09:40 +0000 (12:09 +0200)]
drm/i915/tc: Fix system hang on ADL-P during TypeC PHY disconnect

BugLink: https://bugs.launchpad.net/bugs/1960298
The PHY ownership release->AUX PW disable steps during a modeset
disable->PHY disconnect sequence can hang the system if the PHY
disconnect happens after disabling the PHY's PLL. The spec doesn't
require a specific order for these two steps, so this issue is still
being root caused by HW/FW teams. Until that is found, let's make
sure the disconnect happens before the PLL is disabled, and do this on
all platforms for consistency.

v2: Add a TODO comment to remove the w/a once the issue is root
    caused/fixed. (Jose)

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-7-imre.deak@intel.com
(cherry picked from commit b58a88682093b3438dad66f2c3d3a4d0a20ee1e8)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Drop extra TC cold blocking from intel_tc_port_connected()
Imre Deak [Tue, 8 Feb 2022 10:09:39 +0000 (12:09 +0200)]
drm/i915/tc: Drop extra TC cold blocking from intel_tc_port_connected()

BugLink: https://bugs.launchpad.net/bugs/1960298
After the previous patch the driver holds a power domain blocking
TC-cold whenever the port is locked, so we can remove the extra blocking
around the lock/unlock sequence.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-13-imre.deak@intel.com
(cherry picked from commit ff67c4c0dd67b6dbb78a0d045100dd2f9dee88b0)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Fix TypeC PHY connect/disconnect logic on ADL-P
Imre Deak [Tue, 8 Feb 2022 10:09:38 +0000 (12:09 +0200)]
drm/i915/tc: Fix TypeC PHY connect/disconnect logic on ADL-P

BugLink: https://bugs.launchpad.net/bugs/1960298
So far TC-cold was blocked only for the duration of TypeC mode resets.
The DP-alt and legacy modes require TC-cold to be blocked also whenever
the port is in use (AUX transfers, enable modeset), and this was ensured
by the held PHY ownership flag. On ADL-P this doesn't work, since the
PHY ownership flag is in a register backed by the PW#2 power well.
Whenever this power well is disabled the ownership flag is cleared by
the HW under the driver.

The only way to cleanly release and re-acquire the PHY ownership flag
and also allow for power saving (by disabling the display power wells
and reaching DC5/6 states) is to hold the TC-cold blocking power domains
while the PHY is connected and disconnect/reconnect the PHY on-demand
around AUX transfers and modeset enable/disables. Let's do that,
disconnecting a PHY with a 1 sec delay after it becomes idle. For
consistency do this on all platforms and TypeC modes.

v2: Add tc_mode!=disconnected and phy_is_owned asserts to
    __intel_tc_port_lock().

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-6-imre.deak@intel.com
(cherry picked from commit 3e0abc7661c82266d3a3f27fbbadcc74cc4997e1)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/icl/tc: Remove the ICL special casing during TC-cold blocking
Imre Deak [Tue, 8 Feb 2022 10:09:37 +0000 (12:09 +0200)]
drm/i915/icl/tc: Remove the ICL special casing during TC-cold blocking

BugLink: https://bugs.launchpad.net/bugs/1960298
While a TypeC port mode is locked a DISPLAY_CORE power domain reference
is held, which implies a runtime PM ref. By removing the ICL !legacy
port special casing, a TC_COLD_OFF power domain reference will be taken
for such ports, which also translates to a runtime PM ref on that
platform. A follow-up change will stop holding the DISPLAY_CORE power
domain while the port is locked.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-11-imre.deak@intel.com
(cherry picked from commit 38c393462d01d2746f9f91c1a6482fded2b1b8bb)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Avoid using legacy AUX PW in TBT mode
Imre Deak [Tue, 8 Feb 2022 10:09:36 +0000 (12:09 +0200)]
drm/i915/tc: Avoid using legacy AUX PW in TBT mode

BugLink: https://bugs.launchpad.net/bugs/1960298
For the ADL-P TBT mode the spec doesn't require blocking TC-cold by
using the legacy AUX power domain. To avoid the timeouts that this would
cause during PHY disconnect/reconnect sequences (which will be more
frequent after a follow-up change) use the TC_COLD_OFF power domain in
TBT mode on all platforms. On TGL this power domain blocks TC-cold via a
PUNIT command, while on other platforms the domain just takes a runtime
PM reference.

If the HPD live status indicates that the port mode needs to be reset
- for instance after switching from TBT to a DP-alt sink - still take
the AUX domain, since the IOM firmware handshake requires this.

v2: Rebased on v2 of the previous patch.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-5-imre.deak@intel.com
(cherry picked from commit 8e8289a00e6360e0b340db05b7e16dfb5e7be067)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Refactor TC-cold block/unblock helpers
Imre Deak [Tue, 8 Feb 2022 10:09:35 +0000 (12:09 +0200)]
drm/i915/tc: Refactor TC-cold block/unblock helpers

BugLink: https://bugs.launchpad.net/bugs/1960298
A follow-up change will select the TC-cold blocking power domain based
on the TypeC mode, prepare for that here.

Also bring intel_tc_cold_requires_aux_pw() earlier to its logical place
for readability.

No functional change.

v2: Add code comment about IOM reg accesses in TCCOLD. (Jose)

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-4-imre.deak@intel.com
(cherry picked from commit d0bc677056bd9de6eb731dd8bff889a5fe36e381)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Add a mode for the TypeC PHY's disconnected state
Imre Deak [Tue, 8 Feb 2022 10:09:34 +0000 (12:09 +0200)]
drm/i915/tc: Add a mode for the TypeC PHY's disconnected state

BugLink: https://bugs.launchpad.net/bugs/1960298
A follow-up change will start to disconnect/re-connect PHYs around AUX
transfers and modeset enable/disables. To prepare for that add a new
TypeC PHY disconnected mode, to help tracking the TC-cold blocking power
domain status (no power domain in disconnected state, mode dependent
power domain in connected state).

v2: Move the !disconnected mode and phy-owned asserts in
    __intel_tc_port_lock() later in the patchset, when the asserts will
    hold. (Jose)

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-3-imre.deak@intel.com
(cherry picked from commit 64851a32c463e5412561de67764d6fdc074bd193)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Don't keep legacy TypeC ports in connected state w/o a sink
Imre Deak [Tue, 8 Feb 2022 10:09:33 +0000 (12:09 +0200)]
drm/i915/tc: Don't keep legacy TypeC ports in connected state w/o a sink

BugLink: https://bugs.launchpad.net/bugs/1960298
A follow-up patch will disconnect/reconnect PHYs around AUX transfers
and modeset enable/disables. To prepare for that and make things
consistent for all TypeC modes stop connecting the PHY in legacy mode
without a sink being connected. This was done before since in legacy
mode the PHY is dedicated to display usage, so there was no point in
disconnecting it. However after the follow-up changes the TC-cold
blocking power domains will be held as long as the PHY is in the
connected state, so we'll need to disconnect/re-connect the PHY in all
TypeC modes to allow for power saving.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-7-imre.deak@intel.com
(cherry picked from commit 675d23c14821fbaef3df5cbad94b42ec2e3a858a)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Add/use helpers to retrieve TypeC port properties
Imre Deak [Tue, 8 Feb 2022 10:09:32 +0000 (12:09 +0200)]
drm/i915/tc: Add/use helpers to retrieve TypeC port properties

BugLink: https://bugs.launchpad.net/bugs/1960298
Instead of directly accessing the TypeC port internal struct members,
add/use helpers to retrieve the corresponding properties.

No functional change.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-6-imre.deak@intel.com
(cherry picked from commit 11a8970865b49c2a1e714ea3ba910d05fdde6944)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Check for DP-alt, legacy sinks before taking PHY ownership
Imre Deak [Tue, 8 Feb 2022 10:09:31 +0000 (12:09 +0200)]
drm/i915/tc: Check for DP-alt, legacy sinks before taking PHY ownership

BugLink: https://bugs.launchpad.net/bugs/1960298
On ADL-P the PHY ready/complete flag is always set even in TBT-alt mode.
To avoid taking the PHY ownership and the following spurious "PHY sudden
disconnect" messages on this platform when connecting the PHY in TBT
mode, check if there is any DP-alt or legacy sink connected before
taking the ownership.

v2: (Jose)
- Fix debug message clarifying that a TBT sink can be connected.
- Add comments describing the PHY complete HW flag semantic differences
  between adl-p and other platforms.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929132833.2253961-2-imre.deak@intel.com
(cherry picked from commit 30e114ef4b1620bd6768952279b53ea24e232efb)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/tc: Remove waiting for PHY complete during releasing ownership
Imre Deak [Tue, 8 Feb 2022 10:09:30 +0000 (12:09 +0200)]
drm/i915/tc: Remove waiting for PHY complete during releasing ownership

BugLink: https://bugs.launchpad.net/bugs/1960298
Waiting for the PHY complete flag to clear when releasing the PHY
ownership was add in

commit ddec362724f9 ("drm/i915: Wait for TypeC PHY complete flag to clear in safe mode")

This isn't required by the spec, the vague idea was to make the
handshake with the firmware more robust, without actual evidence for
when it would be needed. Checking this again, the flag doesn't clear on
ICL until after the PHY's PLL is disabled and the flag is permanently
set on ADL-P. To avoid the spurious timeout messages in dmesg, just
remove this wait.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-4-imre.deak@intel.com
(cherry picked from commit 62e1e308ffd7a867ef82375f3cff7f8789ce6721)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/adlp/tc: Fix PHY connected check for Thunderbolt mode
Imre Deak [Tue, 8 Feb 2022 10:09:29 +0000 (12:09 +0200)]
drm/i915/adlp/tc: Fix PHY connected check for Thunderbolt mode

BugLink: https://bugs.launchpad.net/bugs/1960298
On ADL-P the PHY ready (aka status complete on other platforms) flag is
always set, besides when a DP-alt, legacy sink is connected also when a
TBT sink is connected or nothing is connected. So assume the PHY to be
connected when both the TBT live status and PHY ready flags are set.

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210921002313.1132357-3-imre.deak@intel.com
(cherry picked from commit 4f7dad584fdce914d698233179a1188481789884)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agodrm/i915/dmc: Update to DMC v2.12
Anusha Srivatsa [Tue, 8 Feb 2022 10:09:28 +0000 (12:09 +0200)]
drm/i915/dmc: Update to DMC v2.12

BugLink: https://bugs.launchpad.net/bugs/1960298
The release notes mentions that this version-
1. Fix for unblock indication to punit.
2. Robustness fix for DC6/6v abort scenarios.

Cc: Imre Deak <Imre Deak <imre.deak@intel.com>>
Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210914215732.67135-2-anusha.srivatsa@intel.com
(cherry picked from commit 259d71992e57c637aa0a5d3f4f7b9f689c186191)
Signed-off-by: Timo Aaltonen <timo.aaltonen@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Config] upgrade debug symbols from DWARF4 to DWARF5
Dimitri John Ledkov [Mon, 7 Feb 2022 15:15:16 +0000 (15:15 +0000)]
UBUNTU: [Config] upgrade debug symbols from DWARF4 to DWARF5

pahole is new enough across all releases to support DWARF5. DWARF5
provides better debug symbols that are also more compact. Test build
indicates ~10% reduction in debug linux install size.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agolib/Kconfig.debug: Allow BTF + DWARF5 with pahole 1.21+
Nathan Chancellor [Mon, 7 Feb 2022 15:15:15 +0000 (15:15 +0000)]
lib/Kconfig.debug: Allow BTF + DWARF5 with pahole 1.21+

Commit 98cd6f521f10 ("Kconfig: allow explicit opt in to DWARF v5")
prevented CONFIG_DEBUG_INFO_DWARF5 from being selected when
CONFIG_DEBUG_INFO_BTF is enabled because pahole had issues with clang's
DWARF5 info. This was resolved by [1], which is in pahole v1.21.

Allow DEBUG_INFO_DWARF5 to be selected with DEBUG_INFO_BTF when using
pahole v1.21 or newer.

[1]: https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?id=7d8e829f636f47aba2e1b6eda57e74d8e31f733c

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-6-nathan@kernel.org
(cherry picked from bpf-next commit 42d9b379e3e1790eafb87c799c9edfd0b37a37c7)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agolib/Kconfig.debug: Use CONFIG_PAHOLE_VERSION
Nathan Chancellor [Mon, 7 Feb 2022 15:15:14 +0000 (15:15 +0000)]
lib/Kconfig.debug: Use CONFIG_PAHOLE_VERSION

Now that CONFIG_PAHOLE_VERSION exists, use it in the definition of
CONFIG_PAHOLE_HAS_SPLIT_BTF and CONFIG_PAHOLE_HAS_BTF_TAG to reduce the
amount of duplication across the tree.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-5-nathan@kernel.org
(cherry picked from bpf-next commit 6323c81350b73a4569cf52df85f80273faa64071)
(conflicts did not apply PAHOLE_HAS_BTF_TAG hunk as did not cherry-pick pre-req)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoscripts/pahole-flags.sh: Use pahole-version.sh
Nathan Chancellor [Mon, 7 Feb 2022 15:15:13 +0000 (15:15 +0000)]
scripts/pahole-flags.sh: Use pahole-version.sh

Use pahole-version.sh to get pahole's version code to reduce the amount
of duplication across the tree.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-4-nathan@kernel.org
(cherry picked from bpf-next commit 2d6c9810eb8915c4ddede707b8e167a1d919e1ca)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agokbuild: Add CONFIG_PAHOLE_VERSION
Nathan Chancellor [Mon, 7 Feb 2022 15:15:12 +0000 (15:15 +0000)]
kbuild: Add CONFIG_PAHOLE_VERSION

There are a few different places where pahole's version is turned into a
three digit form with the exact same command. Move this command into
scripts/pahole-version.sh to reduce the amount of duplication across the
tree.

Create CONFIG_PAHOLE_VERSION so the version code can be used in Kconfig
to enable and disable configuration options based on the pahole version,
which is already done in a couple of places.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-3-nathan@kernel.org
(cherry picked from bpf-next commit 613fe169237785a4bb1d06397b52606b2967da53)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoMAINTAINERS: Add scripts/pahole-flags.sh to BPF section
Nathan Chancellor [Mon, 7 Feb 2022 15:15:11 +0000 (15:15 +0000)]
MAINTAINERS: Add scripts/pahole-flags.sh to BPF section

Currently, scripts/pahole-flags.sh has no formal maintainer. Add it to
the BPF section so that patches to it can be properly reviewed and
picked up.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220201205624.652313-2-nathan@kernel.org
(cherry picked from bpf-next commit f67644b4f282d42acf5ad9b0175ef5671314ab12)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agokbuild: Unify options for BTF generation for vmlinux and modules
Jiri Olsa [Mon, 7 Feb 2022 15:15:10 +0000 (15:15 +0000)]
kbuild: Unify options for BTF generation for vmlinux and modules

Using new PAHOLE_FLAGS variable to pass extra arguments to
pahole for both vmlinux and modules BTF data generation.

Adding new scripts/pahole-flags.sh script that detect and
prints pahole options.

[ fixed issues found by kernel test robot ]

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211029125729.70002-1-jolsa@kernel.org
(cherry picked from v5.16-rc1 commit 9741e07ece7c247dd65e1aa01e16b683f01c05a8)
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Packaging] use xz compression for ddebs
Dimitri John Ledkov [Mon, 7 Feb 2022 14:21:00 +0000 (14:21 +0000)]
UBUNTU: [Packaging] use xz compression for ddebs

ddebs are huge in size, and rarely used. Keep them xz compressed.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Packaging] do not use compression for image packages
Dimitri John Ledkov [Mon, 7 Feb 2022 14:20:59 +0000 (14:20 +0000)]
UBUNTU: [Packaging] do not use compression for image packages

linux-image-ABI packages contain compressed content only (vmlinuz,
changelog) and thus the deb does not benefit at all from being
recompressed again. Only copyring file is compressed. We can actually
avoid shipping /doc/ at all, by symlinking it to the modules package
provided /doc/.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Packaging] use default zstd compression
Dimitri John Ledkov [Mon, 7 Feb 2022 14:20:58 +0000 (14:20 +0000)]
UBUNTU: [Packaging] use default zstd compression

Revert "UBUNTU: [Packaging] enforce xz compression for debs"

This reverts commit 45da4d72dea537910d970211ff8c345f4f9a2775.

The previous commit incorrectly stated that jammy dpkg default has
switched from xz to zstd. This change was done late in impish
cycle. [1] It also incorrectly states that there are no evident benefits
for the kernel packages to use zstd.

It is correct that zstd compression may require more
resources. However, the decompression speed and decompression memory
requirements are a lot faster. The choice to switch from xz to zstd by
default in Ubuntu was done to speed up installation and upgrade of all
packages, at the expense of slightly larger download sizes.

If we do want to futher optimize compression methods it should
probably be done on per subpackage type. For example, linux-image-ABI
already contains compressed kernel image and not much else, we can
choose to not compress that deb at all with compression method
none. Debug symbols are usually rarely installed, thus it might make
sense to keep them small and thus choose compress ddebs with
xz. However modules and tools should remain compressed with zstd.

[1] https://launchpad.net/ubuntu/+source/dpkg/1.20.9ubuntu2

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoKVM: s390: Add a routine for setting userspace CPU state
Eric Farman [Fri, 4 Feb 2022 15:11:51 +0000 (16:11 +0100)]
KVM: s390: Add a routine for setting userspace CPU state

BugLink: https://bugs.launchpad.net/bugs/1959735
This capability exists, but we don't record anything when userspace
enables it. Let's refactor that code so that a note can be made in
the debug logs that it was enabled.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20211008203112.1979843-7-farman@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
(cherry picked from commit 67cf68b6a5ccac8bc7dfef0a220b59af4c83fd2c)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoKVM: s390: Simplify SIGP Set Arch handling
Eric Farman [Fri, 4 Feb 2022 15:11:50 +0000 (16:11 +0100)]
KVM: s390: Simplify SIGP Set Arch handling

BugLink: https://bugs.launchpad.net/bugs/1959735
The Principles of Operations describe the various reasons that
each individual SIGP orders might be rejected, and the status
bit that are set for each condition.

For example, for the Set Architecture order, it states:

  "If it is not true that all other CPUs in the configu-
   ration are in the stopped or check-stop state, ...
   bit 54 (incorrect state) ... is set to one."

However, it also states:

  "... if the CZAM facility is installed, ...
   bit 55 (invalid parameter) ... is set to one."

Since the Configuration-z/Architecture-Architectural Mode (CZAM)
facility is unconditionally presented, there is no need to examine
each VCPU to determine if it is started/stopped. It can simply be
rejected outright with the Invalid Parameter bit.

Fixes: b697e435aeee ("KVM: s390: Support Configuration z/Architecture Mode")
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Link: https://lore.kernel.org/r/20211008203112.1979843-2-farman@linux.ibm.com
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
(cherry picked from commit 8eeba194a32e0f50329354a696baaa2e3d9accc5)
Signed-off-by: Frank Heimes <frank.heimes@canonical.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: SAUCE: ath11k: shrink TCSR read mask for WCN6855 hw2.1
You-Sheng Yang [Fri, 28 Jan 2022 12:04:43 +0000 (20:04 +0800)]
UBUNTU: SAUCE: ath11k: shrink TCSR read mask for WCN6855 hw2.1

BugLink: https://bugs.launchpad.net/bugs/1954938
Full WCN6855 hw2.1 support has landed to kernel as commit d1147a316b53
("ath11k: add support for WCN6855 hw2.1"), and it was based on several
new features and fixes that involves additions & removals of members in
ath11k_hw_params, which in turn pulls in numerous prerequisite commits.

While additional features of hw2.1, e.g. WiFi 6G, are still not planned
for Focal oem-5.14 and Jammy 5.15 kernels, this patch brings in the
minimum change to enable basic functions.

The high bits of TCSR are reserved for other use, and the actual major
version mask occupies 4 bits only.

Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoUBUNTU: [Config] disable FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION
Paolo Pisati [Thu, 10 Feb 2022 14:34:09 +0000 (15:34 +0100)]
UBUNTU: [Config] disable FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION

BugLink: https://bugs.launchpad.net/bugs/1960516
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoLinux 5.15.22
Greg Kroah-Hartman [Tue, 8 Feb 2022 17:34:14 +0000 (18:34 +0100)]
Linux 5.15.22

BugLink: https://bugs.launchpad.net/bugs/1960516
Link: https://lore.kernel.org/r/20220207103802.280120990@linuxfoundation.org
Link: https://lore.kernel.org/r/20220207133903.595766086@linuxfoundation.org
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Shuah Khan <skhan@linuxfoundation.org>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Slade Watkins <slade@sladewatkins.com>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: netfilter: check stateless nat udp checksum fixup
Florian Westphal [Mon, 24 Jan 2022 21:09:15 +0000 (22:09 +0100)]
selftests: netfilter: check stateless nat udp checksum fixup

BugLink: https://bugs.launchpad.net/bugs/1960516
commit aad51ca71ad83273e8826d6cfdcf53c98748d1fa upstream.

Add a test that sends large udp packet (which is fragmented)
via a stateless nft nat rule, i.e. 'ip saddr set 10.2.3.4'
and check that the datagram is received by peer.

On kernels without
commit 4e1860a38637 ("netfilter: nft_payload: do not update layer 4 checksum when mangling fragments")',
this will fail with:

cmp: EOF on /tmp/tmp.V1q0iXJyQF which is empty
-rw------- 1 root root 4096 Jan 24 22:03 /tmp/tmp.Aaqnq4rBKS
-rw------- 1 root root    0 Jan 24 22:03 /tmp/tmp.V1q0iXJyQF
ERROR: in and output file mismatch when checking udp with stateless nat
FAIL: nftables v1.0.0 (Fearless Fosdick #2)

On patched kernels, this will show:
PASS: IP statless for ns2-PFp89amx

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agoselftests: nft_concat_range: add test for reload with no element add/del
Florian Westphal [Wed, 26 Jan 2022 11:54:54 +0000 (12:54 +0100)]
selftests: nft_concat_range: add test for reload with no element add/del

BugLink: https://bugs.launchpad.net/bugs/1960516
commit eda0cf1202acf1ef47f93d8f92d4839213431424 upstream.

Add a specific test for the reload issue fixed with
commit 23c54263efd7cb ("netfilter: nft_set_pipapo: allocate pcpu scratch maps on clone").

Add to set, then flush set content + restore without other add/remove in
the transaction.

On kernels before the fix, this test case fails:
  net,mac with reload    [FAIL]

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agogpio: mpc8xxx: Fix an ignored error return from platform_get_irq()
Yang Li [Wed, 19 Jan 2022 01:04:32 +0000 (09:04 +0800)]
gpio: mpc8xxx: Fix an ignored error return from platform_get_irq()

BugLink: https://bugs.launchpad.net/bugs/1960516
commit 9f51ce0b9e73f83bab2442b36d5e247a81bd3401 upstream.

The return from the call to platform_get_irq() is int, it can be
a negative error code, however this is being assigned to an unsigned
int variable 'irqn', so making 'irqn' an int.

Eliminate the following coccicheck warning:
./drivers/gpio/gpio-mpc8xxx.c:391:5-21: WARNING: Unsigned expression
compared with zero: mpc8xxx_gc -> irqn < 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 0b39536cc699 ("gpio: mpc8xxx: Fix IRQ check in mpc8xxx_probe")
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2 years agogpio: idt3243x: Fix an ignored error return from platform_get_irq()
Yang Li [Wed, 19 Jan 2022 01:04:31 +0000 (09:04 +0800)]
gpio: idt3243x: Fix an ignored error return from platform_get_irq()

BugLink: https://bugs.launchpad.net/bugs/1960516
commit 7c1cf55577782725ea2bc24687767c8fe8e57486 upstream.

The return from the call to platform_get_irq() is int, it can be
a negative error code, however this is being assigned to an unsigned
int variable 'parent_irq', so making 'parent_irq' an int.

Eliminate the following coccicheck warning:
./drivers/gpio/gpio-idt3243x.c:167:6-16: WARNING: Unsigned expression
compared with zero: parent_irq < 0

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 30fee1d7462a ("gpio: idt3243x: Fix IRQ check in idt_gpio_probe")
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>