Commit 157e118b authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

x86/mm/highmem: Use generic kmap atomic implementation



Convert X86 to the generic kmap atomic implementation and make the
iomap_atomic() naming convention consistent while at it.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201103095857.375127260@linutronix.de
parent 389755c2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -14,10 +14,11 @@ config X86_32
	select ARCH_WANT_IPC_PARSE_VERSION
	select CLKSRC_I8253
	select CLONE_BACKWARDS
	select GENERIC_VDSO_32
	select HAVE_DEBUG_STACKOVERFLOW
	select KMAP_LOCAL
	select MODULES_USE_ELF_REL
	select OLD_SIGACTION
	select GENERIC_VDSO_32

config X86_64
	def_bool y
+2 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
#include <asm/pgtable_types.h>
#ifdef CONFIG_X86_32
#include <linux/threads.h>
#include <asm/kmap_types.h>
#include <asm/kmap_size.h>
#else
#include <uapi/asm/vsyscall.h>
#endif
@@ -94,7 +94,7 @@ enum fixed_addresses {
#endif
#ifdef CONFIG_X86_32
	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
#ifdef CONFIG_PCI_MMCONFIG
	FIX_PCIE_MCFG,
#endif
@@ -151,7 +151,6 @@ extern void reserve_top_address(unsigned long reserve);

extern int fixmaps_set;

extern pte_t *kmap_pte;
extern pte_t *pkmap_page_table;

void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
+9 −4
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@

#include <linux/interrupt.h>
#include <linux/threads.h>
#include <asm/kmap_types.h>
#include <asm/tlbflush.h>
#include <asm/paravirt.h>
#include <asm/fixmap.h>
@@ -58,11 +57,17 @@ extern unsigned long highstart_pfn, highend_pfn;
#define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
#define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))

void *kmap_atomic_pfn(unsigned long pfn);
void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot);

#define flush_cache_kmaps()	do { } while (0)

#define	arch_kmap_local_post_map(vaddr, pteval)		\
	arch_flush_lazy_mmu_mode()

#define	arch_kmap_local_post_unmap(vaddr)		\
	do {						\
		flush_tlb_one_kernel((vaddr));		\
		arch_flush_lazy_mmu_mode();		\
	} while (0)

extern void add_highpages_with_active_regions(int nid, unsigned long start_pfn,
					unsigned long end_pfn);

+10 −8
Original line number Diff line number Diff line
@@ -9,19 +9,21 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <linux/highmem.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>

void __iomem *
iomap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot);
void __iomem *iomap_atomic_pfn_prot(unsigned long pfn, pgprot_t prot);

void
iounmap_atomic(void __iomem *kvaddr);
static inline void iounmap_atomic(void __iomem *vaddr)
{
	kunmap_local_indexed((void __force *)vaddr);
	pagefault_enable();
	preempt_enable();
}

int
iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot);
int iomap_create_wc(resource_size_t base, unsigned long size, pgprot_t *prot);

void
iomap_free(resource_size_t base, unsigned long size);
void iomap_free(resource_size_t base, unsigned long size);

#endif /* _ASM_X86_IOMAP_H */

arch/x86/include/asm/kmap_types.h

deleted100644 → 0
+0 −13
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_KMAP_TYPES_H
#define _ASM_X86_KMAP_TYPES_H

#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
#define  __WITH_KM_FENCE
#endif

#include <asm-generic/kmap_types.h>

#undef __WITH_KM_FENCE

#endif /* _ASM_X86_KMAP_TYPES_H */
Loading