Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1436ab06 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull TPM updates from James Morris:
 "Here are the TPM updates from Jarkko for v4.14, which I've placed in
  their own branch (next-tpm). I ended up cherry-picking them as other
  changes had been made in Jarkko's branch after he sent me his original
  pull request.

  I plan on maintaining a separate branch for TPM (and other security
  subsystems) from now on.

  From Jarkko: 'Not much this time except a few fixes'"

* 'next-tpm' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
  tpm: ibmvtpm: simplify crq initialization and document crq format
  tpm: replace msleep() with  usleep_range() in TPM 1.2/2.0 generic drivers
  Documentation: tpm: add powered-while-suspended binding documentation
  tpm: tpm_crb: constify acpi_device_id.
  tpm: vtpm: constify vio_device_id
parents cd4175b1 fb154e0e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -8,6 +8,12 @@ Required properties:
                   the firmware event log
- linux,sml-size : size of the memory allocated for the firmware event log

Optional properties:

- powered-while-suspended: present when the TPM is left powered on between
                           suspend and resume (makes the suspend/resume
                           callbacks do nothing).

Example (for OpenPower Systems with Nuvoton TPM 2.0 on I2C)
----------------------------------------------------------

+5 −5
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
			goto out;
		}

		msleep(TPM_TIMEOUT);	/* CHECK */
		tpm_msleep(TPM_TIMEOUT);
		rmb();
	} while (time_before(jiffies, stop));

@@ -970,7 +970,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
			dev_info(
			    &chip->dev, HW_ERR
			    "TPM command timed out during continue self test");
			msleep(delay_msec);
			tpm_msleep(delay_msec);
			continue;
		}

@@ -985,7 +985,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
		}
		if (rc != TPM_WARN_DOING_SELFTEST)
			return rc;
		msleep(delay_msec);
		tpm_msleep(delay_msec);
	} while (--loops > 0);

	return rc;
@@ -1085,7 +1085,7 @@ int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
		}
	} else {
		do {
			msleep(TPM_TIMEOUT);
			tpm_msleep(TPM_TIMEOUT);
			status = chip->ops->status(chip);
			if ((status & mask) == mask)
				return 0;
@@ -1150,7 +1150,7 @@ int tpm_pm_suspend(struct device *dev)
		 */
		if (rc != TPM_WARN_RETRY)
			break;
		msleep(TPM_TIMEOUT_RETRY);
		tpm_msleep(TPM_TIMEOUT_RETRY);
	}

	if (rc)
+8 −1
Original line number Diff line number Diff line
@@ -50,7 +50,8 @@ enum tpm_const {

enum tpm_timeout {
	TPM_TIMEOUT = 5,	/* msecs */
	TPM_TIMEOUT_RETRY = 100 /* msecs */
	TPM_TIMEOUT_RETRY = 100, /* msecs */
	TPM_TIMEOUT_RANGE_US = 300	/* usecs */
};

/* TPM addresses */
@@ -527,6 +528,12 @@ int tpm_pm_resume(struct device *dev);
int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
		      wait_queue_head_t *queue, bool check_cancel);

static inline void tpm_msleep(unsigned int delay_msec)
{
	usleep_range(delay_msec * 1000,
		     (delay_msec * 1000) + TPM_TIMEOUT_RANGE_US);
};

struct tpm_chip *tpm_chip_find_get(int chip_num);
__must_check int tpm_try_get_ops(struct tpm_chip *chip);
void tpm_put_ops(struct tpm_chip *chip);
+1 −1
Original line number Diff line number Diff line
@@ -899,7 +899,7 @@ static int tpm2_do_selftest(struct tpm_chip *chip)
		if (rc != TPM2_RC_TESTING)
			break;

		msleep(delay_msec);
		tpm_msleep(delay_msec);
	}

	return rc;
+1 −1
Original line number Diff line number Diff line
@@ -665,7 +665,7 @@ static const struct dev_pm_ops crb_pm = {
	SET_RUNTIME_PM_OPS(crb_pm_runtime_suspend, crb_pm_runtime_resume, NULL)
};

static struct acpi_device_id crb_device_ids[] = {
static const struct acpi_device_id crb_device_ids[] = {
	{"MSFT0101", 0},
	{"", 0},
};
Loading