aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr_32.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:33:43 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:43 -0500
commitf0646e43acb18f0e00b00085dc88bc3f403e7930 (patch)
treec47968a44ac541854929f03d22cf2fb76d76cb55 /arch/x86/mm/pageattr_32.c
parenta5a5dc31794c3271c066835ad2c90c58a3805569 (diff)
x86: return the page table level in lookup_address()
based on this patch from Andi Kleen: | Subject: CPA: Return the page table level in lookup_address() | From: Andi Kleen <ak@suse.de> | | Needed for the next change. | | And change all the callers. and ported it to x86.git. Signed-off-by: Andi Kleen <ak@suse.de> Acked-by: Jan Beulich <jbeulich@novell.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/pageattr_32.c')
-rw-r--r--arch/x86/mm/pageattr_32.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/mm/pageattr_32.c b/arch/x86/mm/pageattr_32.c
index be4656403d77..523fd5b37df9 100644
--- a/arch/x86/mm/pageattr_32.c
+++ b/arch/x86/mm/pageattr_32.c
@@ -18,7 +18,7 @@
18static DEFINE_SPINLOCK(cpa_lock); 18static DEFINE_SPINLOCK(cpa_lock);
19static struct list_head df_list = LIST_HEAD_INIT(df_list); 19static struct list_head df_list = LIST_HEAD_INIT(df_list);
20 20
21pte_t *lookup_address(unsigned long address) 21pte_t *lookup_address(unsigned long address, int *level)
22{ 22{
23 pgd_t *pgd = pgd_offset_k(address); 23 pgd_t *pgd = pgd_offset_k(address);
24 pud_t *pud; 24 pud_t *pud;
@@ -32,8 +32,10 @@ pte_t *lookup_address(unsigned long address)
32 pmd = pmd_offset(pud, address); 32 pmd = pmd_offset(pud, address);
33 if (pmd_none(*pmd)) 33 if (pmd_none(*pmd))
34 return NULL; 34 return NULL;
35 *level = 2;
35 if (pmd_large(*pmd)) 36 if (pmd_large(*pmd))
36 return (pte_t *)pmd; 37 return (pte_t *)pmd;
38 *level = 3;
37 39
38 return pte_offset_kernel(pmd, address); 40 return pte_offset_kernel(pmd, address);
39} 41}
@@ -156,11 +158,12 @@ static int __change_page_attr(struct page *page, pgprot_t prot)
156 struct page *kpte_page; 158 struct page *kpte_page;
157 unsigned long address; 159 unsigned long address;
158 pte_t *kpte; 160 pte_t *kpte;
161 int level;
159 162
160 BUG_ON(PageHighMem(page)); 163 BUG_ON(PageHighMem(page));
161 address = (unsigned long)page_address(page); 164 address = (unsigned long)page_address(page);
162 165
163 kpte = lookup_address(address); 166 kpte = lookup_address(address, &level);
164 if (!kpte) 167 if (!kpte)
165 return -EINVAL; 168 return -EINVAL;
166 169