From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Wilson Subject: Re: [PATCH] drm/i915: add register read IOCTL Date: Thu, 12 Jul 2012 09:11:39 +0100 Message-ID: <1342080707_56@CP5-2952> References: <1342051656-32481-1-git-send-email-ben@bwidawsk.net> <20120712075843.GA5039@phenom.ffwll.local> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from fireflyinternet.com (smtp.fireflyinternet.com [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 7FF419E740 for ; Thu, 12 Jul 2012 01:11:51 -0700 (PDT) In-Reply-To: <20120712075843.GA5039@phenom.ffwll.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter , Ben Widawsky Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Thu, 12 Jul 2012 09:58:43 +0200, Daniel Vetter wrote: > On Wed, Jul 11, 2012 at 05:07:36PM -0700, Ben Widawsky wrote: > I think we should check for both reg offset _and_ size. Just to avoid > people reading 64bit for a 32bit reg to get at the secret stuff in the > next reg ;-) Or in case that the hw has strange semantics if you don't > read the right size (I've seen that). Imo just creating a little table > with { offset; size; } pairs would be good enough. Do you want to allow people to read a subregister? That's the only reason I see to have userspace pass in a size, and extracting a field from a register can be trivially done in userspace (and will be done as part of the normal process of extracting a value from the result). Reading 8,16,32,64 bits all generate a 64-bit read cycle so should be immaterial performance wise. -Chris -- Chris Wilson, Intel Open Source Technology Centre