mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
This PR fixes a critical bug in my first pull request. I fixed the
cherry pick issue and tested with real hardare and libvirt/qemu plus swtpm. -----BEGIN PGP SIGNATURE----- iIgEABYIADAWIQRE6pSOnaBC00OEHEIaerohdGur0gUCZE55VRIcamFya2tvQGtl cm5lbC5vcmcACgkQGnq6IXRrq9ILfAD+OPfN2zNx0bAmKB9iRvBulD1P6TIaFUOu 8xrTkCyfPugA/0khCPhEz44RjMkVy8wdpDRalIdo0M4zIf3XSCFJA7oL =uhNB -----END PGP SIGNATURE----- Merge tag 'tpmdd-v6.4-rc1-fix-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd Pull tpm fix from Jarkko Sakkinen: "This fixes a critical bug in my first pull request. I fixed the cherry pick issue and tested with real hardare and libvirt/qemu plus swtpm" * tag 'tpmdd-v6.4-rc1-fix-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: tpm: Re-enable TPM chip boostrapping non-tpm_tis TPM drivers
This commit is contained in:
commit
ed9a65e575
4 changed files with 28 additions and 11 deletions
|
|
@ -605,13 +605,19 @@ static int tpm_get_pcr_allocation(struct tpm_chip *chip)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tpm_chip_startup() - performs auto startup and allocates the PCRs
|
* tpm_chip_bootstrap() - Boostrap TPM chip after power on
|
||||||
* @chip: TPM chip to use.
|
* @chip: TPM chip to use.
|
||||||
|
*
|
||||||
|
* Initialize TPM chip after power on. This a one-shot function: subsequent
|
||||||
|
* calls will have no effect.
|
||||||
*/
|
*/
|
||||||
int tpm_chip_startup(struct tpm_chip *chip)
|
int tpm_chip_bootstrap(struct tpm_chip *chip)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if (chip->flags & TPM_CHIP_FLAG_BOOTSTRAPPED)
|
||||||
|
return 0;
|
||||||
|
|
||||||
rc = tpm_chip_start(chip);
|
rc = tpm_chip_start(chip);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -624,9 +630,15 @@ int tpm_chip_startup(struct tpm_chip *chip)
|
||||||
stop:
|
stop:
|
||||||
tpm_chip_stop(chip);
|
tpm_chip_stop(chip);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Unconditionally set, as driver initialization should cease, when the
|
||||||
|
* boostrapping process fails.
|
||||||
|
*/
|
||||||
|
chip->flags |= TPM_CHIP_FLAG_BOOTSTRAPPED;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(tpm_chip_startup);
|
EXPORT_SYMBOL_GPL(tpm_chip_bootstrap);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* tpm_chip_register() - create a character device for the TPM chip
|
* tpm_chip_register() - create a character device for the TPM chip
|
||||||
|
|
@ -643,6 +655,10 @@ int tpm_chip_register(struct tpm_chip *chip)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
rc = tpm_chip_bootstrap(chip);
|
||||||
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
tpm_sysfs_add_device(chip);
|
tpm_sysfs_add_device(chip);
|
||||||
|
|
||||||
tpm_bios_log_setup(chip);
|
tpm_bios_log_setup(chip);
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ static inline void tpm_msleep(unsigned int delay_msec)
|
||||||
delay_msec * 1000);
|
delay_msec * 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
int tpm_chip_startup(struct tpm_chip *chip);
|
int tpm_chip_bootstrap(struct tpm_chip *chip);
|
||||||
int tpm_chip_start(struct tpm_chip *chip);
|
int tpm_chip_start(struct tpm_chip *chip);
|
||||||
void tpm_chip_stop(struct tpm_chip *chip);
|
void tpm_chip_stop(struct tpm_chip *chip);
|
||||||
struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip);
|
struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip);
|
||||||
|
|
|
||||||
|
|
@ -1139,7 +1139,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
|
||||||
init_waitqueue_head(&priv->read_queue);
|
init_waitqueue_head(&priv->read_queue);
|
||||||
init_waitqueue_head(&priv->int_queue);
|
init_waitqueue_head(&priv->int_queue);
|
||||||
|
|
||||||
rc = tpm_chip_startup(chip);
|
rc = tpm_chip_bootstrap(chip);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -274,13 +274,14 @@ enum tpm2_cc_attrs {
|
||||||
#define TPM_VID_ATML 0x1114
|
#define TPM_VID_ATML 0x1114
|
||||||
|
|
||||||
enum tpm_chip_flags {
|
enum tpm_chip_flags {
|
||||||
TPM_CHIP_FLAG_TPM2 = BIT(1),
|
TPM_CHIP_FLAG_BOOTSTRAPPED = BIT(0),
|
||||||
TPM_CHIP_FLAG_IRQ = BIT(2),
|
TPM_CHIP_FLAG_TPM2 = BIT(1),
|
||||||
TPM_CHIP_FLAG_VIRTUAL = BIT(3),
|
TPM_CHIP_FLAG_IRQ = BIT(2),
|
||||||
TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4),
|
TPM_CHIP_FLAG_VIRTUAL = BIT(3),
|
||||||
TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5),
|
TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4),
|
||||||
|
TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5),
|
||||||
TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6),
|
TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6),
|
||||||
TPM_CHIP_FLAG_FIRMWARE_UPGRADE = BIT(7),
|
TPM_CHIP_FLAG_FIRMWARE_UPGRADE = BIT(7),
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)
|
#define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue