| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Page table support for the Hexagon architecture |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 and |
|---|
| 8 | | - * only version 2 as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 18 | | - * 02110-1301, USA. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #ifndef _ASM_PGTABLE_H |
|---|
| .. | .. |
|---|
| 25 | 12 | * Page table definitions for Qualcomm Hexagon processor. |
|---|
| 26 | 13 | */ |
|---|
| 27 | 14 | #include <asm/page.h> |
|---|
| 28 | | -#define __ARCH_USE_5LEVEL_HACK |
|---|
| 29 | 15 | #include <asm-generic/pgtable-nopmd.h> |
|---|
| 30 | 16 | |
|---|
| 31 | 17 | /* A handy thing to have if one has the RAM. Declared in head.S */ |
|---|
| .. | .. |
|---|
| 171 | 157 | |
|---|
| 172 | 158 | /* Seems to be zero even in architectures where the zero page is firewalled? */ |
|---|
| 173 | 159 | #define FIRST_USER_ADDRESS 0UL |
|---|
| 174 | | -#define pte_special(pte) 0 |
|---|
| 175 | | -#define pte_mkspecial(pte) (pte) |
|---|
| 176 | 160 | |
|---|
| 177 | 161 | /* HUGETLB not working currently */ |
|---|
| 178 | 162 | #ifdef CONFIG_HUGETLB_PAGE |
|---|
| .. | .. |
|---|
| 221 | 205 | { |
|---|
| 222 | 206 | pte_val(*ptep) = _NULL_PTE; |
|---|
| 223 | 207 | } |
|---|
| 224 | | - |
|---|
| 225 | | -#ifdef NEED_PMD_INDEX_DESPITE_BEING_2_LEVEL |
|---|
| 226 | | -/** |
|---|
| 227 | | - * pmd_index - returns the index of the entry in the PMD page |
|---|
| 228 | | - * which would control the given virtual address |
|---|
| 229 | | - */ |
|---|
| 230 | | -#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
|---|
| 231 | | - |
|---|
| 232 | | -#endif |
|---|
| 233 | | - |
|---|
| 234 | | -/** |
|---|
| 235 | | - * pgd_index - returns the index of the entry in the PGD page |
|---|
| 236 | | - * which would control the given virtual address |
|---|
| 237 | | - * |
|---|
| 238 | | - * This returns the *index* for the address in the pgd_t |
|---|
| 239 | | - */ |
|---|
| 240 | | -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
|---|
| 241 | | - |
|---|
| 242 | | -/* |
|---|
| 243 | | - * pgd_offset - find an offset in a page-table-directory |
|---|
| 244 | | - */ |
|---|
| 245 | | -#define pgd_offset(mm, addr) ((mm)->pgd + pgd_index(addr)) |
|---|
| 246 | | - |
|---|
| 247 | | -/* |
|---|
| 248 | | - * pgd_offset_k - get kernel (init_mm) pgd entry pointer for addr |
|---|
| 249 | | - */ |
|---|
| 250 | | -#define pgd_offset_k(address) pgd_offset(&init_mm, address) |
|---|
| 251 | 208 | |
|---|
| 252 | 209 | /** |
|---|
| 253 | 210 | * pmd_none - check if pmd_entry is mapped |
|---|
| .. | .. |
|---|
| 419 | 376 | */ |
|---|
| 420 | 377 | #define set_pte_at(mm, addr, ptep, pte) set_pte(ptep, pte) |
|---|
| 421 | 378 | |
|---|
| 422 | | -/* |
|---|
| 423 | | - * May need to invoke the virtual machine as well... |
|---|
| 424 | | - */ |
|---|
| 425 | | -#define pte_unmap(pte) do { } while (0) |
|---|
| 426 | | -#define pte_unmap_nested(pte) do { } while (0) |
|---|
| 427 | | - |
|---|
| 428 | | -/* |
|---|
| 429 | | - * pte_offset_map - returns the linear address of the page table entry |
|---|
| 430 | | - * corresponding to an address |
|---|
| 431 | | - */ |
|---|
| 432 | | -#define pte_offset_map(dir, address) \ |
|---|
| 433 | | - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
|---|
| 434 | | - |
|---|
| 435 | | -#define pte_offset_map_nested(pmd, addr) pte_offset_map(pmd, addr) |
|---|
| 436 | | - |
|---|
| 437 | | -/* pte_offset_kernel - kernel version of pte_offset */ |
|---|
| 438 | | -#define pte_offset_kernel(dir, address) \ |
|---|
| 439 | | - ((pte_t *) (unsigned long) __va(pmd_val(*dir) & PAGE_MASK) \ |
|---|
| 440 | | - + __pte_offset(address)) |
|---|
| 379 | +static inline unsigned long pmd_page_vaddr(pmd_t pmd) |
|---|
| 380 | +{ |
|---|
| 381 | + return (unsigned long)__va(pmd_val(pmd) & PAGE_MASK); |
|---|
| 382 | +} |
|---|
| 441 | 383 | |
|---|
| 442 | 384 | /* ZERO_PAGE - returns the globally shared zero page */ |
|---|
| 443 | 385 | #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page)) |
|---|
| 444 | | - |
|---|
| 445 | | -#define __pte_offset(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
|---|
| 446 | | - |
|---|
| 447 | | -/* I think this is in case we have page table caches; needed by init/main.c */ |
|---|
| 448 | | -#define pgtable_cache_init() do { } while (0) |
|---|
| 449 | 386 | |
|---|
| 450 | 387 | /* |
|---|
| 451 | 388 | * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the PTE is |
|---|
| .. | .. |
|---|
| 478 | 415 | ((swp_entry_t) { \ |
|---|
| 479 | 416 | ((type << 1) | \ |
|---|
| 480 | 417 | ((offset & 0x7ffff0) << 9) | ((offset & 0xf) << 6)) }) |
|---|
| 481 | | - |
|---|
| 482 | | -/* Oh boy. There are a lot of possible arch overrides found in this file. */ |
|---|
| 483 | | -#include <asm-generic/pgtable.h> |
|---|
| 484 | 418 | |
|---|
| 485 | 419 | #endif |
|---|