* [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A
@ 2026-11-12 23:38 Siddharth Chintamaneni
2026-11-13 18:31 ` Jarkko Sakkinen
0 siblings, 1 reply; 4+ messages in thread
From: Siddharth Chintamaneni @ 2026-11-12 23:38 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen
Cc: Jason Gunthorpe, Sudeep Holla, Yeoreum Yun, Stuart Yoder, apais,
rlmenge, hargar, linux-integrity, linux-arm-kernel, linux-kernel,
Siddharth Chintamaneni, stable
Prior to commit 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed
when tpm_crb_ffa is built-in"), built-in tpm_crb_ffa only registered
tpm_crb_ffa_driver from tpm_crb_ffa_init() after crb_acpi_probe()
confirmed start_method == ACPI_TPM2_CRB_WITH_ARM_FFA. After that
commit, tpm_crb_ffa unconditionally registers on the FF-A bus at
device_initcall time (and when loaded as a module) without checking
the platform's ACPI TPM2 table.
A platform's firmware may expose a TPM CRB over FF-A Secure Partition
for UEFI boot services while advertising a non-FF-A start method to
the OS in the ACPI TPM2 table. When the ACPI TPM2 table designates a
non-FF-A start method, Linux has no consumer for tpm_crb_ffa and
should not probe the FF-A TPM service.
On Microsoft Cobalt 200 systems, the ACPI TPM2 table does not use
ACPI_TPM2_CRB_WITH_ARM_FFA, yet ffa_init() discovers the FF-A TPM
partition and tpm_crb_ffa_probe() unconditionally sends
CRB_FFA_GET_INTERFACE_VERSION via FFA_MSG_SEND_DIRECT_REQ2/REQ SMC.
That request wedges the calling CPU in Secure World (with Non-Secure
interrupts and GICv3 pseudo-NMIs masked), hanging boot with an RCU CPU
stall:
[ 5.507519] ARM FF-A: Driver version 1.2
[ 5.507519] ARM FF-A: Firmware version 1.2 found
[ 5.507551] ARM FF-A: Notification setup failed -61, not enabled
[ 7.150580] Freeing initrd memory: 293640K
[ 65.515248] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
[ 65.521346] rcu: 10-...0: (3 GPs behind) idle=dd9c/1/0x4000000000000000 softirq=37/37 fqs=5262
[ 65.530031] rcu: hardirqs softirqs csw/system
[ 65.535589] rcu: number: 0 0 0
[ 65.541146] rcu: cputime: 0 0 0 ==> 30028(ms)
[ 65.548102] rcu: (detected by 66, t=15010 jiffies, g=-951, q=1384 ncpus=132)
[ 65.555228] Sending NMI from CPU 66 to CPUs 10:
[ 75.560686] After 10 seconds, these CPUS still haven't responded to the NMI: 10
Check the ACPI TPM2 table in tpm_crb_ffa_driver_init() and return
-ENODEV before calling ffa_register() unless the table is present and
specifies ACPI_TPM2_CRB_WITH_ARM_FFA, matching the check_acpi_tpm2()
pattern in tpm_tis.c. This ensures Linux only issues FF-A TPM requests
when ACPI advertises the FF-A start method (for both built-in and
modular builds), while preserving normal FF-A bus probing on platforms
that use CRB over FF-A.
Fixes: 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed when tpm_crb_ffa is built-in")
Fixes: eb93f0734ef1 ("tpm_crb: ffa_tpm: Implement driver compliant to CRB over FF-A")
Cc: stable@vger.kernel.org
Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com>
---
drivers/char/tpm/tpm_crb_ffa.c | 37 +++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/drivers/char/tpm/tpm_crb_ffa.c b/drivers/char/tpm/tpm_crb_ffa.c
index 025c4d4b17ca..8219a8d01344 100644
--- a/drivers/char/tpm/tpm_crb_ffa.c
+++ b/drivers/char/tpm/tpm_crb_ffa.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) "CRB_FFA: " fmt
+#include <linux/acpi.h>
#include <linux/arm_ffa.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
@@ -395,7 +396,41 @@ static struct ffa_driver tpm_crb_ffa_driver = {
.id_table = tpm_crb_ffa_device_id,
};
-module_ffa_driver(tpm_crb_ffa_driver);
+static bool __init tpm_crb_ffa_has_acpi_tpm2(void)
+{
+ struct acpi_table_tpm2 *buf;
+ acpi_status status;
+ bool match;
+
+ if (acpi_disabled)
+ return false;
+
+ status = acpi_get_table(ACPI_SIG_TPM2, 1,
+ (struct acpi_table_header **)&buf);
+ if (ACPI_FAILURE(status))
+ return false;
+
+ match = buf->header.length >= sizeof(*buf) &&
+ buf->start_method == ACPI_TPM2_CRB_WITH_ARM_FFA;
+ acpi_put_table((struct acpi_table_header *)buf);
+
+ return match;
+}
+
+static int __init tpm_crb_ffa_driver_init(void)
+{
+ if (!tpm_crb_ffa_has_acpi_tpm2())
+ return -ENODEV;
+
+ return ffa_register(&tpm_crb_ffa_driver);
+}
+module_init(tpm_crb_ffa_driver_init);
+
+static void __exit tpm_crb_ffa_driver_exit(void)
+{
+ ffa_unregister(&tpm_crb_ffa_driver);
+}
+module_exit(tpm_crb_ffa_driver_exit);
MODULE_AUTHOR("Arm");
MODULE_DESCRIPTION("TPM CRB FFA driver");
--
2.45.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A 2026-11-12 23:38 [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A Siddharth Chintamaneni @ 2026-11-13 18:31 ` Jarkko Sakkinen 2026-11-13 19:31 ` Siddharth Chintamaneni 0 siblings, 1 reply; 4+ messages in thread From: Jarkko Sakkinen @ 2026-11-13 18:31 UTC (permalink / raw) To: Siddharth Chintamaneni Cc: Peter Huewe, Jason Gunthorpe, Sudeep Holla, Yeoreum Yun, Stuart Yoder, apais, rlmenge, hargar, linux-integrity, linux-arm-kernel, linux-kernel, stable [-- Attachment #1: Type: text/plain, Size: 3193 bytes --] On Thu, Nov 12, 2026 at 11:38:07PM +0000, Siddharth Chintamaneni wrote: > Prior to commit 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed > when tpm_crb_ffa is built-in"), built-in tpm_crb_ffa only registered > tpm_crb_ffa_driver from tpm_crb_ffa_init() after crb_acpi_probe() > confirmed start_method == ACPI_TPM2_CRB_WITH_ARM_FFA. After that > commit, tpm_crb_ffa unconditionally registers on the FF-A bus at > device_initcall time (and when loaded as a module) without checking > the platform's ACPI TPM2 table. > > A platform's firmware may expose a TPM CRB over FF-A Secure Partition > for UEFI boot services while advertising a non-FF-A start method to > the OS in the ACPI TPM2 table. When the ACPI TPM2 table designates a > non-FF-A start method, Linux has no consumer for tpm_crb_ffa and > should not probe the FF-A TPM service. > > On Microsoft Cobalt 200 systems, the ACPI TPM2 table does not use > ACPI_TPM2_CRB_WITH_ARM_FFA, yet ffa_init() discovers the FF-A TPM > partition and tpm_crb_ffa_probe() unconditionally sends > CRB_FFA_GET_INTERFACE_VERSION via FFA_MSG_SEND_DIRECT_REQ2/REQ SMC. > That request wedges the calling CPU in Secure World (with Non-Secure > interrupts and GICv3 pseudo-NMIs masked), hanging boot with an RCU CPU > stall: > > [ 5.507519] ARM FF-A: Driver version 1.2 > [ 5.507519] ARM FF-A: Firmware version 1.2 found > [ 5.507551] ARM FF-A: Notification setup failed -61, not enabled > [ 7.150580] Freeing initrd memory: 293640K > [ 65.515248] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: > [ 65.521346] rcu: 10-...0: (3 GPs behind) idle=dd9c/1/0x4000000000000000 softirq=37/37 fqs=5262 > [ 65.530031] rcu: hardirqs softirqs csw/system > [ 65.535589] rcu: number: 0 0 0 > [ 65.541146] rcu: cputime: 0 0 0 ==> 30028(ms) > [ 65.548102] rcu: (detected by 66, t=15010 jiffies, g=-951, q=1384 ncpus=132) > [ 65.555228] Sending NMI from CPU 66 to CPUs 10: > [ 75.560686] After 10 seconds, these CPUS still haven't responded to the NMI: 10 > > Check the ACPI TPM2 table in tpm_crb_ffa_driver_init() and return > -ENODEV before calling ffa_register() unless the table is present and > specifies ACPI_TPM2_CRB_WITH_ARM_FFA, matching the check_acpi_tpm2() > pattern in tpm_tis.c. This ensures Linux only issues FF-A TPM requests > > when ACPI advertises the FF-A start method (for both built-in and > modular builds), while preserving normal FF-A bus probing on platforms > that use CRB over FF-A. > > Fixes: 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed when tpm_crb_ffa is built-in") > Fixes: eb93f0734ef1 ("tpm_crb: ffa_tpm: Implement driver compliant to CRB over FF-A") Pick the older. I attached a prepending patch that caches the start method, which can be later used in tpm_tis and tpm_crb. So that totals four patches: 1. My patch. 2. Your fix using the cached value. 3. tpm_tis update to use the cached value. 4. tpm_crb update to use the cached value. Fast-forward when these are in the mainline, I can send my change with Stable-dep-of tag to stable@vger.kernel.org. Br, Jarkko [-- Attachment #2: 0001-tpm-Cache-TPM2-start-method.patch --] [-- Type: text/x-diff, Size: 3151 bytes --] From fc841edc9b4036bed36126dbdc7fdd41cee185c8 Mon Sep 17 00:00:00 2001 From: Jarkko Sakkinen <jarkko@kernel.org> Date: Fri, 13 Nov 2026 20:18:42 +0200 Subject: [PATCH] tpm: Cache TPM2 start method Both tpm_tis and tpm_crb have duplicate code for retrieving the start method from TPM2 ACPI table. Eagerly cache the start method already at chip creation. The cached chip->start_method can then be used by the leaf drivers; or ignored depending on the requirements. Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> --- drivers/char/tpm/tpm-chip.c | 36 +++++++++++++++++++++++++++++------- include/linux/tpm.h | 1 + 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 0be5dbfaa72e..540dd366effc 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -256,18 +256,24 @@ int tpm_class_shutdown(struct device *dev) } /** - * tpm_chip_alloc() - allocate a new struct tpm_chip instance - * @pdev: device to which the chip is associated - * At this point pdev mst be initialized, but does not have to - * be registered - * @ops: struct tpm_class_ops instance + * tpm_chip_alloc() - Allocate a new struct tpm_chip instance + * @pdev: device to which the chip is associated At this point pdev mst be + * initialized, but does not have to be registered + * @ops: struct tpm_class_ops for the chip. + * + * Allocates a new struct tpm_chip instance, and assigns a free device number + * for it. Must be paired with put_device(&chip->dev). * - * Allocates a new struct tpm_chip instance and assigns a free - * device number for it. Must be paired with put_device(&chip->dev). + * When ACPI is enabled, additionally tries to eagerly cache the start method + * from TPM2 ACPI table for the devices that need know it. */ struct tpm_chip *tpm_chip_alloc(struct device *pdev, const struct tpm_class_ops *ops) { +#ifdef CONFIG_ACPI + struct acpi_table_tpm2 *tbl; + acpi_status status; +#endif struct tpm_chip *chip; int rc; @@ -275,6 +281,22 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, if (chip == NULL) return ERR_PTR(-ENOMEM); +#ifdef CONFIG_ACPI + chip->start_method = ACPI_TPM2_NOT_ALLOWED; + if (!acpi_disabled) { + status = acpi_get_table(ACPI_SIG_TPM2, 1, (struct acpi_table_header **)&tbl); + if (!ACPI_FAILURE(status) || tbl->header.length >= sizeof(*tbl)) { + chip->start_method = tbl->start_method; + dev_info(pdev, "TPM2 ACPI table is available"); + } else { + dev_info(pdev, "TPM2 ACPI table is not available"); + } + + if (!ACPI_FAILURE(status)) + acpi_put_table((struct acpi_table_header *)tbl); + } +#endif + mutex_init(&chip->tpm_mutex); init_rwsem(&chip->ops_sem); diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 0db277af45c3..f6cc91615469 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -149,6 +149,7 @@ struct tpm_chip { struct tpm_bank_info allocated_banks[TPM2_MAX_PCR_BANKS]; #ifdef CONFIG_ACPI acpi_handle acpi_dev_handle; + u32 start_method; char ppi_version[TPM_PPI_VERSION_LEN + 1]; #endif /* CONFIG_ACPI */ -- 2.47.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A 2026-11-13 18:31 ` Jarkko Sakkinen @ 2026-11-13 19:31 ` Siddharth Chintamaneni 2026-11-13 20:20 ` Jarkko Sakkinen 0 siblings, 1 reply; 4+ messages in thread From: Siddharth Chintamaneni @ 2026-11-13 19:31 UTC (permalink / raw) To: Jarkko Sakkinen Cc: Peter Huewe, Jason Gunthorpe, Sudeep Holla, Yeoreum Yun, Stuart Yoder, apais, rlmenge, hargar, linux-integrity, linux-arm-kernel, linux-kernel, stable On Fri, 13 Nov 2026 at 10:31, Jarkko Sakkinen <jarkko@kernel.org> wrote: > > On Thu, Nov 12, 2026 at 11:38:07PM +0000, Siddharth Chintamaneni wrote: > > Prior to commit 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed > > when tpm_crb_ffa is built-in"), built-in tpm_crb_ffa only registered > > tpm_crb_ffa_driver from tpm_crb_ffa_init() after crb_acpi_probe() > > confirmed start_method == ACPI_TPM2_CRB_WITH_ARM_FFA. After that > > commit, tpm_crb_ffa unconditionally registers on the FF-A bus at > > device_initcall time (and when loaded as a module) without checking > > the platform's ACPI TPM2 table. > > > > A platform's firmware may expose a TPM CRB over FF-A Secure Partition > > for UEFI boot services while advertising a non-FF-A start method to > > the OS in the ACPI TPM2 table. When the ACPI TPM2 table designates a > > non-FF-A start method, Linux has no consumer for tpm_crb_ffa and > > should not probe the FF-A TPM service. > > > > On Microsoft Cobalt 200 systems, the ACPI TPM2 table does not use > > ACPI_TPM2_CRB_WITH_ARM_FFA, yet ffa_init() discovers the FF-A TPM > > partition and tpm_crb_ffa_probe() unconditionally sends > > CRB_FFA_GET_INTERFACE_VERSION via FFA_MSG_SEND_DIRECT_REQ2/REQ SMC. > > That request wedges the calling CPU in Secure World (with Non-Secure > > interrupts and GICv3 pseudo-NMIs masked), hanging boot with an RCU CPU > > stall: > > > > [ 5.507519] ARM FF-A: Driver version 1.2 > > [ 5.507519] ARM FF-A: Firmware version 1.2 found > > [ 5.507551] ARM FF-A: Notification setup failed -61, not enabled > > [ 7.150580] Freeing initrd memory: 293640K > > [ 65.515248] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: > > [ 65.521346] rcu: 10-...0: (3 GPs behind) idle=dd9c/1/0x4000000000000000 softirq=37/37 fqs=5262 > > [ 65.530031] rcu: hardirqs softirqs csw/system > > [ 65.535589] rcu: number: 0 0 0 > > [ 65.541146] rcu: cputime: 0 0 0 ==> 30028(ms) > > [ 65.548102] rcu: (detected by 66, t=15010 jiffies, g=-951, q=1384 ncpus=132) > > [ 65.555228] Sending NMI from CPU 66 to CPUs 10: > > [ 75.560686] After 10 seconds, these CPUS still haven't responded to the NMI: 10 > > > > Check the ACPI TPM2 table in tpm_crb_ffa_driver_init() and return > > -ENODEV before calling ffa_register() unless the table is present and > > specifies ACPI_TPM2_CRB_WITH_ARM_FFA, matching the check_acpi_tpm2() > > pattern in tpm_tis.c. This ensures Linux only issues FF-A TPM requests > > > > when ACPI advertises the FF-A start method (for both built-in and > > modular builds), while preserving normal FF-A bus probing on platforms > > that use CRB over FF-A. > > > > Fixes: 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed when tpm_crb_ffa is built-in") > > Fixes: eb93f0734ef1 ("tpm_crb: ffa_tpm: Implement driver compliant to CRB over FF-A") > > Pick the older. > > I attached a prepending patch that caches the start method, which can be > later used in tpm_tis and tpm_crb. > > So that totals four patches: > > 1. My patch. > 2. Your fix using the cached value. > 3. tpm_tis update to use the cached value. > 4. tpm_crb update to use the cached value. > Sounds good! I can put together that 4 patch v2 series. Two quick notes before I spin v2 - Module loading with CONFIG_TCG_CRB=m and CONFIG_TCG_ARM_CRB_FFA=m: As Sashiko flagged on v1 [1], because tpm_crb.ko directly references tpm_crb_ffa_init() and tpm_crb_ffa_start(), returning -ENODEV from tpm_crb_ffa's module_init would prevent modprobe from loading tpm_crb.ko on non-FF-A systems. In v2, I will move the start_method check into tpm_crb_ffa_probe() (matching check_acpi_tpm2() in tpm_tis) so both modules load cleanly while still skipping the FF-A probe on non-FF-A platforms - regarding the location of caching approach - tpm_crb_ffa never allocates a struct tpm_chip, and both tpm_tis (check_acpi_tpm2()) and tpm_crb (crb_acpi_probe()) check start_method before calling tpmm_chip_alloc(). Would it work for you if patch 1 caches start_method once in tpm_init() (subsys_initcall in tpm-interface.c) and exports a small helper (e.g. tpm_acpi_start_method()) so tpm_crb_ffa_probe(), tpm_tis, and tpm_crb can all query it before chip allocation? (Also noticed a small '||' -> '&&' typo on the header.length check in the attached patch.) [1] https://sashiko.dev/#/patchset/20261112233807.70664-1-sidchintamaneni%40gmail.com > Fast-forward when these are in the mainline, I can send my change with > Stable-dep-of tag to stable@vger.kernel.org. > > Br, Jarkko ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A 2026-11-13 19:31 ` Siddharth Chintamaneni @ 2026-11-13 20:20 ` Jarkko Sakkinen 0 siblings, 0 replies; 4+ messages in thread From: Jarkko Sakkinen @ 2026-11-13 20:20 UTC (permalink / raw) To: Siddharth Chintamaneni Cc: Peter Huewe, Jason Gunthorpe, Sudeep Holla, Yeoreum Yun, Stuart Yoder, apais, rlmenge, hargar, linux-integrity, linux-arm-kernel, linux-kernel, stable On Fri, Nov 13, 2026 at 11:31:31AM -0800, Siddharth Chintamaneni wrote: > On Fri, 13 Nov 2026 at 10:31, Jarkko Sakkinen <jarkko@kernel.org> wrote: > > > > On Thu, Nov 12, 2026 at 11:38:07PM +0000, Siddharth Chintamaneni wrote: > > > Prior to commit 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed > > > when tpm_crb_ffa is built-in"), built-in tpm_crb_ffa only registered > > > tpm_crb_ffa_driver from tpm_crb_ffa_init() after crb_acpi_probe() > > > confirmed start_method == ACPI_TPM2_CRB_WITH_ARM_FFA. After that > > > commit, tpm_crb_ffa unconditionally registers on the FF-A bus at > > > device_initcall time (and when loaded as a module) without checking > > > the platform's ACPI TPM2 table. > > > > > > A platform's firmware may expose a TPM CRB over FF-A Secure Partition > > > for UEFI boot services while advertising a non-FF-A start method to > > > the OS in the ACPI TPM2 table. When the ACPI TPM2 table designates a > > > non-FF-A start method, Linux has no consumer for tpm_crb_ffa and > > > should not probe the FF-A TPM service. > > > > > > On Microsoft Cobalt 200 systems, the ACPI TPM2 table does not use > > > ACPI_TPM2_CRB_WITH_ARM_FFA, yet ffa_init() discovers the FF-A TPM > > > partition and tpm_crb_ffa_probe() unconditionally sends > > > CRB_FFA_GET_INTERFACE_VERSION via FFA_MSG_SEND_DIRECT_REQ2/REQ SMC. > > > That request wedges the calling CPU in Secure World (with Non-Secure > > > interrupts and GICv3 pseudo-NMIs masked), hanging boot with an RCU CPU > > > stall: > > > > > > [ 5.507519] ARM FF-A: Driver version 1.2 > > > [ 5.507519] ARM FF-A: Firmware version 1.2 found > > > [ 5.507551] ARM FF-A: Notification setup failed -61, not enabled > > > [ 7.150580] Freeing initrd memory: 293640K > > > [ 65.515248] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: > > > [ 65.521346] rcu: 10-...0: (3 GPs behind) idle=dd9c/1/0x4000000000000000 softirq=37/37 fqs=5262 > > > [ 65.530031] rcu: hardirqs softirqs csw/system > > > [ 65.535589] rcu: number: 0 0 0 > > > [ 65.541146] rcu: cputime: 0 0 0 ==> 30028(ms) > > > [ 65.548102] rcu: (detected by 66, t=15010 jiffies, g=-951, q=1384 ncpus=132) > > > [ 65.555228] Sending NMI from CPU 66 to CPUs 10: > > > [ 75.560686] After 10 seconds, these CPUS still haven't responded to the NMI: 10 > > > > > > Check the ACPI TPM2 table in tpm_crb_ffa_driver_init() and return > > > -ENODEV before calling ffa_register() unless the table is present and > > > specifies ACPI_TPM2_CRB_WITH_ARM_FFA, matching the check_acpi_tpm2() > > > pattern in tpm_tis.c. This ensures Linux only issues FF-A TPM requests > > > > > > when ACPI advertises the FF-A start method (for both built-in and > > > modular builds), while preserving normal FF-A bus probing on platforms > > > that use CRB over FF-A. > > > > > > Fixes: 677042afb97a ("tpm: tpm_crb_ffa: revert defered_probed when tpm_crb_ffa is built-in") > > > Fixes: eb93f0734ef1 ("tpm_crb: ffa_tpm: Implement driver compliant to CRB over FF-A") > > > > Pick the older. > > > > I attached a prepending patch that caches the start method, which can be > > later used in tpm_tis and tpm_crb. > > > > So that totals four patches: > > > > 1. My patch. > > 2. Your fix using the cached value. > > 3. tpm_tis update to use the cached value. > > 4. tpm_crb update to use the cached value. > > > > Sounds good! I can put together that 4 patch v2 series. > > Two quick notes before I spin v2 > > - Module loading with CONFIG_TCG_CRB=m and CONFIG_TCG_ARM_CRB_FFA=m: > As Sashiko flagged on v1 [1], because tpm_crb.ko directly references > tpm_crb_ffa_init() and tpm_crb_ffa_start(), returning -ENODEV from > tpm_crb_ffa's module_init would prevent modprobe from loading > tpm_crb.ko on non-FF-A systems. In v2, I will move the start_method > check into tpm_crb_ffa_probe() (matching check_acpi_tpm2() in tpm_tis) > so both modules load cleanly while still skipping the FF-A probe on > non-FF-A platforms > > - regarding the location of caching approach - > tpm_crb_ffa never allocates a struct tpm_chip, and both tpm_tis > (check_acpi_tpm2()) and tpm_crb (crb_acpi_probe()) check start_method > before calling tpmm_chip_alloc(). Would it work for you if patch 1 > caches start_method once in tpm_init() (subsys_initcall in > tpm-interface.c) and exports a small helper (e.g. > tpm_acpi_start_method()) so tpm_crb_ffa_probe(), tpm_tis, and tpm_crb > can all query it before chip allocation? (Also noticed a small '||' -> > '&&' typo on the header.length check in the attached patch.) Move it to tpm_init() and store the result to a global variable, let's say tpm2_acpi_start_method. There's only one of these so it's all fine. You can then mark the resulting commit as: Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Co-developed-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org> I just put those tag because it is easy to mix up with Co-by tag, when using it. Br, Jarkko ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-13 20:20 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-12 23:38 [PATCH v1 1/1] tpm: tpm_crb_ffa: Only register driver when ACPI TPM2 uses FF-A Siddharth Chintamaneni 2026-11-13 18:31 ` Jarkko Sakkinen 2026-11-13 19:31 ` Siddharth Chintamaneni 2026-11-13 20:20 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox