From: Toshi Kani <toshi.kani@hp.com>
To: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com,
akpm@linux-foundation.org, arnd@arndb.de, konrad.wilk@oracle.com,
plagnioj@jcrosoft.com, tomi.valkeinen@ti.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stefan.bader@canonical.com, luto@amacapital.net,
airlied@gmail.com, bp@alien8.de, Toshi Kani <toshi.kani@hp.com>
Subject: [RFC PATCH 7/11] x86, mm: Keep _set_memory_<type>() slot-independent
Date: Tue, 15 Jul 2014 13:34:40 -0600 [thread overview]
Message-ID: <1405452884-25688-8-git-send-email-toshi.kani@hp.com> (raw)
In-Reply-To: <1405452884-25688-1-git-send-email-toshi.kani@hp.com>
The _set_memory_<type>() interfaces assume how each memory type is
assigned to PAT slots in the PAT MSTR. For instance, _set_memory_wb()
assumes that WB is assigned to the PA0/4 slot by calling
change_page_attr_clear().
This patch changes the _set_memory_<type>() interfaces to call
change_page_attr_set_clr() directly for all memory types, and keep
them independent from the PAT slot assignment.
It also introduces pgprot_set_cache() for setting a specified page
cache value to a pgprot_t value.
Signed-off-by: Toshi Kani <toshi.kani@hp.com>
---
arch/x86/mm/pageattr.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a2a1e70..da597d0 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -1444,8 +1444,10 @@ int _set_memory_uc(unsigned long addr, int numpages)
/*
* for now UC MINUS. see comments in ioremap_nocache()
*/
- return change_page_attr_set(&addr, numpages,
- __pgprot(_PAGE_CACHE_UC_MINUS), 0);
+ return change_page_attr_set_clr(&addr, numpages,
+ __pgprot(_PAGE_CACHE_UC_MINUS),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, 0, NULL);
}
int set_memory_uc(unsigned long addr, int numpages)
@@ -1489,8 +1491,10 @@ static int _set_memory_array(unsigned long *addr, int addrinarray,
goto out_free;
}
- ret = change_page_attr_set(addr, addrinarray,
- __pgprot(_PAGE_CACHE_UC_MINUS), 1);
+ ret = change_page_attr_set_clr(addr, addrinarray,
+ __pgprot(_PAGE_CACHE_UC_MINUS),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, CPA_ARRAY, NULL);
if (!ret && new_type == _PAGE_CACHE_WC)
ret = change_page_attr_set_clr(addr, addrinarray,
@@ -1526,8 +1530,10 @@ int _set_memory_wc(unsigned long addr, int numpages)
int ret;
unsigned long addr_copy = addr;
- ret = change_page_attr_set(&addr, numpages,
- __pgprot(_PAGE_CACHE_UC_MINUS), 0);
+ ret = change_page_attr_set_clr(&addr, numpages,
+ __pgprot(_PAGE_CACHE_UC_MINUS),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, 0, NULL);
if (!ret) {
ret = change_page_attr_set_clr(&addr_copy, numpages,
__pgprot(_PAGE_CACHE_WC),
@@ -1570,8 +1576,10 @@ EXPORT_SYMBOL(set_memory_array_wt);
int _set_memory_wt(unsigned long addr, int numpages)
{
- return change_page_attr_set(&addr, numpages,
- __pgprot(_PAGE_CACHE_WT), 0);
+ return change_page_attr_set_clr(&addr, numpages,
+ __pgprot(_PAGE_CACHE_WT),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, 0, NULL);
}
int set_memory_wt(unsigned long addr, int numpages)
@@ -1601,8 +1609,10 @@ EXPORT_SYMBOL(set_memory_wt);
int _set_memory_wb(unsigned long addr, int numpages)
{
- return change_page_attr_clear(&addr, numpages,
- __pgprot(_PAGE_CACHE_MASK), 0);
+ return change_page_attr_set_clr(&addr, numpages,
+ __pgprot(_PAGE_CACHE_WB),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, 0, NULL);
}
int set_memory_wb(unsigned long addr, int numpages)
@@ -1623,8 +1633,10 @@ int set_memory_array_wb(unsigned long *addr, int addrinarray)
int i;
int ret;
- ret = change_page_attr_clear(addr, addrinarray,
- __pgprot(_PAGE_CACHE_MASK), 1);
+ ret = change_page_attr_set_clr(addr, addrinarray,
+ __pgprot(_PAGE_CACHE_WB),
+ __pgprot(_PAGE_CACHE_MASK),
+ 0, CPA_ARRAY, NULL);
if (ret)
return ret;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-07-15 19:45 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-15 19:34 [RFC PATCH 0/11] Support Write-Through mapping on x86 Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 1/11] x86, mm, pat: Redefine _PAGE_CACHE_UC as UC_MINUS Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 2/11] x86, mm, pat: Define _PAGE_CACHE_WT for PA3/7 of PAT Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 3/11] x86, mm, pat: Change reserve_memtype() to handle WT type Toshi Kani
2014-07-15 19:56 ` Andy Lutomirski
2014-07-15 23:10 ` Toshi Kani
2014-07-15 23:36 ` Andy Lutomirski
2014-07-15 23:46 ` H. Peter Anvin
2014-07-15 23:54 ` Andy Lutomirski
2014-07-15 23:59 ` H. Peter Anvin
2014-07-15 23:53 ` Toshi Kani
2014-07-16 0:05 ` H. Peter Anvin
2014-07-16 0:28 ` Andy Lutomirski
2014-07-16 0:31 ` H. Peter Anvin
2014-07-16 14:35 ` Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 4/11] x86, mm, asm-gen: Add ioremap_wt() for WT mapping Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 5/11] x86, mm: Add set_memory[_array]_wt() for setting WT Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 6/11] x86, mm, pat: Add pgprot_writethrough() for WT Toshi Kani
2014-07-15 19:34 ` Toshi Kani [this message]
2014-07-15 19:34 ` [RFC PATCH 8/11] x86, mm, pat: Keep pgprot_<type>() slot-independent Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 9/11] x86, efi: Cleanup PCD bit manipulation in EFI Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 10/11] x86, xen: Cleanup PWT/PCD bit manipulation in Xen Toshi Kani
2014-07-15 19:34 ` [RFC PATCH 11/11] x86, fbdev: Cleanup PWT/PCD bit manipulation in fbdev Toshi Kani
2014-07-15 19:53 ` [RFC PATCH 0/11] Support Write-Through mapping on x86 Andy Lutomirski
2014-07-15 20:10 ` H. Peter Anvin
2014-07-15 20:09 ` H. Peter Anvin
2014-07-15 21:23 ` Toshi Kani
2014-07-16 0:40 ` Konrad Rzeszutek Wilk
2014-07-16 21:28 ` Toshi Kani
2014-07-21 16:31 ` Toshi Kani
2014-07-21 16:47 ` H. Peter Anvin
2014-07-21 17:16 ` Toshi Kani
2014-07-21 17:32 ` H. Peter Anvin
2014-07-21 17:33 ` Toshi Kani
2014-07-21 18:33 ` Konrad Rzeszutek Wilk
2014-07-21 19:24 ` Toshi Kani
2014-07-21 20:22 ` H. Peter Anvin
2014-07-21 17:20 ` Toshi Kani
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=1405452884-25688-8-git-send-email-toshi.kani@hp.com \
--to=toshi.kani@hp.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=plagnioj@jcrosoft.com \
--cc=stefan.bader@canonical.com \
--cc=tglx@linutronix.de \
--cc=tomi.valkeinen@ti.com \
/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).