]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
powerpc/iommu: Pass mm_struct to init/cleanup helpers
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Wed, 30 Nov 2016 06:51:59 +0000 (17:51 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 2 Dec 2016 03:38:27 +0000 (14:38 +1100)
We are going to get rid of @current references in mmu_context_boos3s64.c
and cache mm_struct in the VFIO container. Since mm_context_t does not
have reference counting, we will be using mm_struct which does have
the reference counter.

This changes mm_iommu_init/mm_iommu_cleanup to receive mm_struct rather
than mm_context_t (which is embedded into mm).

This should not cause any behavioral change.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/mmu_context.h
arch/powerpc/kernel/setup-common.c
arch/powerpc/mm/mmu_context_book3s64.c
arch/powerpc/mm/mmu_context_iommu.c

index 5c451140660a91b3abc7130040685cea8e3db62d..424844bc2a573e064b6578029e31146dd2e5464b 100644 (file)
@@ -23,8 +23,8 @@ extern bool mm_iommu_preregistered(void);
 extern long mm_iommu_get(unsigned long ua, unsigned long entries,
                struct mm_iommu_table_group_mem_t **pmem);
 extern long mm_iommu_put(struct mm_iommu_table_group_mem_t *mem);
-extern void mm_iommu_init(mm_context_t *ctx);
-extern void mm_iommu_cleanup(mm_context_t *ctx);
+extern void mm_iommu_init(struct mm_struct *mm);
+extern void mm_iommu_cleanup(struct mm_struct *mm);
 extern struct mm_iommu_table_group_mem_t *mm_iommu_lookup(unsigned long ua,
                unsigned long size);
 extern struct mm_iommu_table_group_mem_t *mm_iommu_find(unsigned long ua,
index 270ee30abdcf739982438271d8b5957e7e830dbb..f516ac508ae33e7a8d73ab6c9d392ed44a2a1c64 100644 (file)
@@ -915,7 +915,7 @@ void __init setup_arch(char **cmdline_p)
        init_mm.context.pte_frag = NULL;
 #endif
 #ifdef CONFIG_SPAPR_TCE_IOMMU
-       mm_iommu_init(&init_mm.context);
+       mm_iommu_init(&init_mm);
 #endif
        irqstack_early_init();
        exc_lvl_early_init();
index b114f8b93ec92145e5a541dbcc8c3c7708cf590e..ad82735909753dee3d6f4212b012f75c430edd57 100644 (file)
@@ -115,7 +115,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
        mm->context.pte_frag = NULL;
 #endif
 #ifdef CONFIG_SPAPR_TCE_IOMMU
-       mm_iommu_init(&mm->context);
+       mm_iommu_init(mm);
 #endif
        return 0;
 }
@@ -160,7 +160,7 @@ static inline void destroy_pagetable_page(struct mm_struct *mm)
 void destroy_context(struct mm_struct *mm)
 {
 #ifdef CONFIG_SPAPR_TCE_IOMMU
-       mm_iommu_cleanup(&mm->context);
+       mm_iommu_cleanup(mm);
 #endif
 
 #ifdef CONFIG_PPC_ICSWX
index e0f1c33601ddb1ab6bc3e780b1ed43f9f80a1e58..ad2e575fd418a6ca5beffb87e78332d88de118f6 100644 (file)
@@ -373,16 +373,17 @@ void mm_iommu_mapped_dec(struct mm_iommu_table_group_mem_t *mem)
 }
 EXPORT_SYMBOL_GPL(mm_iommu_mapped_dec);
 
-void mm_iommu_init(mm_context_t *ctx)
+void mm_iommu_init(struct mm_struct *mm)
 {
-       INIT_LIST_HEAD_RCU(&ctx->iommu_group_mem_list);
+       INIT_LIST_HEAD_RCU(&mm->context.iommu_group_mem_list);
 }
 
-void mm_iommu_cleanup(mm_context_t *ctx)
+void mm_iommu_cleanup(struct mm_struct *mm)
 {
        struct mm_iommu_table_group_mem_t *mem, *tmp;
 
-       list_for_each_entry_safe(mem, tmp, &ctx->iommu_group_mem_list, next) {
+       list_for_each_entry_safe(mem, tmp, &mm->context.iommu_group_mem_list,
+                       next) {
                list_del_rcu(&mem->next);
                mm_iommu_do_free(mem);
        }