]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
arm64/mm: Remove dependency on MM in new_context
authorJulien Grall <julien.grall@arm.com>
Thu, 5 Jul 2018 10:13:17 +0000 (11:13 +0100)
committerJulien Grall <julien.grall@arm.com>
Thu, 20 Jun 2019 12:45:05 +0000 (13:45 +0100)
The function new_context will be part of a generic ASID allocator. At
the moment, the MM structure is only used to fetch the ASID.

To remove the dependency on MM, it is possible to just pass a pointer to
the current ASID.

Signed-off-by: Julien Grall <julien.grall@arm.com>
arch/arm64/mm/context.c

index 6457a9310fe4be9d8f2ec61a44f4b5510e5a6297..a9cc59288b088e25b5f84fe5fa2aefbc8a760cce 100644 (file)
@@ -151,10 +151,10 @@ static bool check_update_reserved_asid(struct asid_info *info, u64 asid,
        return hit;
 }
 
-static u64 new_context(struct asid_info *info, struct mm_struct *mm)
+static u64 new_context(struct asid_info *info, atomic64_t *pasid)
 {
        static u32 cur_idx = 1;
-       u64 asid = atomic64_read(&mm->context.id);
+       u64 asid = atomic64_read(pasid);
        u64 generation = atomic64_read(&info->generation);
 
        if (asid != 0) {
@@ -236,7 +236,7 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu)
        /* Check that our ASID belongs to the current generation. */
        asid = atomic64_read(&mm->context.id);
        if ((asid ^ atomic64_read(&info->generation)) >> info->bits) {
-               asid = new_context(info, mm);
+               asid = new_context(info, &mm->context.id);
                atomic64_set(&mm->context.id, asid);
        }