diff options
author | Rob Clark <robdclark@chromium.org> | 2022-09-23 10:33:07 -0700 |
---|---|---|
committer | Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | 2022-11-02 19:08:13 +0300 |
commit | 90d2c87f325ff3422995175bd92812b28d8eb2a9 (patch) | |
tree | 087023803dad3ca186fb25f9c398226bd03903cb /drivers/gpu/drm | |
parent | 92bab9142456c37d14a0de212b272cdd94846c6d (diff) | |
download | linux-stable-90d2c87f325ff3422995175bd92812b28d8eb2a9.tar.gz linux-stable-90d2c87f325ff3422995175bd92812b28d8eb2a9.tar.bz2 linux-stable-90d2c87f325ff3422995175bd92812b28d8eb2a9.zip |
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 <robdclark@chromium.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/504453/
Link: https://lore.kernel.org/r/20220923173307.2429872-1-robdclark@gmail.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 105b5b48e828..862b60a5e886 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -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_IOVA: case MSM_INFO_SET_IOVA: + case MSM_INFO_GET_FLAGS: /* value returned as immediate, not pointer, so len==0: */ if (args->len) return -EINVAL; @@ -846,6 +847,15 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data, case MSM_INFO_SET_IOVA: ret = msm_ioctl_gem_info_set_iova(dev, file, obj, args->value); 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: /* length check should leave room for terminating null: */ if (args->len >= sizeof(msm_obj->name)) { |