hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
kernel/drivers/char/tpm/tpm_tis.c
....@@ -54,6 +54,31 @@
5454 return container_of(data, struct tpm_tis_tcg_phy, priv);
5555 }
5656
57
+#ifdef CONFIG_PREEMPT_RT_FULL
58
+/*
59
+ * Flushes previous write operations to chip so that a subsequent
60
+ * ioread*()s won't stall a cpu.
61
+ */
62
+static inline void tpm_tis_flush(void __iomem *iobase)
63
+{
64
+ ioread8(iobase + TPM_ACCESS(0));
65
+}
66
+#else
67
+#define tpm_tis_flush(iobase) do { } while (0)
68
+#endif
69
+
70
+static inline void tpm_tis_iowrite8(u8 b, void __iomem *iobase, u32 addr)
71
+{
72
+ iowrite8(b, iobase + addr);
73
+ tpm_tis_flush(iobase);
74
+}
75
+
76
+static inline void tpm_tis_iowrite32(u32 b, void __iomem *iobase, u32 addr)
77
+{
78
+ iowrite32(b, iobase + addr);
79
+ tpm_tis_flush(iobase);
80
+}
81
+
5782 static int interrupts = -1;
5883 module_param(interrupts, int, 0444);
5984 MODULE_PARM_DESC(interrupts, "Enable interrupts");
....@@ -173,7 +198,7 @@
173198 struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data);
174199
175200 while (len--)
176
- iowrite8(*value++, phy->iobase + addr);
201
+ tpm_tis_iowrite8(*value++, phy->iobase, addr);
177202
178203 return 0;
179204 }
....@@ -200,7 +225,7 @@
200225 {
201226 struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data);
202227
203
- iowrite32(value, phy->iobase + addr);
228
+ tpm_tis_iowrite32(value, phy->iobase, addr);
204229
205230 return 0;
206231 }