linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-fbdev@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Jerome Glisse <j.glisse@gmail.com>,
	Alex Deucher <alexdeucher@gmail.com>,
	Dave Airlie <airlied@gmail.com>,
	Andy Lutomirski <luto@amacapital.net>
Subject: [PATCH v3 0/9] Clean up write-combining MTRR addition
Date: Mon, 13 May 2013 23:58:39 +0000	[thread overview]
Message-ID: <cover.1368485053.git.luto@amacapital.net> (raw)

A fair number of drivers (mostly graphics) add write-combining MTRRs.
Most ignore errors and most add the MTRR even on PAT systems which don't
need to use MTRRs.

This series adds new functions arch_phys_wc_{add,del} that, on PAT-less
x86 systems with MTRRs, add MTRRs and report errors, and that do nothing
otherwise.  (Other architectures, if any, with a similar mechanism could
implement them.)

I've only tested the radeon driver, since I don't have test hardware
easily available for the other drivers.

Benefits include:
 - Simpler code
 - No more complaints about MTRR conflict warnings on PAT systems
 - Eventual unexporting of the MTRR API?

This series eliminates about half of the mtrr_add calls in drivers/.

Note: this series breaks and then fixes dritests from libdrm.  The breakage
is probably irrelevant for any practical purpose, and fixing it will
be a bit complicated due to header file breakage that's only fixed in
patch 8.

Daniel, can you check that patch 1 is still okay?

Changes from v2:
 - There's a new API phys_wc_to_mtrr_index (x86-only) to support drmGetMap
 - Minor cleanups to patche 1 and 5.
 - Patch 9 is new

Changes from v1:
 - Helpers renamed
 - Lots of bugs fixed

Andy Lutomirski (9):
  Add arch_phys_wc_{add,del} to manipulate WC MTRRs if needed
  drm (ast,cirrus,mgag200,nouveau,savage,vmwgfx): Remove
    drm_mtrr_{add,del}
  drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRs
  drm,agpgart: Use pgprot_writecombine for AGP maps and make the MTRR
    optional
  i915: Use arch_phys_wc_{add,del}
  radeon: Switch to arch_phys_wc_add and add a missing ..._del
  uvesafb: Clean up MTRR code
  drm: Remove mtrr_add and mtrr_del fallback hack for non-MTRR systems
  drm: Don't leak phys_wc "handles" to userspace

Andy Lutomirski (9):
  Add arch_phys_wc_{add,del} to manipulate WC MTRRs if needed
  drm (ast,cirrus,mgag200,nouveau,savage,vmwgfx): Remove
    drm_mtrr_{add,del}
  drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRs
  drm,agpgart: Use pgprot_writecombine for AGP maps and make the MTRR
    optional
  i915: Use arch_phys_wc_{add,del}
  radeon: Switch to arch_phys_wc_add and add a missing ..._del
  uvesafb: Clean up MTRR code
  drm: Remove mtrr_add and mtrr_del fallback hack for non-MTRR systems
  drm: Don't leak phys_wc "handles" to userspace

 Documentation/fb/uvesafb.txt           | 16 +++-----
 arch/x86/include/asm/io.h              |  7 ++++
 arch/x86/include/asm/mtrr.h            | 10 ++++-
 arch/x86/kernel/cpu/mtrr/main.c        | 71 ++++++++++++++++++++++++++++++++++
 drivers/char/agp/frontend.c            |  8 ++--
 drivers/gpu/drm/ast/ast_ttm.c          | 13 ++-----
 drivers/gpu/drm/cirrus/cirrus_ttm.c    | 15 ++-----
 drivers/gpu/drm/drm_bufs.c             | 26 +++++++++----
 drivers/gpu/drm/drm_ioctl.c            | 15 ++++++-
 drivers/gpu/drm/drm_pci.c              |  8 ++--
 drivers/gpu/drm/drm_stub.c             | 10 +----
 drivers/gpu/drm/drm_vm.c               | 22 +++++------
 drivers/gpu/drm/i915/i915_dma.c        | 42 ++------------------
 drivers/gpu/drm/mgag200/mgag200_ttm.c  | 14 ++-----
 drivers/gpu/drm/nouveau/nouveau_ttm.c  | 13 ++-----
 drivers/gpu/drm/radeon/radeon_object.c |  5 ++-
 drivers/gpu/drm/savage/savage_bci.c    | 43 +++++++-------------
 drivers/gpu/drm/savage/savage_drv.h    |  5 +--
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c    | 10 ++---
 drivers/video/uvesafb.c                | 70 ++++++++-------------------------
 include/drm/drmP.h                     | 34 +---------------
 include/drm/drm_os_linux.h             | 16 --------
 include/linux/io.h                     | 25 ++++++++++++
 include/video/uvesafb.h                |  1 +
 24 files changed, 230 insertions(+), 269 deletions(-)

-- 
1.8.1.4


             reply	other threads:[~2013-05-13 23:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 23:58 Andy Lutomirski [this message]
2013-05-13 23:58 ` [PATCH v3 1/9] Add arch_phys_wc_{add,del} to manipulate WC MTRRs if needed Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 2/9] drm (ast,cirrus,mgag200,nouveau,savage,vmwgfx): Remove drm_mtrr_{add,del} Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 3/9] drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRs Andy Lutomirski
2013-05-31  3:47   ` Dave Airlie
2013-05-13 23:58 ` [PATCH v3 4/9] drm,agpgart: Use pgprot_writecombine for AGP maps and make the MTRR optional Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 5/9] i915: Use arch_phys_wc_{add,del} Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 6/9] radeon: Switch to arch_phys_wc_add and add a missing ..._del Andy Lutomirski
2013-05-14 12:58   ` Alex Deucher
2013-05-14 13:37     ` Jerome Glisse
2013-05-14 21:35       ` Andy Lutomirski
2013-05-15 14:49         ` Jerome Glisse
2013-05-15 18:22           ` Andy Lutomirski
2013-05-16 13:50             ` Jerome Glisse
2013-05-16 21:00               ` Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 7/9] uvesafb: Clean up MTRR code Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 8/9] drm: Remove mtrr_add and mtrr_del fallback hack for non-MTRR systems Andy Lutomirski
2013-05-13 23:58 ` [PATCH v3 9/9] drm: Don't leak phys_wc "handles" to userspace Andy Lutomirski
2013-05-23 18:35 ` [PATCH v3 0/9] Clean up write-combining MTRR addition Andy Lutomirski
2013-05-31  3:16   ` Dave Airlie

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=cover.1368485053.git.luto@amacapital.net \
    --to=luto@amacapital.net \
    --cc=airlied@gmail.com \
    --cc=alexdeucher@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=j.glisse@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).