summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_vm_types.h
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2023-07-18 22:39:24 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:37:51 +0300
commit4d18eac03212fc2d8c3d9715e2261ac50e989403 (patch)
tree49618abdcc3436a5764b26986d13f96f7a2ae321 /drivers/gpu/drm/xe/xe_vm_types.h
parent0d39b6daa5455354c485cb4d521b08740456758e (diff)
downloadlinux-4d18eac03212fc2d8c3d9715e2261ac50e989403.tar.xz
drm/xe: Use FIELD_PREP/FIELD_GET for tile id encoding
Use FIELD_PREP()/FIELD_GET() to encode the tile id into flags. Besides protecting for eventual overflow it also makes it easier to see a new flag can't be added as BIT(7). Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20230718193924.3084759-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_vm_types.h')
-rw-r--r--drivers/gpu/drm/xe/xe_vm_types.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm_types.h b/drivers/gpu/drm/xe/xe_vm_types.h
index c1af0cd6aced..1e3c7b98d775 100644
--- a/drivers/gpu/drm/xe/xe_vm_types.h
+++ b/drivers/gpu/drm/xe/xe_vm_types.h
@@ -143,8 +143,8 @@ struct xe_vm {
#define XE_VM_FLAG_SCRATCH_PAGE BIT(4)
#define XE_VM_FLAG_FAULT_MODE BIT(5)
#define XE_VM_FLAG_BANNED BIT(6)
-#define XE_VM_FLAG_TILE_ID(flags) (((flags) >> 7) & 0x3)
-#define XE_VM_FLAG_SET_TILE_ID(tile) ((tile)->id << 7)
+#define XE_VM_FLAG_TILE_ID(flags) FIELD_GET(GENMASK(8, 7), flags)
+#define XE_VM_FLAG_SET_TILE_ID(tile) FIELD_PREP(GENMASK(8, 7), (tile)->id)
unsigned long flags;
/** @composite_fence_ctx: context composite fence */