summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Xiao <Jack.Xiao@amd.com>2015-05-07 16:07:03 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-07-30 00:11:10 -0400
commit1b12e91bd73b7143cf21758243cbad5d4c2feaed (patch)
treee491340fbd8ed1efa5a696cbabb9754cb6f781b1
parent696d78c5affba97ca973fdaf568fca58fcd00cb6 (diff)
amdgpu: fix round down/up page size error
Signed-off-by: Jack Xiao <Jack.Xiao@amd.com> Reviewed-by: Monk Liu monk.liu@amd.com Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
-rw-r--r--amdgpu/amdgpu_internal.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 9cb21566..cc911c5b 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -36,8 +36,9 @@
#define AMDGPU_CS_MAX_RINGS 8
/* do not use below macro if b is not power of 2 aligned value */
-#define ROUND_DOWN(a,b) ((a) & (~((b)-1)))
-#define ROUND_UP(a,b) (((a)+((b)-1)) & (~((b)-1)))
+#define __round_mask(x, y) ((__typeof__(x))((y)-1))
+#define ROUND_UP(x, y) ((((x)-1) | __round_mask(x, y))+1)
+#define ROUND_DOWN(x, y) ((x) & ~__round_mask(x, y))
struct amdgpu_bo_va_hole {
struct list_head list;