Skip to contentSkip to conversation

i915/gvt/dmabuf: some plane 'size' fixes

PATCH In review Uri Lublin 3 participants 8 messages Apr 14, 2019 – Apr 15, 2019

Subsystems (3)
lore
Share & tools
lore

Uri Lublin

author
#0 lore raw

cover i915/gvt/dmabuf: some plane 'size' fixes

We started looking at the kvmgt driver code when we noticed the 'size' calculation in qemu-kvm is wrong.
The first fix we had is now already committed upstream (7f1a93b1f1d1d2603a49a9e4226259db9272f305).

There is a mismatch between the comment for 'size' field of struct intel_vgpu_fb_info and the code.
The comment says the plane size is kept in bytes, while the code keeps it in pages.
These patches fix this problem as well as some related inconsistencies.

Uri Lublin (3):
i915/gvt/dmabuf: vgpu_get_plane_info: validate_range with size in
bytes
i915/gvt/dmabuf: fix comment about 'size' field i915/gvt/dmabuf: update_fb_info: convert size correctly

 drivers/gpu/drm/i915/gvt/dmabuf.c | 5 +++--
 drivers/gpu/drm/i915/gvt/dmabuf.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#1 lore raw

PATCH 1/3 i915/gvt/dmabuf: vgpu_get_plane_info: validate_range with size in bytes

size is kept in pages, validate_range gets bytes.

---
 drivers/gpu/drm/i915/gvt/dmabuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +2 -1
index 69a9a1b2ea4a..857e3a02d951 100644
@@ -284,7 +284,8 @@ static int vgpu_get_plane_info(struct drm_device *dev,
 		return -EFAULT;
 	}
 
