aboutsummaryrefslogtreecommitdiffstats
path: root/arch/hexagon
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2015-02-10 17:10:33 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-10 17:30:32 -0500
commitd99f95e6522db22192c331c75de182023a49fbcc (patch)
tree9e1fe61901aa3d3ee6d1a396d44bf1254859efbd /arch/hexagon
parentca5bfa7b390017f053d7581bc701518b87bc3d43 (diff)
hexagon: drop _PAGE_FILE and pte_file()-related helpers
We've replaced remap_file_pages(2) implementation with emulation. Nobody creates non-linear mapping anymore. This patch also increase number of bits availble for swap offset. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Richard Kuo <rkuo@codeaurora.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/hexagon')
-rw-r--r--arch/hexagon/include/asm/pgtable.h60
1 files changed, 16 insertions, 44 deletions
diff --git a/arch/hexagon/include/asm/pgtable.h b/arch/hexagon/include/asm/pgtable.h
index d8bd54fa431e..6e35e71d2aea 100644
--- a/arch/hexagon/include/asm/pgtable.h
+++ b/arch/hexagon/include/asm/pgtable.h
@@ -62,13 +62,6 @@ extern unsigned long zero_page_mask;
62#define _PAGE_ACCESSED (1<<2) 62#define _PAGE_ACCESSED (1<<2)
63 63
64/* 64/*
65 * _PAGE_FILE is only meaningful if _PAGE_PRESENT is false, while
66 * _PAGE_DIRTY is only meaningful if _PAGE_PRESENT is true.
67 * So we can overload the bit...
68 */
69#define _PAGE_FILE _PAGE_DIRTY /* set: pagecache, unset = swap */
70
71/*
72 * For now, let's say that Valid and Present are the same thing. 65 * For now, let's say that Valid and Present are the same thing.
73 * Alternatively, we could say that it's the "or" of R, W, and X 66 * Alternatively, we could say that it's the "or" of R, W, and X
74 * permissions. 67 * permissions.
@@ -456,57 +449,36 @@ static inline int pte_exec(pte_t pte)
456#define pgtable_cache_init() do { } while (0) 449#define pgtable_cache_init() do { } while (0)
457 450
458/* 451/*
459 * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the 452 * Swap/file PTE definitions. If _PAGE_PRESENT is zero, the rest of the PTE is
460 * PTE is interpreted as swap information. Depending on the _PAGE_FILE 453 * interpreted as swap information. The remaining free bits are interpreted as
461 * bit, the remaining free bits are eitehr interpreted as a file offset 454 * swap type/offset tuple. Rather than have the TLB fill handler test
462 * or a swap type/offset tuple. Rather than have the TLB fill handler 455 * _PAGE_PRESENT, we're going to reserve the permissions bits and set them to
463 * test _PAGE_PRESENT, we're going to reserve the permissions bits 456 * all zeros for swap entries, which speeds up the miss handler at the cost of
464 * and set them to all zeros for swap entries, which speeds up the 457 * 3 bits of offset. That trade-off can be revisited if necessary, but Hexagon
465 * miss handler at the cost of 3 bits of offset. That trade-off can 458 * processor architecture and target applications suggest a lot of TLB misses
466 * be revisited if necessary, but Hexagon processor architecture and 459 * and not much swap space.
467 * target applications suggest a lot of TLB misses and not much swap space.
468 * 460 *
469 * Format of swap PTE: 461 * Format of swap PTE:
470 * bit 0: Present (zero) 462 * bit 0: Present (zero)
471 * bit 1: _PAGE_FILE (zero) 463 * bits 1-5: swap type (arch independent layer uses 5 bits max)
472 * bits 2-6: swap type (arch independent layer uses 5 bits max) 464 * bits 6-9: bits 3:0 of offset
473 * bits 7-9: bits 2:0 of offset 465 * bits 10-12: effectively _PAGE_PROTNONE (all zero)
474 * bits 10-12: effectively _PAGE_PROTNONE (all zero) 466 * bits 13-31: bits 22:4 of swap offset
475 * bits 13-31: bits 21:3 of swap offset
476 *
477 * Format of file PTE:
478 * bit 0: Present (zero)
479 * bit 1: _PAGE_FILE (zero)
480 * bits 2-9: bits 7:0 of offset
481 * bits 10-12: effectively _PAGE_PROTNONE (all zero)
482 * bits 13-31: bits 26:8 of swap offset
483 * 467 *
484 * The split offset makes some of the following macros a little gnarly, 468 * The split offset makes some of the following macros a little gnarly,
485 * but there's plenty of precedent for this sort of thing. 469 * but there's plenty of precedent for this sort of thing.
486 */ 470 */
487#define PTE_FILE_MAX_BITS 27
488 471
489/* Used for swap PTEs */ 472/* Used for swap PTEs */
490#define __swp_type(swp_pte) (((swp_pte).val >> 2) & 0x1f) 473#define __swp_type(swp_pte) (((swp_pte).val >> 1) & 0x1f)
491 474
492#define __swp_offset(swp_pte) \ 475#define __swp_offset(swp_pte) \
493 ((((swp_pte).val >> 7) & 0x7) | (((swp_pte).val >> 10) & 0x003ffff8)) 476 ((((swp_pte).val >> 6) & 0xf) | (((swp_pte).val >> 9) & 0x7ffff0))
494 477
495#define __swp_entry(type, offset) \ 478#define __swp_entry(type, offset) \
496 ((swp_entry_t) { \ 479 ((swp_entry_t) { \
497 ((type << 2) | \ 480 ((type << 1) | \
498 ((offset & 0x3ffff8) << 10) | ((offset & 0x7) << 7)) }) 481 ((offset & 0x7ffff0) << 9) | ((offset & 0xf) << 6)) })
499
500/* Used for file PTEs */
501#define pte_file(pte) \
502 ((pte_val(pte) & (_PAGE_FILE | _PAGE_PRESENT)) == _PAGE_FILE)
503
504#define pte_to_pgoff(pte) \
505 (((pte_val(pte) >> 2) & 0xff) | ((pte_val(pte) >> 5) & 0x07ffff00))
506
507#define pgoff_to_pte(off) \
508 ((pte_t) { ((((off) & 0x7ffff00) << 5) | (((off) & 0xff) << 2)\
509 | _PAGE_FILE) })
510 482
511/* Oh boy. There are a lot of possible arch overrides found in this file. */ 483/* Oh boy. There are a lot of possible arch overrides found in this file. */
512#include <asm-generic/pgtable.h> 484#include <asm-generic/pgtable.h>