Skip to content

Clean up write-combining MTRR addition

Andy Lutomirski dri-devel linux-fbdev lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 10 repliesIn review
  2. v28 patches 9 repliesSuperseded
  3. v17 patches 8 repliesSuperseded

Changes in v3 from the cover letter

- 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

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9Add arch_phys_wc_{add,del} to manipulate WC MTRRs if neededarch/x86/include/asm/io.h arch/x86/include/asm/mtrr.h arch/x86/kernel/cpu/mtrr/main.c +1 more+112 -10 replies
2/9drm (ast,cirrus,mgag200,nouveau,savage,vmwgfx): Remove drm_mtrr_{add,del}drivers/gpu/drm/ast/ast_ttm.c drivers/gpu/drm/cirrus/cirrus_ttm.c drivers/gpu/drm/mgag200/mgag200_ttm.c +5 more+35 -1070 replies
3/9drm: Update drm_addmap and drm_mmap to use PAT WC instead of MTRRsdrivers/gpu/drm/drm_bufs.c drivers/gpu/drm/drm_vm.c+20 -201 reply
4/9drm,agpgart: Use pgprot_writecombine for AGP maps and make the MTRR optionaldrivers/char/agp/frontend.c drivers/gpu/drm/drm_pci.c drivers/gpu/drm/drm_stub.c +1 more+15 -220 replies
5/9i915: Use arch_phys_wc_{add,del}drivers/gpu/drm/i915/i915_dma.c+4 -380 replies
6/9radeon: Switch to arch_phys_wc_add and add a missing ..._deldrivers/gpu/drm/radeon/radeon_object.c+3 -27 replies
7/9uvesafb: Clean up MTRR codeDocumentation/fb/uvesafb.txt drivers/video/uvesafb.c include/video/uvesafb.h+23 -640 replies
8/9drm: Remove mtrr_add and mtrr_del fallback hack for non-MTRR systemsinclude/drm/drmP.h include/drm/drm_os_linux.h+1 -200 replies
9/9drm: Don't leak phys_wc "handles" to userspacedrivers/gpu/drm/drm_bufs.c drivers/gpu/drm/drm_ioctl.c+23 -10 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchDaniel VetterAlex Deucher
1/9R-b
2/9R-b
3/9R-b
4/9R-b
5/9R-b
6/9R-b R-b
7/9R-b
8/9R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/9] Clean up write-combining MTRR addition

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(-)
Signature · 1 line
1.8.1.4