Skip to content

Commit 3078d9c

Browse files
committed
drm/xe: Use VF_CAP_REG for device wmb
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 <[email protected]> Cc: Matt Roper <[email protected]> Reviewed-by: Matt Roper <[email protected]> Reviewed-by: Himal Prasad Ghimiray <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 466a6c3 commit 3078d9c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/gpu/drm/xe/xe_device.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,13 +744,22 @@ void xe_device_shutdown(struct xe_device *xe)
744744
{
745745
}
746746

747+
/**
748+
* xe_device_wmb() - Device specific write memory barrier
749+
* @xe: the &xe_device
750+
*
751+
* While wmb() is sufficient for a barrier if we use system memory, on discrete
752+
* platforms with device memory we additionally need to issue a register write.
753+
* Since it doesn't matter which register we write to, use the read-only VF_CAP
754+
* register that is also marked as accessible by the VFs.
755+
*/
747756
void xe_device_wmb(struct xe_device *xe)
748757
{
749758
struct xe_gt *gt = xe_root_mmio_gt(xe);
750759

751760
wmb();
752761
if (IS_DGFX(xe))
753-
xe_mmio_write32(gt, SOFTWARE_FLAGS_SPR33, 0);
762+
xe_mmio_write32(gt, VF_CAP_REG, 0);
754763
}
755764

756765
/**

0 commit comments

Comments
 (0)