Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1215213

[tip:x86/mm] x86/mm/mtrr: Remove kernel internal MTRR interfaces: unexport mtrr_add() and mtrr_del()

From "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:x86/mm] x86/mm/mtrr: Remove kernel internal MTRR interfaces: unexport mtrr_add() and mtrr_del()
Date 2015-08-28 10:20 +0200
Message-ID <q2n3c-5ZO-5@gated-at.bofh.it> (permalink)
References <q15Bn-gI-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  2baa891e42d84159b693eadd44f6fe1486285bdc
Gitweb:     http://git.kernel.org/tip/2baa891e42d84159b693eadd44f6fe1486285bdc
Author:     Luis R. Rodriguez <mcgrof@suse.com>
AuthorDate: Mon, 24 Aug 2015 12:13:33 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 28 Aug 2015 10:09:28 +0200

x86/mm/mtrr: Remove kernel internal MTRR interfaces: unexport mtrr_add() and mtrr_del()

The effort to replace mtrr_add() with architecture agnostic
arch_phys_wc_add() is complete, this will ensure write-combining
implementations (PAT on x86) is taken advantage instead of using
MTRR. With the effort done now, hide direct MTRR access for
drivers.

The legacy user-space /proc/mtrr ABI is not affected.

Update x86 documentation on MTRR to reflect the completion of
the phasing out of direct access to MTRR, also add a note on
platform firmware code use of MTRRs based on the obituary
discussion of MTRRs on Linux [0].

  [0] http://lkml.kernel.org/r/1438991330.3109.196.camel@hp.com

Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
Cc: <syrjala@sci.fi>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Doug Ledford <dledford@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Ville Syrjälä <syrjala@sci.fi>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: airlied@linux.ie
Cc: benh@kernel.crashing.org
Cc: bhelgaas@google.com
Cc: dan.j.williams@intel.com
Cc: konrad.wilk@oracle.com
Cc: linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: mst@redhat.com
Cc: netdev@vger.kernel.org
Cc: vinod.koul@intel.com
Cc: xen-devel@lists.xensource.com
Link: http://lkml.kernel.org/r/1440443613-13696-12-git-send-email-mcgrof@do-not-panic.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 Documentation/x86/mtrr.txt      | 20 ++++++++++++++++----
 arch/x86/kernel/cpu/mtrr/main.c |  2 --
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/Documentation/x86/mtrr.txt b/Documentation/x86/mtrr.txt
index 860bc3a..dc3e703 100644
--- a/Documentation/x86/mtrr.txt
+++ b/Documentation/x86/mtrr.txt
@@ -6,10 +6,22 @@ Luis R. Rodriguez <mcgrof@do-not-panic.com> - April 9, 2015
 ===============================================================================
 Phasing out MTRR use
 
-MTRR use is replaced on modern x86 hardware with PAT. Over time the only type
-of effective MTRR that is expected to be supported will be for write-combining.
-As MTRR use is phased out device drivers should use arch_phys_wc_add() to make
-MTRR effective on non-PAT systems while a no-op on PAT enabled systems.
+MTRR use is replaced on modern x86 hardware with PAT. Direct MTRR use by
+drivers on Linux is now completely phased out, device drivers should use
+arch_phys_wc_add() in combination with ioremap_wc() to make MTRR effective on
+non-PAT systems while a no-op but equally effective on PAT enabled systems.
+
+Even if Linux does not use MTRRs directly, some x86 platform firmware may still
+set up MTRRs early before booting the OS. They do this as some platform
+firmware may still have implemented access to MTRRs which would be controlled
+and handled by the platform firmware directly. An example of platform use of
+MTRRs is through the use of SMI handlers, one case could be for fan control,
+the platform code would need uncachable access to some of its fan control
+registers. Such platform access does not need any Operating System MTRR code in
+place other than mtrr_type_lookup() to ensure any OS specific mapping requests
+are aligned with platform MTRR setup. If MTRRs are only set up by the platform
+firmware code though and the OS does not make any specific MTRR mapping
+requests mtrr_type_lookup() should always return MTRR_TYPE_INVALID.
 
 For details refer to Documentation/x86/pat.txt.
 
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index e7ed0d8..f891b47 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -448,7 +448,6 @@ int mtrr_add(unsigned long base, unsigned long size, unsigned int type,
 	return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type,
 			     increment);
 }
