From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E378E1A5BAF for ; Thu, 7 Aug 2025 01:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754531104; cv=none; b=aySyJhD3gEPKHtH3czGaE9pXtPPVtMY/T4PjnxUFgUIaTBWaDO/eTbeToJoG2720IyTeihvN0avHdDmSQmd175o7slhctWw7BWaPNDfjGAuvfB9NTYd+NdKN/4N0VjOFIlE4tesNGBvHLV38SUpfZxK4hA3UCLUyuKcWJN8YZRM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754531104; c=relaxed/simple; bh=PKiNhDV/woD9XQWUc1QLLTXDf6qKPRlDYuwRtODBNz0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M35tf4mFj0gP/cK0SqBjkQKEMas04QAKp5RYrbDJDKJMe0+LNLWbF0GXnZIXg/Q4//jL+HFmCOpkTIg8wwEzkn4Uo2R6K3QwiUDcxHdWj5PJASD7dCFgPozbmsGgaWeR0NATqhdiV6tFj1C+k5FmO5htvOoIAoiq3YxcgzMHw6w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=eMJ/1kvi; arc=none smtp.client-ip=209.85.219.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="eMJ/1kvi" Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-6f8aa9e6ffdso6083776d6.3 for ; Wed, 06 Aug 2025 18:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1754531101; x=1755135901; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=5YQfTLXaPrwDWqa20JnWXXwtihBOEt4q7FRxEsztbTE=; b=eMJ/1kviecAKHCx1NN9fWza/jo12NvyAvLBw2c37rFrINU8UaJalQExTosnB3QbP0O AVRct7g//CG1g1kXjvUslwRV///v5JZnbryUosKEKHjdEudzWog+lY1TgfQl9G46WNbB EWGfaWpRaOHcWIH0lFocExwM45eVgjRwHmfTcbRaVSGkUHuIBF15grWD68fUNU8EYjOr Rs3x8K1N/7E4klinMLLILvRfXzkKEUw+PNKn9xndXwL7nNKB+wbmjGZOrJex+xnsVYTo 70URJ2i+jU+xm48FbnNf57QriyWlVt5bncQ+XAZmBHmIU/gkE2MBJyePUgBlWGQbXZiL tN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754531101; x=1755135901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5YQfTLXaPrwDWqa20JnWXXwtihBOEt4q7FRxEsztbTE=; b=kaQTD2eYcMKhYXE+tjfGadi+5KkObk7Lr/qlS0IuNJFZokou5v6Yc2jV7BcbBgR4Lf Deb7ktudwXXSWNtCEG5qoIgw41HQ3cNLHycXTUe6u3OtY5cdvibYZWFRJihFD5w5N29L oTIGtt5VTOYbhdFRwZ0A6XUsTAXOgIsMR9qtpDKYs/1yFfkl+QZUXzEeZulLA916phBI EszJ3qhurC2pMlZKSu4ODhc8ty/FnC3KdLXsf4dR8AFKps8LyF34wdo6MbRS4zU01Jd7 8WrJtxN1hMC6BMVW9dEcHkajhrdL4ajivoZlJjA55ugwrkIyaAqm1rz7YngBLZb5wWaa Ottw== X-Forwarded-Encrypted: i=1; AJvYcCU/AgaTizKP2twYLDrN0YIlphfs7BSVudvQsaTM6jS/XTvnoV1DDsuQlP6y0u/8Mia6LBGoi4TzaOssgFI=@vger.kernel.org X-Gm-Message-State: AOJu0YyCEDUQ3yNbayX6nwOeOPVa2K14QZhZgRb5Ib5Nx8Pi9avBRZvM EpiQN0QasoTjWc8WEXJF9U1jVM7gNf95riDvtkOvoCDedS3ZfqAgywza7/WBh4aREqA= X-Gm-Gg: ASbGncuiuOS58Gzjqx4fbEuwMv+4ub77VxiaITzq6lHbaGkj3UHc9RzjYvhgr8TPx1+ HEkOAOn0Bp2jBrx2YUnxdcu4qvpkI8J5F0mZT1pGGqruIT354AxpFqQORjDl1wMJnYuaa2NIMkh X0FcO1F38ZiZxSvA8+pCMzCNPOhLKHr5VLVOrXRv83zDck8ia/n5XAVgU23P1QeQ0JAmd+LheDu ISFYv8dURyrClgU3ZazaE+REedICAk1iYPy/jc5Bsrvr9WEZICYshTsET5GkxnJ/iJ6UftVdd1Z KenVXgbP8OK3OiREdHMFtRWDrJB5eLIb4RWJ/SmpLcY66Neu5y6TW8M8WhGwyHrN30EWDn9HACF 0BgFpG8jB/RddCMFF0XpAaafgbSYeElDCzuYb46x9yE/Z6rE/zdYFd6EStPvCj+a7QBMlCfJ95k GZU26V/gOJbnCL X-Google-Smtp-Source: AGHT+IHmmcvtRUPUdTTVwMopqE/V5cogsgxyMiffpH9sAyZ4atsq/VQ1CQZ07gsqifDfn1bW6xxifg== X-Received: by 2002:a05:6214:40f:b0:704:f7d8:edfc with SMTP id 6a1803df08f44-7098a8639d6mr19787226d6.49.1754531100577; Wed, 06 Aug 2025 18:45:00 -0700 (PDT) Received: from soleen.c.googlers.com.com (235.247.85.34.bc.googleusercontent.com. [34.85.247.235]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-7077cde5a01sm92969046d6.70.2025.08.06.18.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Aug 2025 18:44:59 -0700 (PDT) From: Pasha Tatashin To: pratyush@kernel.org, jasonmiu@google.com, graf@amazon.com, changyuanl@google.com, pasha.tatashin@soleen.com, rppt@kernel.org, dmatlack@google.com, rientjes@google.com, corbet@lwn.net, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, kanie@linux.alibaba.com, ojeda@kernel.org, aliceryhl@google.com, masahiroy@kernel.org, akpm@linux-foundation.org, tj@kernel.org, yoann.congal@smile.fr, mmaurer@google.com, roman.gushchin@linux.dev, chenridong@huawei.com, axboe@kernel.dk, mark.rutland@arm.com, jannh@google.com, vincent.guittot@linaro.org, hannes@cmpxchg.org, dan.j.williams@intel.com, david@redhat.com, joel.granados@kernel.org, rostedt@goodmis.org, anna.schumaker@oracle.com, song@kernel.org, zhangguopeng@kylinos.cn, linux@weissschuh.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rafael@kernel.org, dakr@kernel.org, bartosz.golaszewski@linaro.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, yesanishhere@gmail.com, Jonathan.Cameron@huawei.com, quic_zijuhu@quicinc.com, aleksander.lobakin@intel.com, ira.weiny@intel.com, andriy.shevchenko@linux.intel.com, leon@kernel.org, lukas@wunner.de, bhelgaas@google.com, wagi@kernel.org, djeffery@redhat.com, stuart.w.hayes@gmail.com, ptyadav@amazon.de, lennart@poettering.net, brauner@kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, saeedm@nvidia.com, ajayachandra@nvidia.com, jgg@nvidia.com, parav@nvidia.com, leonro@nvidia.com, witu@nvidia.com Subject: [PATCH v3 09/30] liveupdate: kho: move to kernel/liveupdate Date: Thu, 7 Aug 2025 01:44:15 +0000 Message-ID: <20250807014442.3829950-10-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.50.1.565.gc32cd1483b-goog In-Reply-To: <20250807014442.3829950-1-pasha.tatashin@soleen.com> References: <20250807014442.3829950-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Move KHO to kernel/liveupdate/ in preparation of placing all Live Update core kernel related files to the same place. Signed-off-by: Pasha Tatashin Reviewed-by: Jason Gunthorpe --- Documentation/core-api/kho/concepts.rst | 2 +- MAINTAINERS | 2 +- init/Kconfig | 2 ++ kernel/Kconfig.kexec | 25 ---------------- kernel/Makefile | 3 +- kernel/liveupdate/Kconfig | 30 +++++++++++++++++++ kernel/liveupdate/Makefile | 7 +++++ kernel/{ => liveupdate}/kexec_handover.c | 6 ++-- .../{ => liveupdate}/kexec_handover_debug.c | 0 .../kexec_handover_internal.h | 0 10 files changed, 45 insertions(+), 32 deletions(-) create mode 100644 kernel/liveupdate/Kconfig create mode 100644 kernel/liveupdate/Makefile rename kernel/{ => liveupdate}/kexec_handover.c (99%) rename kernel/{ => liveupdate}/kexec_handover_debug.c (100%) rename kernel/{ => liveupdate}/kexec_handover_internal.h (100%) diff --git a/Documentation/core-api/kho/concepts.rst b/Documentation/core-api/kho/concepts.rst index 36d5c05cfb30..d626d1dbd678 100644 --- a/Documentation/core-api/kho/concepts.rst +++ b/Documentation/core-api/kho/concepts.rst @@ -70,5 +70,5 @@ in the FDT. That state is called the KHO finalization phase. Public API ========== -.. kernel-doc:: kernel/kexec_handover.c +.. kernel-doc:: kernel/liveupdate/kexec_handover.c :export: diff --git a/MAINTAINERS b/MAINTAINERS index ce0314af3bdf..35cf4f95ed46 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13541,7 +13541,7 @@ S: Maintained F: Documentation/admin-guide/mm/kho.rst F: Documentation/core-api/kho/* F: include/linux/kexec_handover.h -F: kernel/kexec_handover* +F: kernel/liveupdate/kexec_handover* F: tools/testing/selftests/kho/ KEYS-ENCRYPTED diff --git a/init/Kconfig b/init/Kconfig index 836320251219..1c67a44b8deb 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2108,6 +2108,8 @@ config TRACEPOINTS source "kernel/Kconfig.kexec" +source "kernel/liveupdate/Kconfig" + endmenu # General setup source "arch/Kconfig" diff --git a/kernel/Kconfig.kexec b/kernel/Kconfig.kexec index 9968d3d4dd17..b05f5018ed98 100644 --- a/kernel/Kconfig.kexec +++ b/kernel/Kconfig.kexec @@ -94,31 +94,6 @@ config KEXEC_JUMP Jump between original kernel and kexeced kernel and invoke code in physical address mode via KEXEC -config KEXEC_HANDOVER - bool "kexec handover" - depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE - depends on !DEFERRED_STRUCT_PAGE_INIT - select MEMBLOCK_KHO_SCRATCH - select KEXEC_FILE - select DEBUG_FS - select LIBFDT - select CMA - help - Allow kexec to hand over state across kernels by generating and - passing additional metadata to the target kernel. This is useful - to keep data or state alive across the kexec. For this to work, - both source and target kernels need to have this option enabled. - -config KEXEC_HANDOVER_DEBUG - bool "kexec handover debug interface" - depends on KEXEC_HANDOVER - depends on DEBUG_FS - help - Allow to control kexec handover device tree via debugfs - interface, i.e. finalize the state or aborting the finalization. - Also, enables inspecting the KHO fdt trees with the debugfs binary - blobs. - config CRASH_DUMP bool "kernel crash dumps" default ARCH_DEFAULT_CRASH_DUMP diff --git a/kernel/Makefile b/kernel/Makefile index bfca6dfe335a..da59db2676fb 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -52,6 +52,7 @@ obj-y += printk/ obj-y += irq/ obj-y += rcu/ obj-y += livepatch/ +obj-y += liveupdate/ obj-y += dma/ obj-y += entry/ obj-y += unwind/ @@ -81,8 +82,6 @@ obj-$(CONFIG_CRASH_DM_CRYPT) += crash_dump_dm_crypt.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_KEXEC_FILE) += kexec_file.o obj-$(CONFIG_KEXEC_ELF) += kexec_elf.o -obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o -obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o obj-$(CONFIG_COMPAT) += compat.o obj-$(CONFIG_CGROUPS) += cgroup/ diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig new file mode 100644 index 000000000000..eebe564b385d --- /dev/null +++ b/kernel/liveupdate/Kconfig @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menu "Live Update" + +config KEXEC_HANDOVER + bool "kexec handover" + depends on ARCH_SUPPORTS_KEXEC_HANDOVER && ARCH_SUPPORTS_KEXEC_FILE + depends on !DEFERRED_STRUCT_PAGE_INIT + select MEMBLOCK_KHO_SCRATCH + select KEXEC_FILE + select DEBUG_FS + select LIBFDT + select CMA + help + Allow kexec to hand over state across kernels by generating and + passing additional metadata to the target kernel. This is useful + to keep data or state alive across the kexec. For this to work, + both source and target kernels need to have this option enabled. + +config KEXEC_HANDOVER_DEBUG + bool "kexec handover debug interface" + depends on KEXEC_HANDOVER + depends on DEBUG_FS + help + Allow to control kexec handover device tree via debugfs + interface, i.e. finalize the state or aborting the finalization. + Also, enables inspecting the KHO fdt trees with the debugfs binary + blobs. + +endmenu diff --git a/kernel/liveupdate/Makefile b/kernel/liveupdate/Makefile new file mode 100644 index 000000000000..72cf7a8e6739 --- /dev/null +++ b/kernel/liveupdate/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the linux kernel. +# + +obj-$(CONFIG_KEXEC_HANDOVER) += kexec_handover.o +obj-$(CONFIG_KEXEC_HANDOVER_DEBUG) += kexec_handover_debug.o diff --git a/kernel/kexec_handover.c b/kernel/liveupdate/kexec_handover.c similarity index 99% rename from kernel/kexec_handover.c rename to kernel/liveupdate/kexec_handover.c index 07755184f44b..05f5694ea057 100644 --- a/kernel/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -23,8 +23,8 @@ * KHO is tightly coupled with mm init and needs access to some of mm * internal APIs. */ -#include "../mm/internal.h" -#include "kexec_internal.h" +#include "../../mm/internal.h" +#include "../kexec_internal.h" #include "kexec_handover_internal.h" #define KHO_FDT_COMPATIBLE "kho-v1" @@ -824,7 +824,7 @@ static int __kho_finalize(void) err |= fdt_finish_reservemap(root); err |= fdt_begin_node(root, ""); err |= fdt_property_string(root, "compatible", KHO_FDT_COMPATIBLE); - /** + /* * Reserve the preserved-memory-map property in the root FDT, so * that all property definitions will precede subnodes created by * KHO callers. diff --git a/kernel/kexec_handover_debug.c b/kernel/liveupdate/kexec_handover_debug.c similarity index 100% rename from kernel/kexec_handover_debug.c rename to kernel/liveupdate/kexec_handover_debug.c diff --git a/kernel/kexec_handover_internal.h b/kernel/liveupdate/kexec_handover_internal.h similarity index 100% rename from kernel/kexec_handover_internal.h rename to kernel/liveupdate/kexec_handover_internal.h -- 2.50.1.565.gc32cd1483b-goog