Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Add debugfs support for page reclamation

Allow for runtime modification to page reclamation feature through
debugfs configuration. This parameter will only take effect if the
platform supports the page reclamation feature by default.

v2:
- Minor comment tweaks. (Shuicheng)
- Convert to kstrtobool_from_user. (Michal)
- Only expose page reclaim file if page reclaim flag
initially supported and with that, remove
xe_match_desc usage. (Michal)

Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251212213225.3564537-22-brian3.nguyen@intel.com

authored by

Brian Nguyen and committed by
Matthew Brost
13d99b01 7c52f13b

+41
+41
drivers/gpu/drm/xe/xe_debugfs.c
··· 293 293 .write = wedged_mode_set, 294 294 }; 295 295 296 + static ssize_t page_reclaim_hw_assist_show(struct file *f, char __user *ubuf, 297 + size_t size, loff_t *pos) 298 + { 299 + struct xe_device *xe = file_inode(f)->i_private; 300 + char buf[8]; 301 + int len; 302 + 303 + len = scnprintf(buf, sizeof(buf), "%d\n", xe->info.has_page_reclaim_hw_assist); 304 + return simple_read_from_buffer(ubuf, size, pos, buf, len); 305 + } 306 + 307 + static ssize_t page_reclaim_hw_assist_set(struct file *f, const char __user *ubuf, 308 + size_t size, loff_t *pos) 309 + { 310 + struct xe_device *xe = file_inode(f)->i_private; 311 + bool val; 312 + ssize_t ret; 313 + 314 + ret = kstrtobool_from_user(ubuf, size, &val); 315 + if (ret) 316 + return ret; 317 + 318 + xe->info.has_page_reclaim_hw_assist = val; 319 + 320 + return size; 321 + } 322 + 323 + static const struct file_operations page_reclaim_hw_assist_fops = { 324 + .owner = THIS_MODULE, 325 + .read = page_reclaim_hw_assist_show, 326 + .write = page_reclaim_hw_assist_set, 327 + }; 328 + 296 329 static ssize_t atomic_svm_timeslice_ms_show(struct file *f, char __user *ubuf, 297 330 size_t size, loff_t *pos) 298 331 { ··· 430 397 431 398 debugfs_create_file("disable_late_binding", 0600, root, xe, 432 399 &disable_late_binding_fops); 400 + 401 + /* 402 + * Don't expose page reclaim configuration file if not supported by the 403 + * hardware initially. 404 + */ 405 + if (xe->info.has_page_reclaim_hw_assist) 406 + debugfs_create_file("page_reclaim_hw_assist", 0600, root, xe, 407 + &page_reclaim_hw_assist_fops); 433 408 434 409 man = ttm_manager_type(bdev, XE_PL_TT); 435 410 ttm_resource_manager_create_debugfs(man, root, "gtt_mm");