aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/pageattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/pageattr.c')
-rw-r--r--arch/x86/mm/pageattr.c58
1 files changed, 8 insertions, 50 deletions
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 4adb33628dec..5c06469a0653 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -752,12 +752,12 @@ static inline int cache_attr(pgprot_t attr)
752 (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD); 752 (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD);
753} 753}
754 754
755static int do_change_page_attr_set_clr(unsigned long addr, int numpages, 755static int change_page_attr_set_clr(unsigned long addr, int numpages,
756 pgprot_t mask_set, pgprot_t mask_clr, 756 pgprot_t mask_set, pgprot_t mask_clr,
757 int force_split, int *tlb_flush) 757 int force_split)
758{ 758{
759 struct cpa_data cpa; 759 struct cpa_data cpa;
760 int ret, checkalias; 760 int ret, cache, checkalias;
761 761
762 /* 762 /*
763 * Check, if we are requested to change a not supported 763 * Check, if we are requested to change a not supported
@@ -795,22 +795,9 @@ static int do_change_page_attr_set_clr(unsigned long addr, int numpages,
795 /* 795 /*
796 * Check whether we really changed something: 796 * Check whether we really changed something:
797 */ 797 */
798 *tlb_flush = cpa.flushtlb; 798 if (!cpa.flushtlb)
799 cpa_fill_pool(NULL);
800
801 return ret;
802}
803
804static int change_page_attr_set_clr(unsigned long addr, int numpages,
805 pgprot_t mask_set, pgprot_t mask_clr,
806 int force_split)
807{
808 int cache, flush_cache = 0, ret;
809
810 ret = do_change_page_attr_set_clr(addr, numpages, mask_set, mask_clr,
811 force_split, &flush_cache);
812 if (!flush_cache)
813 goto out; 799 goto out;
800
814 /* 801 /*
815 * No need to flush, when we did not set any of the caching 802 * No need to flush, when we did not set any of the caching
816 * attributes: 803 * attributes:
@@ -827,7 +814,10 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
827 cpa_flush_range(addr, numpages, cache); 814 cpa_flush_range(addr, numpages, cache);
828 else 815 else
829 cpa_flush_all(cache); 816 cpa_flush_all(cache);
817
830out: 818out:
819 cpa_fill_pool(NULL);
820
831 return ret; 821 return ret;
832} 822}
833 823
@@ -865,30 +855,6 @@ int set_memory_uc(unsigned long addr, int numpages)
865} 855}
866EXPORT_SYMBOL(set_memory_uc); 856EXPORT_SYMBOL(set_memory_uc);
867 857
868int set_memory_uc_noflush(unsigned long addr, int numpages)
869{
870 int flush;
871 /*
872 * for now UC MINUS. see comments in ioremap_nocache()
873 */
874 if (reserve_memtype(addr, addr + numpages * PAGE_SIZE,
875 _PAGE_CACHE_UC_MINUS, NULL))
876 return -EINVAL;
877 /*
878 * for now UC MINUS. see comments in ioremap_nocache()
879 */
880 return do_change_page_attr_set_clr(addr, numpages,
881 __pgprot(_PAGE_CACHE_UC_MINUS),
882 __pgprot(0), 0, &flush);
883}
884EXPORT_SYMBOL(set_memory_uc_noflush);
885
886void set_memory_flush_all(void)
887{
888 cpa_flush_all(1);
889}
890EXPORT_SYMBOL(set_memory_flush_all);
891
892int _set_memory_wc(unsigned long addr, int numpages) 858int _set_memory_wc(unsigned long addr, int numpages)
893{ 859{
894 return change_page_attr_set(addr, numpages, 860 return change_page_attr_set(addr, numpages,
@@ -963,14 +929,6 @@ int set_pages_uc(struct page *page, int numpages)
963} 929}
964EXPORT_SYMBOL(set_pages_uc); 930EXPORT_SYMBOL(set_pages_uc);
965 931
966int set_pages_uc_noflush(struct page *page, int numpages)
967{
968 unsigned long addr = (unsigned long)page_address(page);
969
970 return set_memory_uc_noflush(addr, numpages);
971}
972EXPORT_SYMBOL(set_pages_uc_noflush);
973
974int set_pages_wb(struct page *page, int numpages) 932int set_pages_wb(struct page *page, int numpages)
975{ 933{
976 unsigned long addr = (unsigned long)page_address(page); 934 unsigned long addr = (unsigned long)page_address(page);