1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kexec_handover_debug.c - kexec handover optional debug functionality
4 * Copyright (C) 2025 Google LLC, Pasha Tatashin <pasha.tatashin@soleen.com>
5 */
6
7#define pr_fmt(fmt) "KHO: " fmt
8
9#include "kexec_handover_internal.h"
10
11bool kho_scratch_overlap(phys_addr_t phys, size_t size)
12{
13 phys_addr_t scratch_start, scratch_end;
14 unsigned int i;
15
16 for (i = 0; i < kho_scratch_cnt; i++) {
17 scratch_start = kho_scratch[i].addr;
18 scratch_end = kho_scratch[i].addr + kho_scratch[i].size;
19
20 if (phys < scratch_end && (phys + size) > scratch_start)
21 return true;
22 }
23
24 return false;
25}
26

source code of linux/kernel/liveupdate/kexec_handover_debug.c