mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
Merge tag 'tpmdd-next-v6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
Pull tpm fix from Jarkko Sakkinen: "Correct the state transitions for ARM FF-A to match the spec and how tpm_crb behaves on other platforms" * tag 'tpmdd-next-v6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd: tpm_crb: Add idle support for the Arm FF-A start method
This commit is contained in:
@@ -133,8 +133,7 @@ static inline bool tpm_crb_has_idle(u32 start_method)
|
||||
{
|
||||
return !(start_method == ACPI_TPM2_START_METHOD ||
|
||||
start_method == ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD ||
|
||||
start_method == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC ||
|
||||
start_method == ACPI_TPM2_CRB_WITH_ARM_FFA);
|
||||
start_method == ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC);
|
||||
}
|
||||
|
||||
static bool crb_wait_for_reg_32(u32 __iomem *reg, u32 mask, u32 value,
|
||||
@@ -191,7 +190,7 @@ static int crb_try_pluton_doorbell(struct crb_priv *priv, bool wait_for_complete
|
||||
*
|
||||
* Return: 0 always
|
||||
*/
|
||||
static int __crb_go_idle(struct device *dev, struct crb_priv *priv)
|
||||
static int __crb_go_idle(struct device *dev, struct crb_priv *priv, int loc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -200,6 +199,12 @@ static int __crb_go_idle(struct device *dev, struct crb_priv *priv)
|
||||
|
||||
iowrite32(CRB_CTRL_REQ_GO_IDLE, &priv->regs_t->ctrl_req);
|
||||
|
||||
if (priv->sm == ACPI_TPM2_CRB_WITH_ARM_FFA) {
|
||||
rc = tpm_crb_ffa_start(CRB_FFA_START_TYPE_COMMAND, loc);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = crb_try_pluton_doorbell(priv, true);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -220,7 +225,7 @@ static int crb_go_idle(struct tpm_chip *chip)
|
||||
struct device *dev = &chip->dev;
|
||||
struct crb_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
return __crb_go_idle(dev, priv);
|
||||
return __crb_go_idle(dev, priv, chip->locality);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +243,7 @@ static int crb_go_idle(struct tpm_chip *chip)
|
||||
*
|
||||
* Return: 0 on success -ETIME on timeout;
|
||||
*/
|
||||
static int __crb_cmd_ready(struct device *dev, struct crb_priv *priv)
|
||||
static int __crb_cmd_ready(struct device *dev, struct crb_priv *priv, int loc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -247,6 +252,12 @@ static int __crb_cmd_ready(struct device *dev, struct crb_priv *priv)
|
||||
|
||||
iowrite32(CRB_CTRL_REQ_CMD_READY, &priv->regs_t->ctrl_req);
|
||||
|
||||
if (priv->sm == ACPI_TPM2_CRB_WITH_ARM_FFA) {
|
||||
rc = tpm_crb_ffa_start(CRB_FFA_START_TYPE_COMMAND, loc);
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = crb_try_pluton_doorbell(priv, true);
|
||||
if (rc)
|
||||
return rc;
|
||||
@@ -267,7 +278,7 @@ static int crb_cmd_ready(struct tpm_chip *chip)
|
||||
struct device *dev = &chip->dev;
|
||||
struct crb_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
return __crb_cmd_ready(dev, priv);
|
||||
return __crb_cmd_ready(dev, priv, chip->locality);
|
||||
}
|
||||
|
||||
static int __crb_request_locality(struct device *dev,
|
||||
@@ -444,7 +455,7 @@ static int crb_send(struct tpm_chip *chip, u8 *buf, size_t bufsiz, size_t len)
|
||||
|
||||
/* Seems to be necessary for every command */
|
||||
if (priv->sm == ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON)
|
||||
__crb_cmd_ready(&chip->dev, priv);
|
||||
__crb_cmd_ready(&chip->dev, priv, chip->locality);
|
||||
|
||||
memcpy_toio(priv->cmd, buf, len);
|
||||
|
||||
@@ -672,7 +683,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
|
||||
* PTT HW bug w/a: wake up the device to access
|
||||
* possibly not retained registers.
|
||||
*/
|
||||
ret = __crb_cmd_ready(dev, priv);
|
||||
ret = __crb_cmd_ready(dev, priv, 0);
|
||||
if (ret)
|
||||
goto out_relinquish_locality;
|
||||
|
||||
@@ -744,7 +755,7 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,
|
||||
if (!ret)
|
||||
priv->cmd_size = cmd_size;
|
||||
|
||||
__crb_go_idle(dev, priv);
|
||||
__crb_go_idle(dev, priv, 0);
|
||||
|
||||
out_relinquish_locality:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user