From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0EDEC624D6 for ; Thu, 3 Sep 2026 02:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=t1Sj3SZIoFO1IrO+MibWwCI7jpIestNZ9bFRqEQ8nhA=; b=vKsFTeSiU09V4i62ir2LWXyFMq +MAxvEAL7wvU81hU7rK5d7n6EQ8leSGJ5AuDwdXrhdy7cMt5C0Z1gcUl6/2p6VucH65vQ9KO0LzNW 9XtWwrmkig9aZ4pk/BzpyLugMsKudQ6XF0mVBKvLYRLFzCDlTLsk1OEpDXmttT0/bDsFHD4gYx+lK nEDrvBeyaTkM+8+AAGimY4GdqzYg5X5q6GzjPteQBmx3P4FBfTP9m7OxLv5NyOuv2efNootdR0AfL Go+YfQFQLggWQv0W15cRt0owJhf/GiFkDuZJiZ+aTmeHOwCISE22KwvGsj9clDx8PITeYJRdg4AMh lSX8vGpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1xI9-0000000GDEn-2L0V; Thu, 03 Sep 2026 02:35:05 +0000 Received: from mail-pj1-x1047.google.com ([2607:f8b0:4864:20::1047]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1xI3-0000000GD88-32t2 for kexec@lists.infradead.org; Thu, 03 Sep 2026 02:35:02 +0000 Received: by mail-pj1-x1047.google.com with SMTP id 98e67ed59e1d1-398dc3d8f0fso618191a91.0 for ; Wed, 02 Sep 2026 19:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1788402898; x=1789007698; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=t1Sj3SZIoFO1IrO+MibWwCI7jpIestNZ9bFRqEQ8nhA=; b=fOR/nqVM8iG00vf9FMZcN+8YCru0WHbcssz8CTMMAxk6PIIxZ00LYmKf+EPjVIHQgy cdrp8M3EIEM+30quCgn1m/XQNot0Ow5YaiU3Vkq9UDsaoDAfK5HYaIk6XnywksJ3Xwou fcOmqfp1rOiAQVrx0Y49AaG+wSDRpH3enOLsMIsNMbYoJz5kOFsYiW4uUJkK0G0x4p/8 JEGDdRbL86u7Fcqu2pX1ThXSssyDBThUp3CmNe5eacDw/29NwDEGobchfqswbiYJ2XgW czAZ5aJ//AnASs+S4pUJXbmexVxel8uUoTwtiPyNxmN1UPKf2csmRgrxglGIptuMmKe3 GjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788402898; x=1789007698; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=t1Sj3SZIoFO1IrO+MibWwCI7jpIestNZ9bFRqEQ8nhA=; b=pZhppLgeFgoDnWAW+5bMcCWCP/PyygjyFruQ+JlOLP4PYqOlLpHJw7nqCkVS4mzjfm 5QojEDZA0ZZj1oZBPHmH3Eva8KP0hz17OG86dgV3BeCWEMtem2FY/vLtmvDnJrXiLCVs JNvz7/XNPddyItkUSYhD2ghBzjvf3Ds3K8ckeEjbJApPb6uTdnctYMd1Nw/ut3p9QTzv V+WhqBnO+Y1Ku2iG5s+2iZvXRBHjo+FRUMI8d3LdenHmRy01KKTl9MsQ+TQZBEG82fIe WzxKsBdsa8jmSi7x1gtzwRVkoCECNbCdhsCN6BfGLgEc6CCIQdY+Yg9dRManDLhQImmV 3S2A== X-Forwarded-Encrypted: i=1; AKwUvBye09o4HsIvMczDRBzlJG6o43oeDZy+OyDi08hUEoeUHE2QSdPu1x766/ubEQbJd8UoQHLTTQ==@lists.infradead.org X-Gm-Message-State: AFuF++kCkhiRHIwCEx3yZPPFICd4ygpN7VM29eCfaO0i4Ps/ijAPEAh6 skYJal/n5UmnODKKxF6jD0DbsFyW4h3+ukqVckOwaLfcQzn1+o4mx+n+XKPpOjf96hLEMLzkIr5 hxatMgiuKewG4Fxlpq8GL5w== X-Received: from dybdb19.prod.google.com ([2002:a05:7300:b093:b0:328:684d:3f7]) (user=loganodell job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:4b04:b0:396:4ce0:6400 with SMTP id 98e67ed59e1d1-39b07f33963mr3591851a91.2.1788402897557; Wed, 02 Sep 2026 19:34:57 -0700 (PDT) Date: Wed, 2 Sep 2026 19:34:51 -0700 In-Reply-To: <20260903023452.721732-1-loganodell@google.com> Mime-Version: 1.0 References: <20260903023452.721732-1-loganodell@google.com> X-Mailer: git-send-email 2.55.0.979.g7e5102b832-goog Message-ID: <20260903023452.721732-3-loganodell@google.com> Subject: [RFC PATCH 2/3] luo: Export feature support to vmlinux section From: Logan Odell To: arnd@arndb.de, pasha.tatashin@soleen.com, rppt@kernel.org, pratyush@kernel.org, graf@amazon.com, akpm@linux-foundation.org, pbonzini@redhat.com, maz@kernel.org, oupton@kernel.org, seanjc@google.com, bhelgaas@google.com, alex@shazbot.org, jgg@nvidia.com, kevin.tian@intel.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-pci@vger.kernel.org, iommu@lists.linux.dev, Logan Odell Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260902_193459_764809_0420C909 X-CRM114-Status: GOOD ( 18.60 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org Create a liveupdate_features section that contains the feature information for a given liveupdate component. Add the LUO component first. These can be compared between two kernels to determine live update compatibility. Features marked as required in the running kernel will need to have that feature marked as supported in the next kernel to be eligible for compatibility. Suggested-by: Pratyush Yadav Signed-off-by: Logan Odell --- include/asm-generic/vmlinux.lds.h | 12 +++++++++++ include/linux/kho/abi/luo.h | 34 +++++++++++++++++++++++++++++++ include/linux/liveupdate.h | 12 +++++++++++ kernel/liveupdate/luo_core.c | 16 +++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 5659f4b5a125..aed4e282a78c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -359,6 +359,17 @@ #define THERMAL_TABLE(name) #endif +#ifdef CONFIG_LIVEUPDATE +#define LIVEUPDATE_FEATURES \ + . = ALIGN(8); \ + .liveupdate_features : AT(ADDR(.liveupdate_features) - LOAD_OFFSET) { \ + KEEP(*(.liveupdate_sec_hdr)) \ + KEEP(*(.liveupdate_features)) \ + } +#else +#define LIVEUPDATE_FEATURES +#endif + #define KERNEL_DTB() \ STRUCT_ALIGN(); \ __dtb_start = .; \ @@ -554,6 +565,7 @@ RO_EXCEPTION_TABLE \ NOTES \ BTF \ + LIVEUPDATE_FEATURES \ \ . = ALIGN((align)); \ __end_rodata = .; diff --git a/include/linux/kho/abi/luo.h b/include/linux/kho/abi/luo.h index 0a7662a0cf9a..5b25e1b48cf5 100644 --- a/include/linux/kho/abi/luo.h +++ b/include/linux/kho/abi/luo.h @@ -230,4 +230,38 @@ struct luo_flb_ser { #define LIVEUPDATE_TEST_FLB_COMPATIBLE(i) "liveupdate-test-flb-v" #i #endif +#define LIVEUPDATE_VER_HDR_MAGIC 0x4c565550 /* 'LVUP' */ +#define LIVEUPDATE_VER_HDR_VER 1 + +/** + * struct liveupdate_ver_hdr - Header of vmlinux section with version lists + * @magic: Magic number ('LVUP'). + * @version: Version of the header format. + * + * This struct is the header for the vmlinux section ".liveupdate_features". The + * section contains the list of feature/version entries that the kernel supports. + */ +struct liveupdate_ver_hdr { + u32 magic; + u32 version; +} __packed; + +/** + * struct liveupdate_feature_entry - Live update feature/version entry + * @name: Name of the subsystem or feature ("luo" for core). + * @feat_bytes: Number of bytes covered by supp, req, and active bitmaps (e.g. 8). + * @reserved: Reserved / padding for alignment. + * @supp: Bitmask of supported features. + * @req: Bitmask of required features. + * @active: Bitmask of active features. + */ +struct liveupdate_feature_entry { + char name[LIVEUPDATE_HNDL_COMPAT_LENGTH]; + u32 feat_bytes; + u32 reserved; + u64 supp; + u64 req; + u64 active; +} __packed; + #endif /* _LINUX_KHO_ABI_LUO_H */ diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h index 6051abc0612c..e058df23fed1 100644 --- a/include/linux/liveupdate.h +++ b/include/linux/liveupdate.h @@ -229,6 +229,16 @@ struct liveupdate_flb { #ifdef CONFIG_LIVEUPDATE +#define LIVEUPDATE_FEATURE_ENTRY(_id, _name, _supp, _req, _active) \ + static const struct liveupdate_feature_entry __lu_feat_##_id \ + __used __section(".liveupdate_features") __aligned(8) = { \ + .name = _name, \ + .feat_bytes = sizeof(u64), \ + .supp = (_supp), \ + .req = (_req), \ + .active = (_active), \ + } + /* Return true if live update orchestrator is enabled */ bool liveupdate_enabled(void); @@ -259,6 +269,8 @@ int liveupdate_get_token_outgoing(struct liveupdate_session *s, #else /* CONFIG_LIVEUPDATE */ +#define LIVEUPDATE_FEATURE_ENTRY(_id, _name, _supp, _req, _active) + static inline bool liveupdate_enabled(void) { return false; diff --git a/kernel/liveupdate/luo_core.c b/kernel/liveupdate/luo_core.c index 6add1ecc463f..27413f895174 100644 --- a/kernel/liveupdate/luo_core.c +++ b/kernel/liveupdate/luo_core.c @@ -64,6 +64,22 @@ #include "kexec_handover_internal.h" #include "luo_internal.h" +/* + * This is the header for the ".liveupdate_features" section in vmlinux. + * The linker makes sure that this header precedes the entries. + */ +static const struct liveupdate_ver_hdr ver_hdr + __used __section(".liveupdate_sec_hdr") __aligned(8) = { + .magic = LIVEUPDATE_VER_HDR_MAGIC, + .version = LIVEUPDATE_VER_HDR_VER, +}; + +/* Core LUO features */ +LIVEUPDATE_FEATURE_ENTRY(luo_core, "luo", + LUO_CORE_FEATURES_SUPP, + LUO_CORE_FEATURES_REQ, + LUO_CORE_FEATURES_ACTIVE); + static struct { bool enabled; struct luo_ser *luo_ser_out; -- 2.55.0.979.g7e5102b832-goog