aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/include/hv/hypervisor.h
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-04-01 14:04:21 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-05-25 12:48:27 -0400
commit621b19551507c8fd9d721f4038509c5bb155a983 (patch)
tree62d8d5e7a783364940153b4523fcfba821cee241 /arch/tile/include/hv/hypervisor.h
parentd9ed9faac283a3be73f0e11a2ef49ee55aece4db (diff)
arch/tile: support multiple huge page sizes dynamically
This change adds support for a new "super" bit in the PTE, using the new arch_make_huge_pte() method. The Tilera hypervisor sees the bit set at a given level of the page table and gangs together 4, 16, or 64 consecutive pages from that level of the hierarchy to create a larger TLB entry. One extra "super" page size can be specified at each of the three levels of the page table hierarchy on tilegx, using the "hugepagesz" argument on the boot command line. A new hypervisor API is added to allow Linux to tell the hypervisor how many PTEs to gang together at each level of the page table. To allow pre-allocating huge pages larger than the buddy allocator can handle, this change modifies the Tilera bootmem support to put all of memory on tilegx platforms into bootmem. As part of this change I eliminate the vestigial CONFIG_HIGHPTE support, which never worked anyway, and eliminate the hv_page_size() API in favor of the standard vma_kernel_pagesize() API. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/include/hv/hypervisor.h')
-rw-r--r--arch/tile/include/hv/hypervisor.h70
1 files changed, 67 insertions, 3 deletions
diff --git a/arch/tile/include/hv/hypervisor.h b/arch/tile/include/hv/hypervisor.h
index f27871775b7a..85e5cab4c2f0 100644
--- a/arch/tile/include/hv/hypervisor.h
+++ b/arch/tile/include/hv/hypervisor.h
@@ -66,6 +66,22 @@
66#define HV_DEFAULT_PAGE_SIZE_LARGE \ 66#define HV_DEFAULT_PAGE_SIZE_LARGE \
67 (__HV_SIZE_ONE << HV_LOG2_DEFAULT_PAGE_SIZE_LARGE) 67 (__HV_SIZE_ONE << HV_LOG2_DEFAULT_PAGE_SIZE_LARGE)
68 68
69#if CHIP_VA_WIDTH() > 32
70
71/** The log2 of the initial size of jumbo pages, in bytes.
72 * See HV_DEFAULT_PAGE_SIZE_JUMBO.
73 */
74#define HV_LOG2_DEFAULT_PAGE_SIZE_JUMBO 32
75
76/** The initial size of jumbo pages, in bytes. This value should
77 * be verified at runtime by calling hv_sysconf(HV_SYSCONF_PAGE_SIZE_JUMBO).
78 * It may also be modified when installing a new context.
79 */
80#define HV_DEFAULT_PAGE_SIZE_JUMBO \
81 (__HV_SIZE_ONE << HV_LOG2_DEFAULT_PAGE_SIZE_JUMBO)
82
83#endif
84
69/** The log2 of the granularity at which page tables must be aligned; 85/** The log2 of the granularity at which page tables must be aligned;
70 * in other words, the CPA for a page table must have this many zero 86 * in other words, the CPA for a page table must have this many zero
71 * bits at the bottom of the address. 87 * bits at the bottom of the address.
@@ -284,8 +300,11 @@
284#define HV_DISPATCH_GET_IPI_PTE 56 300#define HV_DISPATCH_GET_IPI_PTE 56
285#endif 301#endif
286 302
303/** hv_set_pte_super_shift */
304#define HV_DISPATCH_SET_PTE_SUPER_SHIFT 57
305
287/** One more than the largest dispatch value */ 306/** One more than the largest dispatch value */
288#define _HV_DISPATCH_END 57 307#define _HV_DISPATCH_END 58
289 308
290 309
291#ifndef __ASSEMBLER__ 310#ifndef __ASSEMBLER__
@@ -413,6 +432,11 @@ typedef enum {
413 */ 432 */
414 HV_SYSCONF_VALID_PAGE_SIZES = 7, 433 HV_SYSCONF_VALID_PAGE_SIZES = 7,
415 434
435 /** The size of jumbo pages, in bytes.
436 * If no jumbo pages are available, zero will be returned.
437 */
438 HV_SYSCONF_PAGE_SIZE_JUMBO = 8,
439
416} HV_SysconfQuery; 440} HV_SysconfQuery;
417 441
418/** Offset to subtract from returned Kelvin temperature to get degrees 442/** Offset to subtract from returned Kelvin temperature to get degrees
@@ -695,6 +719,29 @@ int hv_install_context(HV_PhysAddr page_table, HV_PTE access, HV_ASID asid,
695 719
696#ifndef __ASSEMBLER__ 720#ifndef __ASSEMBLER__
697 721
722
723/** Set the number of pages ganged together by HV_PTE_SUPER at a
724 * particular level of the page table.
725 *
726 * The current TILE-Gx hardware only supports powers of four
727 * (i.e. log2_count must be a multiple of two), and the requested
728 * "super" page size must be less than the span of the next level in
729 * the page table. The largest size that can be requested is 64GB.
730 *
731 * The shift value is initially "0" for all page table levels,
732 * indicating that the HV_PTE_SUPER bit is effectively ignored.
733 *
734 * If you change the count from one non-zero value to another, the
735 * hypervisor will flush the entire TLB and TSB to avoid confusion.
736 *
737 * @param level Page table level (0, 1, or 2)
738 * @param log2_count Base-2 log of the number of pages to gang together,
739 * i.e. how much to shift left the base page size for the super page size.
740 * @return Zero on success, or a hypervisor error code on failure.
741 */
742int hv_set_pte_super_shift(int level, int log2_count);
743
744
698/** Value returned from hv_inquire_context(). */ 745/** Value returned from hv_inquire_context(). */
699typedef struct 746typedef struct
700{ 747{
@@ -1891,8 +1938,9 @@ int hv_flush_remote(HV_PhysAddr cache_pa, unsigned long cache_control,
1891#define HV_PTE_INDEX_USER 10 /**< Page is user-accessible */ 1938#define HV_PTE_INDEX_USER 10 /**< Page is user-accessible */
1892#define HV_PTE_INDEX_ACCESSED 11 /**< Page has been accessed */ 1939#define HV_PTE_INDEX_ACCESSED 11 /**< Page has been accessed */
1893#define HV_PTE_INDEX_DIRTY 12 /**< Page has been written */ 1940#define HV_PTE_INDEX_DIRTY 12 /**< Page has been written */
1894 /* Bits 13-15 are reserved for 1941 /* Bits 13-14 are reserved for
1895 future use. */ 1942 future use. */
1943#define HV_PTE_INDEX_SUPER 15 /**< Pages ganged together for TLB */
1896#define HV_PTE_INDEX_MODE 16 /**< Page mode; see HV_PTE_MODE_xxx */ 1944#define HV_PTE_INDEX_MODE 16 /**< Page mode; see HV_PTE_MODE_xxx */
1897#define HV_PTE_MODE_BITS 3 /**< Number of bits in mode */ 1945#define HV_PTE_MODE_BITS 3 /**< Number of bits in mode */
1898#define HV_PTE_INDEX_CLIENT2 19 /**< Page client state 2 */ 1946#define HV_PTE_INDEX_CLIENT2 19 /**< Page client state 2 */
@@ -1987,7 +2035,10 @@ int hv_flush_remote(HV_PhysAddr cache_pa, unsigned long cache_control,
1987 2035
1988/** Does this PTE map a page? 2036/** Does this PTE map a page?
1989 * 2037 *
1990 * If this bit is set in the level-1 page table, the entry should be 2038 * If this bit is set in a level-0 page table, the entry should be
2039 * interpreted as a level-2 page table entry mapping a jumbo page.
2040 *
2041 * If this bit is set in a level-1 page table, the entry should be
1991 * interpreted as a level-2 page table entry mapping a large page. 2042 * interpreted as a level-2 page table entry mapping a large page.
1992 * 2043 *
1993 * This bit should not be modified by the client while PRESENT is set, as 2044 * This bit should not be modified by the client while PRESENT is set, as
@@ -1997,6 +2048,18 @@ int hv_flush_remote(HV_PhysAddr cache_pa, unsigned long cache_control,
1997 */ 2048 */
1998#define HV_PTE_PAGE (__HV_PTE_ONE << HV_PTE_INDEX_PAGE) 2049#define HV_PTE_PAGE (__HV_PTE_ONE << HV_PTE_INDEX_PAGE)
1999 2050
2051/** Does this PTE implicitly reference multiple pages?
2052 *
2053 * If this bit is set in the page table (either in the level-2 page table,
2054 * or in a higher level page table in conjunction with the PAGE bit)
2055 * then the PTE specifies a range of contiguous pages, not a single page.
2056 * The hv_set_pte_super_shift() allows you to specify the count for
2057 * each level of the page table.
2058 *
2059 * Note: this bit is not supported on TILEPro systems.
2060 */
2061#define HV_PTE_SUPER (__HV_PTE_ONE << HV_PTE_INDEX_SUPER)
2062
2000/** Is this a global (non-ASID) mapping? 2063/** Is this a global (non-ASID) mapping?
2001 * 2064 *
2002 * If this bit is set, the translations established by this PTE will 2065 * If this bit is set, the translations established by this PTE will
@@ -2215,6 +2278,7 @@ hv_pte_clear_##name(HV_PTE pte) \
2215 */ 2278 */
2216_HV_BIT(present, PRESENT) 2279_HV_BIT(present, PRESENT)
2217_HV_BIT(page, PAGE) 2280_HV_BIT(page, PAGE)
2281_HV_BIT(super, SUPER)
2218_HV_BIT(client0, CLIENT0) 2282_HV_BIT(client0, CLIENT0)
2219_HV_BIT(client1, CLIENT1) 2283_HV_BIT(client1, CLIENT1)
2220_HV_BIT(client2, CLIENT2) 2284_HV_BIT(client2, CLIENT2)