lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250604-upstream-xe-non-4k-v2-v2-5-ce7905da7b08@aosc.io>
Date: Wed, 04 Jun 2025 10:57:59 +0800
From: Mingcong Bai via B4 Relay <devnull+jeffbai.aosc.io@...nel.org>
To: Lucas De Marchi <lucas.demarchi@...el.com>, 
 Thomas Hellström <thomas.hellstrom@...ux.intel.com>, 
 Rodrigo Vivi <rodrigo.vivi@...el.com>, David Airlie <airlied@...il.com>, 
 Simona Vetter <simona@...ll.ch>, 
 Francois Dugast <francois.dugast@...el.com>, 
 Zbigniew Kempczyński <zbigniew.kempczynski@...el.com>, 
 José Roberto de Souza <jose.souza@...el.com>, 
 Mauro Carvalho Chehab <mauro.chehab@...ux.intel.com>, 
 Matthew Brost <matthew.brost@...el.com>, 
 Zhanjun Dong <zhanjun.dong@...el.com>, 
 Matt Roper <matthew.d.roper@...el.com>, 
 Alan Previn <alan.previn.teres.alexis@...el.com>, 
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, 
 Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>, 
 Mateusz Naklicki <mateusz.naklicki@...el.com>
Cc: intel-xe@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, 
 linux-kernel@...r.kernel.org, stable@...r.kernel.org, 
 Kexy Biscuit <kexybiscuit@...c.io>, Shang Yatsen <429839446@...com>, 
 Mingcong Bai <jeffbai@...c.io>, Wenbin Fang <fangwenbin@....qq.com>, 
 Haien Liang <27873200@...com>, Jianfeng Liu <liujianfeng1994@...il.com>, 
 Shirong Liu <lsr1024@...com>, Haofeng Wu <s2600cw2@....com>
Subject: [PATCH v2 5/5] drm/xe/query: use PAGE_SIZE as the minimum page
 alignment

From: Mingcong Bai <jeffbai@...c.io>

As this component hooks into userspace API, it should be assumed that it
will play well with non-4KiB/64KiB pages.

Use `PAGE_SIZE' as the final reference for page alignment instead.

Cc: stable@...r.kernel.org
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Fixes: 801989b08aff ("drm/xe/uapi: Make constant comments visible in kernel doc")
Tested-by: Mingcong Bai <jeffbai@...c.io>
Tested-by: Wenbin Fang <fangwenbin@....qq.com>
Tested-by: Haien Liang <27873200@...com>
Tested-by: Jianfeng Liu <liujianfeng1994@...il.com>
Tested-by: Shirong Liu <lsr1024@...com>
Tested-by: Haofeng Wu <s2600cw2@....com>
Link: https://github.com/FanFansfan/loongson-linux/commit/22c55ab3931c32410a077b3ddb6dca3f28223360
Link: https://t.me/c/1109254909/768552
Co-developed-by: Shang Yatsen <429839446@...com>
Signed-off-by: Shang Yatsen <429839446@...com>
Signed-off-by: Mingcong Bai <jeffbai@...c.io>
---
 drivers/gpu/drm/xe/xe_query.c | 2 +-
 include/uapi/drm/xe_drm.h     | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index 2dbf4066d86ff225eee002d352e1233c8d9519b9..fe94a7781fa04fb277d5cc8b973b145293d3d066 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -346,7 +346,7 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
 	config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
 			DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY;
 	config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT] =
-		xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K;
+		xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : PAGE_SIZE;
 	config->info[DRM_XE_QUERY_CONFIG_VA_BITS] = xe->info.va_bits;
 	config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY] =
 		xe_exec_queue_device_get_max_priority(xe);
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index 9c08738c3b918ee387f51a68ba080057c6d5716f..f92eb8c3317a09baad4550024bb3beea02850010 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -397,8 +397,11 @@ struct drm_xe_query_mem_regions {
  *      has low latency hint support
  *    - %DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR - Flag is set if the
  *      device has CPU address mirroring support
- *  - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
- *    required by this device, typically SZ_4K or SZ_64K
+ *  - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment required
+ *    by this device and the CPU. The minimum page size for the device is
+ *    usually SZ_4K or SZ_64K, while for the CPU, it is PAGE_SIZE. This value
+ *    is calculated by max(min_gpu_page_size, PAGE_SIZE). This alignment is
+ *    enforced on buffer object allocations and VM binds.
  *  - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
  *  - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
  *    available exec queue priority

-- 
2.49.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