-EXPORT_SYMBOL(mtrr_add);
 
 /**
  * mtrr_del_page - delete a memory type region
@@ -537,7 +536,6 @@ int mtrr_del(int reg, unsigned long base, unsigned long size)
 		return -EINVAL;
 	return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT);
 }
-EXPORT_SYMBOL(mtrr_del);
 
 /**
  * arch_phys_wc_add - add a WC MTRR and handle errors if PAT is unavailable
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/11] x86/dma: RIP MTRR and dma write-combine API rename "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:20 +0200
  [PATCH v4 01/11] PCI: Add pci_ioremap_wc_bar() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:20 +0200
    [tip:x86/mm] PCI: Add pci_ioremap_wc_bar() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 02/11] drivers/video/fbdev/i740fb: Use arch_phys_wc_add() and pci_ioremap_wc_bar() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:20 +0200
    [tip:x86/mm] drivers/video/fbdev/i740fb: Use arch_phys_wc_add()   and pci_ioremap_wc_bar() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 03/11] drivers/video/fbdev/kyrofb: Use arch_phys_wc_add() and pci_ioremap_wc_bar() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/video/fbdev/kyrofb: Use arch_phys_wc_add()   and pci_ioremap_wc_bar() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 05/11] PCI: Add pci_iomap_wc() variants "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] PCI: Add pci_iomap_wc() variants "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 08/11] drivers/video/fbdev/vt8623fb: Use arch_phys_wc_add() and pci_iomap_wc() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/video/fbdev/vt8623fb: Use arch_phys_wc_add()   and pci_iomap_wc() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 11/11] mtrr: bury MTRR - unexport mtrr_add() and mtrr_del() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] x86/mm/mtrr: Remove kernel internal MTRR interfaces:   unexport mtrr_add() and mtrr_del() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-28 10:20 +0200
  [PATCH v4 09/11] drivers/dma/iop-adma: Use dma_alloc_writecombine() kernel-style "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/dma/iop-adma: Use dma_alloc_writecombine()   kernel-style "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 04/11] drivers/video/fbdev/gxt4500: Use pci_ioremap_wc_bar() to map framebuffer "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/video/fbdev/gxt4500: Use pci_ioremap_wc_bar(  ) to map framebuffer "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 07/11] drivers/video/fbdev/s3fb: Use arch_phys_wc_add() and pci_iomap_wc() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/video/fbdev/s3fb: Use arch_phys_wc_add()   and pci_iomap_wc() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  [PATCH v4 06/11] drivers/video/fbdev/arkfb.c: Use arch_phys_wc_add() and pci_iomap_wc() "Luis R. Rodriguez" <mcgrof@do-not-panic.com> - 2015-08-24 21:30 +0200
    [tip:x86/mm] drivers/video/fbdev/arkfb.c: Use arch_phys_wc_add()   and pci_iomap_wc() "tip-bot for Luis R. Rodriguez" <tipbot@zytor.com> - 2015-08-25 10:30 +0200
  Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() Ingo Molnar <mingo@kernel.org> - 2015-08-25 10:20 +0200
    Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() "Luis R. Rodriguez" <mcgrof@suse.com> - 2015-08-25 17:50 +0200
      Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() Andrew Morton <akpm@linux-foundation.org> - 2015-08-25 22:50 +0200
        Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() "Luis R. Rodriguez" <mcgrof@suse.com> - 2015-08-26 01:20 +0200
          Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() Andrew Morton <akpm@linux-foundation.org> - 2015-08-26 01:30 +0200
            Re: [PATCH v4 10/11] dma: rename dma_*_writecombine() to dma_*_wc() Ingo Molnar <mingo@kernel.org> - 2015-08-26 06:30 +0200

csiph-web