From: James Hogan <james.hogan@imgtec.com> To: <linux-mips@linux-mips.org> Cc: "James Hogan" <james.hogan@imgtec.com>, "Ralf Baechle" <ralf@linux-mips.org>, "Paolo Bonzini" <pbonzini@redhat.com>, "Radim Krčmář" <rkrcmar@redhat.com>, kvm@vger.kernel.org Subject: [PATCH v2 1/30] MIPS: Move pgd_alloc() out of header Date: Thu, 2 Feb 2017 12:04:14 +0000 [thread overview] Message-ID: <21f45e82ab0d734ea1ef614551639f2e8d900557.1486036366.git-series.james.hogan@imgtec.com> (raw) In-Reply-To: <cover.e37f86dece46fc3ed00a075d68119cab361cda8e.1486036366.git-series.james.hogan@imgtec.com> pgd_alloc() references init_mm which is not exported to modules. In order for KVM to be able to use pgd_alloc() to allocate GVA page tables, move pgd_alloc() into a new pgtable.c file and export it to modules. 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 --- Changes in v2: - Move pgd_alloc() into C code rather than exporting init_mm itself (feedback from Arjan van de Ven). --- arch/mips/include/asm/pgalloc.h | 16 +--------------- arch/mips/mm/Makefile | 2 +- arch/mips/mm/pgtable.c | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 arch/mips/mm/pgtable.c diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index a03e86969f78..a8705f6c8180 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -43,21 +43,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) * Initialize a new pgd / pmd table with invalid pointers. */ extern void pgd_init(unsigned long page); - -static inline pgd_t *pgd_alloc(struct mm_struct *mm) -{ - pgd_t *ret, *init; - - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); - if (ret) { - init = pgd_offset(&init_mm, 0UL); - pgd_init((unsigned long)ret); - memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - - return ret; -} +extern pgd_t *pgd_alloc(struct mm_struct *mm); static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile index b4c64bd3f723..b4cc8811a664 100644 --- a/arch/mips/mm/Makefile +++ b/arch/mips/mm/Makefile @@ -4,7 +4,7 @@ obj-y += cache.o dma-default.o extable.o fault.o \ gup.o init.o mmap.o page.o page-funcs.o \ - tlbex.o tlbex-fault.o tlb-funcs.o + pgtable.o tlbex.o tlbex-fault.o tlb-funcs.o ifdef CONFIG_CPU_MICROMIPS obj-y += uasm-micromips.o diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c new file mode 100644 index 000000000000..05560b042d82 --- /dev/null +++ b/arch/mips/mm/pgtable.c @@ -0,0 +1,25 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#include <linux/export.h> +#include <linux/mm.h> +#include <linux/string.h> +#include <asm/pgalloc.h> + +pgd_t *pgd_alloc(struct mm_struct *mm) +{ + pgd_t *ret, *init; + + ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); + if (ret) { + init = pgd_offset(&init_mm, 0UL); + pgd_init((unsigned long)ret); + memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + + return ret; +} +EXPORT_SYMBOL_GPL(pgd_alloc); -- git-series 0.8.10
WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com> To: linux-mips@linux-mips.org Cc: "James Hogan" <james.hogan@imgtec.com>, "Ralf Baechle" <ralf@linux-mips.org>, "Paolo Bonzini" <pbonzini@redhat.com>, "Radim Krčmář" <rkrcmar@redhat.com>, kvm@vger.kernel.org Subject: [PATCH v2 1/30] MIPS: Move pgd_alloc() out of header Date: Thu, 2 Feb 2017 12:04:14 +0000 [thread overview] Message-ID: <21f45e82ab0d734ea1ef614551639f2e8d900557.1486036366.git-series.james.hogan@imgtec.com> (raw) Message-ID: <20170202120414.3UyNxCs6UYNVhCd3MNxAw434GwvDKYkwYSl1JqHFOUU@z> (raw) In-Reply-To: <cover.e37f86dece46fc3ed00a075d68119cab361cda8e.1486036366.git-series.james.hogan@imgtec.com> pgd_alloc() references init_mm which is not exported to modules. In order for KVM to be able to use pgd_alloc() to allocate GVA page tables, move pgd_alloc() into a new pgtable.c file and export it to modules. 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 --- Changes in v2: - Move pgd_alloc() into C code rather than exporting init_mm itself (feedback from Arjan van de Ven). --- arch/mips/include/asm/pgalloc.h | 16 +--------------- arch/mips/mm/Makefile | 2 +- arch/mips/mm/pgtable.c | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 arch/mips/mm/pgtable.c diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h index a03e86969f78..a8705f6c8180 100644 --- a/arch/mips/include/asm/pgalloc.h +++ b/arch/mips/include/asm/pgalloc.h @@ -43,21 +43,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) * Initialize a new pgd / pmd table with invalid pointers. */ extern void pgd_init(unsigned long page); - -static inline pgd_t *pgd_alloc(struct mm_struct *mm) -{ - pgd_t *ret, *init; - - ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); - if (ret) { - init = pgd_offset(&init_mm, 0UL); - pgd_init((unsigned long)ret); - memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - } - - return ret; -} +extern pgd_t *pgd_alloc(struct mm_struct *mm); static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) { diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile index b4c64bd3f723..b4cc8811a664 100644 --- a/arch/mips/mm/Makefile +++ b/arch/mips/mm/Makefile @@ -4,7 +4,7 @@ obj-y += cache.o dma-default.o extable.o fault.o \ gup.o init.o mmap.o page.o page-funcs.o \ - tlbex.o tlbex-fault.o tlb-funcs.o + pgtable.o tlbex.o tlbex-fault.o tlb-funcs.o ifdef CONFIG_CPU_MICROMIPS obj-y += uasm-micromips.o diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c new file mode 100644 index 000000000000..05560b042d82 --- /dev/null +++ b/arch/mips/mm/pgtable.c @@ -0,0 +1,25 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#include <linux/export.h> +#include <linux/mm.h> +#include <linux/string.h> +#include <asm/pgalloc.h> + +pgd_t *pgd_alloc(struct mm_struct *mm) +{ + pgd_t *ret, *init; + + ret = (pgd_t *) __get_free_pages(GFP_KERNEL, PGD_ORDER); + if (ret) { + init = pgd_offset(&init_mm, 0UL); + pgd_init((unsigned long)ret); + memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD, + (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + + return ret; +} +EXPORT_SYMBOL_GPL(pgd_alloc); -- git-series 0.8.10
next prev parent reply other threads:[~2017-02-02 12:05 UTC|newest] Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-02 12:04 [PATCH v2 0/30] KVM: MIPS: Implement GVA page tables James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` James Hogan [this message] 2017-02-02 12:04 ` [PATCH v2 1/30] MIPS: Move pgd_alloc() out of header James Hogan 2017-02-02 12:04 ` [PATCH v2 2/30] MIPS: Export pgd/pmd symbols for KVM James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 3/30] MIPS: uasm: Add include guards in asm/uasm.h James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 4/30] MIPS: Export some tlbex internals for KVM to use James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 5/30] KVM: MIPS: Drop partial KVM_NMI implementation James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 6/30] KVM: MIPS/MMU: Simplify ASID restoration James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 7/30] KVM: MIPS: Convert get/set_regs -> vcpu_load/put James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 8/30] KVM: MIPS/MMU: Move preempt/ASID handling to implementation James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 9/30] KVM: MIPS: Remove duplicated ASIDs from vcpu James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 10/30] KVM: MIPS: Add vcpu_run() & vcpu_reenter() callbacks James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 11/30] KVM: MIPS/T&E: Restore host asid on return to host James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 12/30] KVM: MIPS/T&E: active_mm = init_mm in guest context James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 13/30] KVM: MIPS: Wire up vcpu uninit James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 14/30] KVM: MIPS/T&E: Allocate GVA -> HPA page tables James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 15/30] KVM: MIPS/T&E: Activate GVA page tables in guest context James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 16/30] KVM: MIPS: Support NetLogic KScratch registers James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 17/30] KVM: MIPS: Add fast path TLB refill handler James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 18/30] KVM: MIPS/TLB: Fix off-by-one in TLB invalidate James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 19/30] KVM: MIPS/TLB: Generalise host TLB invalidate to kernel ASID James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 20/30] KVM: MIPS/MMU: Invalidate GVA PTs on ASID changes James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 21/30] KVM: MIPS/MMU: Invalidate stale GVA PTEs on TLBW James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 22/30] KVM: MIPS/MMU: Convert KSeg0 faults to page tables James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 23/30] KVM: MIPS/MMU: Convert TLB mapped " James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 24/30] KVM: MIPS/MMU: Convert commpage fault handling " James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 25/30] KVM: MIPS: Drop vm_init() callback James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 26/30] KVM: MIPS: Use uaccess to read/modify guest instructions James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 27/30] KVM: MIPS/Emulate: Fix CACHE emulation for EVA hosts James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 28/30] KVM: MIPS/TLB: Drop kvm_local_flush_tlb_all() James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 29/30] KVM: MIPS/Emulate: Drop redundant TLB flushes on exceptions James Hogan 2017-02-02 12:04 ` James Hogan 2017-02-02 12:04 ` [PATCH v2 30/30] KVM: MIPS/MMU: Drop kvm_get_new_mmu_context() James Hogan 2017-02-02 12:04 ` James Hogan
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=21f45e82ab0d734ea1ef614551639f2e8d900557.1486036366.git-series.james.hogan@imgtec.com \ --to=james.hogan@imgtec.com \ --cc=kvm@vger.kernel.org \ --cc=linux-mips@linux-mips.org \ --cc=pbonzini@redhat.com \ --cc=ralf@linux-mips.org \ --cc=rkrcmar@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).