From: Daniel Vetter <daniel@ffwll.ch>
To: Andy Lutomirski <luto@amacapital.net>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 2/7] drm (ast, cirrus, mgag200, nouveau, savage, vmwgfx): Rework drm_mtrr_{add, del}
Date: Sat, 4 May 2013 19:45:55 +0200 [thread overview]
Message-ID: <20130504174555.GT5763@phenom.ffwll.local> (raw)
In-Reply-To: <4615b8566e9530e2169a36a5870f1b2eb7e621cd.1367621039.git.luto@amacapital.net>
On Fri, May 03, 2013 at 04:00:30PM -0700, Andy Lutomirski wrote:
> This replaces drm_mtrr_{add,del} with drm_mtrr_{add,del}_wc. The
> interface is simplified (because the base and size parameters to
> drm_mtrr_del never did anything) and it uses
> mtrr_{add,del}_wc_if_needed to avoid allocating MTRRs on systems
> that don't need them.
>
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
[snip]
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 2d94d74..2a3e1fd 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1250,18 +1250,15 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
> return drm_core_check_feature(dev, DRIVER_USE_MTRR);
> }
>
> -#define DRM_MTRR_WC MTRR_TYPE_WRCOMB
> -
> -static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
> - unsigned int flags)
> +static inline int __must_check drm_mtrr_add_wc(unsigned long offset,
> + unsigned long size)
> {
> - return mtrr_add(offset, size, flags, 1);
> + return mtrr_add_wc_if_needed(offset, size);
> }
>
> -static inline int drm_mtrr_del(int handle, unsigned long offset,
> - unsigned long size, unsigned int flags)
> +static inline void drm_mtrr_del_wc(int handle)
> {
> - return mtrr_del(handle, offset, size);
> + mtrr_del_wc_if_needed(handle);
> }
>
> #else
> @@ -1269,16 +1266,14 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
>
> #define DRM_MTRR_WC 0
>
> -static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
> - unsigned int flags)
> +static inline int __must_check drm_mtrr_add_wc(unsigned long offset,
> + unsigned long size)
> {
> - return 0;
> + return -1;
> }
>
> -static inline int drm_mtrr_del(int handle, unsigned long offset,
> - unsigned long size, unsigned int flags)
> +static inline void drm_mtrr_del_wc(int handle)
> {
> - return 0;
> }
Tbh I'm not a big fan of the drm_ indirection. Historically that was
useful as an OS abstraction layer so that the same drivers could be used
unchanged on Linux and the *BSD. But those days are long gone and drm
drivers are now proper Linux drivers, and generally OS HALs seem to be
frowned upon.
Is there another reason than just being consistent with the historic stuff
here? If we need dummy functions for !CONFIG_MTRR I think those should
simply be in the core.
And if the inconsistency bugs you I'd volunteer myself to ditch the old
drm_ mtrr helpers.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2013-05-04 17:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-03 23:00 [PATCH 0/7] Clean up write-combining MTRR addition Andy Lutomirski
2013-05-03 23:00 ` [PATCH 1/7] x86: Add mtrr_{add,del}_wc_if_needed Andy Lutomirski
2013-05-03 23:00 ` [PATCH 2/7] drm (ast,cirrus,mgag200,nouveau,savage,vmwgfx): Rework drm_mtrr_{add,del} Andy Lutomirski
2013-05-04 17:45 ` Daniel Vetter [this message]
2013-05-04 17:48 ` [PATCH 2/7] drm (ast, cirrus, mgag200, nouveau, savage, vmwgfx): Rework drm_mtrr_{add, del} Andy Lutomirski
2013-05-03 23:00 ` [PATCH 3/7] drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRs Andy Lutomirski
2013-05-06 21:22 ` Andy Lutomirski
2013-05-06 23:04 ` Jerome Glisse
2013-05-06 23:39 ` Andy Lutomirski
2013-05-07 3:09 ` Dave Airlie
2013-05-07 14:08 ` Alex Deucher
2013-05-07 16:45 ` Andy Lutomirski
2013-05-03 23:00 ` [PATCH 4/7] drm: Use drm_mtrr_add_wc for the AGP aperture Andy Lutomirski
2013-05-03 23:00 ` [PATCH 5/7] i915: Use drm_mtrr_{add,del}_wc Andy Lutomirski
2013-05-03 23:00 ` [PATCH 6/7] radeon: Switch to drm_mtrr_add_wc and add a missing drm_mtrr_del_wc Andy Lutomirski
2013-05-03 23:00 ` [PATCH 7/7] uvesafb: Clean up MTRR code Andy Lutomirski
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=20130504174555.GT5763@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®