]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/xe: Use VF_CAP_REG for device wmb
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 2 Jul 2024 18:37:04 +0000 (20:37 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Thu, 4 Jul 2024 09:55:40 +0000 (11:55 +0200)
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>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240702183704.1022-4-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_device.c

index 03492fbcb8fbf1aef6ad874b7899100530e60ed6..db513175b29e70f9823f1811e13eea5556abc0ae 100644 (file)
@@ -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);
 }
 
 /**