Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BAD9D3B7F8 for ; Tue, 9 Dec 2025 07:35:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DDC2310E1DA; Tue, 9 Dec 2025 07:35:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="J1JyZFBD"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9516010E1DA for ; Tue, 9 Dec 2025 07:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765265700; x=1796801700; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ldXIBWoPKUhWg5otz0QcaVveUJAPLCdoBnE7UPnP5F0=; b=J1JyZFBDW+Q/Fslg5hs2KpbjH+9DlUjPEVJ3sctCIA2D7xuYlqippICu fXIe5+VzSl1etH/ZKiUYFbidM930Ufd8xhnYEv4z19kRbbFyNRRC5dodq CIQeHh18LA1TcXPUsRcM7M/wnRbczzLMEsX0AEco9wIKTQDF7gT2OwiIr qWKXwtXcJctKQxBSPMxtRs2xvHVRpcnEO7iK0gNHuQ8yHOemnV3JNV2ZX eRqHDDCU5K2LXwKgdlNTa5//yfr7q+oAcn9vAWX6aXigv2zmV3YDiG+Xh f0dj605VK/Kt5fHFVsPScfKRTo87Pk6hcpOEGUar1dzwD5h3WQIXaxc+h g==; X-CSE-ConnectionGUID: X1AU1FP7QY2NWVHh3OccWw== X-CSE-MsgGUID: 92sPejFYROu+NLLE0vRd7w== X-IronPort-AV: E=McAfee;i="6800,10657,11636"; a="67295876" X-IronPort-AV: E=Sophos;i="6.20,260,1758610800"; d="scan'208";a="67295876" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2025 23:35:00 -0800 X-CSE-ConnectionGUID: E9LaAE2NQUecFBMaN6gi/A== X-CSE-MsgGUID: emYqzG43QEG+UycrCYBXZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,260,1758610800"; d="scan'208";a="227189476" Received: from osgc-sh-dragon.sh.intel.com ([10.239.81.44]) by fmviesa001.fm.intel.com with ESMTP; 08 Dec 2025 23:34:59 -0800 From: Brian Nguyen To: intel-xe@lists.freedesktop.org Cc: tejas.upadhyay@intel.com, matthew.brost@intel.com, shuicheng.lin@intel.com, stuart.summers@intel.com, Michal Wajdeczko Subject: [PATCH v3 10/10] drm/xe: Add debugfs support for page reclamation Date: Tue, 9 Dec 2025 15:34:49 +0800 Message-ID: <20251209073438.2432701-22-brian3.nguyen@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251209073438.2432701-12-brian3.nguyen@intel.com> References: <20251209073438.2432701-12-brian3.nguyen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" 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 Reviewed-by: Matthew Brost Reviewed-by: Shuicheng Lin Cc: Michal Wajdeczko --- drivers/gpu/drm/xe/xe_debugfs.c | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_debugfs.c b/drivers/gpu/drm/xe/xe_debugfs.c index 0f8a96a05a8e..d24e5aca30ed 100644 --- a/drivers/gpu/drm/xe/xe_debugfs.c +++ b/drivers/gpu/drm/xe/xe_debugfs.c @@ -291,6 +291,39 @@ static const struct file_operations wedged_mode_fops = { .write = wedged_mode_set, }; +static ssize_t page_reclaim_hw_assist_show(struct file *f, char __user *ubuf, + size_t size, loff_t *pos) +{ + struct xe_device *xe = file_inode(f)->i_private; + char buf[8]; + int len; + + len = scnprintf(buf, sizeof(buf), "%d\n", xe->info.has_page_reclaim_hw_assist); + return simple_read_from_buffer(ubuf, size, pos, buf, len); +} + +static ssize_t page_reclaim_hw_assist_set(struct file *f, const char __user *ubuf, + size_t size, loff_t *pos) +{ + struct xe_device *xe = file_inode(f)->i_private; + bool val; + ssize_t ret; + + ret = kstrtobool_from_user(ubuf, size, &val); + if (ret) + return ret; + + xe->info.has_page_reclaim_hw_assist = val; + + return size; +} + +static const struct file_operations page_reclaim_hw_assist_fops = { + .owner = THIS_MODULE, + .read = page_reclaim_hw_assist_show, + .write = page_reclaim_hw_assist_set, +}; + static ssize_t atomic_svm_timeslice_ms_show(struct file *f, char __user *ubuf, size_t size, loff_t *pos) { @@ -396,6 +429,14 @@ void xe_debugfs_register(struct xe_device *xe) debugfs_create_file("disable_late_binding", 0600, root, xe, &disable_late_binding_fops); + /* + * Don't expose page reclaim configuration file if not supported by the + * hardware initially. + */ + if (xe->info.has_page_reclaim_hw_assist) + debugfs_create_file("page_reclaim_hw_assist", 0600, root, xe, + &page_reclaim_hw_assist_fops); + man = ttm_manager_type(bdev, XE_PL_TT); ttm_resource_manager_create_debugfs(man, root, "gtt_mm"); -- 2.52.0