From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kenneth Graunke Subject: Re: [intel-gpu-tools] [PATCH 1/3] intel-gpu-tools add ioctl interface usage Date: Wed, 06 Apr 2011 11:38:11 -0700 Message-ID: <4D9CB313.8040602@whitecape.org> References: <1302032017-1771-1-git-send-email-ben@bwidawsk.net> <1302032017-1771-2-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from homiemail-a61.g.dreamhost.com (caiajhbdccac.dreamhost.com [208.97.132.202]) by gabe.freedesktop.org (Postfix) with ESMTP id 104D99E7B8 for ; Wed, 6 Apr 2011 11:38:14 -0700 (PDT) Received: from homiemail-a61.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a61.g.dreamhost.com (Postfix) with ESMTP id 2663657806E for ; Wed, 6 Apr 2011 11:38:13 -0700 (PDT) Received: from [10.0.0.248] (static-50-43-37-6.bvtn.or.frontiernet.net [50.43.37.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: kenneth@whitecape.org) by homiemail-a61.g.dreamhost.com (Postfix) with ESMTPSA id EFAA257806C for ; Wed, 6 Apr 2011 11:38:12 -0700 (PDT) In-Reply-To: <1302032017-1771-2-git-send-email-ben@bwidawsk.net> 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: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On 04/05/2011 12:33 PM, Ben Widawsky wrote: > Added the mechnanism to communicate with the i915 IOCTL interface, and > removed the existing forcewake code, as it is not reliable. > > Modified gpu_top to take a flag -i, to use the IOCTL interface. Previous > gpu_top behavior with no args is maintained from previous version. > > Signed-off-by: Ben Widawsky > --- > lib/intel_gpu_tools.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++- > lib/intel_mmio.c | 18 +++++++++++++++ > tools/intel_gpu_top.c | 45 +++++++++++-------------------------- > 3 files changed, 88 insertions(+), 33 deletions(-) One high level comment and a nitpick... I'm a bit surprised that there's a command line option to use the IOCTL interface (i.e. non-broken mode). Shouldn't it try the IOCTL and, if the kernel doesn't support it, fall back to using MMIO? Or, perhaps better...try using the IOCTL by default on gen6, and if it fails, print a message like "Your kernel doesn't support the necessary IOCTLs; please upgrade or run intel_gpu_top -m to force MMIO mode (which may be inaccurate)." and quit. > +#define INREG(reg) \ > + (use_ioctl_mmio ? INREG_IOCTL(reg) : INREG_PCI(reg)) > + > +#define OUTREG(reg, val) \ > + (use_ioctl_mmio ? OUTREG_IOCTL(reg, val) : OUTREG_PCI(reg, val)) > + > static inline uint32_t > -INREG(uint32_t reg) > +INREG_PCI(uint32_t reg) > { > return *(volatile uint32_t *)((volatile char *)mmio + reg); > } As long as you're renaming these, can we please use lowercase for inline functions, while keeping the INREG/OUTREG macros uppercase? > +/* > + * Try to read a register using the i915 IOCTL interface. The operations should > + * not fall back to the normal pci mmio method to avoid confusion. IOCTL usage > + * should be explicitly specified. > + */