-	if (!intel_gvt_ggtt_validate_range(vgpu, info->start, info->size)) {
+	if (!intel_gvt_ggtt_validate_range(vgpu, info->start,
+					   info->size << PAGE_SHIFT)) {
 		gvt_vgpu_err("invalid gma addr\n");
 		return -EFAULT;
 	}
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#2 lore raw

PATCH 2/3 i915/gvt/dmabuf: fix comment about 'size' field

In reply to Uri Lublin

The 'size' field of struct intel_vgpu_fb_info is
kept in pages, not in bytes.

---
 drivers/gpu/drm/i915/gvt/dmabuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/dmabuf.h +1 -1
index 5f8f03fb1d1b..915caa065db8 100644
@@ -40,7 +40,7 @@ struct intel_vgpu_fb_info {
 	__u32 width;	/* width of plane */
 	__u32 height;	/* height of plane */
 	__u32 stride;	/* stride of plane */
-	__u32 size;	/* size of plane in bytes, align on page */
+	__u32 size;	/* size of plane in pages */
 	__u32 x_pos;	/* horizontal position of cursor plane */
 	__u32 y_pos;	/* vertical position of cursor plane */
 	__u32 x_hot;    /* horizontal position of cursor hotspot */
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#3 lore raw

PATCH 3/3 i915/gvt/dmabuf: update_fb_info: convert size correctly

In reply to Uri Lublin

Internal (driver) representation is in pages (intel_vgpu_fb_info). User API is in bytes (vfio_device_gfx_plane_info).

---
 drivers/gpu/drm/i915/gvt/dmabuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +1 -1
index 857e3a02d951..7b66ec2ee167 100644
@@ -355,7 +355,7 @@ static void update_fb_info(struct vfio_device_gfx_plane_info *gvt_dmabuf,
 	gvt_dmabuf->width = fb_info->width;
 	gvt_dmabuf->height = fb_info->height;
 	gvt_dmabuf->stride = fb_info->stride;
-	gvt_dmabuf->size = fb_info->size;
+	gvt_dmabuf->size = fb_info->size << PAGE_SHIFT;
 	gvt_dmabuf->x_pos = fb_info->x_pos;
 	gvt_dmabuf->y_pos = fb_info->y_pos;
 	gvt_dmabuf->x_hot = fb_info->x_hot;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

✓ Fi.CI.BAT: success for i915/gvt/dmabuf: some plane 'size' fixes

In reply to Uri Lublin
== Series Details ==

== Series Details ==

Series: i915/gvt/dmabuf: some plane 'size' fixes
URL : https://patchwork.freedesktop.org/series/59450/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5931 -> Patchwork_12794
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/59450/revisions/1/mbox/

Known issues
------------

Here are the changes found in Patchwork_12794 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@fork-compute0:
- fi-icl-y: NOTRUN -> SKIP [fdo#109315] +17

* igt@gem_exec_basic@readonly-bsd2:
- fi-icl-y: NOTRUN -> SKIP [fdo#109276] +5

* igt@gem_exec_parse@basic-rejected:
- fi-icl-y: NOTRUN -> SKIP [fdo#109289] +1

* igt@i915_selftest@live_contexts:
- fi-skl-gvtdvm: PASS -> DMESG-FAIL [fdo#110235 ]

* igt@kms_chamelium@dp-crc-fast:
- fi-icl-y: NOTRUN -> SKIP [fdo#109284] +8

* igt@kms_force_connector_basic@force-load-detect:
- fi-icl-y: NOTRUN -> SKIP [fdo#109285] +3

* igt@kms_psr@primary_mmap_gtt:
- fi-icl-y: NOTRUN -> SKIP [fdo#110189] +3

* igt@prime_vgem@basic-fence-flip:
- fi-icl-y: NOTRUN -> SKIP [fdo#109294]

#### Possible fixes ####

* igt@gem_exec_basic@basic-default:
- fi-icl-y: INCOMPLETE [fdo#109100] -> PASS

* igt@kms_frontbuffer_tracking@basic:
- fi-byt-clapper: FAIL [fdo#103167] -> PASS

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-byt-clapper: FAIL [fdo#103191] -> PASS

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109294]: https://bugs.freedesktop.org/show_bug.cgi?id=109294
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235

Participating hosts (47 -> 42)
------------------------------

Missing (5): fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510 fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_5931 -> Patchwork_12794

CI_DRM_5931: c969a03216b82726e2e7d49410aa01086727960a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4945: a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12794: aef8296a0d8b498d5d69b1f01b4af10330630896 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

aef8296a0d8b i915/gvt/dmabuf: update_fb_info: convert size correctly 2ec33fc87014 i915/gvt/dmabuf: fix comment about 'size' field 7705427f046d i915/gvt/dmabuf: vgpu_get_plane_info: validate_range with size in bytes

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12794/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✓ Fi.CI.IGT: success for i915/gvt/dmabuf: some plane 'size' fixes

In reply to Uri Lublin
== Series Details ==

== Series Details ==

Series: i915/gvt/dmabuf: some plane 'size' fixes
URL : https://patchwork.freedesktop.org/series/59450/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5931_full -> Patchwork_12794_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_12794_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@debugfs-read:
- shard-skl: NOTRUN -> INCOMPLETE [fdo#107807]

* igt@i915_pm_rpm@i2c:
- shard-iclb: PASS -> DMESG-WARN [fdo#109982]

* igt@i915_pm_rpm@modeset-lpsp-stress:
- shard-apl: NOTRUN -> SKIP [fdo#109271] +20

* igt@kms_busy@extended-pageflip-hang-newfb-render-f:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

* igt@kms_cursor_crc@cursor-256x256-suspend:
- shard-skl: PASS -> INCOMPLETE [fdo#104108]

* igt@kms_cursor_crc@cursor-64x64-suspend:
- shard-kbl: PASS -> DMESG-WARN [fdo#108566]

* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: PASS -> SKIP [fdo#109349]

* igt@kms_fbcon_fbt@psr-suspend:
- shard-skl: NOTRUN -> FAIL [fdo#103833]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-apl: PASS -> FAIL [fdo#102887] / [fdo#105363]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk: PASS -> FAIL [fdo#105363]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-skl: PASS -> INCOMPLETE [fdo#109507]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: PASS -> FAIL [fdo#103167] +8

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: PASS -> DMESG-WARN [fdo#108566] +3

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-gtt:
- shard-iclb: PASS -> FAIL [fdo#109247] +14

* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-cur-indfb-draw-mmap-cpu:
- shard-kbl: NOTRUN -> SKIP [fdo#109271] +20

* igt@kms_lease@atomic_implicit_crtc:
- shard-skl: NOTRUN -> FAIL [fdo#110279]

* igt@kms_pipe_crc_basic@read-crc-pipe-e:
- shard-apl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +1

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-f:
- shard-skl: NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +20

* igt@kms_plane@pixel-format-pipe-b-planes-source-clamping:
- shard-glk: PASS -> SKIP [fdo#109271] +1

* igt@kms_plane_alpha_blend@pipe-a-alpha-opaque-fb:
- shard-skl: NOTRUN -> FAIL [fdo#108145] +3

* igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
- shard-apl: NOTRUN -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: PASS -> FAIL [fdo#110403]

* igt@kms_psr@cursor_render:
- shard-iclb: PASS -> FAIL [fdo#107383] / [fdo#110215] +3

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: PASS -> SKIP [fdo#109441] +1

* igt@kms_rotation_crc@multiplane-rotation:
- shard-kbl: PASS -> INCOMPLETE [fdo#103665]

* igt@kms_setmode@basic:
- shard-apl: PASS -> FAIL [fdo#99912]
- shard-skl: NOTRUN -> FAIL [fdo#99912]

* igt@perf_pmu@busy-accuracy-50-vcs1:
- shard-skl: NOTRUN -> SKIP [fdo#109271] +207

#### Possible fixes ####

* igt@gem_softpin@noreloc-s3:
- shard-apl: DMESG-WARN [fdo#108566] -> PASS +2

* igt@i915_selftest@live_workarounds:
- shard-iclb: DMESG-FAIL [fdo#108954] -> PASS

* igt@i915_suspend@debugfs-reader:
- shard-kbl: DMESG-WARN [fdo#108566] -> PASS

* igt@kms_cursor_edge_walk@pipe-a-256x256-top-edge:
- shard-apl: INCOMPLETE [fdo#103927] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-pgflip-blt:
- shard-glk: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-pwrite:
- shard-iclb: FAIL [fdo#109247] -> PASS +17

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: FAIL [fdo#103167] -> PASS +3

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: FAIL [fdo#108145] -> PASS

* igt@kms_psr@cursor_mmap_cpu:
- shard-iclb: FAIL [fdo#107383] / [fdo#110215] -> PASS +2

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: SKIP [fdo#109441] -> PASS +1

* igt@kms_sysfs_edid_timing:
- shard-iclb: FAIL [fdo#100047] -> PASS

[fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103833]: https://bugs.freedesktop.org/show_bug.cgi?id=103833
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107383]: https://bugs.freedesktop.org/show_bug.cgi?id=107383
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108954]: https://bugs.freedesktop.org/show_bug.cgi?id=108954
[fdo#109247]: https://bugs.freedesktop.org/show_bug.cgi?id=109247
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#109982]: https://bugs.freedesktop.org/show_bug.cgi?id=109982
[fdo#110215]: https://bugs.freedesktop.org/show_bug.cgi?id=110215
[fdo#110279]: https://bugs.freedesktop.org/show_bug.cgi?id=110279
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 9)
------------------------------

Missing (1): shard-hsw

Build changes
-------------

* Linux: CI_DRM_5931 -> Patchwork_12794

CI_DRM_5931: c969a03216b82726e2e7d49410aa01086727960a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4945: a52cc643cfe6733465cfc9ccb3d21cbdc4fd7506 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_12794: aef8296a0d8b498d5d69b1f01b4af10330630896 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_12794/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to Uri Lublin
Quoted 11 lines · Uri Lublin

We started looking at the kvmgt driver code when we noticed the 'size' calculation in qemu-kvm is wrong.
The first fix we had is now already committed upstream (7f1a93b1f1d1d2603a49a9e4226259db9272f305).

There is a mismatch between the comment for 'size' field of struct intel_vgpu_fb_info and the code.
The comment says the plane size is kept in bytes, while the code keeps it in pages.
These patches fix this problem as well as some related inconsistencies.

We have another series that would put size as bytes actually.
https://patchwork.freedesktop.org/series/59260/

The first one is a fix for 5.1, and second one would be queued for next kernel.

thanks

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#7 lore raw
Quoted 13 lines · Zhenyu Wang
Quoted 11 lines · Uri Lublin

We started looking at the kvmgt driver code when we noticed the 'size' calculation in qemu-kvm is wrong.
The first fix we had is now already committed upstream (7f1a93b1f1d1d2603a49a9e4226259db9272f305).

There is a mismatch between the comment for 'size' field of struct intel_vgpu_fb_info and the code.
The comment says the plane size is kept in bytes, while the code keeps it in pages.
These patches fix this problem as well as some related inconsistencies.

Quoted 2 lines

We have another series that would put size as bytes actually.
https://patchwork.freedesktop.org/series/59260/

Hi,

We did look at gvt-staging branch but not at patchwork.

It seems the field description is still wrong.
In both structures, it says:
"/* size of plane in bytes, align on page */"
But it seems possible that the value is not aligned on page.

Thanks,
Uri and Snir

Quoted 6 lines

The first one is a fix for 5.1, and second one would be queued for next kernel.

thanks

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx