mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-24 23:04:17 +08:00
c2106a231c
The GHCB specification section 2.7 states that when SEV-SNP is enabled,
a guest should not rely on the hypervisor to provide the address of the
AP jump table. Instead, if a guest BIOS wants to provide an AP jump
table, it should record the address in the SNP secrets page so the guest
operating system can obtain it directly from there.
Fix this on the guest kernel side by having SNP guests use the AP jump
table address published in the secrets page rather than issuing a GHCB
request to get it.
[ mroth:
- Improve error handling when ioremap()/memremap() return NULL
- Don't mix function calls with declarations
- Add missing __init
- Tweak commit message ]
Fixes: 0afb6b660a
("x86/sev: Use SEV-SNP AP creation to start secondary CPUs")
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20220422135624.114172-3-michael.roth@amd.com
64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2021 Advanced Micro Devices, Inc.
|
|
*
|
|
* Author: Brijesh Singh <brijesh.singh@amd.com>
|
|
*
|
|
* SEV-SNP API spec is available at https://developer.amd.com/sev
|
|
*/
|
|
|
|
#ifndef __VIRT_SEVGUEST_H__
|
|
#define __VIRT_SEVGUEST_H__
|
|
|
|
#include <linux/types.h>
|
|
|
|
#define MAX_AUTHTAG_LEN 32
|
|
|
|
/* See SNP spec SNP_GUEST_REQUEST section for the structure */
|
|
enum msg_type {
|
|
SNP_MSG_TYPE_INVALID = 0,
|
|
SNP_MSG_CPUID_REQ,
|
|
SNP_MSG_CPUID_RSP,
|
|
SNP_MSG_KEY_REQ,
|
|
SNP_MSG_KEY_RSP,
|
|
SNP_MSG_REPORT_REQ,
|
|
SNP_MSG_REPORT_RSP,
|
|
SNP_MSG_EXPORT_REQ,
|
|
SNP_MSG_EXPORT_RSP,
|
|
SNP_MSG_IMPORT_REQ,
|
|
SNP_MSG_IMPORT_RSP,
|
|
SNP_MSG_ABSORB_REQ,
|
|
SNP_MSG_ABSORB_RSP,
|
|
SNP_MSG_VMRK_REQ,
|
|
SNP_MSG_VMRK_RSP,
|
|
|
|
SNP_MSG_TYPE_MAX
|
|
};
|
|
|
|
enum aead_algo {
|
|
SNP_AEAD_INVALID,
|
|
SNP_AEAD_AES_256_GCM,
|
|
};
|
|
|
|
struct snp_guest_msg_hdr {
|
|
u8 authtag[MAX_AUTHTAG_LEN];
|
|
u64 msg_seqno;
|
|
u8 rsvd1[8];
|
|
u8 algo;
|
|
u8 hdr_version;
|
|
u16 hdr_sz;
|
|
u8 msg_type;
|
|
u8 msg_version;
|
|
u16 msg_sz;
|
|
u32 rsvd2;
|
|
u8 msg_vmpck;
|
|
u8 rsvd3[35];
|
|
} __packed;
|
|
|
|
struct snp_guest_msg {
|
|
struct snp_guest_msg_hdr hdr;
|
|
u8 payload[4000];
|
|
} __packed;
|
|
|
|
#endif /* __VIRT_SEVGUEST_H__ */
|