Use the new acpi_build_madt_standalone() function to fill the MADT parameter field. The IGVM parameter can be consumed by Coconut SVSM [1], instead of relying on the fw_cfg interface, which has caused problems before due to unexpected access [2,3]. Using IGVM parameters is the default way for Coconut SVSM across hypervisors; switching over would allow removing specialized code paths for QEMU in Coconut. Coconut SVSM needs to know the SMP configuration, but does not look at any other ACPI data, nor does it interact with the PCI bus settings. Since the MADT is static and not linked with other ACPI tables, it can be supplied stand-alone like this. Generating the MADT twice (during ACPI table building and IGVM processing) seems acceptable, since there is no infrastructure to obtain the MADT out of the ACPI table memory area. In any case OVMF, which runs after SVSM has already been initialized, will continue reading all ACPI tables via fw_cfg and provide fixed up ACPI data to the OS as before without any changes. The IGVM parameter handler is implemented for the i386 machine target and stubbed for all others. [1] https://github.com/coconut-svsm/svsm/pull/858 [2] https://gitlab.com/qemu-project/qemu/-/issues/2882 [3] https://github.com/coconut-svsm/svsm/issues/646 Signed-off-by: Oliver Steffen <osteffen@redhat.com> Message-ID: <20260130054714.715928-10-osteffen@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
83 lines
2.0 KiB
C
83 lines
2.0 KiB
C
/*
|
|
* QEMU IGVM private data structures
|
|
*
|
|
* Everything which depends on igvm library headers goes here.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef QEMU_IGVM_INTERNAL_H
|
|
#define QEMU_IGVM_INTERNAL_H
|
|
|
|
#include "qemu/queue.h"
|
|
#include "qemu/typedefs.h"
|
|
#include "qom/object.h"
|
|
#include "hw/core/boards.h"
|
|
#include "hw/core/resettable.h"
|
|
|
|
#include "system/confidential-guest-support.h"
|
|
#include <igvm/igvm.h>
|
|
|
|
struct IgvmCfg {
|
|
ObjectClass parent_class;
|
|
|
|
/*
|
|
* filename: Filename that specifies a file that contains the configuration
|
|
* of the guest in Independent Guest Virtual Machine (IGVM)
|
|
* format.
|
|
*/
|
|
char *filename;
|
|
IgvmHandle file;
|
|
ResettableState reset_state;
|
|
};
|
|
|
|
typedef struct QIgvmParameterData {
|
|
QTAILQ_ENTRY(QIgvmParameterData) next;
|
|
uint8_t *data;
|
|
uint32_t size;
|
|
uint32_t index;
|
|
} QIgvmParameterData;
|
|
|
|
/*
|
|
* QIgvm contains the information required during processing of a single IGVM
|
|
* file.
|
|
*/
|
|
typedef struct QIgvm {
|
|
IgvmHandle file;
|
|
MachineState *machine_state;
|
|
ConfidentialGuestSupportClass *cgsc;
|
|
uint32_t compatibility_mask;
|
|
unsigned current_header_index;
|
|
QTAILQ_HEAD(, QIgvmParameterData) parameter_data;
|
|
IgvmPlatformType platform_type;
|
|
|
|
/*
|
|
* SEV-SNP platforms can contain an ID block and authentication
|
|
* that should be verified by the guest.
|
|
*/
|
|
struct sev_id_block *id_block;
|
|
struct sev_id_authentication *id_auth;
|
|
|
|
/* Define the guest policy for SEV guests */
|
|
uint64_t sev_policy;
|
|
|
|
/* These variables keep track of contiguous page regions */
|
|
IGVM_VHS_PAGE_DATA region_prev_page_data;
|
|
uint64_t region_start;
|
|
unsigned region_start_index;
|
|
unsigned region_last_index;
|
|
unsigned region_page_count;
|
|
} QIgvm;
|
|
|
|
IgvmHandle qigvm_file_init(char *filename, Error **errp);
|
|
|
|
QIgvmParameterData*
|
|
qigvm_find_param_entry(QIgvm *igvm, uint32_t parameter_area_index);
|
|
|
|
/*
|
|
* IGVM parameter handlers
|
|
*/
|
|
int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **errp);
|
|
|
|
#endif
|