From: Greg Kroah-Hartman Date: Fri, 17 Feb 2023 14:15:24 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.14.306~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56ff9995723b31e6813e906c1fc35c821348297b;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: aio-fix-mremap-after-fork-null-deref.patch drm-amd-display-fail-atomic_check-early-on-normalize_zpos-error.patch mptcp-do-not-wait-for-bare-sockets-timeout.patch netfilter-nft_tproxy-restrict-to-prerouting-hook.patch platform-x86-amd-pmc-correct-usage-of-smu-version.patch platform-x86-amd-pmc-disable-irq1-wakeup-for-rn-czn.patch platform-x86-amd-pmc-export-idlemask-values-based-on-the-apu.patch platform-x86-amd-pmc-fix-compilation-when-config_debugfs-is-disabled.patch --- diff --git a/queue-5.15/aio-fix-mremap-after-fork-null-deref.patch b/queue-5.15/aio-fix-mremap-after-fork-null-deref.patch new file mode 100644 index 00000000000..b004d06a6e8 --- /dev/null +++ b/queue-5.15/aio-fix-mremap-after-fork-null-deref.patch @@ -0,0 +1,49 @@ +From 81e9d6f8647650a7bead74c5f926e29970e834d1 Mon Sep 17 00:00:00 2001 +From: Seth Jenkins +Date: Tue, 31 Jan 2023 12:25:55 -0500 +Subject: aio: fix mremap after fork null-deref + +From: Seth Jenkins + +commit 81e9d6f8647650a7bead74c5f926e29970e834d1 upstream. + +Commit e4a0d3e720e7 ("aio: Make it possible to remap aio ring") introduced +a null-deref if mremap is called on an old aio mapping after fork as +mm->ioctx_table will be set to NULL. + +[jmoyer@redhat.com: fix 80 column issue] +Link: https://lkml.kernel.org/r/x49sffq4nvg.fsf@segfault.boston.devel.redhat.com +Fixes: e4a0d3e720e7 ("aio: Make it possible to remap aio ring") +Signed-off-by: Seth Jenkins +Signed-off-by: Jeff Moyer +Cc: Alexander Viro +Cc: Benjamin LaHaise +Cc: Jann Horn +Cc: Pavel Emelyanov +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + fs/aio.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/fs/aio.c ++++ b/fs/aio.c +@@ -334,6 +334,9 @@ static int aio_ring_mremap(struct vm_are + spin_lock(&mm->ioctx_lock); + rcu_read_lock(); + table = rcu_dereference(mm->ioctx_table); ++ if (!table) ++ goto out_unlock; ++ + for (i = 0; i < table->nr; i++) { + struct kioctx *ctx; + +@@ -347,6 +350,7 @@ static int aio_ring_mremap(struct vm_are + } + } + ++out_unlock: + rcu_read_unlock(); + spin_unlock(&mm->ioctx_lock); + return res; diff --git a/queue-5.15/drm-amd-display-fail-atomic_check-early-on-normalize_zpos-error.patch b/queue-5.15/drm-amd-display-fail-atomic_check-early-on-normalize_zpos-error.patch new file mode 100644 index 00000000000..51cfdb6c7b5 --- /dev/null +++ b/queue-5.15/drm-amd-display-fail-atomic_check-early-on-normalize_zpos-error.patch @@ -0,0 +1,44 @@ +From 2a00299e7447395d0898e7c6214817c06a61a8e8 Mon Sep 17 00:00:00 2001 +From: Leo Li +Date: Thu, 9 Feb 2023 12:15:21 -0500 +Subject: drm/amd/display: Fail atomic_check early on normalize_zpos error + +From: Leo Li + +commit 2a00299e7447395d0898e7c6214817c06a61a8e8 upstream. + +[Why] + +drm_atomic_normalize_zpos() can return an error code when there's +modeset lock contention. This was being ignored. + +[How] + +Bail out of atomic check if normalize_zpos() returns an error. + +Fixes: b261509952bc ("drm/amd/display: Fix double cursor on non-video RGB MPO") +Signed-off-by: Leo Li +Tested-by: Mikhail Gavrilov +Reviewed-by: Hamza Mahfooz +Signed-off-by: Alex Deucher +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -10889,7 +10889,11 @@ static int amdgpu_dm_atomic_check(struct + * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in + * atomic state, so call drm helper to normalize zpos. + */ +- drm_atomic_normalize_zpos(dev, state); ++ ret = drm_atomic_normalize_zpos(dev, state); ++ if (ret) { ++ drm_dbg(dev, "drm_atomic_normalize_zpos() failed\n"); ++ goto fail; ++ } + + /* Remove exiting planes if they are modified */ + for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { diff --git a/queue-5.15/mptcp-do-not-wait-for-bare-sockets-timeout.patch b/queue-5.15/mptcp-do-not-wait-for-bare-sockets-timeout.patch new file mode 100644 index 00000000000..21eda759bd3 --- /dev/null +++ b/queue-5.15/mptcp-do-not-wait-for-bare-sockets-timeout.patch @@ -0,0 +1,64 @@ +From d4e85922e3e7ef2071f91f65e61629b60f3a9cf4 Mon Sep 17 00:00:00 2001 +From: Paolo Abeni +Date: Tue, 7 Feb 2023 14:04:13 +0100 +Subject: mptcp: do not wait for bare sockets' timeout + +From: Paolo Abeni + +commit d4e85922e3e7ef2071f91f65e61629b60f3a9cf4 upstream. + +If the peer closes all the existing subflows for a given +mptcp socket and later the application closes it, the current +implementation let it survive until the timewait timeout expires. + +While the above is allowed by the protocol specification it +consumes resources for almost no reason and additionally +causes sporadic self-tests failures. + +Let's move the mptcp socket to the TCP_CLOSE state when there are +no alive subflows at close time, so that the allocated resources +will be freed immediately. + +Fixes: e16163b6e2b7 ("mptcp: refactor shutdown and close") +Cc: stable@vger.kernel.org +Signed-off-by: Paolo Abeni +Reviewed-by: Matthieu Baerts +Signed-off-by: Matthieu Baerts +Signed-off-by: David S. Miller +Signed-off-by: Matthieu Baerts +Signed-off-by: Greg Kroah-Hartman + +--- + net/mptcp/protocol.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/net/mptcp/protocol.c ++++ b/net/mptcp/protocol.c +@@ -2726,6 +2726,7 @@ static void mptcp_close(struct sock *sk, + { + struct mptcp_subflow_context *subflow; + bool do_cancel_work = false; ++ int subflows_alive = 0; + + lock_sock(sk); + sk->sk_shutdown = SHUTDOWN_MASK; +@@ -2747,11 +2748,19 @@ cleanup: + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + bool slow = lock_sock_fast_nested(ssk); + ++ subflows_alive += ssk->sk_state != TCP_CLOSE; ++ + sock_orphan(ssk); + unlock_sock_fast(ssk, slow); + } + sock_orphan(sk); + ++ /* all the subflows are closed, only timeout can change the msk ++ * state, let's not keep resources busy for no reasons ++ */ ++ if (subflows_alive == 0) ++ inet_sk_state_store(sk, TCP_CLOSE); ++ + sock_hold(sk); + pr_debug("msk=%p state=%d", sk, sk->sk_state); + if (sk->sk_state == TCP_CLOSE) { diff --git a/queue-5.15/netfilter-nft_tproxy-restrict-to-prerouting-hook.patch b/queue-5.15/netfilter-nft_tproxy-restrict-to-prerouting-hook.patch new file mode 100644 index 00000000000..af38a5e66c1 --- /dev/null +++ b/queue-5.15/netfilter-nft_tproxy-restrict-to-prerouting-hook.patch @@ -0,0 +1,45 @@ +From 18bbc3213383a82b05383827f4b1b882e3f0a5a5 Mon Sep 17 00:00:00 2001 +From: Florian Westphal +Date: Sat, 20 Aug 2022 17:54:06 +0200 +Subject: netfilter: nft_tproxy: restrict to prerouting hook + +From: Florian Westphal + +commit 18bbc3213383a82b05383827f4b1b882e3f0a5a5 upstream. + +TPROXY is only allowed from prerouting, but nft_tproxy doesn't check this. +This fixes a crash (null dereference) when using tproxy from e.g. output. + +Fixes: 4ed8eb6570a4 ("netfilter: nf_tables: Add native tproxy support") +Reported-by: Shell Chen +Signed-off-by: Florian Westphal +Signed-off-by: Qingfang DENG +Signed-off-by: Greg Kroah-Hartman +--- + net/netfilter/nft_tproxy.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/net/netfilter/nft_tproxy.c ++++ b/net/netfilter/nft_tproxy.c +@@ -312,6 +312,13 @@ static int nft_tproxy_dump(struct sk_buf + return 0; + } + ++static int nft_tproxy_validate(const struct nft_ctx *ctx, ++ const struct nft_expr *expr, ++ const struct nft_data **data) ++{ ++ return nft_chain_validate_hooks(ctx->chain, 1 << NF_INET_PRE_ROUTING); ++} ++ + static struct nft_expr_type nft_tproxy_type; + static const struct nft_expr_ops nft_tproxy_ops = { + .type = &nft_tproxy_type, +@@ -320,6 +327,7 @@ static const struct nft_expr_ops nft_tpr + .init = nft_tproxy_init, + .destroy = nft_tproxy_destroy, + .dump = nft_tproxy_dump, ++ .validate = nft_tproxy_validate, + }; + + static struct nft_expr_type nft_tproxy_type __read_mostly = { diff --git a/queue-5.15/platform-x86-amd-pmc-correct-usage-of-smu-version.patch b/queue-5.15/platform-x86-amd-pmc-correct-usage-of-smu-version.patch new file mode 100644 index 00000000000..422765773d2 --- /dev/null +++ b/queue-5.15/platform-x86-amd-pmc-correct-usage-of-smu-version.patch @@ -0,0 +1,61 @@ +From b8fb0d9b47660ddb8a8256412784aad7cee9f21a Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Thu, 20 Jan 2022 11:44:39 -0600 +Subject: platform/x86: amd-pmc: Correct usage of SMU version + +From: Mario Limonciello + +commit b8fb0d9b47660ddb8a8256412784aad7cee9f21a upstream. + +Yellow carp has been outputting versions like `1093.24.0`, but this +is supposed to be 69.24.0. That is the MSB is being interpreted +incorrectly. + +The MSB is not part of the major version, but has generally been +treated that way thus far. It's actually the program, and used to +distinguish between two programs from a similar family but different +codebase. + +Link: https://patchwork.freedesktop.org/patch/469993/ +Signed-off-by: Mario Limonciello +Link: https://lore.kernel.org/r/20220120174439.12770-1-mario.limonciello@amd.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/amd-pmc.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/platform/x86/amd-pmc.c ++++ b/drivers/platform/x86/amd-pmc.c +@@ -115,9 +115,10 @@ struct amd_pmc_dev { + u32 cpu_id; + u32 active_ips; + /* SMU version information */ +- u16 major; +- u16 minor; +- u16 rev; ++ u8 smu_program; ++ u8 major; ++ u8 minor; ++ u8 rev; + struct device *dev; + struct mutex lock; /* generic mutex lock */ + #if IS_ENABLED(CONFIG_DEBUG_FS) +@@ -164,11 +165,13 @@ static int amd_pmc_get_smu_version(struc + if (rc) + return rc; + +- dev->major = (val >> 16) & GENMASK(15, 0); ++ dev->smu_program = (val >> 24) & GENMASK(7, 0); ++ dev->major = (val >> 16) & GENMASK(7, 0); + dev->minor = (val >> 8) & GENMASK(7, 0); + dev->rev = (val >> 0) & GENMASK(7, 0); + +- dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev); ++ dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n", ++ dev->smu_program, dev->major, dev->minor, dev->rev); + + return 0; + } diff --git a/queue-5.15/platform-x86-amd-pmc-disable-irq1-wakeup-for-rn-czn.patch b/queue-5.15/platform-x86-amd-pmc-disable-irq1-wakeup-for-rn-czn.patch new file mode 100644 index 00000000000..48a35cff903 --- /dev/null +++ b/queue-5.15/platform-x86-amd-pmc-disable-irq1-wakeup-for-rn-czn.patch @@ -0,0 +1,122 @@ +From 8e60615e8932167057b363c11a7835da7f007106 Mon Sep 17 00:00:00 2001 +From: Mario Limonciello +Date: Fri, 20 Jan 2023 13:15:18 -0600 +Subject: platform/x86/amd: pmc: Disable IRQ1 wakeup for RN/CZN + +From: Mario Limonciello + +commit 8e60615e8932167057b363c11a7835da7f007106 upstream. + +By default when the system is configured for low power idle in the FADT +the keyboard is set up as a wake source. This matches the behavior that +Windows uses for Modern Standby as well. + +It has been reported that a variety of AMD based designs there are +spurious wakeups are happening where two IRQ sources are active. + +For example: +``` +PM: Triggering wakeup from IRQ 9 +PM: Triggering wakeup from IRQ 1 +``` + +In these designs IRQ 9 is the ACPI SCI and IRQ 1 is the keyboard. +One way to trigger this problem is to suspend the laptop and then unplug +the AC adapter. The SOC will be in a hardware sleep state and plugging +in the AC adapter returns control to the kernel's s2idle loop. + +Normally if just IRQ 9 was active the s2idle loop would advance any EC +transactions and no other IRQ being active would cause the s2idle loop +to put the SOC back into hardware sleep state. + +When this bug occurred IRQ 1 is also active even if no keyboard activity +occurred. This causes the s2idle loop to break and the system to wake. + +This is a platform firmware bug triggering IRQ1 without keyboard activity. +This occurs in Windows as well, but Windows will enter "SW DRIPS" and +then with no activity enters back into "HW DRIPS" (hardware sleep state). + +This issue affects Renoir, Lucienne, Cezanne, and Barcelo platforms. It +does not happen on newer systems such as Mendocino or Rembrandt. + +It's been fixed in newer platform firmware. To avoid triggering the bug +on older systems check the SMU F/W version and adjust the policy at suspend +time for s2idle wakeup from keyboard on these systems. A lot of thought +and experimentation has been given around the timing of disabling IRQ1, +and to make it work the "suspend" PM callback is restored. + +Reported-by: Kai-Heng Feng +Reported-by: Xaver Hugl +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2115 +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1951 +Signed-off-by: Mario Limonciello +Link: https://lore.kernel.org/r/20230120191519.15926-1-mario.limonciello@amd.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +[ This has been hand modified for missing dependency commits. ] +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1921#note_1770257 +Signed-off-by: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/amd-pmc.c | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +--- a/drivers/platform/x86/amd-pmc.c ++++ b/drivers/platform/x86/amd-pmc.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -412,12 +413,48 @@ static int amd_pmc_get_os_hint(struct am + return -EINVAL; + } + ++static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev) ++{ ++ struct device *d; ++ int rc; ++ ++ if (!pdev->major) { ++ rc = amd_pmc_get_smu_version(pdev); ++ if (rc) ++ return rc; ++ } ++ ++ if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65)) ++ return 0; ++ ++ d = bus_find_device_by_name(&serio_bus, NULL, "serio0"); ++ if (!d) ++ return 0; ++ if (device_may_wakeup(d)) { ++ dev_info_once(d, "Disabling IRQ1 wakeup source to avoid platform firmware bug\n"); ++ disable_irq_wake(1); ++ device_set_wakeup_enable(d, false); ++ } ++ put_device(d); ++ ++ return 0; ++} ++ + static int __maybe_unused amd_pmc_suspend(struct device *dev) + { + struct amd_pmc_dev *pdev = dev_get_drvdata(dev); + int rc; + u8 msg; + ++ if (pdev->cpu_id == AMD_CPU_ID_CZN) { ++ int rc = amd_pmc_czn_wa_irq1(pdev); ++ ++ if (rc) { ++ dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc); ++ return rc; ++ } ++ } ++ + /* Reset and Start SMU logging - to monitor the s0i3 stats */ + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0); + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0); diff --git a/queue-5.15/platform-x86-amd-pmc-export-idlemask-values-based-on-the-apu.patch b/queue-5.15/platform-x86-amd-pmc-export-idlemask-values-based-on-the-apu.patch new file mode 100644 index 00000000000..dffd262b895 --- /dev/null +++ b/queue-5.15/platform-x86-amd-pmc-export-idlemask-values-based-on-the-apu.patch @@ -0,0 +1,156 @@ +From f6045de1f53268131ea75a99b210b869dcc150b2 Mon Sep 17 00:00:00 2001 +From: Sanket Goswami +Date: Thu, 16 Sep 2021 18:10:02 +0530 +Subject: platform/x86: amd-pmc: Export Idlemask values based on the APU + +From: Sanket Goswami + +commit f6045de1f53268131ea75a99b210b869dcc150b2 upstream. + +IdleMask is the metric used by the PM firmware to know the status of each +of the Hardware IP blocks monitored by the PM firmware. + +Knowing this value is key to get the information of s2idle suspend/resume +status. This value is mapped to PMC scratch registers, retrieve them +accordingly based on the CPU family and the underlying firmware support. + +Co-developed-by: Shyam Sundar S K +Signed-off-by: Shyam Sundar S K +Signed-off-by: Sanket Goswami +Reviewed-by: Mario Limonciello +Link: https://lore.kernel.org/r/20210916124002.2529-1-Sanket.Goswami@amd.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/amd-pmc.c | 76 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 76 insertions(+) + +--- a/drivers/platform/x86/amd-pmc.c ++++ b/drivers/platform/x86/amd-pmc.c +@@ -29,6 +29,10 @@ + #define AMD_PMC_REGISTER_RESPONSE 0x980 + #define AMD_PMC_REGISTER_ARGUMENT 0x9BC + ++/* PMC Scratch Registers */ ++#define AMD_PMC_SCRATCH_REG_CZN 0x94 ++#define AMD_PMC_SCRATCH_REG_YC 0xD14 ++ + /* Base address of SMU for mapping physical address to virtual address */ + #define AMD_PMC_SMU_INDEX_ADDRESS 0xB8 + #define AMD_PMC_SMU_INDEX_DATA 0xBC +@@ -110,6 +114,10 @@ struct amd_pmc_dev { + u32 base_addr; + u32 cpu_id; + u32 active_ips; ++/* SMU version information */ ++ u16 major; ++ u16 minor; ++ u16 rev; + struct device *dev; + struct mutex lock; /* generic mutex lock */ + #if IS_ENABLED(CONFIG_DEBUG_FS) +@@ -201,6 +209,66 @@ static int s0ix_stats_show(struct seq_fi + } + DEFINE_SHOW_ATTRIBUTE(s0ix_stats); + ++static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) ++{ ++ int rc; ++ u32 val; ++ ++ rc = amd_pmc_send_cmd(dev, 0, &val, SMU_MSG_GETSMUVERSION, 1); ++ if (rc) ++ return rc; ++ ++ dev->major = (val >> 16) & GENMASK(15, 0); ++ dev->minor = (val >> 8) & GENMASK(7, 0); ++ dev->rev = (val >> 0) & GENMASK(7, 0); ++ ++ dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev); ++ ++ return 0; ++} ++ ++static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, ++ struct seq_file *s) ++{ ++ u32 val; ++ ++ switch (pdev->cpu_id) { ++ case AMD_CPU_ID_CZN: ++ val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_CZN); ++ break; ++ case AMD_CPU_ID_YC: ++ val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_YC); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (dev) ++ dev_dbg(pdev->dev, "SMU idlemask s0i3: 0x%x\n", val); ++ ++ if (s) ++ seq_printf(s, "SMU idlemask : 0x%x\n", val); ++ ++ return 0; ++} ++ ++static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) ++{ ++ struct amd_pmc_dev *dev = s->private; ++ int rc; ++ ++ if (dev->major > 56 || (dev->major >= 55 && dev->minor >= 37)) { ++ rc = amd_pmc_idlemask_read(dev, NULL, s); ++ if (rc) ++ return rc; ++ } else { ++ seq_puts(s, "Unsupported SMU version for Idlemask\n"); ++ } ++ ++ return 0; ++} ++DEFINE_SHOW_ATTRIBUTE(amd_pmc_idlemask); ++ + static void amd_pmc_dbgfs_unregister(struct amd_pmc_dev *dev) + { + debugfs_remove_recursive(dev->dbgfs_dir); +@@ -213,6 +281,8 @@ static void amd_pmc_dbgfs_register(struc + &smu_fw_info_fops); + debugfs_create_file("s0ix_stats", 0644, dev->dbgfs_dir, dev, + &s0ix_stats_fops); ++ debugfs_create_file("amd_pmc_idlemask", 0644, dev->dbgfs_dir, dev, ++ &amd_pmc_idlemask_fops); + } + #else + static inline void amd_pmc_dbgfs_register(struct amd_pmc_dev *dev) +@@ -349,6 +419,8 @@ static int __maybe_unused amd_pmc_suspen + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_RESET, 0); + amd_pmc_send_cmd(pdev, 0, NULL, SMU_MSG_LOG_START, 0); + ++ /* Dump the IdleMask before we send hint to SMU */ ++ amd_pmc_idlemask_read(pdev, dev, NULL); + msg = amd_pmc_get_os_hint(pdev); + rc = amd_pmc_send_cmd(pdev, 1, NULL, msg, 0); + if (rc) +@@ -371,6 +443,9 @@ static int __maybe_unused amd_pmc_resume + if (rc) + dev_err(pdev->dev, "resume failed\n"); + ++ /* Dump the IdleMask to see the blockers */ ++ amd_pmc_idlemask_read(pdev, dev, NULL); ++ + return 0; + } + +@@ -458,6 +533,7 @@ static int amd_pmc_probe(struct platform + if (err) + dev_err(dev->dev, "SMU debugging info not supported on this platform\n"); + ++ amd_pmc_get_smu_version(dev); + platform_set_drvdata(pdev, dev); + amd_pmc_dbgfs_register(dev); + return 0; diff --git a/queue-5.15/platform-x86-amd-pmc-fix-compilation-when-config_debugfs-is-disabled.patch b/queue-5.15/platform-x86-amd-pmc-fix-compilation-when-config_debugfs-is-disabled.patch new file mode 100644 index 00000000000..1520b2f7599 --- /dev/null +++ b/queue-5.15/platform-x86-amd-pmc-fix-compilation-when-config_debugfs-is-disabled.patch @@ -0,0 +1,130 @@ +From 40635cd32f0d83573a558dc30e9ba3469e769249 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 28 Sep 2021 16:16:06 +0200 +Subject: platform/x86: amd-pmc: Fix compilation when CONFIG_DEBUGFS is disabled + +From: Hans de Goede + +commit 40635cd32f0d83573a558dc30e9ba3469e769249 upstream. + +The amd_pmc_get_smu_version() and amd_pmc_idlemask_read() functions are +used in the probe / suspend/resume code, so they are also used when +CONFIG_DEBUGFS is disabled, move them outside of the #ifdef CONFIG_DEBUGFS +block. + +Note this purely moves the code to above the #ifdef CONFIG_DEBUGFS, +the code is completely unchanged. + +Fixes: f6045de1f532 ("platform/x86: amd-pmc: Export Idlemask values based on the APU") +Cc: Shyam Sundar S K +Cc: Sanket Goswami +Reported-by: Nathan Chancellor +Signed-off-by: Hans de Goede +Signed-off-by: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/x86/amd-pmc.c | 86 ++++++++++++++++++++--------------------- + 1 file changed, 43 insertions(+), 43 deletions(-) + +--- a/drivers/platform/x86/amd-pmc.c ++++ b/drivers/platform/x86/amd-pmc.c +@@ -155,6 +155,49 @@ struct smu_metrics { + u64 timecondition_notmet_totaltime[SOC_SUBSYSTEM_IP_MAX]; + } __packed; + ++static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) ++{ ++ int rc; ++ u32 val; ++ ++ rc = amd_pmc_send_cmd(dev, 0, &val, SMU_MSG_GETSMUVERSION, 1); ++ if (rc) ++ return rc; ++ ++ dev->major = (val >> 16) & GENMASK(15, 0); ++ dev->minor = (val >> 8) & GENMASK(7, 0); ++ dev->rev = (val >> 0) & GENMASK(7, 0); ++ ++ dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev); ++ ++ return 0; ++} ++ ++static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, ++ struct seq_file *s) ++{ ++ u32 val; ++ ++ switch (pdev->cpu_id) { ++ case AMD_CPU_ID_CZN: ++ val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_CZN); ++ break; ++ case AMD_CPU_ID_YC: ++ val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_YC); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ if (dev) ++ dev_dbg(pdev->dev, "SMU idlemask s0i3: 0x%x\n", val); ++ ++ if (s) ++ seq_printf(s, "SMU idlemask : 0x%x\n", val); ++ ++ return 0; ++} ++ + #ifdef CONFIG_DEBUG_FS + static int smu_fw_info_show(struct seq_file *s, void *unused) + { +@@ -209,49 +252,6 @@ static int s0ix_stats_show(struct seq_fi + } + DEFINE_SHOW_ATTRIBUTE(s0ix_stats); + +-static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev) +-{ +- int rc; +- u32 val; +- +- rc = amd_pmc_send_cmd(dev, 0, &val, SMU_MSG_GETSMUVERSION, 1); +- if (rc) +- return rc; +- +- dev->major = (val >> 16) & GENMASK(15, 0); +- dev->minor = (val >> 8) & GENMASK(7, 0); +- dev->rev = (val >> 0) & GENMASK(7, 0); +- +- dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev); +- +- return 0; +-} +- +-static int amd_pmc_idlemask_read(struct amd_pmc_dev *pdev, struct device *dev, +- struct seq_file *s) +-{ +- u32 val; +- +- switch (pdev->cpu_id) { +- case AMD_CPU_ID_CZN: +- val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_CZN); +- break; +- case AMD_CPU_ID_YC: +- val = amd_pmc_reg_read(pdev, AMD_PMC_SCRATCH_REG_YC); +- break; +- default: +- return -EINVAL; +- } +- +- if (dev) +- dev_dbg(pdev->dev, "SMU idlemask s0i3: 0x%x\n", val); +- +- if (s) +- seq_printf(s, "SMU idlemask : 0x%x\n", val); +- +- return 0; +-} +- + static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) + { + struct amd_pmc_dev *dev = s->private; diff --git a/queue-5.15/series b/queue-5.15/series index 94450643aae..cf640c74eda 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -31,3 +31,11 @@ xfs-don-t-assert-fail-on-perag-references-on-teardow.patch xfs-assert-in-xfs_btree_del_cursor-should-take-into-.patch xfs-purge-dquots-after-inode-walk-fails-during-quota.patch xfs-don-t-leak-btree-cursor-when-insrec-fails-after-.patch +mptcp-do-not-wait-for-bare-sockets-timeout.patch +aio-fix-mremap-after-fork-null-deref.patch +drm-amd-display-fail-atomic_check-early-on-normalize_zpos-error.patch +platform-x86-amd-pmc-export-idlemask-values-based-on-the-apu.patch +platform-x86-amd-pmc-fix-compilation-when-config_debugfs-is-disabled.patch +platform-x86-amd-pmc-correct-usage-of-smu-version.patch +platform-x86-amd-pmc-disable-irq1-wakeup-for-rn-czn.patch +netfilter-nft_tproxy-restrict-to-prerouting-hook.patch