From: Alexey Kardashevskiy <aik@ozlabs.ru> To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy <aik@ozlabs.ru>, Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.com>, David Gibson <david@gibson.dropbear.id.au>, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH kernel 2/9] KVM: PPC: Make real_vmalloc_addr() public Date: Tue, 15 Sep 2015 20:49:32 +1000 [thread overview] Message-ID: <1442314179-9706-3-git-send-email-aik@ozlabs.ru> (raw) In-Reply-To: <1442314179-9706-1-git-send-email-aik@ozlabs.ru> This helper translates vmalloc'd addresses to linear addresses. It is only used by the KVM MMU code now and resides in the HV KVM code. We will need it further in the TCE code and the DMA memory preregistration code called in real mode. This makes real_vmalloc_addr() public and moves it to the powerpc code as it does not do anything special for KVM. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- arch/powerpc/include/asm/mmu-hash64.h | 3 +++ arch/powerpc/kvm/book3s_hv_rm_mmu.c | 17 ----------------- arch/powerpc/mm/hash_utils_64.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index a82f534..fd06b73 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h @@ -606,6 +606,9 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1; return get_vsid(context, ea, ssize); } + +void *real_vmalloc_addr(void *x); + #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_MMU_HASH64_H_ */ diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index c1df9bb..987b7d1 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c @@ -22,23 +22,6 @@ #include <asm/synch.h> #include <asm/ppc-opcode.h> -/* Translate address of a vmalloc'd thing to a linear map address */ -static void *real_vmalloc_addr(void *x) -{ - unsigned long addr = (unsigned long) x; - pte_t *p; - /* - * assume we don't have huge pages in vmalloc space... - * So don't worry about THP collapse/split. Called - * Only in realmode, hence won't need irq_save/restore. - */ - p = __find_linux_pte_or_hugepte(swapper_pg_dir, addr, NULL); - if (!p || !pte_present(*p)) - return NULL; - addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK); - return __va(addr); -} - /* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */ static int global_invalidates(struct kvm *kvm, unsigned long flags) { diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 5ec987f..9737d6a 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -1556,3 +1556,20 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, /* Finally limit subsequent allocations */ memblock_set_current_limit(ppc64_rma_size); } + +/* Translate address of a vmalloc'd thing to a linear map address */ +void *real_vmalloc_addr(void *x) +{ + unsigned long addr = (unsigned long) x; + pte_t *p; + /* + * assume we don't have huge pages in vmalloc space... + * So don't worry about THP collapse/split. Called + * Only in realmode, hence won't need irq_save/restore. + */ + p = __find_linux_pte_or_hugepte(swapper_pg_dir, addr, NULL); + if (!p || !pte_present(*p)) + return NULL; + addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK); + return __va(addr); +} -- 2.4.0.rc3.8.gfb3e7d5
WARNING: multiple messages have this Message-ID (diff)
From: Alexey Kardashevskiy <aik@ozlabs.ru> To: linuxppc-dev@lists.ozlabs.org Cc: Alexey Kardashevskiy <aik@ozlabs.ru>, Paul Mackerras <paulus@samba.org>, Alexander Graf <agraf@suse.com>, David Gibson <david@gibson.dropbear.id.au>, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org Subject: [PATCH kernel 2/9] KVM: PPC: Make real_vmalloc_addr() public Date: Tue, 15 Sep 2015 10:49:32 +0000 [thread overview] Message-ID: <1442314179-9706-3-git-send-email-aik@ozlabs.ru> (raw) In-Reply-To: <1442314179-9706-1-git-send-email-aik@ozlabs.ru> This helper translates vmalloc'd addresses to linear addresses. It is only used by the KVM MMU code now and resides in the HV KVM code. We will need it further in the TCE code and the DMA memory preregistration code called in real mode. This makes real_vmalloc_addr() public and moves it to the powerpc code as it does not do anything special for KVM. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- arch/powerpc/include/asm/mmu-hash64.h | 3 +++ arch/powerpc/kvm/book3s_hv_rm_mmu.c | 17 ----------------- arch/powerpc/mm/hash_utils_64.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index a82f534..fd06b73 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h @@ -606,6 +606,9 @@ static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1; return get_vsid(context, ea, ssize); } + +void *real_vmalloc_addr(void *x); + #endif /* __ASSEMBLY__ */ #endif /* _ASM_POWERPC_MMU_HASH64_H_ */ diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index c1df9bb..987b7d1 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c @@ -22,23 +22,6 @@ #include <asm/synch.h> #include <asm/ppc-opcode.h> -/* Translate address of a vmalloc'd thing to a linear map address */ -static void *real_vmalloc_addr(void *x) -{ - unsigned long addr = (unsigned long) x; - pte_t *p; - /* - * assume we don't have huge pages in vmalloc space... - * So don't worry about THP collapse/split. Called - * Only in realmode, hence won't need irq_save/restore. - */ - p = __find_linux_pte_or_hugepte(swapper_pg_dir, addr, NULL); - if (!p || !pte_present(*p)) - return NULL; - addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK); - return __va(addr); -} - /* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */ static int global_invalidates(struct kvm *kvm, unsigned long flags) { diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 5ec987f..9737d6a 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -1556,3 +1556,20 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base, /* Finally limit subsequent allocations */ memblock_set_current_limit(ppc64_rma_size); } + +/* Translate address of a vmalloc'd thing to a linear map address */ +void *real_vmalloc_addr(void *x) +{ + unsigned long addr = (unsigned long) x; + pte_t *p; + /* + * assume we don't have huge pages in vmalloc space... + * So don't worry about THP collapse/split. Called + * Only in realmode, hence won't need irq_save/restore. + */ + p = __find_linux_pte_or_hugepte(swapper_pg_dir, addr, NULL); + if (!p || !pte_present(*p)) + return NULL; + addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK); + return __va(addr); +} -- 2.4.0.rc3.8.gfb3e7d5
next prev parent reply other threads:[~2015-09-15 10:50 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-15 10:49 [PATCH kernel 0/9] KVM: PPC: Add in-kernel multitce handling Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-09-15 10:49 ` [PATCH kernel 1/9] rcu: Define notrace version of list_for_each_entry_rcu Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 2:05 ` David Gibson 2015-12-08 2:05 ` David Gibson 2015-09-15 10:49 ` Alexey Kardashevskiy [this message] 2015-09-15 10:49 ` [PATCH kernel 2/9] KVM: PPC: Make real_vmalloc_addr() public Alexey Kardashevskiy 2015-12-08 2:08 ` David Gibson 2015-12-08 2:08 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 3/9] KVM: PPC: Rework H_PUT_TCE/H_GET_TCE handlers Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 2:18 ` David Gibson 2015-12-08 2:18 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 4/9] KVM: PPC: Use RCU for arch.spapr_tce_tables Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 2:35 ` David Gibson 2015-12-08 2:35 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 5/9] KVM: PPC: Account TCE-containing pages in locked_vm Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-11-30 2:06 ` Paul Mackerras 2015-11-30 2:06 ` Paul Mackerras 2015-11-30 5:09 ` Alexey Kardashevskiy 2015-11-30 5:09 ` Alexey Kardashevskiy 2015-12-08 5:18 ` David Gibson 2015-12-08 5:18 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 6/9] KVM: PPC: Replace SPAPR_TCE_SHIFT with IOMMU_PAGE_SHIFT_4K Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 5:19 ` David Gibson 2015-12-08 5:19 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 7/9] KVM: PPC: Move reusable bits of H_PUT_TCE handler to helpers Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 5:27 ` David Gibson 2015-12-08 5:27 ` David Gibson 2015-12-22 7:24 ` Alexey Kardashevskiy 2015-12-22 7:24 ` Alexey Kardashevskiy 2015-09-15 10:49 ` [PATCH kernel 8/9] KVM: Fix KVM_SMI chapter number Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 5:29 ` David Gibson 2015-12-08 5:29 ` David Gibson 2015-09-15 10:49 ` [PATCH kernel 9/9] KVM: PPC: Add support for multiple-TCE hcalls Alexey Kardashevskiy 2015-09-15 10:49 ` Alexey Kardashevskiy 2015-12-08 5:48 ` David Gibson 2015-12-08 5:48 ` David Gibson 2015-12-22 7:42 ` Alexey Kardashevskiy 2015-12-22 7:42 ` Alexey Kardashevskiy
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=1442314179-9706-3-git-send-email-aik@ozlabs.ru \ --to=aik@ozlabs.ru \ --cc=agraf@suse.com \ --cc=david@gibson.dropbear.id.au \ --cc=kvm-ppc@vger.kernel.org \ --cc=kvm@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=paulus@samba.org \ /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 an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.