hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/gpu/drm/virtio/virtgpu_fence.c
....@@ -23,9 +23,12 @@
2323 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2424 */
2525
26
-#include <drm/drmP.h>
2726 #include <trace/events/dma_fence.h>
27
+
2828 #include "virtgpu_drv.h"
29
+
30
+#define to_virtio_fence(x) \
31
+ container_of(x, struct virtio_gpu_fence, f)
2932
3033 static const char *virtio_get_driver_name(struct dma_fence *f)
3134 {
....@@ -37,10 +40,14 @@
3740 return "controlq";
3841 }
3942
40
-bool virtio_fence_signaled(struct dma_fence *f)
43
+static bool virtio_fence_signaled(struct dma_fence *f)
4144 {
4245 struct virtio_gpu_fence *fence = to_virtio_fence(f);
4346
47
+ if (WARN_ON_ONCE(fence->f.seqno == 0))
48
+ /* leaked fence outside driver before completing
49
+ * initialization with virtio_gpu_fence_emit */
50
+ return false;
4451 if (atomic64_read(&fence->drv->last_seq) >= fence->f.seqno)
4552 return true;
4653 return false;
....@@ -48,7 +55,7 @@
4855
4956 static void virtio_fence_value_str(struct dma_fence *f, char *str, int size)
5057 {
51
- snprintf(str, size, "%llu", (long long unsigned int) f->seqno);
58
+ snprintf(str, size, "%llu", f->seqno);
5259 }
5360
5461 static void virtio_timeline_value_str(struct dma_fence *f, char *str, int size)