From mboxrd@z Thu Jan 1 00:00:00 1970 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 38602C44507 for ; Mon, 13 Jul 2026 02:27:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A600810E2A4; Mon, 13 Jul 2026 02:27:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kWA3mXDy"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id A15DD10E05D for ; Mon, 13 Jul 2026 02:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783909659; x=1815445659; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K1Fy5MLMa8XGxbD6cNjOaABJvgJMeE1sofVwymRzNLk=; b=kWA3mXDy3Y117hlNhrtBz7gp1A+XUd5ffVi8AXJ6iAGbdLswWo0wVbz+ Zp0+CIKh5toK/Q7HSSDzh1J0MKNk3t85/iWM0Alkk150jtkxNctL5Dtea 6ZJdXfd/FUgjuFK8jZVYTOj6UJ2tsamYvoj/xjxUaV9E0Xcn9aK037ocF aNhRL9W7JzST8g0cyBZzoXcPCgPoEiUQlWDt1Q0QBSoRuQw5Mh3CANQMT 0v74Px+W2iLzJD2Hl/5B8IQfY4yUqlwq8GvziwfQTOTrfx5xgWAovivp9 8Tq1bN8UCYUJtdNhntlfKIODa/zeIoA+idjj3VtrLUYSkT+TDWrbojUuW Q==; X-CSE-ConnectionGUID: 6feJn1k9RLOimj9oWbHhKg== X-CSE-MsgGUID: b2fDlxjsSuu1Io15OWDg5Q== X-IronPort-AV: E=McAfee;i="6800,10657,11841"; a="88197448" X-IronPort-AV: E=Sophos;i="6.25,154,1779174000"; d="scan'208";a="88197448" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2026 19:27:39 -0700 X-CSE-ConnectionGUID: 4kqgyk7LRTG8pbviMwKXMQ== X-CSE-MsgGUID: fMq388UORMO4ypJWZD1PDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,154,1779174000"; d="scan'208";a="253680022" Received: from gfx-coremm-kmd15.iind.intel.com ([10.223.55.8]) by orviesa006.jf.intel.com with ESMTP; 12 Jul 2026 19:27:38 -0700 From: Nareshkumar Gollakoti To: intel-xe@lists.freedesktop.org Cc: himal.prasad.ghimiray@intel.com, naresh.kumar.g@intel.com Subject: [PATCH v4 1/8] drm/xe: add page size allocation control state to xe_device Date: Mon, 13 Jul 2026 07:55:34 +0530 Message-ID: <20260713022541.2581814-2-naresh.kumar.g@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260713022541.2581814-1-naresh.kumar.g@intel.com> References: <20260713022541.2581814-1-naresh.kumar.g@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" Introduce xe_page_size_alloc_ctrl_mode and add page_size_alloc_ctrl state to struct xe_device along with mutex lock. The new control supports forcing user BO allocations to 2M pages, forcing them to 1G pages, or using a mixed round-robin mode across 4K, 64K, 2M, and 1G page sizes. Track the current mixed-mode index in xe_device so allocation policy can be applied consistently. v2 - make cur_index to atomic as update need in later patch to avoid race/concurency (sashiko) v3 - reworded comments - protect mode/index updates with a mutex for proper concurrency handling v4(sashiko) - move xe_debug_page_size_alloc_ctrl_init() before drm_dev_register(), so mutex and control states are initialized before any userspace visibility Signed-off-by: Nareshkumar Gollakoti --- drivers/gpu/drm/xe/xe_device.c | 9 +++++++++ drivers/gpu/drm/xe/xe_device_types.h | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index c9fa4bfed2b9..6143e3603023 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -923,6 +923,13 @@ static void xe_device_wedged_fini(struct drm_device *drm, void *arg) xe_pm_runtime_put(xe); } +static void xe_debug_page_size_alloc_ctrl_init(struct xe_device *xe) +{ + mutex_init(&xe->page_size_alloc_ctrl.lock); + xe->page_size_alloc_ctrl.mode = XE_PAGE_SIZE_ALLOC_CTRL_MODE_NONE; + xe->page_size_alloc_ctrl.cur_index = 0; +} + int xe_device_probe(struct xe_device *xe) { struct xe_tile *tile; @@ -1075,6 +1082,8 @@ int xe_device_probe(struct xe_device *xe) if (err) return err; + xe_debug_page_size_alloc_ctrl_init(xe); + err = drm_dev_register(&xe->drm, 0); if (err) return err; diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index 022e08205897..8cd70756413b 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -61,6 +61,21 @@ enum xe_wedged_mode { XE_WEDGED_MODE_UPON_ANY_HANG_NO_RESET = 2, }; +/** + * enum xe_page_size_alloc_ctrl_mode - User BO page-size allocation control modes + * @XE_PAGE_SIZE_ALLOC_CTRL_MODE_NONE: Use the normal allocation policy + * @XE_PAGE_SIZE_ALLOC_CTRL_MODE_ONLY_2M: Force user BO allocations to 2M pages + * @XE_PAGE_SIZE_ALLOC_CTRL_MODE_ONLY_1G: Force user BO allocations to 1G pages + * @XE_PAGE_SIZE_ALLOC_CTRL_MODE_MIXED: Select page sizes in round-robin order + * (4K, 64K, 2M, 1G) + */ +enum xe_page_size_alloc_ctrl_mode { + XE_PAGE_SIZE_ALLOC_CTRL_MODE_NONE = 0, + XE_PAGE_SIZE_ALLOC_CTRL_MODE_ONLY_2M, + XE_PAGE_SIZE_ALLOC_CTRL_MODE_ONLY_1G, + XE_PAGE_SIZE_ALLOC_CTRL_MODE_MIXED +}; + #define XE_BO_INVALID_OFFSET LONG_MAX #define GRAPHICS_VER(xe) ((xe)->info.graphics_verx100 / 100) @@ -474,6 +489,16 @@ struct xe_device { /** @late_bind: xe mei late bind interface */ struct xe_late_bind late_bind; + /** @page_size_alloc_ctrl: User BO page-size allocation debug control state */ + struct { + /** @mode: xe page size allocation control mode */ + enum xe_page_size_alloc_ctrl_mode mode; + /** @cur_index: Round-robin index used by mixed mode */ + u32 cur_index; + /** @lock: Protects @mode and @cur_index */ + struct mutex lock; + } page_size_alloc_ctrl; + /** @oa: oa observation subsystem */ struct xe_oa oa; -- 2.43.0