summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm_tis_core.h
diff options
context:
space:
mode:
authorLino Sanfilippo <l.sanfilippo@kunbus.com>2022-11-24 16:55:25 +0300
committerJarkko Sakkinen <jarkko@kernel.org>2023-04-24 16:15:53 +0300
commit858e8b792d06f45c427897bd90205a1d90bf430f (patch)
tree6ea73650a4d7bf67f75d45a931bcaa9098addb36 /drivers/char/tpm/tpm_tis_core.h
parent099f26f22f5834ad744aee093ed4d11de13cac15 (diff)
downloadlinux-858e8b792d06f45c427897bd90205a1d90bf430f.tar.xz
tpm, tpm_tis: Avoid cache incoherency in test for interrupts
The interrupt handler that sets the boolean variable irq_tested may run on another CPU as the thread that checks irq_tested as part of the irq test in tpm_tis_send(). Since nothing guarantees cache coherency between CPUs for unsynchronized accesses to boolean variables the testing thread might not perceive the value change done in the interrupt handler. Avoid this issue by setting the bit TPM_TIS_IRQ_TESTED in the flags field of the tpm_tis_data struct and by accessing this field with the bit manipulating functions that provide cache coherency. Also convert all other existing sites to use the proper macros when accessing this bitfield. Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com> Tested-by: Michael Niewöhner <linux@mniewoehner.de> Tested-by: Jarkko Sakkinen <jarkko@kernel.org> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'drivers/char/tpm/tpm_tis_core.h')
-rw-r--r--drivers/char/tpm/tpm_tis_core.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
index b68479e0de10..57718f43cf64 100644
--- a/drivers/char/tpm/tpm_tis_core.h
+++ b/drivers/char/tpm/tpm_tis_core.h
@@ -87,13 +87,13 @@ enum tpm_tis_flags {
TPM_TIS_ITPM_WORKAROUND = BIT(0),
TPM_TIS_INVALID_STATUS = BIT(1),
TPM_TIS_DEFAULT_CANCELLATION = BIT(2),
+ TPM_TIS_IRQ_TESTED = BIT(3),
};
struct tpm_tis_data {
u16 manufacturer_id;
int locality;
int irq;
- bool irq_tested;
unsigned long flags;
void __iomem *ilb_base_addr;
u16 clkrun_enabled;