Skip to content

Commit 90d2c87

Browse files
robclarklumag
authored andcommitted
drm/msm: Add MSM_INFO_GET_FLAGS
In some cases crosvm needs a way to query the cache flags to communicate them to the guest kernel for guest userspace mapping. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/504453/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 92bab91 commit 90d2c87

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
819819
case MSM_INFO_GET_OFFSET:
820820
case MSM_INFO_GET_IOVA:
821821
case MSM_INFO_SET_IOVA:
822+
case MSM_INFO_GET_FLAGS:
822823
/* value returned as immediate, not pointer, so len==0: */
823824
if (args->len)
824825
return -EINVAL;
@@ -846,6 +847,15 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
846847
case MSM_INFO_SET_IOVA:
847848
ret = msm_ioctl_gem_info_set_iova(dev, file, obj, args->value);
848849
break;
850+
case MSM_INFO_GET_FLAGS:
851+
if (obj->import_attach) {
852+
ret = -EINVAL;
853+
break;
854+
}
855+
/* Hide internal kernel-only flags: */
856+
args->value = to_msm_bo(obj)->flags & MSM_BO_FLAGS;
857+
ret = 0;
858+
break;
849859
case MSM_INFO_SET_NAME:
850860
/* length check should leave room for terminating null: */
851861
if (args->len >= sizeof(msm_obj->name)) {

include/uapi/drm/msm_drm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ struct drm_msm_gem_new {
138138
#define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */
139139
#define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */
140140
#define MSM_INFO_SET_IOVA 0x04 /* set the iova, passed by value */
141+
#define MSM_INFO_GET_FLAGS 0x05 /* get the MSM_BO_x flags */
141142

142143
struct drm_msm_gem_info {
143144
__u32 handle; /* in */

0 commit comments

Comments
 (0)