Skip to content

Commit

Permalink
drm/xe: Use FIELD_PREP/FIELD_GET for tile id encoding
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lucas De Marchi authored and Rodrigo Vivi committed Dec 21, 2023
1 parent 0d39b6d commit 4d18eac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/xe/xe_vm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 4d18eac

Please sign in to comment.