Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Michal Wajdeczko" <michal.wajdeczko@intel.com>,
	"Piotr Piórkowski" <piotr.piorkowski@intel.com>
Subject: [PATCH] drm/xe/pf: Fix xe_gt_sriov_pf_config_print_available_ggtt()
Date: Fri, 19 Apr 2024 16:10:00 +0200	[thread overview]
Message-ID: <20240419141000.314-1-michal.wajdeczko@intel.com> (raw)

This function is using internal helper pf_get_spare_ggtt() that
expects PF's master mutex to be locked. Fix that.

Fixes: ac6598aed1b3 ("drm/xe/pf: Add support to configure SR-IOV VFs")
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
index 0f5614877770..79116ad58620 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -1932,14 +1932,17 @@ int xe_gt_sriov_pf_config_print_available_ggtt(struct xe_gt *gt, struct drm_prin
 	const struct drm_mm *mm = &ggtt->mm;
 	const struct drm_mm_node *entry;
 	u64 alignment = pf_get_ggtt_alignment(gt);
-	u64 spare = pf_get_spare_ggtt(gt);
 	u64 hole_min_start = xe_wopcm_size(gt_to_xe(gt));
 	u64 hole_start, hole_end, hole_size;
-	u64 avail, total = 0;
+	u64 spare, avail, total = 0;
 	char buf[10];
 
 	xe_gt_assert(gt, IS_SRIOV_PF(gt_to_xe(gt)));
 
+	mutex_lock(xe_gt_sriov_pf_master_mutex(gt));
+
+	spare = pf_get_spare_ggtt(gt);
+
 	mutex_lock(&ggtt->lock);
 
 	drm_mm_for_each_hole(entry, mm, hole_start, hole_end) {
@@ -1957,6 +1960,7 @@ int xe_gt_sriov_pf_config_print_available_ggtt(struct xe_gt *gt, struct drm_prin
 	}
 
 	mutex_unlock(&ggtt->lock);
+	mutex_unlock(xe_gt_sriov_pf_master_mutex(gt));
 
 	string_get_size(total, 1, STRING_UNITS_2, buf, sizeof(buf));
 	drm_printf(p, "total:\t%llu\t(%s)\n", total, buf);
-- 
2.43.0


             reply	other threads:[~2024-04-19 14:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 14:10 Michal Wajdeczko [this message]
2024-04-19 15:56 ` ✓ CI.Patch_applied: success for drm/xe/pf: Fix xe_gt_sriov_pf_config_print_available_ggtt() Patchwork
2024-04-19 15:57 ` ✓ CI.checkpatch: " Patchwork
2024-04-19 15:58 ` ✓ CI.KUnit: " Patchwork
2024-04-19 16:11 ` ✓ CI.Build: " Patchwork
2024-04-19 16:24 ` ✓ CI.Hooks: " Patchwork
2024-04-19 16:36 ` ✓ CI.checksparse: " Patchwork
2024-04-19 17:46 ` ✓ CI.BAT: " Patchwork
2024-04-21  7:54 ` ✗ CI.FULL: failure " Patchwork
2024-04-22 17:35   ` Michal Wajdeczko
2024-04-22 17:08 ` [PATCH] " Piotr Piórkowski
2024-04-23 12:02 ` ✗ CI.Patch_applied: failure for drm/xe/pf: Fix xe_gt_sriov_pf_config_print_available_ggtt() (rev2) Patchwork

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=20240419141000.314-1-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=piotr.piorkowski@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