tpm: Don't make vendor check required for probe
Subsystems (3)
PATCH v2 1/1 tpm: Don't make vendor check required for probe
The vendor check introduced by commit 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.
As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
---v1->v2:
* Check x86 vendor for AMD
--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_crb.c +6 -1
@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)
@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif return ret; }
Signature · 1 line
2.34.1
Hi Mario,
Thanks for the patch. I applied v2 to linux v6.4.11 and it resolves the issue on my workstation with the intel ADL fTPM.
Cheers,
Ronan
Raymond Jay Golo
Tested-byQuoted 51 lines
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +6
-1@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif return ret; }Signature · 1 line
2.34.1
Fixes problem on my machine.
Jarkko Sakkinen
maintainerQuoted 42 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +5
-1@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)
drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 4 lines
drivers/char/tpm/tpm_crb.c +1
-0@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif
Looks much better but the main question here is that is this combination possible:
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)
BR, Jarkko
Quoted 51 lines · Jarkko Sakkinen
Quoted 42 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +5
-1@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 4 lines
drivers/char/tpm/tpm_crb.c +1
-0@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the tpm_crb driver.
Quoted 52 lines · Mario Limonciello
Quoted 51 lines · Jarkko Sakkinen
Quoted 42 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +5
-1@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 4 lines
drivers/char/tpm/tpm_crb.c +1
-0@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 8 lines
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the
tpm_crbdriver.
Then I guess we'll go with this for now. Thanks for the effort.
I'm planning to send a pull request right after this with the fix so it will land to v6.6-rc1 or v6.6-rc2:
https://lore.kernel.org/linux-integrity/[email protected]/
BR, Jarkko
Quoted 64 lines · Jarkko Sakkinen
Quoted 52 lines · Mario Limonciello
Quoted 51 lines · Jarkko Sakkinen
Quoted 42 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +5
-1@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ; +#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret; ret =crb_request_locality (chip,0 );if (ret)drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 4 lines
drivers/char/tpm/tpm_crb.c +1
-0@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 8 lines
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the
tpm_crbdriver.Then I guess we'll go with this for now. Thanks for the effort.
Quoted 8 lines
Reviewed-by Jarkko Sakkinen <[email protected]>I'm planning to send a pull request right after this with the fix so it will land to v6.6-rc1 or v6.6-rc2:
https://lore.kernel.org/linux-integrity/[email protected]/BR, Jarkko
Super minor nit that isn't this patch in particular so don't hold this up, but it seems like the function name for the earlier attempt to solve this issue that mentioned amd and ftpm was a clearer description of what was happening than crb_check_flags.
Regards,
Jerry
Jarkko Sakkinen
maintainerQuoted 33 lines · Jerry Snitselaar
Quoted 32 lines · Jarkko Sakkinen
Quoted 31 lines · Mario Limonciello
Quoted 30 lines · Jarkko Sakkinen
Quoted 29 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +0
-0@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 468
Quoted 3 lines
drivers/char/tpm/tpm_crb.c +1
-0static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ;
Oops I missed this. This adds unnecessary clutter to the diff.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 473
Quoted 5 lines
drivers/char/tpm/tpm_crb.c +4
-1+#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret;
No reason to use variable here. Should be just "return 0". It also documents what is going on. Now this gives impression as the "ret" could change.
I dropped the current version from my -next. I did not notice the change in declarations earlier, sorry.
Quoted 30 lines
Quoted 30 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 8 lines
drivers/char/tpm/tpm_crb.c +1
-0ret =crb_request_locality (chip,0 );if (ret)@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 8 lines
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the
tpm_crbdriver.Then I guess we'll go with this for now. Thanks for the effort.
Reviewed-by Jarkko Sakkinen <[email protected]>I'm planning to send a pull request right after this with the fix so it will land to v6.6-rc1 or v6.6-rc2:
https://lore.kernel.org/linux-integrity/[email protected]/
Quoted 7 lines
Quoted 1 line
BR, Jarkko
Super minor nit that isn't this patch in particular so don't hold this up, but it seems like the function name for the earlier attempt to solve this issue that mentioned amd and ftpm was a clearer description of what was happening than
crb_check_flags.
I posted an alternative: https://lkml.org/lkml/2023/8/22/1188
BR, Jarkko
Jarkko Sakkinen
maintainerQuoted 85 lines · Jarkko Sakkinen
Quoted 33 lines · Jerry Snitselaar
Quoted 32 lines · Jarkko Sakkinen
Quoted 31 lines · Mario Limonciello
Quoted 30 lines · Jarkko Sakkinen
Quoted 29 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +0
-0@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 468
Quoted 3 lines
drivers/char/tpm/tpm_crb.c +1
-0static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ;Oops I missed this. This adds unnecessary clutter to the diff.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 473
Quoted 5 lines
drivers/char/tpm/tpm_crb.c +4
-1+#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret;No reason to use variable here. Should be just "return 0". It also documents what is going on. Now this gives impression as the "ret" could change.
I dropped the current version from my -next. I did not notice the change in declarations earlier, sorry.
Quoted 33 lines
Quoted 31 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 8 lines
drivers/char/tpm/tpm_crb.c +1
-0ret =crb_request_locality (chip,0 );if (ret)@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 8 lines
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the
tpm_crbdriver.Then I guess we'll go with this for now. Thanks for the effort.
Reviewed-by Jarkko Sakkinen <[email protected]>I'm planning to send a pull request right after this with the fix so it will land to v6.6-rc1 or v6.6-rc2:
https://lore.kernel.org/linux-integrity/[email protected]/BR, Jarkko
Quoted 6 lines
Quoted 4 lines
Super minor nit that isn't this patch in particular so don't hold this up, but it seems like the function name for the earlier attempt to solve this issue that mentioned amd and ftpm was a clearer description of what was happening than
crb_check_flags.I posted an alternative: https://lkml.org/lkml/2023/8/22/1188
Ignore my reviewed-by (I cannot review my own patches) :-)
Also should be probably v6.4+ (should check when the fix landed)?
BR, Jarkko
Jarkko Sakkinen
maintainerQuoted 91 lines · Jarkko Sakkinen
Quoted 90 lines · Jarkko Sakkinen
Quoted 33 lines · Jerry Snitselaar
Quoted 32 lines · Jarkko Sakkinen
Quoted 31 lines · Mario Limonciello
Quoted 30 lines · Jarkko Sakkinen
Quoted 29 lines · Mario Limonciello
The vendor check introduced by commit
554b841d4703("tpm: Disable RNG for all AMD fTPMs") doesn't work properly on a number of Intel fTPMs. On the reported systems the TPM doesn't reply at bootup and returns back the command code. This makes the TPM fail probe.As this isn't crucial for anything but AMD fTPM and AMD fTPM works, check the chip vendor and if it's not AMD don't run the checks.
Fixes 554b841d4703 ("tpm: Disable RNG for all AMD fTPMs")Reported-by Todd Brandt <[email protected]>Reported-by Patrick Steinhardt <[email protected]>Reported-by Ronan Pigott <[email protected]>Reported-by Raymond Jay Golo <[email protected]>Signed-off-by Mario Limonciello <[email protected]>---
v1->v2:
* Check x86 vendor for AMD--- drivers/char/tpm/tpm_crb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/char/tpm/tpm_crb.c +0
-0@@ -465,8 +465,12 @@ static bool crb_req_canceled(struct tpm_chip *chip, u8 status)Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 468
Quoted 3 lines
drivers/char/tpm/tpm_crb.c +1
-0static int crb_check_flags (struct tpm_chip *chip) { +int ret =0 ;Oops I missed this. This adds unnecessary clutter to the diff.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/char/tpm/tpm_crb.c static bool crb_req_canceled(struct tpm_chip *chip, u8 status) · line 472
Quoted 5 lines
drivers/char/tpm/tpm_crb.c +4
-1+#ifdef CONFIG_X86 u32 val; -int ret; + +if (boot_cpu_data.x86_vendor !=X86_VENDOR_AMD ) +return ret;No reason to use variable here. Should be just "return 0". It also documents what is going on. Now this gives impression as the "ret" could change.
I dropped the current version from my -next. I did not notice the change in declarations earlier, sorry.
Quoted 37 lines
Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
drivers/char/tpm/tpm_crb.c static int crb_check_flags(struct tpm_chip *chip) · line 488
Quoted 8 lines
drivers/char/tpm/tpm_crb.c +1
-0ret =crb_request_locality (chip,0 );if (ret)@@ -481,6 +485,7 @@ static int crb_check_flags(struct tpm_chip *chip) release:crb_relinquish_locality (chip,0 ); +#endif Looks much better but the main question here is that is this combination possible:
Quoted 8 lines
Quoted 4 lines
1. AMD CPU
2. Non-AMD fTPM (i.e. manufacturer property differs)BR, Jarkko
Yes that combination is possible.
Pluton TPM uses the
tpm_crbdriver.Then I guess we'll go with this for now. Thanks for the effort.
Quoted 8 lines
Reviewed-by Jarkko Sakkinen <[email protected]>I'm planning to send a pull request right after this with the fix so it will land to v6.6-rc1 or v6.6-rc2:
https://lore.kernel.org/linux-integrity/[email protected]/BR, Jarkko
Super minor nit that isn't this patch in particular so don't hold this up, but it seems like the function name for the earlier attempt to solve this issue that mentioned amd and ftpm was a clearer description of what was happening than
crb_check_flags.
Quoted 5 lines
Quoted 1 line
I posted an alternative: https://lkml.org/lkml/2023/8/22/1188
Ignore my reviewed-by (I cannot review my own patches) :-)
Also should be probably v6.4+ (should check when the fix landed)?
v2: https://lkml.org/lkml/2023/8/22/1197
BR, Jarkko