From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: Re: [PATCH V3 5/6] drm/i915: Update the restrict check to filter out wrong Ring ID passed by user-space Date: Wed, 16 Apr 2014 19:50:48 +0300 Message-ID: <1397667048.4215.50.camel@intelbox> References: <1397616077-1125-1-git-send-email-yakui.zhao@intel.com> <1397616077-1125-6-git-send-email-yakui.zhao@intel.com> Reply-To: imre.deak@intel.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1147765448==" Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 80EB86E3F2 for ; Wed, 16 Apr 2014 09:50:51 -0700 (PDT) In-Reply-To: <1397616077-1125-6-git-send-email-yakui.zhao@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Zhao Yakui Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1147765448== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-lguOc4tNhT5UzaZMbm39" --=-lguOc4tNhT5UzaZMbm39 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2014-04-16 at 10:41 +0800, Zhao Yakui wrote: > One extra ring is added in the kernel driver but it is transparent to the > user-space application/middleware. In such case the number of the rings > in kernel driver is bigger than that exported to the user-space. So > it needs to filter out the wrong Ring ID passed by user-space. >=20 > Signed-off-by: Zhao Yakui > --- > drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- > drivers/gpu/drm/i915/intel_ringbuffer.h | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm= /i915/i915_gem_execbuffer.c > index 3491402..341ec68 100644 > --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c > +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c > @@ -1035,7 +1035,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void= *data, > if (args->flags & I915_EXEC_IS_PINNED) > flags |=3D I915_DISPATCH_PINNED; > =20 > - if ((args->flags & I915_EXEC_RING_MASK) > I915_NUM_RINGS) { > + if ((args->flags & I915_EXEC_RING_MASK) > LAST_USER_RING) { > DRM_DEBUG("execbuf with unknown ring: %d\n", > (int)(args->flags & I915_EXEC_RING_MASK)); > return -EINVAL; > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i9= 15/intel_ringbuffer.h > index 8ca4285..59f4cdd 100644 > --- a/drivers/gpu/drm/i915/intel_ringbuffer.h > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h > @@ -64,6 +64,7 @@ struct intel_ring_buffer { > VCS2, > } id; > #define I915_NUM_RINGS 5 > +#define LAST_USER_RING (VECS + 1) Defining this in the enum is cleaner IMO. Also this patch should ideally be applied before 2/6 for bisectability. In any case: Reviewed-by: Imre Deak =20 > u32 mmio_base; > void __iomem *virtual_start; > struct drm_device *dev; --=-lguOc4tNhT5UzaZMbm39 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQEcBAABAgAGBQJTTrToAAoJEORIIAnNuWDFBuAH/35VI6k890QckcqLmuLjaIIL RTENUmx3IvTryaA4zkY25nZTWdJqitcqORollUXh3lQRkaQ3dKbwI+8Hmb8wPWl0 H7IEWJrDT5t0NvY4DRBEKTC4xweWGtPIMFFgN4uf1Zzle2Sh10Vm34CBVMQVNSBo BG86hymdgpvT2vLhBnXw9aKSUs7mRQd8Sc5aayUo8vXUrGvlS5bY/sCTvWiTQVUG Zmz0NRn1a/g/6MBmBhxPS450gG08kY3ZMBqZKJCkW/r0N1ZOXiFl8Nik4VMY6r1a etoF5ZFcwpT0rHn7Zkg9xszp6CgkvyW6KFKyV6KZQfXxA3D1cQ1OM9aAj8ATe4c= =NOJO -----END PGP SIGNATURE----- --=-lguOc4tNhT5UzaZMbm39-- --===============1147765448== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============1147765448==--