From nobody Sat Sep 26 13:08:01 2026 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 21906388E46 for ; Tue, 1 Sep 2026 11:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788262455; cv=none; b=Pf502QX3mqo+J8wyKKM3+xpjckD7sBzKsXPzQYQNbbkasTT7hA/WP4Mw1e/S6JhoYSI47/Tqj96KbPOH/ZxguZUIHAdfAOsHC4vhCDyiScH3ZNAhziUUZ6gyWDff1QJS9tybfRIMdpSbS94frCsmpjhvNrRlHQYGS760U8ggqz0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788262455; c=relaxed/simple; bh=cWXWqzgZ6EzkJijPSxMiirfRi4OQcwgKxYz+zIUuXYQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uyNuccoYSO4b3Jk1+s2v2L4NrMdAiP0DR0RlFeuLPEVEHOGhgh3UxmuFgJXMskbEQ+mZYedZaSD1t5Sf56BzSKlOgyFHhH5wHTUXE+X5oZTIAAEjyqpirAJXwgbplfKv4Kefyua8poglJW8/uABRYLVZgUIqoZY9fyE0hDyjVH0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XuHZDuD0; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XuHZDuD0" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-398b1e63c49so900659a91.0 for ; Tue, 01 Sep 2026 04:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788262453; x=1788867253; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=v5b4XLc/S0guAvnfK57cAFeTiBvZBRE21WVSi52BFiM=; b=XuHZDuD0OmbNtjQASTkIMoMDUEHLQEI9M+hIoHXjhNzPEQ1evx3MVUk0vCKWSijctK xSVeYe4Lg3n0yJ4uFAS3/h+scjmIvxje9KGdzByjSjC0RfM2Rw5OcGxfnEsXqu4ntLNB PH2ErJLbnc8PG83O3TIZf/xL1CM9y0ZIPfS61P7FX174lsPud6sqLbo/jkKzirrnjmIn QD1IVibJofzixRA20ky+8W/cOqOsthb9cUoBJbpoxEg+GM2Y2RIZOF2e/mvEXoPlFtlv ud6VsjDZV97sGoQ6UwUjGUSWtD/EY7xjqyVj9RMWaYTymhOld5/q3qYMcoOgHf+n4Cys u3dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788262453; x=1788867253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=v5b4XLc/S0guAvnfK57cAFeTiBvZBRE21WVSi52BFiM=; b=e5baYo9i+pHKK0XOBLMU4+1PifV9Gg/W1f+BbxehupfqVop22rbbh91zuW4S4dsLwm D1nCJu7oHzp2M/9gCSdEj8FtLdKkiEpxMvW3SXrBhzJZFFUtN9uHSBMet8GpkmehObvC Q8G113RpqcTP4py3/uC5jVK9jzKAAA0y3KYLC7Uel2WXs/k90DteLSMfA3hMpo+NVqvG yZ/wpR3qnk7ADDx1I4WM/4F9XK17VyoFlAbefjAS9MjiXw3DVZtdFSHE91TWNvbeoIPO CNibu/Ch6LuuYa//S6YOccR+Cw/Q1pRUWOQEaEePw0ePr9+Jdi99aNOAQypSlOZ0J6sQ PkzQ== X-Forwarded-Encrypted: i=1; AKwUvBwyJ7iOKOpC6W5SEG2UYbX2b3k7Fq+6N50K+8rvK4NX4NE/dBRkmLr2/gd4rAbsE+a0/1UTFFZ8/t7PW/c=@vger.kernel.org X-Gm-Message-State: AFuF++lSoUIfyFvrI8w7j/LW1+B0vU/iMRf8bhdPesOI2jFmvB2xOPS1 jQQE7mNXEdeN/70B1fFRd2BGV21BLRk9744nqnpUtToj4xZAFB9so7Ub X-Gm-Gg: AYBFou2l7PXcnaKOzhoGZWGZtTGf5YNsN8cFx5s16rowMcqpQCSc0eQr6yjZCXAyg63 DM7ol7vsdTCkEpR0dbDsghL8SY72kjjBnV7YfnCucI/8TPAR5Xm6LBgEKUfsuOGuBprRp5HAacM PShCvkfQwJfeBwQ9QynOJ8mNa8uL8E49Mj8K68OlNMzbFcm+LjgL1gq/z9zzfD6ajDo/p0cTNUp wWl0TPnYI30zksTrkxHf4CPcihAooaTEHmTdZT5ElebR/iz+P5hbmkKdbNgE/v5afKNU0Q8Zv+U QBRra5KQqMtOLRcryXysejKx2cmK2vHQPlPV6+mrTBzX1daejaEFcsxyrIK7FzyoayESnehWJJY JGKtiapqhlCPNfE8NjJReFcQXJcG8EtPtfFdaobZfYbff1NXqJ8SWnkFq19KSYjHZtUHXa66++/ kXk4sRqjv5wKeP6qtJYpRiHSHHf1Mgw1zV0NgepG7aENorMMjrPJWH0hapfxe5LOpveI6VsNI72 0eBNoj0qO9vs4IxO+JGxYBfpi0KpBa8fw0= X-Received: by 2002:a17:90b:33c6:b0:398:ceed:b903 with SMTP id 98e67ed59e1d1-3990f7693e4mr4193506a91.11.1788262453118; Tue, 01 Sep 2026 04:34:13 -0700 (PDT) Received: from overlord.home.arpa (ip68-107-67-45.sd.sd.cox.net. [68.107.67.45]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3286f7bf283sm41447470eec.8.2026.09.01.04.34.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 04:34:12 -0700 (PDT) From: "Jasmeet (Jazz) Bhatia" To: Ard Biesheuvel Cc: Ilias Apalodimas , rafael@kernel.org, Pavel Machek , linux-efi@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, "Jasmeet (Jazz) Bhatia" Subject: [PATCH v1 1/2] efi/libstub: Install memreserve table on x86 Date: Tue, 1 Sep 2026 04:34:07 -0700 Message-ID: <08dea57d1e1190a3dab0f6cd424c07a07b0760b8.1788259938.git.jasmeet.bhatia.us@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The generic EFI stub installs the Linux EFI memreserve configuration table from efi_stub_common(), but x86 uses a separate EFI stub path. Consequently, efi_mem_reserve_persistent() cannot be used on x86 when no memreserve root has been installed. Move install_memreserve_table() to the common stub helper code, expose it through efistub.h, and invoke it from the x86 stub before exiting boot services. This allows x86 kernels to add persistent EFI memory reservations that are carried across kexec. Signed-off-by: Jasmeet (Jazz) Bhatia --- .../firmware/efi/libstub/efi-stub-helper.c | 23 +++++++++++++++++++ drivers/firmware/efi/libstub/efi-stub.c | 23 ------------------- drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/x86-stub.c | 2 ++ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmw= are/efi/libstub/efi-stub-helper.c index f27f2e1f0019..9ea0ed0ed7d1 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -27,6 +27,29 @@ static bool efi_disable_pci_dma =3D IS_ENABLED(CONFIG_EF= I_DISABLE_PCI_DMA); =20 int efi_mem_encrypt; =20 +void install_memreserve_table(void) +{ + struct linux_efi_memreserve *rsv; + efi_guid_t memreserve_table_guid =3D LINUX_EFI_MEMRESERVE_TABLE_GUID; + efi_status_t status; + + status =3D efi_bs_call(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv), + (void **)&rsv); + if (status !=3D EFI_SUCCESS) { + efi_err("Failed to allocate memreserve entry!\n"); + return; + } + + rsv->next =3D 0; + rsv->size =3D 0; + atomic_set(&rsv->count, 0); + + status =3D efi_bs_call(install_configuration_table, + &memreserve_table_guid, rsv); + if (status !=3D EFI_SUCCESS) + efi_err("Failed to install memreserve config table!\n"); +} + bool __pure __efi_soft_reserve_enabled(void) { return !efi_nosoftreserve; diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi= /libstub/efi-stub.c index 42d6073bcd06..e378dd7db682 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -77,29 +77,6 @@ static struct sysfb_display_info *setup_primary_display(= void) return NULL; } =20 -static void install_memreserve_table(void) -{ - struct linux_efi_memreserve *rsv; - efi_guid_t memreserve_table_guid =3D LINUX_EFI_MEMRESERVE_TABLE_GUID; - efi_status_t status; - - status =3D efi_bs_call(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv), - (void **)&rsv); - if (status !=3D EFI_SUCCESS) { - efi_err("Failed to allocate memreserve entry!\n"); - return; - } - - rsv->next =3D 0; - rsv->size =3D 0; - atomic_set(&rsv->count, 0); - - status =3D efi_bs_call(install_configuration_table, - &memreserve_table_guid, rsv); - if (status !=3D EFI_SUCCESS) - efi_err("Failed to install memreserve config table!\n"); -} - static u32 get_supported_rt_services(void) { const efi_rt_properties_table_t *rt_prop_table; diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/= libstub/efistub.h index fd91fc15ec81..8656d6a545e5 100644 --- a/drivers/firmware/efi/libstub/efistub.h +++ b/drivers/firmware/efi/libstub/efistub.h @@ -1168,6 +1168,7 @@ efi_enable_reset_attack_mitigation(void) { } #endif =20 void efi_retrieve_eventlog(void); +void install_memreserve_table(void); =20 struct sysfb_display_info *alloc_primary_display(void); struct sysfb_display_info *__alloc_primary_display(void); diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi= /libstub/x86-stub.c index cef32e2c82d8..4a24126ccfd9 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -1015,6 +1015,8 @@ void __noreturn efi_stub_entry(efi_handle_t handle, =20 efi_retrieve_eventlog(); =20 + install_memreserve_table(); + setup_graphics(boot_params); =20 setup_efi_pci(boot_params); --=20 2.55.0 From nobody Sat Sep 26 13:08:01 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 D531239022A for ; Tue, 1 Sep 2026 11:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788262456; cv=none; b=h0VcjeqzAQMW0Or85g1q+vF5G3TD0DavGZU2tdRGRVeVHvgVplPDk0eDoNnWc8LgRy3D4V/9iGMbBMmpRa52HabFHZeoJsNzvijkahHs9G68AYfEJt1LBHq2s+QAxyGpZ1LIDavlYYkSL7BILBMu6athx5EyHpF5kxCOYHkePT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788262456; c=relaxed/simple; bh=fhx1FsZvbL+7Z6ubNkIzzDm1cdSx/W9etVKPIrEFWWQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sLk27ngrWQFFuYr3l6EOLDNMLyZStQcwp02BFfbxif5AJFfG7uXOBUP3tx7eXksMd/jMMM+uLCCtZO3YLz+vJsbjJykrMpfWXqGDwueHCGAcqWgj62F9XMSsb2iK4+0K/hdv7gI7ON9ZzSMOJNnfcleTJu2R4hYq9L2XGdMbDvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZDXs6rlR; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZDXs6rlR" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-3964e480f76so830249a91.1 for ; Tue, 01 Sep 2026 04:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788262454; x=1788867254; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=zSTftTM7ayeET7JuSORVBV3fyBOCZeg8g4qShMXHwdI=; b=ZDXs6rlRWdJ+X50i+AUCwVmzre12nqiOv66epithl0tCHf5Hipwo4/kAaZUJ0fx1oG Y+GOugguLqQr+kiVJByBtHCsFEgygg6KtiNEL/URa6Fdbwe2HJ5bh5j8+8hxIzG3vYXB +BkmLXXfuqnNZ3rBs3vyMDLKRM1PWy3ZbdxsL5YBocMkL361HBvWJVvwG7M0Bcd9MbgL JQYDue1y9JFrOWwe5heAett2YYY+tWrasnFl/kr50a7vA61v75tSzUmjtCm6LafRzcaf AV/0rETb6Dp8/hMyEyv+gNLUJF2DzpwTr++T/eTEEbu2Am8aiWvYyHdCQlJ57CvKeqYT Bc2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788262454; x=1788867254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=zSTftTM7ayeET7JuSORVBV3fyBOCZeg8g4qShMXHwdI=; b=XCD0Vj6iw9UoidkPM6Aki4knYS/XQBS5EbnRfO36R5uY8VS28OU+kaEqquXXbCnpno oepGond4LhOZT7hgX5Nnaic+WdQIP7Z9x1u8pc0YuAwrshrnUhmvCs4aNIkESXxSyx4f OW9mws/EZ8t0qaNVnr3BnhbGx6IiEKhmkD1u2pZ/6nIhvTtRPkoPpUuf3qnrIG9CvdKR A7O6t5J429Ggrx9OF6ymF5ArKYAu3m55hUE4JmxGyCvHP4sT3Kxt3bHryIhMLiBytvYe XGBk3gZQpBt3v5nFNK5dx4TOaZoeXtVDL04bxxcUGIs6CsH5nP72Ery/HqMyPVo7Ntdp 8TBg== X-Forwarded-Encrypted: i=1; AKwUvByShRqbMrRDhk/6aOHhyLkuNs0YSuP/SIJhUEjms3Kg+Dgzq4qPyNNRfqj6QVirvxQiu62LxTLtw5gj0/Q=@vger.kernel.org X-Gm-Message-State: AFuF++kUTZVcZGRwIXSIt40UAgxZnsaEeafKOJKCygUX29Tpht+lP3/0 vJvYGuoxC4NXBNPJI3+HhhSauM8Z1Tkk9a2NzuPmqVWrXc2d14SkyE16 X-Gm-Gg: AYBFou19WYShdzXERqKvd3slMmHS4FiVupbycPzHIlabmtxvPCbJ7cnwuC7FQvHMilx zPug8kTrPVXuva6ovz8DZF3ITK1GADse4WbFaelKNqF3mzNLu3b/iPNaXHQn/HaezTPtG2cXy+w 2M/ux69MghIz95i7/h7RGKPI2K8ZAJWQKvWGPbMTw3RWNAhqp91gJo3UHw/AVFDsego44Ihq+f+ eXr4piWFBWTky20nSDSNwHj3RFhUn1XQpR9YdoshrNBLIXTs9eXnAgpzt86uwDjt+kxvkKELCEY J1ZROgIRieiXmiguRI05tiyNBgfTEmHXdroCgSsFNJIafAJFEv6Mlm1Jqd9acHpNxTjq54uskMy iVySBqAAnUIW6rBZeiWWNW2/ID7+RcHO8w2FMLxq+tJC8VZrvDhzAnrNGtoCHeE/nelOcFtLEQt gvmXMWqAaGetAOJwF0fMOIvQPccQuVr4UGvFdw1qCXlNmim+gYYkbzLaW61kPK48T71BJD6CHM+ MhGjG9Kr2Ofd4c+RVhkTfRaGMEKDQZ6dXYokI5UjOoNUw== X-Received: by 2002:a17:90a:1c97:b0:398:b1eb:136c with SMTP id 98e67ed59e1d1-398b1eb1c02mr20501909a91.9.1788262454195; Tue, 01 Sep 2026 04:34:14 -0700 (PDT) Received: from overlord.home.arpa (ip68-107-67-45.sd.sd.cox.net. [68.107.67.45]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3286f7bf283sm41447470eec.8.2026.09.01.04.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 04:34:13 -0700 (PDT) From: "Jasmeet (Jazz) Bhatia" To: Ard Biesheuvel Cc: Ilias Apalodimas , rafael@kernel.org, Pavel Machek , linux-efi@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, "Jasmeet (Jazz) Bhatia" Subject: [PATCH v1 2/2] efi/tpm: Persistently reserve the TPM event log Date: Tue, 1 Sep 2026 04:34:08 -0700 Message-ID: X-Mailer: git-send-email 2.55.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption") changed the TPM event log allocation from EFI_LOADER_DATA to EFI_ACPI_RECLAIM_MEMORY so that the memory would remain reserved across kexec. On x86, EFI_ACPI_RECLAIM_MEMORY is represented as ACPI data in the E820 map. If the EFI allocator places the event log at a different physical address on a subsequent boot, this changes the firmware E820 map. x86 hibernation records architecture-specific information derived from that map and rejects the image when it differs on resume: Hibernate inconsistent memory map detected! PM: hibernation: Image mismatch: architecture specific data This occurs on a Framework Laptop 16 (AMD Ryzen AI 300 Series), where the EFI allocation backing the TPM event log was observed at different addresses across otherwise ordinary boots. Allocate the event log from EFI_LOADER_DATA again so that the Linux-created allocation does not appear as an E820 ACPI region. Preserve the kexec protection provided by commit 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to avoid corruption") by adding the event log range to the Linux EFI persistent memreserve table. On Linux 7.2, the stock kernel failed hibernation resume because of the E820 mismatch, while both an EFI_LOADER_DATA-only diagnostic build and this series resumed successfully. With this series, the TPM event log range remained reserved across both kexec_file_load() and kexec_load(). The contents exported through binary_bios_measurements were byte-for-byte identical before and after both kexec tests. Fixes: 77d48d39e991 ("efistub/tpm: Use ACPI reclaim memory for event log to= avoid corruption") Link: https://lore.kernel.org/all/DL3MNWW4VEBR.K3K6A92WMHUY@gmail.com/ Signed-off-by: Jasmeet (Jazz) Bhatia --- drivers/firmware/efi/libstub/tpm.c | 2 +- drivers/firmware/efi/tpm.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/tpm.c b/drivers/firmware/efi/libs= tub/tpm.c index a5c6c4f163fc..8e04aaf428d0 100644 --- a/drivers/firmware/efi/libstub/tpm.c +++ b/drivers/firmware/efi/libstub/tpm.c @@ -96,7 +96,7 @@ static void efi_retrieve_tcg2_eventlog(int version, efi_p= hysical_addr_t log_loca } =20 /* Allocate space for the logs and copy them. */ - status =3D efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY, + status =3D efi_bs_call(allocate_pool, EFI_LOADER_DATA, sizeof(*log_tbl) + log_size, (void **)&log_tbl); =20 if (status !=3D EFI_SUCCESS) { diff --git a/drivers/firmware/efi/tpm.c b/drivers/firmware/efi/tpm.c index cdd431027065..9771cc91d71e 100644 --- a/drivers/firmware/efi/tpm.c +++ b/drivers/firmware/efi/tpm.c @@ -15,6 +15,9 @@ =20 int efi_tpm_final_log_size; EXPORT_SYMBOL(efi_tpm_final_log_size); +#ifdef CONFIG_KEXEC_CORE +static unsigned int efi_tpm_eventlog_size __initdata; +#endif =20 static int __init tpm2_calc_event_log_size(void *data, int count, void *si= ze_info) { @@ -68,6 +71,10 @@ int __init efi_tpm_eventlog_init(void) goto out; } =20 +#ifdef CONFIG_KEXEC_CORE + efi_tpm_eventlog_size =3D tbl_size; +#endif + if (efi.tpm_final_log =3D=3D EFI_INVALID_TABLE_ADDR) { pr_info("TPM Final Events table not present\n"); goto out; @@ -114,3 +121,23 @@ int __init efi_tpm_eventlog_init(void) return ret; } =20 +#ifdef CONFIG_KEXEC_CORE +static int __init efi_tpm_eventlog_reserve_persistent(void) +{ + int ret; + + if (efi.tpm_log =3D=3D EFI_INVALID_TABLE_ADDR || + !efi_tpm_eventlog_size) + return 0; + + ret =3D efi_mem_reserve_persistent(efi.tpm_log, + efi_tpm_eventlog_size); + if (ret) + pr_warn("Failed to persistently reserve TPM Event Log: %d\n", + ret); + + return 0; +} +late_initcall(efi_tpm_eventlog_reserve_persistent); +#endif + --=20 2.55.0