[Intel-gfx] [PATCH igt] igt/gen7_forcewake_mt: Make the mmio register as volatile

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 19 23:11:13 UTC 2018


Prevent the compiler from caching reads/writes to the hw register as we
do want to perform mmio.

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

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;
-- 
2.15.1



More information about the Intel-gfx mailing list