Skip to content

Commit 82e69a1

Browse files
Fenghua Yutorvalds
authored andcommitted
mm/fork: clear PASID for new mm
When a new mm is created, its PASID should be cleared, i.e. the PASID is initialized to its init state 0 on both ARM and X86. This patch was part of the series introducing mm->pasid, but got lost along the way [1]. It still makes sense to have it, because each address space has a different PASID. And the IOMMU code in iommu_sva_alloc_pasid() expects the pasid field of a new mm struct to be cleared. [1] https://lore.kernel.org/linux-iommu/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Fenghua Yu <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Reviewed-by: Tony Luck <[email protected]> Cc: Jacob Pan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 0740a50 commit 82e69a1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/linux/mm_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#endif
2424
#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
2525

26+
#define INIT_PASID 0
2627

2728
struct address_space;
2829
struct mem_cgroup;

kernel/fork.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,13 @@ static void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
994994
#endif
995995
}
996996

997+
static void mm_init_pasid(struct mm_struct *mm)
998+
{
999+
#ifdef CONFIG_IOMMU_SUPPORT
1000+
mm->pasid = INIT_PASID;
1001+
#endif
1002+
}
1003+
9971004
static void mm_init_uprobes_state(struct mm_struct *mm)
9981005
{
9991006
#ifdef CONFIG_UPROBES
@@ -1024,6 +1031,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
10241031
mm_init_cpumask(mm);
10251032
mm_init_aio(mm);
10261033
mm_init_owner(mm, p);
1034+
mm_init_pasid(mm);
10271035
RCU_INIT_POINTER(mm->exe_file, NULL);
10281036
mmu_notifier_subscriptions_init(mm);
10291037
init_tlb_flush_pending(mm);

0 commit comments

Comments
 (0)