tpm: Do not remap from ACPI resouces again for Pluton TPM
Subsystems (2)
PATCH 1/1 tpm: Do not remap from ACPI resouces again for Pluton TPM
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Since remapping is already done in crb_map_pluton, remapping again in crb_map_io causes EBUSY error:
``` [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 ``` --- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm_crb.c +11 -8
@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,u32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;
Signature · 1 line
2.41.0
PATCH v2 1/1 tpm: Do not remap from ACPI resouces again for Pluton TPM
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Since remapping is already done in crb_map_pluton, remapping again in crb_map_io causes EBUSY error:
``` [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 ```
---
v2: add missing sign-off in commit message
--- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm_crb.c +11 -8
@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,u32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;
Signature · 1 line
2.41.0
Jarkko Sakkinen
maintainerQuoted 4 lines · Valentin David
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Quoted 8 lines
Since remapping is already done in
crb_map_pluton, remapping again incrb_map_iocauses EBUSY error:``` [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 ```Signed-off-by Valentin David <[email protected]>
Please add a fixes tag.
Quoted 39 lines
---
v2: add missing sign-off in commit message--- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)drivers/char/tpm/tpm_crb.c +11
-8@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,u32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;Signature · 1 line
2.41.0
I don't see anything else to complain about.
BR, Jarkko
PATCH v3 1/1 tpm: Do not remap from ACPI resouces again for Pluton TPM
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Since remapping is already done in crb_map_pluton, remapping again in crb_map_io causes EBUSY error:
``` [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 ```
---
v3: Add fixes tag
--- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/char/tpm/tpm_crb.c +11 -8
@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,u32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;
Signature · 1 line
2.41.0
Quoted 53 lines · Valentin David
For Pluton TPM devices, it was assumed that there was no ACPI memory regions. This is not true for ASUS ROG Ally. ACPI advertises 0xfd500000-0xfd5fffff.
Since remapping is already done in
crb_map_pluton, remapping again incrb_map_iocauses EBUSY error:``` [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [mem 0xfd500000-0xfd5fffff] [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 ```Fixes 4d2732882703 ("tpm_crb: Add support for CRB devices based on Pluton")Signed-off-by Valentin David <[email protected]>---
v3: Add fixes tag--- drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)drivers/char/tpm/tpm_crb.c +11
-8@@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, struct crb_priv *priv,u32 rsp_size;int ret; -INIT_LIST_HEAD (&acpi_resource_list); - ret =acpi_dev_get_resources (device, &acpi_resource_list, - crb_check_resource, iores_array); -if (ret <0 ) -return ret; -acpi_dev_free_resource_list (&acpi_resource_list); - -/* Pluton doesn't appear to define ACPI memory regions */ +/* +* Pluton sometimes does not define ACPI memory regions. +* Mapping is then done in crb_map_pluton +*/ if (priv->sm !=ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON ) { +INIT_LIST_HEAD (&acpi_resource_list); + ret =acpi_dev_get_resources (device, &acpi_resource_list, + crb_check_resource, iores_array); +if (ret <0 ) +return ret; +acpi_dev_free_resource_list (&acpi_resource_list); +if (resource_type (iores_array) !=IORESOURCE_MEM ) {dev_err (dev,FW_BUG "TPM2 ACPI table does not define a memory resource\n" );return -EINVAL ;Signature · 1 line
2.41.0
BR, Jarkko