|
@@ -30,6 +30,7 @@
|
|
*/
|
|
*/
|
|
struct cpa_data {
|
|
struct cpa_data {
|
|
unsigned long *vaddr;
|
|
unsigned long *vaddr;
|
|
|
|
+ pgd_t *pgd;
|
|
pgprot_t mask_set;
|
|
pgprot_t mask_set;
|
|
pgprot_t mask_clr;
|
|
pgprot_t mask_clr;
|
|
int numpages;
|
|
int numpages;
|
|
@@ -322,17 +323,9 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
|
|
return prot;
|
|
return prot;
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * Lookup the page table entry for a virtual address. Return a pointer
|
|
|
|
- * to the entry and the level of the mapping.
|
|
|
|
- *
|
|
|
|
- * Note: We return pud and pmd either when the entry is marked large
|
|
|
|
- * or when the present bit is not set. Otherwise we would return a
|
|
|
|
- * pointer to a nonexisting mapping.
|
|
|
|
- */
|
|
|
|
-pte_t *lookup_address(unsigned long address, unsigned int *level)
|
|
|
|
|
|
+static pte_t *__lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
|
|
|
|
+ unsigned int *level)
|
|
{
|
|
{
|
|
- pgd_t *pgd = pgd_offset_k(address);
|
|
|
|
pud_t *pud;
|
|
pud_t *pud;
|
|
pmd_t *pmd;
|
|
pmd_t *pmd;
|
|
|
|
|
|
@@ -361,8 +354,31 @@ pte_t *lookup_address(unsigned long address, unsigned int *level)
|
|
|
|
|
|
return pte_offset_kernel(pmd, address);
|
|
return pte_offset_kernel(pmd, address);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Lookup the page table entry for a virtual address. Return a pointer
|
|
|
|
+ * to the entry and the level of the mapping.
|
|
|
|
+ *
|
|
|
|
+ * Note: We return pud and pmd either when the entry is marked large
|
|
|
|
+ * or when the present bit is not set. Otherwise we would return a
|
|
|
|
+ * pointer to a nonexisting mapping.
|
|
|
|
+ */
|
|
|
|
+pte_t *lookup_address(unsigned long address, unsigned int *level)
|
|
|
|
+{
|
|
|
|
+ return __lookup_address_in_pgd(pgd_offset_k(address), address, level);
|
|
|
|
+}
|
|
EXPORT_SYMBOL_GPL(lookup_address);
|
|
EXPORT_SYMBOL_GPL(lookup_address);
|
|
|
|
|
|
|
|
+static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long address,
|
|
|
|
+ unsigned int *level)
|
|
|
|
+{
|
|
|
|
+ if (cpa->pgd)
|
|
|
|
+ return __lookup_address_in_pgd(cpa->pgd + pgd_index(address),
|
|
|
|
+ address, level);
|
|
|
|
+
|
|
|
|
+ return lookup_address(address, level);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* This is necessary because __pa() does not work on some
|
|
* This is necessary because __pa() does not work on some
|
|
* kinds of memory, like vmalloc() or the alloc_remap()
|
|
* kinds of memory, like vmalloc() or the alloc_remap()
|