From: Randy Dunlap <rdunlap@infradead.org>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
mingo@elte.hu, tglx@linutronix.de, hpa@zytor.com, bp@suse.de,
plagnioj@jcrosoft.com, tomi.valkeinen@ti.com,
daniel.vetter@intel.com, airlied@linux.ie
Cc: dledford@redhat.com, awalls@md.metrocast.net, syrjala@sci.fi,
luto@amacapital.net, mst@redhat.com, cocci@systeme.lip6.fr,
linux-kernel@vger.kernel.org,
"Luis R. Rodriguez" <mcgrof@suse.com>,
Toshi Kani <toshi.kani@hp.com>, Jonathan Corbet <corbet@lwn.net>,
Dave Hansen <dave.hansen@linux.intel.com>,
Suresh Siddha <sbsiddha@gmail.com>,
Juergen Gross <jgross@suse.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Dave Airlie <airlied@redhat.com>,
Antonino Daplas <adaplas@gmail.com>, Mel Gorman <mgorman@suse.de>,
Vlastimil Babka <vbabka@suse.cz>,
Davidlohr Bueso <dbueso@suse.de>,
linux-fbdev@vger.kernel.org
Subject: Re: [PATCH v4 2/6] x86: document WC MTRR effects on PAT / non-PAT pages
Date: Thu, 30 Apr 2015 22:01:12 +0000 [thread overview]
Message-ID: <5542A628.8050705@infradead.org> (raw)
In-Reply-To: <1430343851-967-3-git-send-email-mcgrof@do-not-panic.com>
On 04/29/15 14:44, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> ---
> Documentation/x86/mtrr.txt | 18 +++++++++++++++---
> Documentation/x86/pat.txt | 40 +++++++++++++++++++++++++++++++++++++++-
> arch/x86/kernel/cpu/mtrr/main.c | 3 +++
> 3 files changed, 57 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
> index cf08c9f..7e183e3 100644
> --- a/Documentation/x86/pat.txt
> +++ b/Documentation/x86/pat.txt
> @@ -102,7 +104,43 @@ wants to export a RAM region, it has to do set_memory_uc() or set_memory_wc()
> as step 0 above and also track the usage of those pages and use set_memory_wb()
> before the page is freed to free pool.
>
> -
> +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 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()
> +is made should already have be ioremap'd with write-combining page attributes
> +or PAT entries, this can be done by using ioremap_wc() / or respective helpers.
> +Devices which combine areas of IO memory desired to remain uncachable with
I would spell it uncacheable. In kernel Documentation/, grep uncacheable finds
14 hits vs. 6 hits for uncachable. No big deal.
> +areas where write-combining is desirable and are restricted by the size
> +requirements of MTRRs should consider splitting up their IO memory space
> +cleanly with ioremap_uc() and ioremap_wc() followed by an arch_phys_wc_add()
> +encompassing both regions. Such use is nevertheless heavily discouraged as
> +the effective memory type is considered implementation defined. This strategy
> +should only be used as last resort on devices with size-contrained regions
size-constrained
> +where otherwise MTRR write-combining would not be effective.
> +
> +Note that you cannot use set_memory_wc() to override / whitelist IO remapped
> +memory space mapped with ioremap*() calls, set_memory_wc() can only be used
> +on RAM.
> +
> +----------------------------------------------------------------------
> +MTRR Non-PAT PAT Linux ioremap value Effective memory type
> +----------------------------------------------------------------------
> + Non-PAT | PAT
> + PAT
> + |PCD
> + ||PWT
> + |||
> +WC 000 WB _PAGE_CACHE_MODE_WB WC | WC
> +WC 001 WC _PAGE_CACHE_MODE_WC WC* | WC
> +WC 010 UC- _PAGE_CACHE_MODE_UC_MINUS WC* | WC
> +WC 011 UC _PAGE_CACHE_MODE_UC UC | UC
> +----------------------------------------------------------------------
> +
> +(*) denotes implementation defined and is discouraged
>
> Notes:
>
> diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
> index ea5f363..12abdbe 100644
> --- a/arch/x86/kernel/cpu/mtrr/main.c
> +++ b/arch/x86/kernel/cpu/mtrr/main.c
> @@ -538,6 +538,9 @@ EXPORT_SYMBOL(mtrr_del);
> * attempts to add a WC MTRR covering size bytes starting at base and
> * logs an error if this fails.
> *
> + * The caller should expect to need to provide a power of two size on an
* The called should provide a power of two size on an equivalent
* power of two boundary.
> + * equivalent power of two boundary.
> + *
> * Drivers must store the return value to pass to mtrr_del_wc_if_needed,
> * but drivers should not try to interpret that return value.
> */
>
--
~Randy
next prev parent reply other threads:[~2015-04-30 22:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1430343851-967-1-git-send-email-mcgrof@do-not-panic.com>
2015-04-29 21:44 ` [PATCH v4 1/6] x86: add ioremap_uc() - force strong UC, PCD=1, PWT=1 Luis R. Rodriguez
2015-04-30 10:18 ` Borislav Petkov
2015-04-29 21:44 ` [PATCH v4 2/6] x86: document WC MTRR effects on PAT / non-PAT pages Luis R. Rodriguez
2015-04-30 22:01 ` Randy Dunlap [this message]
2015-05-05 0:45 ` Luis R. Rodriguez
2015-05-05 7:22 ` Borislav Petkov
2015-05-05 7:46 ` Luis R. Rodriguez
2015-05-05 7:53 ` Borislav Petkov
2015-05-05 7:31 ` Luis R. Rodriguez
2015-05-04 12:23 ` Borislav Petkov
2015-05-05 7:35 ` Luis R. Rodriguez
2015-04-29 21:44 ` [PATCH v4 3/6] video: fbdev: atyfb: move framebuffer length fudging to helper Luis R. Rodriguez
2015-04-29 21:44 ` [PATCH v4 4/6] video: fbdev: atyfb: clarify ioremap() base and length used Luis R. Rodriguez
2015-04-29 21:44 ` [PATCH v4 5/6] video: fbdev: atyfb: replace MTRR UC hole with strong UC Luis R. Rodriguez
2015-04-29 21:44 ` [PATCH v4 6/6] video: fbdev: atyfb: use arch_phys_wc_add() and ioremap_wc() Luis R. Rodriguez
2015-05-20 19:53 ` Luis R. Rodriguez
2015-05-20 20:57 ` Luis R. Rodriguez
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=5542A628.8050705@infradead.org \
--to=rdunlap@infradead.org \
--cc=adaplas@gmail.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=awalls@md.metrocast.net \
--cc=bp@suse.de \
--cc=cocci@systeme.lip6.fr \
--cc=corbet@lwn.net \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=dbueso@suse.de \
--cc=dledford@redhat.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mcgrof@do-not-panic.com \
--cc=mcgrof@suse.com \
--cc=mgorman@suse.de \
--cc=mingo@elte.hu \
--cc=mst@redhat.com \
--cc=plagnioj@jcrosoft.com \
--cc=sbsiddha@gmail.com \
--cc=syrjala@sci.fi \
--cc=tglx@linutronix.de \
--cc=tomi.valkeinen@ti.com \
--cc=toshi.kani@hp.com \
--cc=vbabka@suse.cz \
/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).