kho: remove global preserved_mem_map and store state in FDT
authorPasha Tatashin <pasha.tatashin@soleen.com>
Fri, 14 Nov 2025 18:59:57 +0000 (13:59 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 27 Nov 2025 22:24:35 +0000 (14:24 -0800)
commitefa3a9775ac2a869788ac61fccad1efd26cd2d33
tree6f31c53f731bedc9a84ed2b0008321bf2e6e6572
parent71960fe1344c432f8d67f6f9b379533496b89f8c
kho: remove global preserved_mem_map and store state in FDT

Currently, the serialized memory map is tracked via
kho_out.preserved_mem_map and copied to the FDT during finalization.  This
double tracking is redundant.

Remove preserved_mem_map from kho_out.  Instead, maintain the physical
address of the head chunk directly in the preserved-memory-map FDT
property.

Introduce kho_update_memory_map() to manage this property. This function
handles:
1. Retrieving and freeing any existing serialized map (handling the
   abort/retry case).
2. Updating the FDT property with the new chunk address.

This establishes the FDT as the single source of truth for the handover
state.

Link: https://lkml.kernel.org/r/20251114190002.3311679-9-pasha.tatashin@soleen.com
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Cc: Alexander Graf <graf@amazon.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baoquan He <bhe@redhat.com>
Cc: Coiby Xu <coxu@redhat.com>
Cc: Dave Vasilevsky <dave@vasilevsky.ca>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Kees Cook <kees@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/liveupdate/kexec_handover.c