Add kunit stubs in kho_restore_folio() and kho_restore_pages() so the users can mock these functions in kunit tests. Signed-off-by: Samiullah Khawaja --- kernel/liveupdate/kexec_handover.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c index 11855e275397..902019f36c24 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -10,6 +10,8 @@ #define pr_fmt(fmt) "KHO: " fmt +#include + #include #include #include @@ -423,7 +425,11 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio) */ struct folio *kho_restore_folio(phys_addr_t phys) { - struct page *page = kho_restore_page(phys, true); + struct page *page; + + KUNIT_STATIC_STUB_REDIRECT(kho_restore_folio, phys); + + page = kho_restore_page(phys, true); return page ? page_folio(page) : NULL; } @@ -445,6 +451,8 @@ struct page *kho_restore_pages(phys_addr_t phys, unsigned long nr_pages) const unsigned long end_pfn = start_pfn + nr_pages; unsigned long pfn = start_pfn; + KUNIT_STATIC_STUB_REDIRECT(kho_restore_pages, phys, nr_pages); + while (pfn < end_pfn) { const unsigned int order = min(count_trailing_zeros(pfn), ilog2(end_pfn - pfn)); -- 2.54.0.746.g67dd491aae-goog