From patchwork Thu Mar 3 21:21:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 8496231 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 784829F2F0 for ; Thu, 3 Mar 2016 21:22:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A66B820382 for ; Thu, 3 Mar 2016 21:22:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B629520173 for ; Thu, 3 Mar 2016 21:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758182AbcCCVWD (ORCPT ); Thu, 3 Mar 2016 16:22:03 -0500 Received: from mail.kernel.org ([198.145.29.136]:37195 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757773AbcCCVWB (ORCPT ); Thu, 3 Mar 2016 16:22:01 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D36152013D; Thu, 3 Mar 2016 21:21:59 +0000 (UTC) Received: from garbanzo.do-not-panic.com (c-73-15-241-2.hsd1.ca.comcast.net [73.15.241.2]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B8D52011B; Thu, 3 Mar 2016 21:21:58 +0000 (UTC) From: "Luis R. Rodriguez" To: bp@alien8.de, mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com Cc: toshi.kani@hp.com, paulmck@linux.vnet.ibm.com, airlied@redhat.com, benh@kernel.crashing.org, mst@redhat.com, vinod.koul@intel.com, jgross@suse.com, daniel.vetter@ffwll.ch, luto@amacapital.net, linux-fbdev@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, "Luis R. Rodriguez" Subject: [PATCH] x86: PAT: Documentation: update overlapping ioremap hack recommendation Date: Thu, 3 Mar 2016 13:21:48 -0800 Message-Id: <1457040108-27358-1-git-send-email-mcgrof@kernel.org> X-Mailer: git-send-email 2.7.0 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current documentation refers to using set_memor_wc() as a possible hole strategy when you have overlapping ioremap() regions, that's incorrect as set_memory_*() helpers can only be used on RAM, not IO memory. This fixes that, and updates the documention to *strongly* discourage overlapping ioremap() memory uses, but also documents a possible solution should there really be no other option. Signed-off-by: Luis R. Rodriguez --- Documentation/x86/pat.txt | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt index 54944c71b819..8a26b4cdccf6 100644 --- a/Documentation/x86/pat.txt +++ b/Documentation/x86/pat.txt @@ -113,18 +113,21 @@ MTRR effects on PAT / non-PAT systems ------------------------------------- The following table provides the effects of using write-combining MTRRs when -using ioremap*() calls on x86 for both non-PAT and PAT systems. Ideally -mtrr_add() usage will be phased out in favor of arch_phys_wc_add() which will -be a no-op on PAT enabled systems. The region over which a arch_phys_wc_add() +using ioremap*() calls on x86 for both non-PAT and PAT systems. As of v4.3 +mtrr_add() has been phased out in favor of arch_phys_wc_add(), these calls are +a no-op on PAT enabled systems. The region over which an arch_phys_wc_add() is made, should already have been ioremapped with WC attributes or PAT entries, -this can be done by using ioremap_wc() / set_memory_wc(). Devices which -combine areas of IO memory desired to remain uncacheable with areas where -write-combining is desirable should consider use of ioremap_uc() followed by -set_memory_wc() to white-list effective write-combined areas. Such use is -nevertheless discouraged as the effective memory type is considered -implementation defined, yet this strategy can be used as last resort on devices -with size-constrained regions where otherwise MTRR write-combining would -otherwise not be effective. +this can be done by using ioremap_wc(). Devices which combine areas of IO +memory desired to remain uncacheable with areas where write-combining is +desirable should consider use of ioremap_wc() followed by an overlapping +ioremap_uc() "hole". For an example of this strategy refer to commit 3cc2dac5be +("drivers/video/fbdev/atyfb: Replace MTRR UC hole with strong UC"). +Such use is nevertheless heavily discouraged as the effective memory type is +considered implementation defined. This strategy should only be used used as a +last resort measure. + +Note you cannot use set_memory_*() helpers on ioremap'd regions, even though +its use currently gives no hint of an error. ---------------------------------------------------------------------- MTRR Non-PAT PAT Linux ioremap value Effective memory type