Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+28 -11
+19 -3
drivers/char/tpm/tpm-chip.c
··· 605 605 } 606 606 607 607 /* 608 - * tpm_chip_startup() - performs auto startup and allocates the PCRs 608 + * tpm_chip_bootstrap() - Boostrap TPM chip after power on 609 609 * @chip: TPM chip to use. 610 + * 611 + * Initialize TPM chip after power on. This a one-shot function: subsequent 612 + * calls will have no effect. 610 613 */ 611 - int tpm_chip_startup(struct tpm_chip *chip) 614 + int tpm_chip_bootstrap(struct tpm_chip *chip) 612 615 { 613 616 int rc; 617 + 618 + if (chip->flags & TPM_CHIP_FLAG_BOOTSTRAPPED) 619 + return 0; 614 620 615 621 rc = tpm_chip_start(chip); 616 622 if (rc) ··· 630 624 stop: 631 625 tpm_chip_stop(chip); 632 626 627 + /* 628 + * Unconditionally set, as driver initialization should cease, when the 629 + * boostrapping process fails. 630 + */ 631 + chip->flags |= TPM_CHIP_FLAG_BOOTSTRAPPED; 632 + 633 633 return rc; 634 634 } 635 - EXPORT_SYMBOL_GPL(tpm_chip_startup); 635 + EXPORT_SYMBOL_GPL(tpm_chip_bootstrap); 636 636 637 637 /* 638 638 * tpm_chip_register() - create a character device for the TPM chip ··· 654 642 int tpm_chip_register(struct tpm_chip *chip) 655 643 { 656 644 int rc; 645 + 646 + rc = tpm_chip_bootstrap(chip); 647 + if (rc) 648 + return rc; 657 649 658 650 tpm_sysfs_add_device(chip); 659 651
+1 -1
drivers/char/tpm/tpm.h
··· 264 264 delay_msec * 1000); 265 265 }; 266 266 267 - int tpm_chip_startup(struct tpm_chip *chip); 267 + int tpm_chip_bootstrap(struct tpm_chip *chip); 268 268 int tpm_chip_start(struct tpm_chip *chip); 269 269 void tpm_chip_stop(struct tpm_chip *chip); 270 270 struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip);
+1 -1
drivers/char/tpm/tpm_tis_core.c
··· 1139 1139 init_waitqueue_head(&priv->read_queue); 1140 1140 init_waitqueue_head(&priv->int_queue); 1141 1141 1142 - rc = tpm_chip_startup(chip); 1142 + rc = tpm_chip_bootstrap(chip); 1143 1143 if (rc) 1144 1144 goto out_err; 1145 1145
+7 -6
include/linux/tpm.h
··· 274 274 #define TPM_VID_ATML 0x1114 275 275 276 276 enum tpm_chip_flags { 277 - TPM_CHIP_FLAG_TPM2 = BIT(1), 278 - TPM_CHIP_FLAG_IRQ = BIT(2), 279 - TPM_CHIP_FLAG_VIRTUAL = BIT(3), 280 - TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), 281 - TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), 277 + TPM_CHIP_FLAG_BOOTSTRAPPED = BIT(0), 278 + TPM_CHIP_FLAG_TPM2 = BIT(1), 279 + TPM_CHIP_FLAG_IRQ = BIT(2), 280 + TPM_CHIP_FLAG_VIRTUAL = BIT(3), 281 + TPM_CHIP_FLAG_HAVE_TIMEOUTS = BIT(4), 282 + TPM_CHIP_FLAG_ALWAYS_POWERED = BIT(5), 282 283 TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = BIT(6), 283 - TPM_CHIP_FLAG_FIRMWARE_UPGRADE = BIT(7), 284 + TPM_CHIP_FLAG_FIRMWARE_UPGRADE = BIT(7), 284 285 }; 285 286 286 287 #define to_tpm_chip(d) container_of(d, struct tpm_chip, dev)