[RFC 03/12] drm/xe/svm: Helper to add tile masks to svm ranges

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Tue Mar 11 06:26:41 UTC 2025



On 11-03-2025 00:49, Matthew Brost wrote:
> On Mon, Mar 10, 2025 at 06:13:32PM +0530, Himal Prasad Ghimiray wrote:
>> Introduce a helper to add tile mask of binding present and invalidated
>> for the range. Add a lockdep_assert to ensure it is protected by GPU SVM
>> notifier lock.
>>
>> Suggested-by: Matthew Brost <matthew.brost at intel.com>
> 
> Reviewed-by: Matthew Brost <matthew.brost at intel.com>

Thanks

> 
>> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_pt.c | 19 ++++++++++++++-----
>>   1 file changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
>> index ffaf0d02dc7d..cf7a6ba2aec8 100644
>> --- a/drivers/gpu/drm/xe/xe_pt.c
>> +++ b/drivers/gpu/drm/xe/xe_pt.c
>> @@ -2178,6 +2178,16 @@ static void unbind_op_commit(struct xe_vm *vm, struct xe_tile *tile,
>>   	}
>>   }
>>   
>> +static void range_present_and_invalidated_tile(struct xe_vm *vm,
>> +					       struct xe_svm_range *range,
>> +					       u8 tile_id)
>> +{
>> +	lockdep_assert_held(&vm->svm.gpusvm.notifier_lock);
>> +
>> +	range->tile_present |= BIT(tile_id);
>> +	range->tile_invalidated &= ~BIT(tile_id);
>> +}
>> +
>>   static void op_commit(struct xe_vm *vm,
>>   		      struct xe_tile *tile,
>>   		      struct xe_vm_pgtable_update_ops *pt_update_ops,
>> @@ -2232,12 +2242,11 @@ static void op_commit(struct xe_vm *vm,
>>   	}
>>   	case DRM_GPUVA_OP_DRIVER:
>>   	{
>> -		if (op->subop == XE_VMA_SUBOP_MAP_RANGE) {
>> -			op->map_range.range->tile_present |= BIT(tile->id);
>> -			op->map_range.range->tile_invalidated &= ~BIT(tile->id);
>> -		} else if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE) {
>> +		if (op->subop == XE_VMA_SUBOP_MAP_RANGE)
>> +			range_present_and_invalidated_tile(vm, op->map_range.range, tile->id);
>> +		else if (op->subop == XE_VMA_SUBOP_UNMAP_RANGE)
>>   			op->unmap_range.range->tile_present &= ~BIT(tile->id);
>> -		}
>> +
>>   		break;
>>   	}
>>   	default:
>> -- 
>> 2.34.1
>>



More information about the Intel-xe mailing list