From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Michal Wajdeczko" <michal.wajdeczko@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>
Subject: [PATCH 2/2] drm/xe: Use drm_device managed mutex/mm init helpers in GGTT
Date: Fri, 24 May 2024 15:35:18 +0200 [thread overview]
Message-ID: <20240524133518.976-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20240524133518.976-1-michal.wajdeczko@intel.com>
There is not need for private release action as there are existing
drmm_mm_init() and drmm_mutex_init() helpers that can be used.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
drivers/gpu/drm/xe/xe_ggtt.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 17e5066763db..7c91fe212dcb 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -96,14 +96,6 @@ static void xe_ggtt_clear(struct xe_ggtt *ggtt, u64 start, u64 size)
}
}
-static void ggtt_fini_early(struct drm_device *drm, void *arg)
-{
- struct xe_ggtt *ggtt = arg;
-
- mutex_destroy(&ggtt->lock);
- drm_mm_takedown(&ggtt->mm);
-}
-
static void ggtt_fini(struct drm_device *drm, void *arg)
{
struct xe_ggtt *ggtt = arg;
@@ -141,6 +133,7 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
struct xe_device *xe = tile_to_xe(ggtt->tile);
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
unsigned int gsm_size;
+ int err;
if (IS_SRIOV_VF(xe))
gsm_size = SZ_8M; /* GGTT is expected to be 4GiB */
@@ -189,12 +182,18 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
else
ggtt->pt_ops = &xelp_pt_ops;
- drm_mm_init(&ggtt->mm, xe_wopcm_size(xe),
- ggtt->size - xe_wopcm_size(xe));
- mutex_init(&ggtt->lock);
+ err = drmm_mm_init(&xe->drm, &ggtt->mm, xe_wopcm_size(xe),
+ ggtt->size - xe_wopcm_size(xe));
+ if (err)
+ return err;
+
+ err = drmm_mutex_init(&xe->drm, &ggtt->lock);
+ if (err)
+ return err;
+
primelockdep(ggtt);
- return drmm_add_action_or_reset(&xe->drm, ggtt_fini_early, ggtt);
+ return 0;
}
static void xe_ggtt_invalidate(struct xe_ggtt *ggtt);
--
2.43.0
next prev parent reply other threads:[~2024-05-24 13:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 13:35 [PATCH 0/2] Add DRM-managed drm_mm_init() Michal Wajdeczko
2024-05-24 13:35 ` [PATCH 1/2] drm: " Michal Wajdeczko
2024-06-06 17:27 ` Rodrigo Vivi
2024-05-24 13:35 ` Michal Wajdeczko [this message]
2024-06-06 17:25 ` [PATCH 2/2] drm/xe: Use drm_device managed mutex/mm init helpers in GGTT Rodrigo Vivi
2024-06-06 18:33 ` Michal Wajdeczko
2024-05-24 13:41 ` ✓ CI.Patch_applied: success for Add DRM-managed drm_mm_init() Patchwork
2024-05-24 13:42 ` ✓ CI.checkpatch: " Patchwork
2024-05-24 13:43 ` ✓ CI.KUnit: " Patchwork
2024-05-24 13:54 ` ✓ CI.Build: " Patchwork
2024-05-24 13:57 ` ✓ CI.Hooks: " Patchwork
2024-05-24 13:58 ` ✗ CI.checksparse: warning " Patchwork
2024-05-24 14:28 ` ✗ CI.BAT: failure " Patchwork
2024-05-24 17:25 ` Michal Wajdeczko
2024-05-27 11:27 ` ✗ CI.FULL: " 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=20240524133518.976-3-michal.wajdeczko@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
--cc=thomas.hellstrom@linux.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