|
21 | 21 |
|
22 | 22 | #include <asm/pgalloc.h>
|
23 | 23 | #include <asm/gmap.h>
|
| 24 | +#include <asm/page.h> |
24 | 25 | #include <asm/tlb.h>
|
25 | 26 |
|
26 | 27 | #define GMAP_SHADOW_FAKE_TABLE 1ULL
|
27 | 28 |
|
| 29 | +static struct page *gmap_alloc_crst(void) |
| 30 | +{ |
| 31 | + struct page *page; |
| 32 | + |
| 33 | + page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 34 | + if (!page) |
| 35 | + return NULL; |
| 36 | + arch_set_page_dat(page, CRST_ALLOC_ORDER); |
| 37 | + return page; |
| 38 | +} |
| 39 | + |
28 | 40 | /**
|
29 | 41 | * gmap_alloc - allocate and initialize a guest address space
|
30 | 42 | * @limit: maximum address of the gmap address space
|
@@ -67,7 +79,7 @@ static struct gmap *gmap_alloc(unsigned long limit)
|
67 | 79 | spin_lock_init(&gmap->guest_table_lock);
|
68 | 80 | spin_lock_init(&gmap->shadow_lock);
|
69 | 81 | refcount_set(&gmap->ref_count, 1);
|
70 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 82 | + page = gmap_alloc_crst(); |
71 | 83 | if (!page)
|
72 | 84 | goto out_free;
|
73 | 85 | page->index = 0;
|
@@ -308,7 +320,7 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table,
|
308 | 320 | unsigned long *new;
|
309 | 321 |
|
310 | 322 | /* since we dont free the gmap table until gmap_free we can unlock */
|
311 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 323 | + page = gmap_alloc_crst(); |
312 | 324 | if (!page)
|
313 | 325 | return -ENOMEM;
|
314 | 326 | new = page_to_virt(page);
|
@@ -1759,7 +1771,7 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t,
|
1759 | 1771 |
|
1760 | 1772 | BUG_ON(!gmap_is_shadow(sg));
|
1761 | 1773 | /* Allocate a shadow region second table */
|
1762 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 1774 | + page = gmap_alloc_crst(); |
1763 | 1775 | if (!page)
|
1764 | 1776 | return -ENOMEM;
|
1765 | 1777 | page->index = r2t & _REGION_ENTRY_ORIGIN;
|
@@ -1843,7 +1855,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
|
1843 | 1855 |
|
1844 | 1856 | BUG_ON(!gmap_is_shadow(sg));
|
1845 | 1857 | /* Allocate a shadow region second table */
|
1846 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 1858 | + page = gmap_alloc_crst(); |
1847 | 1859 | if (!page)
|
1848 | 1860 | return -ENOMEM;
|
1849 | 1861 | page->index = r3t & _REGION_ENTRY_ORIGIN;
|
@@ -1927,7 +1939,7 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt,
|
1927 | 1939 |
|
1928 | 1940 | BUG_ON(!gmap_is_shadow(sg) || (sgt & _REGION3_ENTRY_LARGE));
|
1929 | 1941 | /* Allocate a shadow segment table */
|
1930 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 1942 | + page = gmap_alloc_crst(); |
1931 | 1943 | if (!page)
|
1932 | 1944 | return -ENOMEM;
|
1933 | 1945 | page->index = sgt & _REGION_ENTRY_ORIGIN;
|
@@ -2855,7 +2867,7 @@ int s390_replace_asce(struct gmap *gmap)
|
2855 | 2867 | if ((gmap->asce & _ASCE_TYPE_MASK) == _ASCE_TYPE_SEGMENT)
|
2856 | 2868 | return -EINVAL;
|
2857 | 2869 |
|
2858 |
| - page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); |
| 2870 | + page = gmap_alloc_crst(); |
2859 | 2871 | if (!page)
|
2860 | 2872 | return -ENOMEM;
|
2861 | 2873 | page->index = 0;
|
|
0 commit comments