linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: mm: Use asid2idx() and asid feature macro for cleanup
@ 2021-10-28 12:27 Yunfeng Ye
  2021-12-06 16:23 ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: Yunfeng Ye @ 2021-10-28 12:27 UTC (permalink / raw)
  To: catalin.marinas, will, wangkefeng.wang, linux-arm-kernel,
	linux-kernel
  Cc: wuxu.wu, Hewenliang

Use asid2idx() and asid feature macro for cleanup.

No functional change.

Signed-off-by: Yunfeng Ye <yeyunfeng@huawei.com>
---
 arch/arm64/mm/context.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c
index cd72576ae2b7..076f14a75bd5 100644
--- a/arch/arm64/mm/context.c
+++ b/arch/arm64/mm/context.c
@@ -50,10 +50,10 @@ static u32 get_cpu_asid_bits(void)
 		pr_warn("CPU%d: Unknown ASID size (%d); assuming 8-bit\n",
 					smp_processor_id(),  fld);
 		fallthrough;
-	case 0:
+	case ID_AA64MMFR0_ASID_8:
 		asid = 8;
 		break;
-	case 2:
+	case ID_AA64MMFR0_ASID_16:
 		asid = 16;
 	}

@@ -162,7 +162,7 @@ static u64 new_context(struct mm_struct *mm)
 	u64 generation = atomic64_read(&asid_generation);

 	if (asid != 0) {
-		u64 newasid = generation | (asid & ~ASID_MASK);
+		u64 newasid = generation | asid2idx(asid);

 		/*
 		 * If our current ASID was active during a rollover, we
@@ -306,7 +306,7 @@ unsigned long arm64_mm_context_get(struct mm_struct *mm)
 out_unlock:
 	raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);

-	asid &= ~ASID_MASK;
+	asid = asid2idx(asid);

 	/* Set the equivalent of USER_ASID_BIT */
 	if (asid && arm64_kernel_unmapped_at_el0())
-- 
2.27.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-07 10:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-28 12:27 [PATCH] arm64: mm: Use asid2idx() and asid feature macro for cleanup Yunfeng Ye
2021-12-06 16:23 ` Catalin Marinas
2021-12-07  2:21   ` Yunfeng Ye
2021-12-07 10:50     ` Catalin Marinas

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).