Commit 90d2c87f authored by Rob Clark's avatar Rob Clark Committed by Dmitry Baryshkov

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: default avatarRob Clark <robdclark@chromium.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/504453/
Link: https://lore.kernel.org/r/20220923173307.2429872-1-robdclark@gmail.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent 92bab914
...@@ -819,6 +819,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, ...@@ -819,6 +819,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
case MSM_INFO_GET_OFFSET: case MSM_INFO_GET_OFFSET:
case MSM_INFO_GET_IOVA: case MSM_INFO_GET_IOVA:
case MSM_INFO_SET_IOVA: case MSM_INFO_SET_IOVA:
case MSM_INFO_GET_FLAGS:
/* value returned as immediate, not pointer, so len==0: */ /* value returned as immediate, not pointer, so len==0: */
if (args->len) if (args->len)
return -EINVAL; return -EINVAL;
...@@ -846,6 +847,15 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, ...@@ -846,6 +847,15 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
case MSM_INFO_SET_IOVA: case MSM_INFO_SET_IOVA:
ret = msm_ioctl_gem_info_set_iova(dev, file, obj, args->value); ret = msm_ioctl_gem_info_set_iova(dev, file, obj, args->value);
break; break;
case MSM_INFO_GET_FLAGS:
if (obj->import_attach) {
ret = -EINVAL;
break;
}
/* Hide internal kernel-only flags: */
args->value = to_msm_bo(obj)->flags & MSM_BO_FLAGS;
ret = 0;
break;
case MSM_INFO_SET_NAME: case MSM_INFO_SET_NAME:
/* length check should leave room for terminating null: */ /* length check should leave room for terminating null: */
if (args->len >= sizeof(msm_obj->name)) { if (args->len >= sizeof(msm_obj->name)) {
......
...@@ -138,6 +138,7 @@ struct drm_msm_gem_new { ...@@ -138,6 +138,7 @@ struct drm_msm_gem_new {
#define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */ #define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */
#define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */ #define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */
#define MSM_INFO_SET_IOVA 0x04 /* set the iova, passed by value */ #define MSM_INFO_SET_IOVA 0x04 /* set the iova, passed by value */
#define MSM_INFO_GET_FLAGS 0x05 /* get the MSM_BO_x flags */
struct drm_msm_gem_info { struct drm_msm_gem_info {
__u32 handle; /* in */ __u32 handle; /* in */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment