* [Intel-gfx] [PATCH 0/1] drm/i915/uapi: Enable L3 Bank Count Querying
@ 2023-09-14 18:32 Jonathan Cavitt
2023-09-14 18:32 ` [Intel-gfx] [PATCH 1/1] " Jonathan Cavitt
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Cavitt @ 2023-09-14 18:32 UTC (permalink / raw)
To: intel-gfx
Cc: bartosz.dunajski, adam.cetnerowski, jonathan.cavitt,
slawomir.milczarek, michal.mrozek, james.c.wright,
matthew.d.roper
Extend the query ioctl to allow querying the count of the available L3
Banks on a given engine.
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
CC: Ashutosh Dixit <ashutosh.dixit@intel.com>
CC: Matt Roper <matthew.d.roper@intel.com>
CC: John Harrison <john.c.harrison@intel.com>
CC: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
CC: James Ausmus <james.ausmus@intel.com>
CC: James C Wright <james.c.wright@intel.com>
CC: Slawomir Milczarek <slawomir.milczarek@intel.com>
CC: Michal Mrozek <michal.mrozek@intel.com>
CC: Adam Cetnerowski <adam.cetnerowski@intel.com>
CC: Bartosz Dunajski <bartosz.dunajski@intel.com>
Jonathan Cavitt (1):
drm/i915/uapi: Enable L3 Bank Count Querying
drivers/gpu/drm/i915/gt/intel_gt.c | 26 +++++++++++++++++++
drivers/gpu/drm/i915/gt/intel_gt.h | 3 +++
drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
drivers/gpu/drm/i915/i915_query.c | 34 +++++++++++++++++++++++++
include/uapi/drm/i915_drm.h | 15 ++++++++++-
5 files changed, 78 insertions(+), 1 deletion(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] [PATCH 1/1] drm/i915/uapi: Enable L3 Bank Count Querying
2023-09-14 18:32 [Intel-gfx] [PATCH 0/1] drm/i915/uapi: Enable L3 Bank Count Querying Jonathan Cavitt
@ 2023-09-14 18:32 ` Jonathan Cavitt
2023-09-20 14:50 ` Rodrigo Vivi
2023-09-14 23:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2023-09-14 23:38 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cavitt @ 2023-09-14 18:32 UTC (permalink / raw)
To: intel-gfx
Cc: bartosz.dunajski, adam.cetnerowski, jonathan.cavitt,
slawomir.milczarek, michal.mrozek, james.c.wright,
matthew.d.roper
Extend the query ioctl to allow querying the count of the available L3
Banks on a given engine.
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
---
drivers/gpu/drm/i915/gt/intel_gt.c | 26 +++++++++++++++++++
drivers/gpu/drm/i915/gt/intel_gt.h | 3 +++
drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
drivers/gpu/drm/i915/i915_query.c | 34 +++++++++++++++++++++++++
include/uapi/drm/i915_drm.h | 15 ++++++++++-
5 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index 449f0b7fc8434..865854c76c375 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -884,6 +884,32 @@ static int intel_gt_tile_setup(struct intel_gt *gt, phys_addr_t phys_addr)
return 0;
}
+int intel_count_l3_banks(struct drm_i915_private *i915,
+ struct intel_engine_cs *engine)
+{
+ struct intel_gt *gt = engine->gt;
+ struct intel_uncore *uncore = gt->uncore;
+ intel_wakeref_t wakeref;
+ u32 count, store;
+
+ /* L3 Banks not supported prior to version 12 */
+ if (GRAPHICS_VER(i915) < 12)
+ return -ENODEV;
+
+ if (IS_PONTEVECCHIO(i915)) {
+ with_intel_runtime_pm(uncore->rpm, wakeref)
+ store = intel_uncore_read(uncore, GEN10_MIRROR_FUSE3);
+ count = hweight32(REG_FIELD_GET(GEN12_MEML3_EN_MASK, store)) * 4 *
+ hweight32(REG_FIELD_GET(XEHPC_GT_L3_MODE_MASK, store));
+ } else if (GRAPHICS_VER_FULL(i915) > IP_VER(12, 50)) {
+ count = hweight32(gt->info.mslice_mask) * 8;
+ } else {
+ count = hweight32(gt->info.l3bank_mask);
+ }
+
+ return count;
+}
+
int intel_gt_probe_all(struct drm_i915_private *i915)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
index 239848bcb2a42..4a05443418efd 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt.h
@@ -161,6 +161,9 @@ static inline bool intel_gt_is_wedged(const struct intel_gt *gt)
return unlikely(test_bit(I915_WEDGED, >->reset.flags));
}
+int intel_count_l3_banks(struct drm_i915_private *i915,
+ struct intel_engine_cs *engine);
+
int intel_gt_probe_all(struct drm_i915_private *i915);
int intel_gt_tiles_init(struct drm_i915_private *i915);
void intel_gt_release_all(struct drm_i915_private *i915);
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
index a00ff51c681d5..f148bf3dfd4b3 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
@@ -569,6 +569,7 @@
#define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
#define GEN10_L3BANK_PAIR_COUNT 4
#define GEN10_L3BANK_MASK 0x0F
+#define XEHPC_GT_L3_MODE_MASK REG_GENMASK(7, 4)
/* on Xe_HP the same fuses indicates mslices instead of L3 banks */
#define GEN12_MAX_MSLICES 4
#define GEN12_MEML3_EN_MASK 0x0F
diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c
index 00871ef997920..bd3e68cf1bd10 100644
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -10,6 +10,7 @@
#include "i915_perf.h"
#include "i915_query.h"
#include "gt/intel_engine_user.h"
+#include "gt/intel_gt.h"
#include <uapi/drm/i915_drm.h>
static int copy_query_item(void *query_hdr, size_t query_sz,
@@ -551,6 +552,38 @@ static int query_hwconfig_blob(struct drm_i915_private *i915,
return hwconfig->size;
}
+static int
+query_l3bank_count(struct drm_i915_private *i915,
+ struct drm_i915_query_item *query_item)
+{
+ struct drm_i915_query_memory_regions __user *query_ptr =
+ u64_to_user_ptr(query_item->data_ptr);
+ struct i915_engine_class_instance classinstance;
+ struct intel_engine_cs *engine;
+ int count;
+
+ if (query_item->length == 0)
+ return sizeof(count);
+
+ classinstance = *((struct i915_engine_class_instance *)&query_item->flags);
+
+ engine = intel_engine_lookup_user(i915, (u8)classinstance.engine_class,
+ (u8)classinstance.engine_instance);
+
+ if (!engine)
+ return -EINVAL;
+
+ count = intel_count_l3_banks(i915, engine);
+
+ if (count < 0)
+ return count;
+
+ if (copy_to_user(query_ptr, &count, sizeof(count)))
+ return -EFAULT;
+
+ return sizeof(count);
+}
+
static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
struct drm_i915_query_item *query_item) = {
query_topology_info,
@@ -559,6 +592,7 @@ static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
query_memregion_info,
query_hwconfig_blob,
query_geometry_subslices,
+ query_l3bank_count,
};
int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 7000e5910a1d7..746d427af8e4c 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -3013,6 +3013,7 @@ struct drm_i915_query_item {
* - %DRM_I915_QUERY_MEMORY_REGIONS (see struct drm_i915_query_memory_regions)
* - %DRM_I915_QUERY_HWCONFIG_BLOB (see `GuC HWCONFIG blob uAPI`)
* - %DRM_I915_QUERY_GEOMETRY_SUBSLICES (see struct drm_i915_query_topology_info)
+ * - %DRM_I915_QUERY_L3BANK_COUNT (see `L3 Bank Count Query uAPI`)
*/
__u64 query_id;
#define DRM_I915_QUERY_TOPOLOGY_INFO 1
@@ -3021,6 +3022,7 @@ struct drm_i915_query_item {
#define DRM_I915_QUERY_MEMORY_REGIONS 4
#define DRM_I915_QUERY_HWCONFIG_BLOB 5
#define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6
+#define DRM_I915_QUERY_L3BANK_COUNT 7
/* Must be kept compact -- no holes and well documented */
/**
@@ -3443,7 +3445,7 @@ struct drm_i915_memory_region_info {
__u64 probed_size;
/**
- * @unallocated_size: Estimate of memory remaining
+. * @unallocated_size: Estimate of memory remaining
*
* Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting.
* Without this (or if this is an older kernel) the value here will
@@ -3690,6 +3692,17 @@ struct drm_i915_gem_create_ext {
__u64 extensions;
};
+/**
+ * DOC: L3 Bank Count Query uAPI
+ *
+ * The L3 bank count query called through the query id
+ * DRM_I915_QUERY_L3BANK_COUNT and returns the count of
+ * the available L3 Banks on a given engine.
+ *
+ * The count itself is an integer, and since no additional
+ * data is returned, the count is returned as such.
+ */
+
/**
* struct drm_i915_gem_create_ext_memory_regions - The
* I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/uapi: Enable L3 Bank Count Querying
2023-09-14 18:32 [Intel-gfx] [PATCH 0/1] drm/i915/uapi: Enable L3 Bank Count Querying Jonathan Cavitt
2023-09-14 18:32 ` [Intel-gfx] [PATCH 1/1] " Jonathan Cavitt
@ 2023-09-14 23:21 ` Patchwork
2023-09-14 23:38 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2023-09-14 23:21 UTC (permalink / raw)
To: Jonathan Cavitt; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/uapi: Enable L3 Bank Count Querying
URL : https://patchwork.freedesktop.org/series/123718/
State : warning
== Summary ==
Error: dim sparse failed
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/uapi: Enable L3 Bank Count Querying
2023-09-14 18:32 [Intel-gfx] [PATCH 0/1] drm/i915/uapi: Enable L3 Bank Count Querying Jonathan Cavitt
2023-09-14 18:32 ` [Intel-gfx] [PATCH 1/1] " Jonathan Cavitt
2023-09-14 23:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
@ 2023-09-14 23:38 ` Patchwork
2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2023-09-14 23:38 UTC (permalink / raw)
To: Jonathan Cavitt; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 5825 bytes --]
== Series Details ==
Series: drm/i915/uapi: Enable L3 Bank Count Querying
URL : https://patchwork.freedesktop.org/series/123718/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_13633 -> Patchwork_123718v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_123718v1 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_123718v1, please notify your bug team (lgci.bug.filing@intel.com) to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/index.html
Participating hosts (40 -> 39)
------------------------------
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_123718v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live@hangcheck:
- bat-rpls-1: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/bat-rpls-1/igt@i915_selftest@live@hangcheck.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/bat-rpls-1/igt@i915_selftest@live@hangcheck.html
Known issues
------------
Here are the changes found in Patchwork_123718v1 that come from known issues:
### CI changes ###
#### Possible fixes ####
* boot:
- fi-hsw-4770: [FAIL][3] ([i915#8293]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/fi-hsw-4770/boot.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-hsw-4770/boot.html
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s0@smem:
- bat-dg2-9: [PASS][5] -> [INCOMPLETE][6] ([i915#9275])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/bat-dg2-9/igt@gem_exec_suspend@basic-s0@smem.html
* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- fi-hsw-4770: NOTRUN -> [SKIP][7] ([fdo#109271]) +13 other tests skip
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-hsw-4770/igt@kms_addfb_basic@addfb25-y-tiled-small-legacy.html
* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [PASS][8] -> [FAIL][9] ([IGT#3] / [i915#6121])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-kbl-guc/igt@kms_hdmi_inject@inject-audio.html
* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1:
- fi-hsw-4770: NOTRUN -> [DMESG-WARN][10] ([i915#8841]) +6 other tests dmesg-warn
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-hsw-4770/igt@kms_pipe_crc_basic@suspend-read-crc@pipe-c-vga-1.html
* igt@kms_psr@sprite_plane_onoff:
- fi-hsw-4770: NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#1072]) +3 other tests skip
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-hsw-4770/igt@kms_psr@sprite_plane_onoff.html
#### Possible fixes ####
* igt@i915_selftest@live@execlists:
- fi-bsw-n3050: [ABORT][12] ([i915#7911] / [i915#7913]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/fi-bsw-n3050/igt@i915_selftest@live@execlists.html
* igt@i915_suspend@basic-s2idle-without-i915:
- bat-dg2-9: [WARN][14] -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/bat-dg2-9/igt@i915_suspend@basic-s2idle-without-i915.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/bat-dg2-9/igt@i915_suspend@basic-s2idle-without-i915.html
* igt@kms_chamelium_frames@dp-crc-fast:
- {bat-dg2-13}: [DMESG-WARN][16] ([Intel XE#485]) -> [PASS][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13633/bat-dg2-13/igt@kms_chamelium_frames@dp-crc-fast.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/bat-dg2-13/igt@kms_chamelium_frames@dp-crc-fast.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[Intel XE#485]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/485
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#6121]: https://gitlab.freedesktop.org/drm/intel/issues/6121
[i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#8293]: https://gitlab.freedesktop.org/drm/intel/issues/8293
[i915#8841]: https://gitlab.freedesktop.org/drm/intel/issues/8841
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275
Build changes
-------------
* Linux: CI_DRM_13633 -> Patchwork_123718v1
CI-20190529: 20190529
CI_DRM_13633: 5cf0e59ecc1424e51a5f5cf2f26682b5dcea5a25 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7488: 099e058c5dfb7a49942edf03cae88a52a77077a3 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_123718v1: 5cf0e59ecc1424e51a5f5cf2f26682b5dcea5a25 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
e661e8ee9541 drm/i915/uapi: Enable L3 Bank Count Querying
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123718v1/index.html
[-- Attachment #2: Type: text/html, Size: 6756 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915/uapi: Enable L3 Bank Count Querying
2023-09-14 18:32 ` [Intel-gfx] [PATCH 1/1] " Jonathan Cavitt
@ 2023-09-20 14:50 ` Rodrigo Vivi
2023-09-21 8:44 ` Cetnerowski, Adam
0 siblings, 1 reply; 6+ messages in thread
From: Rodrigo Vivi @ 2023-09-20 14:50 UTC (permalink / raw)
To: Jonathan Cavitt
Cc: adam.cetnerowski, intel-gfx, michal.mrozek, slawomir.milczarek,
james.c.wright, bartosz.dunajski, matthew.d.roper
On Thu, Sep 14, 2023 at 11:32:49AM -0700, Jonathan Cavitt wrote:
> Extend the query ioctl to allow querying the count of the available L3
> Banks on a given engine.
Why do you need this? Who is using? Where's the pull request for the UMDs
and IGTs?
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
Please never send a cover letter with a stand-alone single patch.
Specially in this case where the cover letter is not bringing any
additional information. But even if you had enough information
it should be added here, below these '---', after the format-patch,
so it gets to the email without getting into the patch itself.
> drivers/gpu/drm/i915/gt/intel_gt.c | 26 +++++++++++++++++++
> drivers/gpu/drm/i915/gt/intel_gt.h | 3 +++
> drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
> drivers/gpu/drm/i915/i915_query.c | 34 +++++++++++++++++++++++++
> include/uapi/drm/i915_drm.h | 15 ++++++++++-
> 5 files changed, 78 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 449f0b7fc8434..865854c76c375 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -884,6 +884,32 @@ static int intel_gt_tile_setup(struct intel_gt *gt, phys_addr_t phys_addr)
> return 0;
> }
>
> +int intel_count_l3_banks(struct drm_i915_private *i915,
> + struct intel_engine_cs *engine)
> +{
> + struct intel_gt *gt = engine->gt;
> + struct intel_uncore *uncore = gt->uncore;
> + intel_wakeref_t wakeref;
> + u32 count, store;
> +
> + /* L3 Banks not supported prior to version 12 */
> + if (GRAPHICS_VER(i915) < 12)
> + return -ENODEV;
-ENODEV is the best choice?
> +
> + if (IS_PONTEVECCHIO(i915)) {
> + with_intel_runtime_pm(uncore->rpm, wakeref)
> + store = intel_uncore_read(uncore, GEN10_MIRROR_FUSE3);
> + count = hweight32(REG_FIELD_GET(GEN12_MEML3_EN_MASK, store)) * 4 *
> + hweight32(REG_FIELD_GET(XEHPC_GT_L3_MODE_MASK, store));
> + } else if (GRAPHICS_VER_FULL(i915) > IP_VER(12, 50)) {
> + count = hweight32(gt->info.mslice_mask) * 8;
> + } else {
> + count = hweight32(gt->info.l3bank_mask);
> + }
> +
> + return count;
> +}
> +
> int intel_gt_probe_all(struct drm_i915_private *i915)
> {
> struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
> index 239848bcb2a42..4a05443418efd 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -161,6 +161,9 @@ static inline bool intel_gt_is_wedged(const struct intel_gt *gt)
> return unlikely(test_bit(I915_WEDGED, >->reset.flags));
> }
>
> +int intel_count_l3_banks(struct drm_i915_private *i915,
> + struct intel_engine_cs *engine);
> +
> int intel_gt_probe_all(struct drm_i915_private *i915);
> int intel_gt_tiles_init(struct drm_i915_private *i915);
> void intel_gt_release_all(struct drm_i915_private *i915);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_regs.h b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index a00ff51c681d5..f148bf3dfd4b3 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -569,6 +569,7 @@
> #define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
> #define GEN10_L3BANK_PAIR_COUNT 4
This seems to contradict what your comment above told about gen12+
> #define GEN10_L3BANK_MASK 0x0F
> +#define XEHPC_GT_L3_MODE_MASK REG_GENMASK(7, 4)
> /* on Xe_HP the same fuses indicates mslices instead of L3 banks */
> #define GEN12_MAX_MSLICES 4
> #define GEN12_MEML3_EN_MASK 0x0F
> diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c
> index 00871ef997920..bd3e68cf1bd10 100644
> --- a/drivers/gpu/drm/i915/i915_query.c
> +++ b/drivers/gpu/drm/i915/i915_query.c
> @@ -10,6 +10,7 @@
> #include "i915_perf.h"
> #include "i915_query.h"
> #include "gt/intel_engine_user.h"
> +#include "gt/intel_gt.h"
> #include <uapi/drm/i915_drm.h>
>
> static int copy_query_item(void *query_hdr, size_t query_sz,
> @@ -551,6 +552,38 @@ static int query_hwconfig_blob(struct drm_i915_private *i915,
> return hwconfig->size;
> }
>
> +static int
> +query_l3bank_count(struct drm_i915_private *i915,
> + struct drm_i915_query_item *query_item)
> +{
> + struct drm_i915_query_memory_regions __user *query_ptr =
> + u64_to_user_ptr(query_item->data_ptr);
> + struct i915_engine_class_instance classinstance;
> + struct intel_engine_cs *engine;
> + int count;
> +
> + if (query_item->length == 0)
> + return sizeof(count);
> +
> + classinstance = *((struct i915_engine_class_instance *)&query_item->flags);
> +
> + engine = intel_engine_lookup_user(i915, (u8)classinstance.engine_class,
> + (u8)classinstance.engine_instance);
> +
> + if (!engine)
> + return -EINVAL;
> +
> + count = intel_count_l3_banks(i915, engine);
> +
> + if (count < 0)
> + return count;
> +
> + if (copy_to_user(query_ptr, &count, sizeof(count)))
> + return -EFAULT;
> +
> + return sizeof(count);
> +}
> +
> static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
> struct drm_i915_query_item *query_item) = {
> query_topology_info,
> @@ -559,6 +592,7 @@ static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
> query_memregion_info,
> query_hwconfig_blob,
> query_geometry_subslices,
> + query_l3bank_count,
> };
>
> int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 7000e5910a1d7..746d427af8e4c 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -3013,6 +3013,7 @@ struct drm_i915_query_item {
> * - %DRM_I915_QUERY_MEMORY_REGIONS (see struct drm_i915_query_memory_regions)
> * - %DRM_I915_QUERY_HWCONFIG_BLOB (see `GuC HWCONFIG blob uAPI`)
> * - %DRM_I915_QUERY_GEOMETRY_SUBSLICES (see struct drm_i915_query_topology_info)
> + * - %DRM_I915_QUERY_L3BANK_COUNT (see `L3 Bank Count Query uAPI`)
> */
> __u64 query_id;
> #define DRM_I915_QUERY_TOPOLOGY_INFO 1
> @@ -3021,6 +3022,7 @@ struct drm_i915_query_item {
> #define DRM_I915_QUERY_MEMORY_REGIONS 4
> #define DRM_I915_QUERY_HWCONFIG_BLOB 5
> #define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6
> +#define DRM_I915_QUERY_L3BANK_COUNT 7
> /* Must be kept compact -- no holes and well documented */
>
> /**
> @@ -3443,7 +3445,7 @@ struct drm_i915_memory_region_info {
> __u64 probed_size;
>
> /**
> - * @unallocated_size: Estimate of memory remaining
> +. * @unallocated_size: Estimate of memory remaining
^ garbage
> *
> * Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting.
> * Without this (or if this is an older kernel) the value here will
> @@ -3690,6 +3692,17 @@ struct drm_i915_gem_create_ext {
> __u64 extensions;
> };
>
> +/**
> + * DOC: L3 Bank Count Query uAPI
> + *
> + * The L3 bank count query called through the query id
> + * DRM_I915_QUERY_L3BANK_COUNT and returns the count of
> + * the available L3 Banks on a given engine.
> + *
> + * The count itself is an integer, and since no additional
> + * data is returned, the count is returned as such.
> + */
> +
> /**
> * struct drm_i915_gem_create_ext_memory_regions - The
> * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Intel-gfx] [PATCH 1/1] drm/i915/uapi: Enable L3 Bank Count Querying
2023-09-20 14:50 ` Rodrigo Vivi
@ 2023-09-21 8:44 ` Cetnerowski, Adam
0 siblings, 0 replies; 6+ messages in thread
From: Cetnerowski, Adam @ 2023-09-21 8:44 UTC (permalink / raw)
To: Vivi, Rodrigo, Cavitt, Jonathan, Hazubski, Filip
Cc: Dunajski, Bartosz, intel-gfx@lists.freedesktop.org,
Milczarek, Slawomir, Mrozek, Michal, Wright, James C,
Roper, Matthew D
+@Hazubski, Filip
-----Original Message-----
From: Vivi, Rodrigo <rodrigo.vivi@intel.com>
Sent: Wednesday, September 20, 2023 4:51 PM
To: Cavitt, Jonathan <jonathan.cavitt@intel.com>
Cc: intel-gfx@lists.freedesktop.org; Dunajski, Bartosz <bartosz.dunajski@intel.com>; Cetnerowski, Adam <adam.cetnerowski@intel.com>; Milczarek, Slawomir <slawomir.milczarek@intel.com>; Mrozek, Michal <michal.mrozek@intel.com>; Wright, James C <james.c.wright@intel.com>; Roper, Matthew D <matthew.d.roper@intel.com>
Subject: Re: [Intel-gfx] [PATCH 1/1] drm/i915/uapi: Enable L3 Bank Count Querying
On Thu, Sep 14, 2023 at 11:32:49AM -0700, Jonathan Cavitt wrote:
> Extend the query ioctl to allow querying the count of the available L3
> Banks on a given engine.
Why do you need this? Who is using? Where's the pull request for the UMDs and IGTs?
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
Please never send a cover letter with a stand-alone single patch.
Specially in this case where the cover letter is not bringing any additional information. But even if you had enough information it should be added here, below these '---', after the format-patch, so it gets to the email without getting into the patch itself.
> drivers/gpu/drm/i915/gt/intel_gt.c | 26 +++++++++++++++++++
> drivers/gpu/drm/i915/gt/intel_gt.h | 3 +++
> drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 +
> drivers/gpu/drm/i915/i915_query.c | 34 +++++++++++++++++++++++++
> include/uapi/drm/i915_drm.h | 15 ++++++++++-
> 5 files changed, 78 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c
> b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 449f0b7fc8434..865854c76c375 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -884,6 +884,32 @@ static int intel_gt_tile_setup(struct intel_gt *gt, phys_addr_t phys_addr)
> return 0;
> }
>
> +int intel_count_l3_banks(struct drm_i915_private *i915,
> + struct intel_engine_cs *engine)
> +{
> + struct intel_gt *gt = engine->gt;
> + struct intel_uncore *uncore = gt->uncore;
> + intel_wakeref_t wakeref;
> + u32 count, store;
> +
> + /* L3 Banks not supported prior to version 12 */
> + if (GRAPHICS_VER(i915) < 12)
> + return -ENODEV;
-ENODEV is the best choice?
> +
> + if (IS_PONTEVECCHIO(i915)) {
> + with_intel_runtime_pm(uncore->rpm, wakeref)
> + store = intel_uncore_read(uncore, GEN10_MIRROR_FUSE3);
> + count = hweight32(REG_FIELD_GET(GEN12_MEML3_EN_MASK, store)) * 4 *
> + hweight32(REG_FIELD_GET(XEHPC_GT_L3_MODE_MASK, store));
> + } else if (GRAPHICS_VER_FULL(i915) > IP_VER(12, 50)) {
> + count = hweight32(gt->info.mslice_mask) * 8;
> + } else {
> + count = hweight32(gt->info.l3bank_mask);
> + }
> +
> + return count;
> +}
> +
> int intel_gt_probe_all(struct drm_i915_private *i915) {
> struct pci_dev *pdev = to_pci_dev(i915->drm.dev); diff --git
> a/drivers/gpu/drm/i915/gt/intel_gt.h
> b/drivers/gpu/drm/i915/gt/intel_gt.h
> index 239848bcb2a42..4a05443418efd 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.h
> @@ -161,6 +161,9 @@ static inline bool intel_gt_is_wedged(const struct intel_gt *gt)
> return unlikely(test_bit(I915_WEDGED, >->reset.flags)); }
>
> +int intel_count_l3_banks(struct drm_i915_private *i915,
> + struct intel_engine_cs *engine);
> +
> int intel_gt_probe_all(struct drm_i915_private *i915); int
> intel_gt_tiles_init(struct drm_i915_private *i915); void
> intel_gt_release_all(struct drm_i915_private *i915); diff --git
> a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> index a00ff51c681d5..f148bf3dfd4b3 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_regs.h
> @@ -569,6 +569,7 @@
> #define GEN10_MIRROR_FUSE3 _MMIO(0x9118)
> #define GEN10_L3BANK_PAIR_COUNT 4
This seems to contradict what your comment above told about gen12+
> #define GEN10_L3BANK_MASK 0x0F
> +#define XEHPC_GT_L3_MODE_MASK REG_GENMASK(7, 4)
> /* on Xe_HP the same fuses indicates mslices instead of L3 banks */
> #define GEN12_MAX_MSLICES 4
> #define GEN12_MEML3_EN_MASK 0x0F
> diff --git a/drivers/gpu/drm/i915/i915_query.c
> b/drivers/gpu/drm/i915/i915_query.c
> index 00871ef997920..bd3e68cf1bd10 100644
> --- a/drivers/gpu/drm/i915/i915_query.c
> +++ b/drivers/gpu/drm/i915/i915_query.c
> @@ -10,6 +10,7 @@
> #include "i915_perf.h"
> #include "i915_query.h"
> #include "gt/intel_engine_user.h"
> +#include "gt/intel_gt.h"
> #include <uapi/drm/i915_drm.h>
>
> static int copy_query_item(void *query_hdr, size_t query_sz, @@
> -551,6 +552,38 @@ static int query_hwconfig_blob(struct drm_i915_private *i915,
> return hwconfig->size;
> }
>
> +static int
> +query_l3bank_count(struct drm_i915_private *i915,
> + struct drm_i915_query_item *query_item) {
> + struct drm_i915_query_memory_regions __user *query_ptr =
> + u64_to_user_ptr(query_item->data_ptr);
> + struct i915_engine_class_instance classinstance;
> + struct intel_engine_cs *engine;
> + int count;
> +
> + if (query_item->length == 0)
> + return sizeof(count);
> +
> + classinstance = *((struct i915_engine_class_instance
> +*)&query_item->flags);
> +
> + engine = intel_engine_lookup_user(i915, (u8)classinstance.engine_class,
> + (u8)classinstance.engine_instance);
> +
> + if (!engine)
> + return -EINVAL;
> +
> + count = intel_count_l3_banks(i915, engine);
> +
> + if (count < 0)
> + return count;
> +
> + if (copy_to_user(query_ptr, &count, sizeof(count)))
> + return -EFAULT;
> +
> + return sizeof(count);
> +}
> +
> static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
> struct drm_i915_query_item *query_item) = {
> query_topology_info,
> @@ -559,6 +592,7 @@ static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
> query_memregion_info,
> query_hwconfig_blob,
> query_geometry_subslices,
> + query_l3bank_count,
> };
>
> int i915_query_ioctl(struct drm_device *dev, void *data, struct
> drm_file *file) diff --git a/include/uapi/drm/i915_drm.h
> b/include/uapi/drm/i915_drm.h index 7000e5910a1d7..746d427af8e4c
> 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -3013,6 +3013,7 @@ struct drm_i915_query_item {
> * - %DRM_I915_QUERY_MEMORY_REGIONS (see struct drm_i915_query_memory_regions)
> * - %DRM_I915_QUERY_HWCONFIG_BLOB (see `GuC HWCONFIG blob uAPI`)
> * - %DRM_I915_QUERY_GEOMETRY_SUBSLICES (see struct
> drm_i915_query_topology_info)
> + * - %DRM_I915_QUERY_L3BANK_COUNT (see `L3 Bank Count Query uAPI`)
> */
> __u64 query_id;
> #define DRM_I915_QUERY_TOPOLOGY_INFO 1
> @@ -3021,6 +3022,7 @@ struct drm_i915_query_item {
> #define DRM_I915_QUERY_MEMORY_REGIONS 4
> #define DRM_I915_QUERY_HWCONFIG_BLOB 5
> #define DRM_I915_QUERY_GEOMETRY_SUBSLICES 6
> +#define DRM_I915_QUERY_L3BANK_COUNT 7
> /* Must be kept compact -- no holes and well documented */
>
> /**
> @@ -3443,7 +3445,7 @@ struct drm_i915_memory_region_info {
> __u64 probed_size;
>
> /**
> - * @unallocated_size: Estimate of memory remaining
> +. * @unallocated_size: Estimate of memory remaining
^ garbage
> *
> * Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable accounting.
> * Without this (or if this is an older kernel) the value here will
> @@ -3690,6 +3692,17 @@ struct drm_i915_gem_create_ext {
> __u64 extensions;
> };
>
> +/**
> + * DOC: L3 Bank Count Query uAPI
> + *
> + * The L3 bank count query called through the query id
> + * DRM_I915_QUERY_L3BANK_COUNT and returns the count of
> + * the available L3 Banks on a given engine.
> + *
> + * The count itself is an integer, and since no additional
> + * data is returned, the count is returned as such.
> + */
> +
> /**
> * struct drm_i915_gem_create_ext_memory_regions - The
> * I915_GEM_CREATE_EXT_MEMORY_REGIONS extension.
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-21 8:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 18:32 [Intel-gfx] [PATCH 0/1] drm/i915/uapi: Enable L3 Bank Count Querying Jonathan Cavitt
2023-09-14 18:32 ` [Intel-gfx] [PATCH 1/1] " Jonathan Cavitt
2023-09-20 14:50 ` Rodrigo Vivi
2023-09-21 8:44 ` Cetnerowski, Adam
2023-09-14 23:21 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for " Patchwork
2023-09-14 23:38 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox