diff mbox

[2/30] MIPS: Export pgd/pmd symbols for KVM

Message ID dd23ddfe6b616c2111a395e7b0351d7c2c3f8683.1483665879.git-series.james.hogan@imgtec.com (mailing list archive)
State New, archived
Headers show

Commit Message

James Hogan Jan. 6, 2017, 1:32 a.m. UTC
Export pgd_init(), pmd_init(), invalid_pmd_table and
tlbmiss_handler_setup_pgd to GPL kernel modules so that MIPS KVM can use
the inline page table management functions and switch between page
tables:

- pgd_init() is used inline by pgd_alloc(), which KVM will use to
  allocate page directory tables for GVA mappings.

- pmd_init() will be used directly by KVM to initialise newly allocated
  pmd tables with invalid lower level table pointers.

- invalid_pmd_table is used by pud_present(), pud_none(), and
  pud_clear(), which KVM will use to test and clear pud entries.

- tlbmiss_handler_setup_pgd() will be called by KVM entry code to switch
  to the appropriate GVA page tables.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
---
 arch/mips/mm/init.c       | 1 +
 arch/mips/mm/pgtable-32.c | 1 +
 arch/mips/mm/pgtable-64.c | 3 +++
 arch/mips/mm/tlbex.c      | 5 ++++-
 4 files changed, 9 insertions(+), 1 deletion(-)

Comments

Ralf Baechle Jan. 17, 2017, 4:24 p.m. UTC | #1
On Fri, Jan 06, 2017 at 01:32:34AM +0000, James Hogan wrote:

> Export pgd_init(), pmd_init(), invalid_pmd_table and
> tlbmiss_handler_setup_pgd to GPL kernel modules so that MIPS KVM can use
> the inline page table management functions and switch between page
> tables:
> 
> - pgd_init() is used inline by pgd_alloc(), which KVM will use to
>   allocate page directory tables for GVA mappings.
> 
> - pmd_init() will be used directly by KVM to initialise newly allocated
>   pmd tables with invalid lower level table pointers.
> 
> - invalid_pmd_table is used by pud_present(), pud_none(), and
>   pud_clear(), which KVM will use to test and clear pud entries.
> 
> - tlbmiss_handler_setup_pgd() will be called by KVM entry code to switch
>   to the appropriate GVA page tables.
> 
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: linux-mips@linux-mips.org
> Cc: kvm@vger.kernel.org

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index e86ebcf5c071..653569bc0da7 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -538,5 +538,6 @@  unsigned long pgd_current[NR_CPUS];
 pgd_t swapper_pg_dir[_PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
 #ifndef __PAGETABLE_PMD_FOLDED
 pmd_t invalid_pmd_table[PTRS_PER_PMD] __page_aligned_bss;
+EXPORT_SYMBOL_GPL(invalid_pmd_table);
 #endif
 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned_bss;
diff --git a/arch/mips/mm/pgtable-32.c b/arch/mips/mm/pgtable-32.c
index adc6911ba748..b3465c03a3c2 100644
--- a/arch/mips/mm/pgtable-32.c
+++ b/arch/mips/mm/pgtable-32.c
@@ -29,6 +29,7 @@  void pgd_init(unsigned long page)
 		p[i + 7] = (unsigned long) invalid_pte_table;
 	}
 }
+EXPORT_SYMBOL_GPL(pgd_init);
 
 void __init pagetable_init(void)
 {
diff --git a/arch/mips/mm/pgtable-64.c b/arch/mips/mm/pgtable-64.c
index ce4473e7c0d2..88a96b64fcb2 100644
--- a/arch/mips/mm/pgtable-64.c
+++ b/arch/mips/mm/pgtable-64.c
@@ -6,6 +6,7 @@ 
  * Copyright (C) 1999, 2000 by Silicon Graphics
  * Copyright (C) 2003 by Ralf Baechle
  */
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <asm/fixmap.h>
@@ -39,6 +40,7 @@  void pgd_init(unsigned long page)
 		p[-1] = entry;
 	} while (p != end);
 }
+EXPORT_SYMBOL_GPL(pgd_init);
 
 #ifndef __PAGETABLE_PMD_FOLDED
 void pmd_init(unsigned long addr, unsigned long pagetable)
@@ -60,6 +62,7 @@  void pmd_init(unsigned long addr, unsigned long pagetable)
 		p[-1] = pagetable;
 	} while (p != end);
 }
+EXPORT_SYMBOL_GPL(pmd_init);
 #endif
 
 pmd_t mk_pmd(struct page *page, pgprot_t prot)
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 55ce39606cb8..dc7bb1506103 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <linux/bug.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/smp.h>
@@ -1536,7 +1537,9 @@  static void build_loongson3_tlb_refill_handler(void)
 extern u32 handle_tlbl[], handle_tlbl_end[];
 extern u32 handle_tlbs[], handle_tlbs_end[];
 extern u32 handle_tlbm[], handle_tlbm_end[];
-extern u32 tlbmiss_handler_setup_pgd_start[], tlbmiss_handler_setup_pgd[];
+extern u32 tlbmiss_handler_setup_pgd_start[];
+extern u32 tlbmiss_handler_setup_pgd[];
+EXPORT_SYMBOL_GPL(tlbmiss_handler_setup_pgd);
 extern u32 tlbmiss_handler_setup_pgd_end[];
 
 static void build_setup_pgd(void)