i386: add get_user_pages_fast support

Orabug: 14277030

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>

--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -27,6 +27,10 @@ config STACKTRACE_SUPPORT
 	bool
 	default y
 
+config HAVE_GET_USER_PAGES_FAST
+	def_bool y
+	depends on !X86_XEN
+
 config SEMAPHORE_SLEEPERS
 	bool
 	default y
--- a/arch/i386/mm/Makefile
+++ b/arch/i386/mm/Makefile
@@ -4,6 +4,8 @@
 
 obj-y	:= init.o pgtable.o fault.o ioremap.o extable.o pageattr.o mmap.o
 
+gup-y = $(addprefix ../../x86_64/mm/, gup.o)
+obj-$(CONFIG_HAVE_GET_USER_PAGES_FAST) += gup.o
 obj-$(CONFIG_NUMA) += discontig.o
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
 obj-$(CONFIG_HIGHMEM) += highmem.o
--- a/arch/x86_64/mm/gup.c
+++ b/arch/x86_64/mm/gup.c
@@ -84,7 +84,11 @@ static noinline int gup_pte_range(pmd_t 
 		pte_t pte = gup_get_pte(ptep);
 		struct page *page;
 
+#ifdef CONFIG_X86_64
 		if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) {
+#else
+		if ((pte_val(pte) & mask) != mask) {
+#endif
 			pte_unmap(ptep);
 			return 0;
 		}
@@ -120,8 +124,10 @@ static noinline int gup_huge_pmd(pmd_t p
 		mask |= _PAGE_RW;
 	if ((pte_val(pte) & mask) != mask)
 		return 0;
+#ifdef CONFIG_X86_64
 	/* hugepages are never "special" */
 	BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
+#endif
 	BUG_ON(!pfn_valid(pte_pfn(pte)));
 
 	refs = 0;
