Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp245296pxw; Fri, 8 Apr 2022 06:37:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDWZfZHK6sRIUn7krBUhQdNgsXCt6x2435CHAA5S66zDWLEW58R/cdIal36m3JdyNAHha5 X-Received: by 2002:a17:90a:d083:b0:1c9:94bb:732d with SMTP id k3-20020a17090ad08300b001c994bb732dmr21968942pju.106.1649425073570; Fri, 08 Apr 2022 06:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649425073; cv=none; d=google.com; s=arc-20160816; b=ciZyTCD3ecevg1g+0ruHOlUrd/S9jBKLDmfSH3kJSIaKwi4dhW17BLSy/TFtwIccpY 0iERNoeWZQBU5mR/mKAqtor5MG4WX3PP5IBKNq3/abOuijbJzTJzugHlEW42nuexdS/K O6N0mEOPsao+DP1w6kP0+MfCXblPlCh58wmHVxcKhO07WFRSMyQzOrdsnxvrGazlJ8Ud JrgrMnvzRZ0az0Hd6DYvJ6fGixMv6fNVHnOuGAR/lh5nHvnXmvjU9B/3ncO/STboTiRf lfvgKiat5BG2rC1VHAVWe4oXe53k75MzmUfUIHd57W6zFWSR19YXNLLcfZ/zEfAiNOpb 9JBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=uC9grcVxHB8dUVb/ecuMjOgXJrcPVeth/LxfCK+bX7M=; b=fLHWzq5OfNCKHlGv3PwZ+fmb63iYL2Wbj/thQnuOqYRs9GrOJykZY40O7ca1sI0y+H PIqgw/avXZuLxy45vBRXNZMmyhg/BzMDv+NRvJ4LyVdqPlC5g9D6qtmGCfKCBuGimkyN 5vXTK3UTKmgxWo5Nb4rh4XIfVQ3eSqzX2J1jVrKWk3Cvyn6VaY7P1apHhaVXuuT7lVjd cfR9Rgz4qoftCDppiICP6XoJ4u0iP0kjcU3hdJotsiU3uNQkbTT++y+w5i6kItpiI2CD Dmo7gCXPEGYN/wUCcpkTuHSkLDYxSDri/kAy/WTat5EMqNOkRp4zxeiFgtfAJLA/7hHn 9FWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WSQ4r81O; dkim=neutral (no key) header.i=@linutronix.de header.b=eyiyC1GA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm14-20020a17090b3ece00b001bd14e0308fsi1345363pjb.103.2022.04.08.06.37.38; Fri, 08 Apr 2022 06:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WSQ4r81O; dkim=neutral (no key) header.i=@linutronix.de header.b=eyiyC1GA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233029AbiDHJPa (ORCPT + 99 others); Fri, 8 Apr 2022 05:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232868AbiDHJLa (ORCPT ); Fri, 8 Apr 2022 05:11:30 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6E04184B45; Fri, 8 Apr 2022 02:08:56 -0700 (PDT) Date: Fri, 08 Apr 2022 09:08:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649408935; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uC9grcVxHB8dUVb/ecuMjOgXJrcPVeth/LxfCK+bX7M=; b=WSQ4r81OOdfnRP1khhdhCj0LHXYxJYfQTkuVm37y2I5ZFuCHe7BYST2Spf4lQx/vscKG7O EVuiHiidxdW3GSi7HqZM58PSZ9ORIbJXkk2Ykp4/G8+xUdpAwvp3/JYW/T6jZqhSg+jelP 2N2FnJMuJZwd8gt6nH6tRr2RBOqRs+XibV1x4ZwIb5YZk0chp21citjwRrYhjoYhfrONwr z0T9+f9WObt/FIGv99GJ/SwjZWGN52jyhUNIsZROWh2nNH5oGPqbSYu8J9IQkKKzOeDH4g SImCtaN2O3V8PfhrzDzB6IS0ERKnfvbBhEKRkAHdYKY2zZbmZJMgveQxMQqpGg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649408935; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uC9grcVxHB8dUVb/ecuMjOgXJrcPVeth/LxfCK+bX7M=; b=eyiyC1GADpynZs+WQ/+l5OZPl3Tkw4m6nyrAe/ahT6VwU9V+sqRPR7XldAYQAruETTqpaM 846mYTnu8cJkL2DQ== From: "tip-bot2 for Brijesh Singh" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/boot: Add Confidential Computing type to setup_data Cc: Brijesh Singh , Borislav Petkov , Ard Biesheuvel , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220307213356.2797205-30-brijesh.singh@amd.com> References: <20220307213356.2797205-30-brijesh.singh@amd.com> MIME-Version: 1.0 Message-ID: <164940893438.389.17413815716726834375.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/sev branch of tip: Commit-ID: 5ea98e01ab524cbc53dad8aebd27b434ebe5d074 Gitweb: https://git.kernel.org/tip/5ea98e01ab524cbc53dad8aebd27b434ebe5d074 Author: Brijesh Singh AuthorDate: Mon, 07 Mar 2022 15:33:39 -06:00 Committer: Borislav Petkov CommitterDate: Thu, 07 Apr 2022 16:46:33 +02:00 x86/boot: Add Confidential Computing type to setup_data While launching encrypted guests, the hypervisor may need to provide some additional information during the guest boot. When booting under an EFI-based BIOS, the EFI configuration table contains an entry for the confidential computing blob that contains the required information. To support booting encrypted guests on non-EFI VMs, the hypervisor needs to pass this additional information to the guest kernel using a different method. For this purpose, introduce SETUP_CC_BLOB type in setup_data to hold the physical address of the confidential computing blob location. The boot loader or hypervisor may choose to use this method instead of an EFI configuration table. The CC blob location scanning should give preference to a setup_data blob over an EFI configuration table. In AMD SEV-SNP, the CC blob contains the address of the secrets and CPUID pages. The secrets page includes information such as a VM to PSP communication key and the CPUID page contains PSP-filtered CPUID values. Define the AMD SEV confidential computing blob structure. While at it, define the EFI GUID for the confidential computing blob. [ bp: Massage commit message, mark struct __packed. ] Signed-off-by: Brijesh Singh Signed-off-by: Borislav Petkov Acked-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20220307213356.2797205-30-brijesh.singh@amd.com --- arch/x86/include/asm/sev.h | 18 ++++++++++++++++++ arch/x86/include/uapi/asm/bootparam.h | 1 + include/linux/efi.h | 1 + 3 files changed, 20 insertions(+) diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h index a3203b2..8c934bd 100644 --- a/arch/x86/include/asm/sev.h +++ b/arch/x86/include/asm/sev.h @@ -42,6 +42,24 @@ struct es_em_ctxt { struct es_fault_info fi; }; +/* + * AMD SEV Confidential computing blob structure. The structure is + * defined in OVMF UEFI firmware header: + * https://github.com/tianocore/edk2/blob/master/OvmfPkg/Include/Guid/ConfidentialComputingSevSnpBlob.h + */ +#define CC_BLOB_SEV_HDR_MAGIC 0x45444d41 +struct cc_blob_sev_info { + u32 magic; + u16 version; + u16 reserved; + u64 secrets_phys; + u32 secrets_len; + u32 rsvd1; + u64 cpuid_phys; + u32 cpuid_len; + u32 rsvd2; +} __packed; + void do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code); static inline u64 lower_bits(u64 val, unsigned int bits) diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index b25d3f8..1ac5acc 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h @@ -10,6 +10,7 @@ #define SETUP_EFI 4 #define SETUP_APPLE_PROPERTIES 5 #define SETUP_JAILHOUSE 6 +#define SETUP_CC_BLOB 7 #define SETUP_INDIRECT (1<<31) diff --git a/include/linux/efi.h b/include/linux/efi.h index ccd4d3f..984aa68 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -390,6 +390,7 @@ void efi_native_runtime_setup(void); #define EFI_CERT_SHA256_GUID EFI_GUID(0xc1c41626, 0x504c, 0x4092, 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28) #define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72) #define EFI_CERT_X509_SHA256_GUID EFI_GUID(0x3bd2a492, 0x96c0, 0x4079, 0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed) +#define EFI_CC_BLOB_GUID EFI_GUID(0x067b1f5f, 0xcf26, 0x44c5, 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42) /* * This GUID is used to pass to the kernel proper the struct screen_info