igt/gen7_forcewake_mt: Make the mmio register as volatile

Submitted by Chris Wilson on Jan. 19, 2018, 11:11 p.m.

Details

Message ID 20180119231113.4908-1-chris@chris-wilson.co.uk
State New
Headers show
Series "igt/gen7_forcewake_mt: Make the mmio register as volatile" ( rev: 1 ) in IGT (deprecated)

Not browsing as part of any series.

Commit Message

Chris Wilson Jan. 19, 2018, 11:11 p.m.
Prevent the compiler from caching reads/writes to the hw register as we
do want to perform mmio.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/gen7_forcewake_mt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/gen7_forcewake_mt.c b/tests/gen7_forcewake_mt.c
index 07320ef9e..8a23d13e0 100644
--- a/tests/gen7_forcewake_mt.c
+++ b/tests/gen7_forcewake_mt.c
@@ -106,8 +106,9 @@  static void *igfx_get_mmio(void)
 static void *thread(void *arg)
 {
 	struct thread *t = arg;
-	uint32_t *forcewake_mt = (uint32_t *)((char *)t->mmio + FORCEWAKE_MT);
-	uint32_t bit = 1 << t->bit;
+	const uint32_t bit = 1 << t->bit;
+	volatile uint32_t *forcewake_mt =
+		(volatile uint32_t *)((char *)t->mmio + FORCEWAKE_MT);
 
 	while (1) {
 		*forcewake_mt = bit << 16 | bit;