Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751568AbbH1IOO (ORCPT ); Fri, 28 Aug 2015 04:14:14 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56256 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbbH1IOH (ORCPT ); Fri, 28 Aug 2015 04:14:07 -0400 Date: Fri, 28 Aug 2015 01:12:39 -0700 From: "tip-bot for Luis R. Rodriguez" Message-ID: Cc: awalls@md.metrocast.net, vbabka@suse.cz, jgross@suse.com, torvalds@linux-foundation.org, mingo@kernel.org, bp@suse.de, mgorman@suse.de, peterz@infradead.org, adaplas@gmail.com, hpa@zytor.com, mcgrof@suse.com, tglx@linutronix.de, daniel.vetter@ffwll.ch, sbsiddha@gmail.com, dbueso@suse.de, dledford@redhat.com, airlied@redhat.com, toshi.kani@hp.com, tomi.valkeinen@ti.com, linux-kernel@vger.kernel.org, syrjala@sci.fi, dave.hansen@linux.intel.com, plagnioj@jcrosoft.com, luto@amacapital.net Reply-To: dave.hansen@linux.intel.com, syrjala@sci.fi, plagnioj@jcrosoft.com, luto@amacapital.net, tomi.valkeinen@ti.com, linux-kernel@vger.kernel.org, airlied@redhat.com, toshi.kani@hp.com, sbsiddha@gmail.com, dbueso@suse.de, dledford@redhat.com, tglx@linutronix.de, daniel.vetter@ffwll.ch, mgorman@suse.de, peterz@infradead.org, adaplas@gmail.com, hpa@zytor.com, mcgrof@suse.com, jgross@suse.com, awalls@md.metrocast.net, vbabka@suse.cz, torvalds@linux-foundation.org, mingo@kernel.org, bp@suse.de In-Reply-To: <1440443613-13696-12-git-send-email-mcgrof@do-not-panic.com> References: <1440443613-13696-12-git-send-email-mcgrof@do-not-panic.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/mm] x86/mm/mtrr: Remove kernel internal MTRR interfaces: unexport mtrr_add() and mtrr_del() Git-Commit-ID: 2baa891e42d84159b693eadd44f6fe1486285bdc X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5387 Lines: 122 Commit-ID: 2baa891e42d84159b693eadd44f6fe1486285bdc Gitweb: http://git.kernel.org/tip/2baa891e42d84159b693eadd44f6fe1486285bdc Author: Luis R. Rodriguez AuthorDate: Mon, 24 Aug 2015 12:13:33 -0700 Committer: Ingo Molnar 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 Cc: Cc: Andy Lutomirski Cc: Andy Walls Cc: Antonino Daplas Cc: Borislav Petkov Cc: Daniel Vetter Cc: Dave Airlie Cc: Dave Hansen Cc: Davidlohr Bueso Cc: Doug Ledford Cc: H. Peter Anvin Cc: Jean-Christophe Plagniol-Villard Cc: Juergen Gross Cc: Linus Torvalds Cc: Mel Gorman Cc: Peter Zijlstra Cc: Suresh Siddha Cc: Thomas Gleixner Cc: Tomi Valkeinen Cc: Toshi Kani Cc: Ville Syrjälä Cc: Vlastimil Babka 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 --- 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 - 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/