]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Sep 2023 10:20:50 +0000 (11:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Sep 2023 10:20:50 +0000 (11:20 +0100)
added patches:
cpufreq-intel_pstate-set-stale-cpu-frequency-to-minimum.patch
crypto-rsa-pkcs1pad-use-helper-to-set-reqsize.patch
of-property-simplify-of_link_to_phandle.patch
tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch

queue-6.1/cpufreq-intel_pstate-set-stale-cpu-frequency-to-minimum.patch [new file with mode: 0644]
queue-6.1/crypto-rsa-pkcs1pad-use-helper-to-set-reqsize.patch [new file with mode: 0644]
queue-6.1/of-property-simplify-of_link_to_phandle.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch [new file with mode: 0644]

diff --git a/queue-6.1/cpufreq-intel_pstate-set-stale-cpu-frequency-to-minimum.patch b/queue-6.1/cpufreq-intel_pstate-set-stale-cpu-frequency-to-minimum.patch
new file mode 100644 (file)
index 0000000..776d260
--- /dev/null
@@ -0,0 +1,47 @@
+From d51847acb018d83186e4af67bc93f9a00a8644f7 Mon Sep 17 00:00:00 2001
+From: Doug Smythies <dsmythies@telus.net>
+Date: Sun, 20 Aug 2023 13:46:49 -0700
+Subject: cpufreq: intel_pstate: set stale CPU frequency to minimum
+
+From: Doug Smythies <dsmythies@telus.net>
+
+commit d51847acb018d83186e4af67bc93f9a00a8644f7 upstream.
+
+The intel_pstate CPU frequency scaling driver does not
+use policy->cur and it is 0.
+When the CPU frequency is outdated arch_freq_get_on_cpu()
+will default to the nominal clock frequency when its call to
+cpufreq_quick_getpolicy_cur returns the never updated 0.
+Thus, the listed frequency might be outside of currently
+set limits. Some users are complaining about the high
+reported frequency, albeit stale, when their system is
+idle and/or it is above the reduced maximum they have set.
+
+This patch will maintain policy_cur for the intel_pstate
+driver at the current minimum CPU frequency.
+
+Reported-by: Yang Jie <yang.jie@linux.intel.com>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217597
+Signed-off-by: Doug Smythies <dsmythies@telus.net>
+[ rjw: White space damage fixes and comment adjustment ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/cpufreq/intel_pstate.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/cpufreq/intel_pstate.c
++++ b/drivers/cpufreq/intel_pstate.c
+@@ -2574,6 +2574,11 @@ static int intel_pstate_set_policy(struc
+                       intel_pstate_clear_update_util_hook(policy->cpu);
+               intel_pstate_hwp_set(policy->cpu);
+       }
++      /*
++       * policy->cur is never updated with the intel_pstate driver, but it
++       * is used as a stale frequency value. So, keep it within limits.
++       */
++      policy->cur = policy->min;
+       mutex_unlock(&intel_pstate_limits_lock);
diff --git a/queue-6.1/crypto-rsa-pkcs1pad-use-helper-to-set-reqsize.patch b/queue-6.1/crypto-rsa-pkcs1pad-use-helper-to-set-reqsize.patch
new file mode 100644 (file)
index 0000000..dad3eba
--- /dev/null
@@ -0,0 +1,39 @@
+From 5b11d1a360ea23c80c6d4ec3f5986a788d0a0995 Mon Sep 17 00:00:00 2001
+From: Herbert Xu <herbert@gondor.apana.org.au>
+Date: Tue, 22 Nov 2022 13:53:38 +0800
+Subject: crypto: rsa-pkcs1pad - Use helper to set reqsize
+
+From: Herbert Xu <herbert@gondor.apana.org.au>
+
+commit 5b11d1a360ea23c80c6d4ec3f5986a788d0a0995 upstream.
+
+The value of reqsize must only be changed through the helper.
+
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ crypto/rsa-pkcs1pad.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/crypto/rsa-pkcs1pad.c
++++ b/crypto/rsa-pkcs1pad.c
+@@ -575,6 +575,10 @@ static int pkcs1pad_init_tfm(struct cryp
+               return PTR_ERR(child_tfm);
+       ctx->child = child_tfm;
++
++      akcipher_set_reqsize(tfm, sizeof(struct pkcs1pad_request) +
++                                crypto_akcipher_reqsize(child_tfm));
++
+       return 0;
+ }
+@@ -670,7 +674,6 @@ static int pkcs1pad_create(struct crypto
+       inst->alg.set_pub_key = pkcs1pad_set_pub_key;
+       inst->alg.set_priv_key = pkcs1pad_set_priv_key;
+       inst->alg.max_size = pkcs1pad_get_max_size;
+-      inst->alg.reqsize = sizeof(struct pkcs1pad_request) + rsa_alg->reqsize;
+       inst->free = pkcs1pad_free;
diff --git a/queue-6.1/of-property-simplify-of_link_to_phandle.patch b/queue-6.1/of-property-simplify-of_link_to_phandle.patch
new file mode 100644 (file)
index 0000000..2e87f69
--- /dev/null
@@ -0,0 +1,144 @@
+From 4a032827daa89350365166b19d14d82fe8219128 Mon Sep 17 00:00:00 2001
+From: Saravana Kannan <saravanak@google.com>
+Date: Mon, 6 Feb 2023 17:42:01 -0800
+Subject: of: property: Simplify of_link_to_phandle()
+
+From: Saravana Kannan <saravanak@google.com>
+
+commit 4a032827daa89350365166b19d14d82fe8219128 upstream.
+
+The driver core now:
+- Has the parent device of a supplier pick up the consumers if the
+  supplier never has a device created for it.
+- Ignores a supplier if the supplier has no parent device and will never
+  be probed by a driver
+
+And already prevents creating a device link with the consumer as a
+supplier of a parent.
+
+So, we no longer need to find the "compatible" node of the supplier or
+do any other checks in of_link_to_phandle(). We simply need to make sure
+that the supplier is available in DT.
+
+Signed-off-by: Saravana Kannan <saravanak@google.com>
+Tested-by: Colin Foster <colin.foster@in-advantage.com>
+Tested-by: Sudeep Holla <sudeep.holla@arm.com>
+Tested-by: Douglas Anderson <dianders@chromium.org>
+Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Tested-by: Luca Weiss <luca.weiss@fairphone.com> # qcom/sm7225-fairphone-fp4
+Link: https://lore.kernel.org/r/20230207014207.1678715-10-saravanak@google.com
+Fixes: eaf9b5612a47 ("driver core: fw_devlink: Don't purge child fwnode's consumer links")
+Signed-off-by:  Adam Ford <aford173@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/property.c |   84 +++++++-------------------------------------------
+ 1 file changed, 13 insertions(+), 71 deletions(-)
+
+--- a/drivers/of/property.c
++++ b/drivers/of/property.c
+@@ -1062,20 +1062,6 @@ of_fwnode_device_get_match_data(const st
+       return of_device_get_match_data(dev);
+ }
+-static bool of_is_ancestor_of(struct device_node *test_ancestor,
+-                            struct device_node *child)
+-{
+-      of_node_get(child);
+-      while (child) {
+-              if (child == test_ancestor) {
+-                      of_node_put(child);
+-                      return true;
+-              }
+-              child = of_get_next_parent(child);
+-      }
+-      return false;
+-}
+-
+ static struct device_node *of_get_compat_node(struct device_node *np)
+ {
+       of_node_get(np);
+@@ -1106,71 +1092,27 @@ static struct device_node *of_get_compat
+       return node;
+ }
+-/**
+- * of_link_to_phandle - Add fwnode link to supplier from supplier phandle
+- * @con_np: consumer device tree node
+- * @sup_np: supplier device tree node
+- *
+- * Given a phandle to a supplier device tree node (@sup_np), this function
+- * finds the device that owns the supplier device tree node and creates a
+- * device link from @dev consumer device to the supplier device. This function
+- * doesn't create device links for invalid scenarios such as trying to create a
+- * link with a parent device as the consumer of its child device. In such
+- * cases, it returns an error.
+- *
+- * Returns:
+- * - 0 if fwnode link successfully created to supplier
+- * - -EINVAL if the supplier link is invalid and should not be created
+- * - -ENODEV if struct device will never be create for supplier
+- */
+-static int of_link_to_phandle(struct device_node *con_np,
++static void of_link_to_phandle(struct device_node *con_np,
+                             struct device_node *sup_np)
+ {
+-      struct device *sup_dev;
+-      struct device_node *tmp_np = sup_np;
++      struct device_node *tmp_np = of_node_get(sup_np);
+-      /*
+-       * Find the device node that contains the supplier phandle.  It may be
+-       * @sup_np or it may be an ancestor of @sup_np.
+-       */
+-      sup_np = of_get_compat_node(sup_np);
+-      if (!sup_np) {
+-              pr_debug("Not linking %pOFP to %pOFP - No device\n",
+-                       con_np, tmp_np);
+-              return -ENODEV;
+-      }
++      /* Check that sup_np and its ancestors are available. */
++      while (tmp_np) {
++              if (of_fwnode_handle(tmp_np)->dev) {
++                      of_node_put(tmp_np);
++                      break;
++              }
+-      /*
+-       * Don't allow linking a device node as a consumer of one of its
+-       * descendant nodes. By definition, a child node can't be a functional
+-       * dependency for the parent node.
+-       */
+-      if (of_is_ancestor_of(con_np, sup_np)) {
+-              pr_debug("Not linking %pOFP to %pOFP - is descendant\n",
+-                       con_np, sup_np);
+-              of_node_put(sup_np);
+-              return -EINVAL;
+-      }
++              if (!of_device_is_available(tmp_np)) {
++                      of_node_put(tmp_np);
++                      return;
++              }
+-      /*
+-       * Don't create links to "early devices" that won't have struct devices
+-       * created for them.
+-       */
+-      sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
+-      if (!sup_dev &&
+-          (of_node_check_flag(sup_np, OF_POPULATED) ||
+-           sup_np->fwnode.flags & FWNODE_FLAG_NOT_DEVICE)) {
+-              pr_debug("Not linking %pOFP to %pOFP - No struct device\n",
+-                       con_np, sup_np);
+-              of_node_put(sup_np);
+-              return -ENODEV;
++              tmp_np = of_get_next_parent(tmp_np);
+       }
+-      put_device(sup_dev);
+       fwnode_link_add(of_fwnode_handle(con_np), of_fwnode_handle(sup_np));
+-      of_node_put(sup_np);
+-
+-      return 0;
+ }
+ /**
index f706befd13704e14363479f839c2e133d27b2c93..fc6ef7ddae73dbd6e40dd965a06e8aafb71ba13b 100644 (file)
@@ -75,3 +75,7 @@ alsa-seq-oss-fix-racy-open-close-of-midi-devices.patch
 net-sfp-handle-100g-25g-active-optical-cables-in-sfp.patch
 tracing-introduce-pipe_cpumask-to-avoid-race-on-trac.patch
 platform-mellanox-fix-mlxbf-tmfifo-not-handling-all-.patch
+of-property-simplify-of_link_to_phandle.patch
+cpufreq-intel_pstate-set-stale-cpu-frequency-to-minimum.patch
+crypto-rsa-pkcs1pad-use-helper-to-set-reqsize.patch
+tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch
diff --git a/queue-6.1/tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch b/queue-6.1/tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch
new file mode 100644 (file)
index 0000000..55aef4c
--- /dev/null
@@ -0,0 +1,82 @@
+From 8f7f35e5aa6f2182eabcfa3abef4d898a48e9aa8 Mon Sep 17 00:00:00 2001
+From: Jarkko Sakkinen <jarkko@kernel.org>
+Date: Mon, 4 Sep 2023 21:12:10 +0300
+Subject: tpm: Enable hwrng only for Pluton on AMD CPUs
+
+From: Jarkko Sakkinen <jarkko@kernel.org>
+
+commit 8f7f35e5aa6f2182eabcfa3abef4d898a48e9aa8 upstream.
+
+The vendor check introduced by commit 554b841d4703 ("tpm: Disable RNG for
+all AMD fTPMs") doesn't work properly on a number of Intel fTPMs.  On the
+reported systems the TPM doesn't reply at bootup and returns back the
+command code. This makes the TPM fail probe on Lenovo Legion Y540 laptop.
+
+Since only Microsoft Pluton is the only known combination of AMD CPU and
+fTPM from other vendor, disable hwrng otherwise. In order to make sysadmin
+aware of this, print also info message to the klog.
+
+Cc: stable@vger.kernel.org
+Fixes: 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")
+Reported-by: Todd Brandt <todd.e.brandt@intel.com>
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217804
+Reported-by: Patrick Steinhardt <ps@pks.im>
+Reported-by: Raymond Jay Golo <rjgolo@gmail.com>
+Reported-by: Ronan Pigott <ronan@rjp.ie>
+Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
+Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
+Cc: Thorsten Leemhuis <regressions@leemhuis.info>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/char/tpm/tpm_crb.c |   33 ++++++++-------------------------
+ 1 file changed, 8 insertions(+), 25 deletions(-)
+
+--- a/drivers/char/tpm/tpm_crb.c
++++ b/drivers/char/tpm/tpm_crb.c
+@@ -463,28 +463,6 @@ static bool crb_req_canceled(struct tpm_
+       return (cancel & CRB_CANCEL_INVOKE) == CRB_CANCEL_INVOKE;
+ }
+-static int crb_check_flags(struct tpm_chip *chip)
+-{
+-      u32 val;
+-      int ret;
+-
+-      ret = crb_request_locality(chip, 0);
+-      if (ret)
+-              return ret;
+-
+-      ret = tpm2_get_tpm_pt(chip, TPM2_PT_MANUFACTURER, &val, NULL);
+-      if (ret)
+-              goto release;
+-
+-      if (val == 0x414D4400U /* AMD */)
+-              chip->flags |= TPM_CHIP_FLAG_HWRNG_DISABLED;
+-
+-release:
+-      crb_relinquish_locality(chip, 0);
+-
+-      return ret;
+-}
+-
+ static const struct tpm_class_ops tpm_crb = {
+       .flags = TPM_OPS_AUTO_STARTUP,
+       .status = crb_status,
+@@ -826,9 +804,14 @@ static int crb_acpi_add(struct acpi_devi
+       if (rc)
+               goto out;
+-      rc = crb_check_flags(chip);
+-      if (rc)
+-              goto out;
++#ifdef CONFIG_X86
++      /* A quirk for https://www.amd.com/en/support/kb/faq/pa-410 */
++      if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
++          priv->sm != ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON) {
++              dev_info(dev, "Disabling hwrng\n");
++              chip->flags |= TPM_CHIP_FLAG_HWRNG_DISABLED;
++      }
++#endif /* CONFIG_X86 */
+       rc = tpm_chip_register(chip);