From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399336; b=2fVzSyrP5ymONjZSk1nJwhHxgMvHuDbbcNFA6TqN4mrz1ECoF5Pouc4XVlf9xeLfkLrV Id5YntUoIb0FfTdrhQWYBK16TxCfMqczNYvvzqQPGXrxiGfjY8VAD49HUOfkKz3CS88N6 KBTnmIQq94EcIilNG5409zmp17zEJdvMd/jiBS3Fzet/1zfQKB4sjvcj+WPL+wyCxKIgb kEbyE7mu05utfz69/Xg4YWAu5+25UZRNQyEmCVayqB1dPSdW1PsKcejHaWWabT8O3BVVT 04jznsmJWKyhhNDgRpkCIBzOn81Xnc/oL2lARMBK12H6UJ+vA6G1dU2Aj9ftJ1keAdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399336; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:In-Reply-To:Mime-Version: References:X-Developer-Key:X-Developer-Signature:X-Mailer:Message-ID: Subject:From:To:Cc:Content-Type; bh=TnCs43s7hXMYmMw4zM0sGGCuuyWYBPozH0qu1FmbnQw=; b=yZDzMzRb084U5pizgk4LUaRmu1Y7QIFGeFkar/7UANVjjixd9OoUz+qYu85ujwMo0oDk nx/lUdKOX379pj/9oAK28GHlnbMTtXptJGrdgS39gRkSloItILDTPUZTHyJozS9jws8pd NeGJ73WFR3U6jF7Ia2RIzNzqoVTZn+noEivqfetfQVhGbU7nluXWOfxrF/mxn7ZYnmLga 4ZOuuPTSm50O2shv7UPWMXhKkJAmF35Z1XspqZ2AssHpDD4xGVBJGBLTs3YE/Cu/jirC3 nlz2y/J+UaohBMxk195zm2HEUVRyKaWiroVkAsaHQJFrLHjfJPeWkg+zDGbHTwh8AUQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=BPubdI51; arc=none smtp.remote-ip=209.85.128.69 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1CFB606A322 for ; Fri, 4 Dec 2026 15:48:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1CFB606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=BPubdI51 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4bba856092dso8080645e9.1 for ; Fri, 04 Dec 2026 07:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796399334; x=1797004134; darn=vger.kernel.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=TnCs43s7hXMYmMw4zM0sGGCuuyWYBPozH0qu1FmbnQw=; b=BPubdI51rO131R2L9Uk6y8NeXlVuP9l17Cwgp0oPw4QawKXMmjnOdrco0O2htAQZuL aBAB2NnPBTMWclBV30EKTU7rlMRnoPDHOXaVrXQV5/0TGg2J4jVD58WmXidAF3hnte51 QZi/OI7tzwSUl1Oy1pPBSZauzZ79giM3syy1Z8NCp1/jRpPxqacH/JQ+lzBbhQ187PIO rP/6kBqylml5JD3i5NdxfVXWqv6+b0DsOdKQF4ZbagxDMxQj6QQawnKBq17+WbPIMPwV xD3itIptWw43naopeZltBxaZmE8bFpJyOZfYq9kfgEt5uW+LCVVX+7kXPk0Mg6vjMdvZ QM+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796399334; x=1797004134; 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=TnCs43s7hXMYmMw4zM0sGGCuuyWYBPozH0qu1FmbnQw=; b=KZlzqcB3YoX/eqZ1yIcRr1D39feN9C2zdiIh3URp/w0lUcw/D5BchPY/mdP6uiROEy 5sdJobXNSVn3tYbTjmZVp9qQ0IWqqFTMwXaW7JrtYDDZlQVkhkTh8qQUi4HTEbacdP6i BACOXZFzba9AyBlaC5DZPaHaT9FmbfP3Ex4M1BSWaDZeDuu0LjGmEefTlmP/HBRwq9yk MgzWLpFiIsQSJGaVtYEUvIhHvPOJpYQ7c+HByboWm3ST55GNx9TN2n1JYsV6g/TVHqmR Qq5AuU7qivp88F7TGZjqJDjWWlVlsMW5Srz4byZgPYQ3pPl8Mnitc0AaNyhjkbOGi7Ux bzGg== X-Gm-Message-State: APuU4Z/bv08FZ2QeLFT74fBj/EMKbB2DyMJdaX3mxmXQpTMBuixiMPJs aCTyZkBu6NFOE7XYq8VlVX/vMmc+wlsDsybjH+dK3a0EbnGmCDCS0Ck5Nhw6nz9hX6LXG4nd6CF Mtgpz7MVEzcBLq0wTTQos5JSicHejgqUplqrzSMTjsiPcNnN0Y1ZXzOVQc9xHyBaLNxf/ytia7B It6Tpb7S4F4BF949qBRbb3H8ZGhJHAlQ== X-Received: from wmom23.prod.google.com ([2002:a05:600c:4617:b0:4a1:ae53:2fe9]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1d9b:b0:4bb:e7b4:31f0 with SMTP id 5b1f17b1804b1-4bbeb60139amr50283995e9.0.1796399334356; Fri, 04 Dec 2026 07:48:54 -0800 (PST) Date: Fri, 4 Dec 2026 16:48:46 +0100 In-Reply-To: <20261204154842.414894-5-ardb+git@google.com> X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261204154842.414894-5-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=2817; i=ardb@kernel.org; h=from:subject; bh=l74XG5u6m6fPZRsS+VzvfybQukIw1AlzPk+GhqOHIcA=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIVvowX3eF8pCnp9/frrbbMMtElFkIC/5/blTQddN3vDDJ /RulJZ1lLIwiHExyIopsgjM/vtu5+mJUrXOs2Rh5rAygQxh4OIUgIm87mBk2L5wt8OLJnYNJsbN j/IS9y7yjGNnWR/eyr1Getm7w+ybpjIyfDuxdK3sm7zSs91rV+9KPmbGl2MntNX8f+nW/y8n659 dzQgA X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261204154842.414894-8-ardb+git@google.com> Subject: [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: Ard Biesheuvel , Borislav Petkov , Tom Lendacky , Ashish Kalra Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel One of the last things the EFI stub does before handing over to the core kernel when booting as a SEV guest is enabling SEV, even though this is mostly redundant: one of the first things the core kernel does is calling sme_enable(), after setting up the early GDT and IDT but before even setting up the kernel page tables. sme_enable() performs the same SEV-SNP initialization that the decompressor performs in sev_enable(). The only check performed by sev_enable() that was not covered by the core kernel, i.e., whether the hypervisor supports the SVSM GHCB events when not running at VMPL0, has been moved into svsm_setup_ca() in the previous patch. Note that the identity mapping of the CC blob and the secrets page that the decompressor creates in sev_prep_identity_maps() is not needed either, given that EFI maps all of system memory 1:1. So let's just drop this call to sev_enable(), and rely on the core kernel to initialize SEV correctly. Signed-off-by: Ard Biesheuvel --- arch/x86/include/asm/sev.h | 2 -- drivers/firmware/efi/libstub/x86-stub.c | 6 ------ 2 files changed, 8 deletions(-) diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h index c7ea9845351e..3682e39ed295 100644 --- a/arch/x86/include/asm/sev.h +++ b/arch/x86/include/asm/sev.h @@ -462,7 +462,6 @@ static __always_inline void sev_es_nmi_complete(void) __sev_es_nmi_complete(); } extern int __init sev_es_efi_map_ghcbs_cas(pgd_t *pgd); -extern void sev_enable(struct boot_params *bp); /* * RMPADJUST modifies the RMP permissions of a page of a lesser- @@ -606,7 +605,6 @@ static inline void sev_es_ist_exit(void) { } static inline int sev_es_setup_ap_jump_table(struct real_mode_header *rmh) { return 0; } static inline void sev_es_nmi_complete(void) { } static inline int sev_es_efi_map_ghcbs_cas(pgd_t *pgd) { return 0; } -static inline void sev_enable(struct boot_params *bp) { } static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate) { return 0; } static inline int rmpadjust(unsigned long vaddr, bool rmp_psize, unsigned long attrs) { return 0; } static inline void setup_ghcb(void) { } diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 1cceab57a738..66b98c6c0e2a 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -1052,12 +1052,6 @@ void __noreturn efi_stub_entry(efi_handle_t handle, goto fail; } - /* - * Call the SEV init code while still running with the firmware's - * GDT/IDT, so #VC exceptions will be handled by EFI. - */ - sev_enable(boot_params); - efi_5level_switch(); enter_kernel(kernel_entry, boot_params); -- 2.56.1.915.g69d5ec7298-goog