This pull request contains two more bug fixes for tpm_crb, in other
 words categorically disabling rng for AMD CPU's in the tpm_crb driver,
 discarding the earlier probing approach.
 
 BR, Jarkko
 -----BEGIN PGP SIGNATURE-----
 
 iIgEABYIADAWIQRE6pSOnaBC00OEHEIaerohdGur0gUCZPYxGRIcamFya2tvQGtl
 cm5lbC5vcmcACgkQGnq6IXRrq9IRiwD+Lly+vi9Z6qouF72XUnNMohg0PFeHp/Ra
 7yD1LRALWSgBAMqUlFjA62/OEbJDWK+WS3gUx+e20y7L2OeSLPZVfqYB
 =DbwG
 -----END PGP SIGNATURE-----

Merge tag 'tpmdd-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

Pull more tpm updates from Jarkko Sakkinen:
 "Two more bug fixes for tpm_crb, categorically disabling rng for AMD
  CPU's in the tpm_crb driver, discarding the earlier probing approach"

* tag 'tpmdd-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
  tpm: Enable hwrng only for Pluton on AMD CPUs
  tpm_crb: Fix an error handling path in crb_acpi_add()
This commit is contained in:
Linus Torvalds 2023-09-05 11:15:59 -07:00
commit 6155a3b885

View file

@ -463,28 +463,6 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)
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,
@ -797,12 +775,13 @@ static int crb_acpi_add(struct acpi_device *device)
FW_BUG "TPM2 ACPI table has wrong size %u for start method type %d\n",
buf->header.length,
ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON);
return -EINVAL;
rc = -EINVAL;
goto out;
}
crb_pluton = ACPI_ADD_PTR(struct tpm2_crb_pluton, buf, sizeof(*buf));
rc = crb_map_pluton(dev, priv, buf, crb_pluton);
if (rc)
return rc;
goto out;
}
priv->sm = sm;
@ -826,9 +805,14 @@ static int crb_acpi_add(struct acpi_device *device)
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);