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>,
	Matt Roper <matthew.d.roper@intel.com>
Subject: [PATCH 3/3] drm/xe: Use VF_CAP_REG for device wmb
Date: Tue,  2 Jul 2024 20:37:04 +0200	[thread overview]
Message-ID: <20240702183704.1022-4-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20240702183704.1022-1-michal.wajdeczko@intel.com>

To force a write barrier on the device memory, we write to the
SOFTWARE_FLAGS_SPR33 register, but this particular register was
selected because it was one of the writable and unused register.

Since a write barrier should also work if we use the read-only
register, switch to VF_CAP_REG register that is also marked as
accessible for VFs.

While at it, add simple kernel-doc for xe_device_wmb() function.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index cfda7cb5df2c..74beddb55284 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -744,13 +744,22 @@ void xe_device_shutdown(struct xe_device *xe)
 {
 }
 
+/**
+ * xe_device_wmb() - Device specific write memory barrier
+ * @xe: the &xe_device
+ *
+ * While wmb() is sufficient for a barrier if we use system memory, on discrete
+ * platforms with device memory we additionally need to issue a register write.
+ * Since it doesn't matter which register we write to, use the read-only VF_CAP
+ * register that is also marked as accessible by the VFs.
+ */
 void xe_device_wmb(struct xe_device *xe)
 {
 	struct xe_gt *gt = xe_root_mmio_gt(xe);
 
 	wmb();
 	if (IS_DGFX(xe))
-		xe_mmio_write32(gt, SOFTWARE_FLAGS_SPR33, 0);
+		xe_mmio_write32(gt, VF_CAP_REG, 0);
 }
 
 /**
-- 
2.43.0


  parent reply	other threads:[~2024-07-02 18:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 18:37 [PATCH 0/3] drm/xe: Use VF_CAP_REG for device wmb Michal Wajdeczko
2024-07-02 18:37 ` [PATCH 1/3] drm/xe: Fix register definition order in xe_regs.h Michal Wajdeczko
2024-07-04  3:17   ` Ghimiray, Himal Prasad
2024-07-02 18:37 ` [PATCH 2/3] drm/xe: Kill regs/xe_sriov_regs.h Michal Wajdeczko
2024-07-04  3:17   ` Ghimiray, Himal Prasad
2024-07-02 18:37 ` Michal Wajdeczko [this message]
2024-07-04  4:01   ` [PATCH 3/3] drm/xe: Use VF_CAP_REG for device wmb Ghimiray, Himal Prasad
2024-08-26 23:24   ` Dixit, Ashutosh
2024-08-27 21:05     ` Michal Wajdeczko
2024-07-02 22:13 ` [PATCH 0/3] " Matt Roper
2024-07-03 13:22 ` ✓ CI.Patch_applied: success for " Patchwork
2024-07-03 13:22 ` ✗ CI.checkpatch: warning " Patchwork
2024-07-03 13:23 ` ✓ CI.KUnit: success " Patchwork
2024-07-03 13:35 ` ✓ CI.Build: " Patchwork
2024-07-03 13:38 ` ✓ CI.Hooks: " Patchwork
2024-07-03 13:39 ` ✓ CI.checksparse: " Patchwork
2024-07-03 14:05 ` ✓ CI.BAT: " Patchwork
2024-07-03 17:52 ` ✗ CI.FULL: failure " Patchwork
2024-07-03 19:42   ` Michal Wajdeczko

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=20240702183704.1022-4-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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