From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org
Cc: akash.goel@intel.com, shashidhar.hiremath@intel.com
Subject: Re: [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects
Date: Wed, 22 Jul 2015 16:14:37 +0100 [thread overview]
Message-ID: <55AFB35D.8090900@linux.intel.com> (raw)
In-Reply-To: <1437573109-19211-3-git-send-email-ankitprasad.r.sharma@intel.com>
Hi,
On 07/22/2015 02:51 PM, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> Extend the drm_i915_gem_create structure to add support for
> creating Stolen memory backed objects. Added a new flag through
> which user can specify the preference to allocate the object from
> stolen memory, which if set, an attempt will be made to allocate
> the object from stolen memory subject to the availability of
> free space in the stolen region.
>
> v2: Rebased to the latest drm-intel-nightly (Ankit)
>
> v3: Changed versioning of GEM_CREATE param, added new comments (Tvrtko)
>
> Testcase: igt/gem_stolen
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> ---
> drivers/gpu/drm/i915/i915_dma.c | 3 +++
> drivers/gpu/drm/i915/i915_gem.c | 33 +++++++++++++++++++++++++++++----
> include/uapi/drm/i915_drm.h | 15 +++++++++++++++
> 3 files changed, 47 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index c5349fa..bfb07ab 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -167,6 +167,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
> value = i915.enable_hangcheck &&
> intel_has_gpu_reset(dev);
> break;
> + case I915_PARAM_CREATE_VERSION:
> + value = 2;
> + break;
> default:
> DRM_DEBUG("Unknown parameter %d\n", param->param);
> return -EINVAL;
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index fc434ae..9e7e182 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -391,7 +391,8 @@ static int
> i915_gem_create(struct drm_file *file,
> struct drm_device *dev,
> uint64_t size,
> - uint32_t *handle_p)
> + uint32_t *handle_p,
> + uint32_t flags)
> {
> struct drm_i915_gem_object *obj;
> int ret;
> @@ -401,8 +402,31 @@ i915_gem_create(struct drm_file *file,
> if (size == 0)
> return -EINVAL;
>
> + if (flags & ~(I915_CREATE_PLACEMENT_STOLEN))
> + return -EINVAL;
> +
> /* Allocate the new object */
> - obj = i915_gem_alloc_object(dev, size);
> + if (flags & I915_CREATE_PLACEMENT_STOLEN) {
> + mutex_lock(&dev->struct_mutex);
> + obj = i915_gem_object_create_stolen(dev, size);
Is the compiler not complaining that "uint64_t size" is being passed
into "u32 size" here?
Either since there are no checks, can't userspace overflow u32 with a
right value and get success and much smaller object than intended?
Perhaps should test with an IGT.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-07-22 15:14 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-22 13:51 [PATCH v5 0/4] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2015-07-22 13:51 ` [PATCH 1/4] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2015-07-22 15:01 ` Tvrtko Ursulin
2015-07-22 15:05 ` Chris Wilson
2015-07-22 15:06 ` Chris Wilson
2015-07-22 15:16 ` Tvrtko Ursulin
2015-07-22 15:23 ` Chris Wilson
2015-07-22 13:51 ` [PATCH 2/4] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2015-07-22 15:14 ` Tvrtko Ursulin [this message]
2015-07-22 15:27 ` Chris Wilson
2015-07-22 13:51 ` [PATCH 3/4] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2015-07-22 15:10 ` Chris Wilson
2015-07-27 9:38 ` Daniel Vetter
2015-07-29 12:04 ` Chris Wilson
2015-07-31 14:42 ` Goel, Akash
2015-07-31 15:06 ` Chris Wilson
2015-07-31 16:34 ` Goel, Akash
2015-07-31 14:24 ` Goel, Akash
2015-07-22 13:51 ` [PATCH 4/4] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2015-07-22 14:39 ` Chris Wilson
2015-07-31 13:16 ` Goel, Akash
2015-09-10 17:50 ` Ankitprasad Sharma
2015-09-15 9:58 ` Chris Wilson
2015-07-22 15:46 ` Tvrtko Ursulin
2015-07-22 16:05 ` Daniel Vetter
2015-07-22 16:17 ` Tvrtko Ursulin
-- strict thread matches above, loose matches on Subject: below --
2015-09-15 8:33 [PATCH v6 0/4] Support for creating/using Stolen memory " ankitprasad.r.sharma
2015-09-15 8:33 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma
2015-09-15 9:49 ` Chris Wilson
2015-09-20 14:07 ` Ankitprasad Sharma
2015-09-23 9:26 ` Daniel Vetter
2015-09-15 14:11 ` Tvrtko Ursulin
2015-07-01 9:25 [PATCH v4 0/4] Support for creating/using " ankitprasad.r.sharma
2015-07-01 9:25 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma
2015-07-01 15:06 ` Tvrtko Ursulin
2015-07-01 16:19 ` Chris Wilson
2015-07-02 9:37 ` Tvrtko Ursulin
2015-07-02 9:43 ` Chris Wilson
2015-07-01 16:20 ` Tvrtko Ursulin
2015-05-06 10:15 [PATCH v3 0/4] Support for creating/using " ankitprasad.r.sharma
2015-05-06 10:16 ` [PATCH 2/4] drm/i915: Support for creating " ankitprasad.r.sharma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55AFB35D.8090900@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=ankitprasad.r.sharma@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shashidhar.hiremath@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.