From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: kamil.konieczny@linux.intel.com, adam.miszczak@linux.intel.com,
jakub1.kolakowski@intel.com, lukasz.laguna@intel.com,
michal.wajdeczko@intel.com, michal.winiarski@intel.com,
narasimha.c.v@intel.com, piotr.piorkowski@intel.com,
satyanarayana.k.v.p@intel.com, tomasz.lis@intel.com,
Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Subject: [PATCH v3 i-g-t 4/4] lib/xe/xe_sriov_provisioning: Iterate only within valid PTE offsets
Date: Thu, 21 Nov 2024 15:18:51 +0100 [thread overview]
Message-ID: <20241121141851.631877-5-marcin.bernatowicz@linux.intel.com> (raw)
In-Reply-To: <20241121141851.631877-1-marcin.bernatowicz@linux.intel.com>
Update range-checking logic to iterate only within valid PTE offsets
based on MAX_WOPCM_SIZE and GUC_GGTT_TOP.
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3507
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
Cc: C V Narasimha <narasimha.c.v@intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: K V P Satyanarayana <satyanarayana.k.v.p@intel.com>
Cc: Lukasz Laguna <lukasz.laguna@intel.com>
Cc: Michał Wajdeczko <michal.wajdeczko@intel.com>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Tomasz Lis <tomasz.lis@intel.com>
---
lib/xe/xe_sriov_provisioning.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/xe/xe_sriov_provisioning.c b/lib/xe/xe_sriov_provisioning.c
index d448a53d8..67ae9cf54 100644
--- a/lib/xe/xe_sriov_provisioning.c
+++ b/lib/xe/xe_sriov_provisioning.c
@@ -39,6 +39,10 @@ const char *xe_sriov_shared_res_to_string(enum xe_sriov_shared_res res)
#define PRE_1250_IP_VER_GGTT_PTE_VFID_MASK GENMASK_ULL(4, 2)
#define GGTT_PTE_VFID_MASK GENMASK_ULL(11, 2)
#define GGTT_PTE_VFID_SHIFT 2
+#define GUC_GGTT_TOP 0xFEE00000
+#define MAX_WOPCM_SIZE SZ_8M
+#define START_PTE_OFFSET (MAX_WOPCM_SIZE / SZ_4K * sizeof(xe_ggtt_pte_t))
+#define MAX_PTE_OFFSET (GUC_GGTT_TOP / SZ_4K * sizeof(xe_ggtt_pte_t))
static uint64_t get_vfid_mask(int fd)
{
@@ -112,7 +116,8 @@ int xe_sriov_find_ggtt_provisioned_pte_offsets(int pf_fd, int gt, struct xe_mmio
*ranges = NULL;
*nr_ranges = 0;
- for (uint32_t offset = 0; offset < SZ_8M; offset += sizeof(xe_ggtt_pte_t)) {
+ for (uint32_t offset = START_PTE_OFFSET; offset < MAX_PTE_OFFSET;
+ offset += sizeof(xe_ggtt_pte_t)) {
pte = xe_mmio_ggtt_read(mmio, gt, offset);
vf_id = (pte & vfid_mask) >> GGTT_PTE_VFID_SHIFT;
--
2.31.1
next prev parent reply other threads:[~2024-11-21 14:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 14:18 [PATCH v3 i-g-t 0/4] Improvements for xe_sriov_flr test and xe_mmio lib Marcin Bernatowicz
2024-11-21 14:18 ` [PATCH v3 i-g-t 1/4] lib/xe/xe_mmio: Replace open-coded init/cleanup with existing functions Marcin Bernatowicz
2024-11-21 14:18 ` [PATCH v3 i-g-t 2/4] lib/xe/xe_sriov_provisioning: Refactor range handling and logging Marcin Bernatowicz
2024-11-21 14:18 ` [PATCH v3 i-g-t 3/4] tests/xe/xe_sriov_flr: Use SKIP for unmet subcheck prerequisites Marcin Bernatowicz
2024-11-22 10:39 ` Laguna, Lukasz
2024-11-21 14:18 ` Marcin Bernatowicz [this message]
2024-11-22 10:43 ` [PATCH v3 i-g-t 4/4] lib/xe/xe_sriov_provisioning: Iterate only within valid PTE offsets Laguna, Lukasz
2024-11-21 17:31 ` ✓ Xe.CI.BAT: success for Improvements for xe_sriov_flr test and xe_mmio lib (rev3) Patchwork
2024-11-21 17:44 ` ✗ i915.CI.BAT: failure " Patchwork
2024-11-22 2:31 ` ✗ Xe.CI.Full: " Patchwork
2024-11-22 13:29 ` Bernatowicz, Marcin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241121141851.631877-5-marcin.bernatowicz@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=kamil.konieczny@linux.intel.com \
--cc=lukasz.laguna@intel.com \
--cc=michal.wajdeczko@intel.com \
--cc=michal.winiarski@intel.com \
--cc=narasimha.c.v@intel.com \
--cc=piotr.piorkowski@intel.com \
--cc=satyanarayana.k.v.p@intel.com \
--cc=tomasz.lis@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox