Add conditional check for access counter granularity. This check will return -EINVAL if granularity is beyond 64M which is a hardware limitation. v2: Defined XE_ACC_GRANULARITY_128K 0 XE_ACC_GRANULARITY_2M 1 XE_ACC_GRANULARITY_16M 2 XE_ACC_GRANULARITY_64M 3 as part of uAPI. So, that user can also use it.(Oak) v3: Move uAPI to proper location and give proper documentation.(Brian, Oak)
Unified · Split
| @@ -393,6 +393,9 @@ static int exec_queue_set_acc_granularity(struct xe_device *xe, struct xe_exec_q · 392 unmodified lines | ||
| 393 | 393 | if (XE_IOCTL_DBG(xe, !xe->info.supports_usm)) |
| 394 | 394 | return -EINVAL; |
| 395 | 395 | |
| 396 | + if (value > XE_ACC_GRANULARITY_64M) | |
| 397 | + return -EINVAL; | |
| 398 | + | |
| 396 | 399 | q->usm.acc_granularity = value; |
| 397 | 400 | |
| 398 | 401 | return 0; |
| @@ -731,6 +731,20 @@ struct drm_xe_vm_bind { · 730 unmodified lines | ||
| 731 | 731 | __u64 reserved[2]; |
| 732 | 732 | }; |
| 733 | 733 | |
| 734 | +/* For use with XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY */ | |
| 735 | + | |
| 736 | +/* Monitor 128KB contiguous region with 4K sub-granularity */ | |
| 737 | +#define XE_ACC_GRANULARITY_128K 0 | |
| 738 | + | |
| 739 | +/* Monitor 2MB contiguous region with 64KB sub-granularity */ | |
| 740 | +#define XE_ACC_GRANULARITY_2M 1 | |
| 741 | + | |
| 742 | +/* Monitor 16MB contiguous region with 512KB sub-granularity */ | |
| 743 | +#define XE_ACC_GRANULARITY_16M 2 | |
| 744 | + | |
| 745 | +/* Monitor 64MB contiguous region with 2M sub-granularity */ | |
| 746 | +#define XE_ACC_GRANULARITY_64M 3 | |
| 747 | + | |
| 734 | 748 | /** |
| 735 | 749 | * struct drm_xe_exec_queue_set_property - exec queue set property |
| 736 | 750 | * |