[PATCH] sparc/mm: export symbols for lazy_mmu_mode KUnit tests

Kevin Brodsky
2025-12-18T10:05:53Z

Upcoming KUnit tests will call lazy_mmu_mode_{enable,disable}.
These tests may be built as a module, and because of inlining this
means that arch_{enter,flush,leave}_lazy_mmu_mode need to be
exported.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---

The CI reports that sparc needs pretty much the same time treatment as
powerpc... Here's another patch to take care of that.

Andrew, could you please add it after the powerpc one? At this point it's
probably best to remove the comment above MODULE_IMPORT_NS() in
mm/tests/lazy_mmu_mode_kunit.c. Thank you and sorry for the noise!
---
arch/sparc/mm/tlb.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
index 3a852071d260..6d9dd5eb1328 100644
--- a/arch/sparc/mm/tlb.c
+++ b/arch/sparc/mm/tlb.c
@@ -11,6 +11,8 @@
#include <linux/preempt.h>
#include <linux/pagemap.h>

+#include <kunit/visibility.h>
+
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
#include <asm/mmu_context.h>
@@ -54,6 +56,8 @@ void arch_enter_lazy_mmu_mode(void)
{
preempt_disable();
}
+/* For lazy_mmu_mode KUnit tests */
+EXPORT_SYMBOL_IF_KUNIT(arch_enter_lazy_mmu_mode);

void arch_flush_lazy_mmu_mode(void)
{
@@ -62,12 +66,14 @@ void arch_flush_lazy_mmu_mode(void)
if (tb->tlb_nr)
flush_tlb_pending();
}
+EXPORT_SYMBOL_IF_KUNIT(arch_flush_lazy_mmu_mode);

void arch_leave_lazy_mmu_mode(void)
{
arch_flush_lazy_mmu_mode();
preempt_enable();
}
+EXPORT_SYMBOL_IF_KUNIT(arch_leave_lazy_mmu_mode);

static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
bool exec, unsigned int hugepage_shift)

base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
--
2.51.2