io: Open /dev/mem with O_SYNC for uncached access
authorHauke Mehrtens <hauke.mehrtens@intel.com>
Mon, 22 Jul 2019 13:03:57 +0000 (15:03 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Wed, 13 Nov 2019 22:43:36 +0000 (23:43 +0100)
commit1f082d84dd7a35ffeab7daa4674bb3653c55cfa5
treea2c6679702e5463ad98a715449e6078c3e7446d1
parent39001de7b042cb4555e23abb8456c6fe5d060db7
io: Open /dev/mem with O_SYNC for uncached access

Only when /dev/mem is opened with O_SYNC the write and *read* is done
uncached. We saw wrong values read out from the hardware without setting
O_SYNC, the busybox devmem tool showed different values, when O_SYNC is
also set for the io tool, it reads out the same values as devmem.
When looking at the drivers/char/mem.c file in the kernel it is behaving
differently based on the O_DSYNC flag.

Signed-off-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
(cherry-picked from 90df0f3e241dc233c3121dfc5e1be937c6c987bc)
utils/io/Makefile
utils/io/src/io.c