From: tip-bot for Juergen Gross <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jgross@suse.com,
tglx@linutronix.de, mingo@kernel.org, stefan.bader@canonical.com,
hpa@zytor.com
Subject: [tip:x86/mm] x86: Use new cache mode type in track_pfn_remap() and track_pfn_insert()
Date: Sun, 16 Nov 2014 02:56:45 -0800 [thread overview]
Message-ID: <tip-2a3746984c98b17b565e6a2c2bbaaaef757db1b4@git.kernel.org> (raw)
In-Reply-To: <1415019724-4317-10-git-send-email-jgross@suse.com>
Commit-ID: 2a3746984c98b17b565e6a2c2bbaaaef757db1b4
Gitweb: http://git.kernel.org/tip/2a3746984c98b17b565e6a2c2bbaaaef757db1b4
Author: Juergen Gross <jgross@suse.com>
AuthorDate: Mon, 3 Nov 2014 14:01:55 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 16 Nov 2014 11:04:25 +0100
x86: Use new cache mode type in track_pfn_remap() and track_pfn_insert()
Instead of directly using the cache mode bits in the pte switch to
using the cache mode type. As those are the main callers of
lookup_memtype(), change this as well.
Based-on-patch-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stefan.bader@canonical.com
Cc: xen-devel@lists.xensource.com
Cc: konrad.wilk@oracle.com
Cc: ville.syrjala@linux.intel.com
Cc: david.vrabel@citrix.com
Cc: jbeulich@suse.com
Cc: toshi.kani@hp.com
Cc: plagnioj@jcrosoft.com
Cc: tomi.valkeinen@ti.com
Cc: bhelgaas@google.com
Link: http://lkml.kernel.org/r/1415019724-4317-10-git-send-email-jgross@suse.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/mm/pat.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 6d5a8e3..2f3744f 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -394,12 +394,12 @@ int free_memtype(u64 start, u64 end)
*
* Only to be called when PAT is enabled
*
- * Returns _PAGE_CACHE_WB, _PAGE_CACHE_WC, _PAGE_CACHE_UC_MINUS or
- * _PAGE_CACHE_UC
+ * Returns _PAGE_CACHE_MODE_WB, _PAGE_CACHE_MODE_WC, _PAGE_CACHE_MODE_UC_MINUS
+ * or _PAGE_CACHE_MODE_UC
*/
-static unsigned long lookup_memtype(u64 paddr)
+static enum page_cache_mode lookup_memtype(u64 paddr)
{
- int rettype = _PAGE_CACHE_WB;
+ enum page_cache_mode rettype = _PAGE_CACHE_MODE_WB;
struct memtype *entry;
if (x86_platform.is_untracked_pat_range(paddr, paddr + PAGE_SIZE))
@@ -408,13 +408,13 @@ static unsigned long lookup_memtype(u64 paddr)
if (pat_pagerange_is_ram(paddr, paddr + PAGE_SIZE)) {
struct page *page;
page = pfn_to_page(paddr >> PAGE_SHIFT);
- rettype = get_page_memtype(page);
+ rettype = pgprot2cachemode(__pgprot(get_page_memtype(page)));
/*
* -1 from get_page_memtype() implies RAM page is in its
* default state and not reserved, and hence of type WB
*/
if (rettype == -1)
- rettype = _PAGE_CACHE_WB;
+ rettype = _PAGE_CACHE_MODE_WB;
return rettype;
}
@@ -423,9 +423,9 @@ static unsigned long lookup_memtype(u64 paddr)
entry = rbt_memtype_lookup(paddr);
if (entry != NULL)
- rettype = entry->type;
+ rettype = pgprot2cachemode(__pgprot(entry->type));
else
- rettype = _PAGE_CACHE_UC_MINUS;
+ rettype = _PAGE_CACHE_MODE_UC_MINUS;
spin_unlock(&memtype_lock);
return rettype;
@@ -613,7 +613,7 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
if (!pat_enabled)
return 0;
- flags = lookup_memtype(paddr);
+ flags = cachemode2protval(lookup_memtype(paddr));
if (want_flags != flags) {
printk(KERN_WARNING "%s:%d map pfn RAM range req %s for [mem %#010Lx-%#010Lx], got %s\n",
current->comm, current->pid,
@@ -715,7 +715,7 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
unsigned long pfn, unsigned long addr, unsigned long size)
{
resource_size_t paddr = (resource_size_t)pfn << PAGE_SHIFT;
- unsigned long flags;
+ enum page_cache_mode pcm;
/* reserve the whole chunk starting from paddr */
if (addr == vma->vm_start && size == (vma->vm_end - vma->vm_start)) {
@@ -734,18 +734,18 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
* For anything smaller than the vma size we set prot based on the
* lookup.
*/
- flags = lookup_memtype(paddr);
+ pcm = lookup_memtype(paddr);
/* Check memtype for the remaining pages */
while (size > PAGE_SIZE) {
size -= PAGE_SIZE;
paddr += PAGE_SIZE;
- if (flags != lookup_memtype(paddr))
+ if (pcm != lookup_memtype(paddr))
return -EINVAL;
}
*prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
- flags);
+ cachemode2protval(pcm));
return 0;
}
@@ -753,15 +753,15 @@ int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
unsigned long pfn)
{
- unsigned long flags;
+ enum page_cache_mode pcm;
if (!pat_enabled)
return 0;
/* Set prot based on lookup */
- flags = lookup_memtype((resource_size_t)pfn << PAGE_SHIFT);
+ pcm = lookup_memtype((resource_size_t)pfn << PAGE_SHIFT);
*prot = __pgprot((pgprot_val(vma->vm_page_prot) & (~_PAGE_CACHE_MASK)) |
- flags);
+ cachemode2protval(pcm));
return 0;
}
next prev parent reply other threads:[~2014-11-16 10:57 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 13:01 [PATCH V6 00/18] x86: Full support of PAT Juergen Gross
2014-11-03 13:01 ` [PATCH V6 01/18] x86: Make page cache mode a real type Juergen Gross
2014-11-16 10:54 ` [tip:x86/mm] " tip-bot for Juergen Gross
2015-01-22 7:11 ` [PATCH V6 01/18] " Steven Noonan
2015-01-22 10:15 ` Juergen Gross
2015-01-22 11:06 ` Thomas Gleixner
2015-01-22 11:11 ` Juergen Gross
2014-11-03 13:01 ` [PATCH V6 02/18] x86: Use new cache mode type in include/asm/fb.h Juergen Gross
2014-11-16 10:54 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 03/18] x86: Use new cache mode type in drivers/video/fbdev/gbefb.c Juergen Gross
2014-11-07 8:16 ` Tomi Valkeinen
2014-11-07 8:16 ` Tomi Valkeinen
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in drivers/video/fbdev/ gbefb.c tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 04/18] x86: Use new cache mode type in drivers/video/fbdev/vermilion Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in drivers/video/fbdev/ vermilion tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 05/18] x86: Use new cache mode type in arch/x86/pci Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 06/18] x86: Use new cache mode type in arch/x86/mm/init_64.c Juergen Gross
2014-11-16 10:55 ` [tip:x86/mm] x86: Use new cache mode type in arch/x86/mm/ init_64.c tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 07/18] x86: Use new cache mode type in asm/pgtable.h Juergen Gross
2014-11-16 10:56 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 08/18] x86: Use new cache mode type in mm/iomap_32.c Juergen Gross
2014-11-16 10:56 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 09/18] x86: Use new cache mode type in track_pfn_remap() and track_pfn_insert() Juergen Gross
2014-11-16 10:56 ` tip-bot for Juergen Gross [this message]
2014-11-03 13:01 ` [PATCH V6 10/18] x86: Remove looking for setting of _PAGE_PAT_LARGE in pageattr.c Juergen Gross
2014-11-03 16:44 ` Thomas Gleixner
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 11/18] x86: Use new cache mode type in setting page attributes Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 12/18] x86: Use new cache mode type in mm/ioremap.c Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:01 ` [PATCH V6 13/18] x86: Use new cache mode type in memtype related functions Juergen Gross
2014-11-16 10:57 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 14/18] x86: Clean up pgtable_types.h Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 15/18] x86: Support PAT bit in pagetable dump for lower levels Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 16/18] x86: Respect PAT bit when copying pte values between large and normal pages Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 17/18] x86: Enable PAT to use cache mode translation tables Juergen Gross
2014-11-16 10:58 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 13:02 ` [PATCH V6 18/18] xen: Support Xen pv-domains using PAT Juergen Gross
2014-11-16 10:59 ` [tip:x86/mm] " tip-bot for Juergen Gross
2014-11-03 16:43 ` [PATCH V6 00/18] x86: Full support of PAT Toshi Kani
2014-11-14 6:30 ` Juergen Gross
2014-11-16 13:08 ` Ingo Molnar
2014-11-17 4:42 ` Jürgen Groß
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=tip-2a3746984c98b17b565e6a2c2bbaaaef757db1b4@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=stefan.bader@canonical.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.