#include <drm/xe_drm.h>
#include "xe_bo.h"
+#include "xe_pat.h"
#include "xe_pt.h"
#include "xe_svm.h"
struct xe_vma **vmas, int num_vmas,
struct drm_xe_madvise *op)
{
- /* Implementation pending */
+ int i;
+
+ xe_assert(vm->xe, op->type == DRM_XE_MEM_RANGE_ATTR_PAT);
+
+ for (i = 0; i < num_vmas; i++)
+ vmas[i]->attr.pat_index = op->pat_index.val;
}
typedef void (*madvise_func)(struct xe_device *xe, struct xe_vm *vm,
break;
case DRM_XE_MEM_RANGE_ATTR_PAT:
- /*TODO: Add valid pat check */
+ {
+ u16 coh_mode = xe_pat_index_get_coh_mode(xe, args->pat_index.val);
+
+ if (XE_IOCTL_DBG(xe, !coh_mode))
+ return false;
+
+ if (XE_WARN_ON(coh_mode > XE_COH_AT_LEAST_1WAY))
+ return false;
+
+ if (XE_IOCTL_DBG(xe, args->pat_index.pad))
+ return false;
+
+ if (XE_IOCTL_DBG(xe, args->pat_index.reserved))
+ return false;
break;
+ }
default:
if (XE_IOCTL_DBG(xe, 1))
return false;