mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
Merge tag 'firmware-20260617-pull-request' of https://gitlab.com/kraxel/qemu into staging
bugfixes and cleanups for igvm and uefi-vars # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmoycjYACgkQTLbY7tPo # cTgqcBAAxwTUiDHUSlhv11NG0cbfwPwKT8kcp5okw7My4Mja++d2b6+BMuhh993a # eoaKhu5WhhMMfgQVRZN5Utfi+kGBt/TBE0lT36KMNhPAaMEeXhdMNq+ukuF5ffTQ # XKDIxet+ty5oPGN4N8xnyzW4FPr8oowmcNoNqwyxOi/jZrXKQG55rr1BXD9xfMeW # teqwxL5YBHZwDhhpGHTpcGvuyE9rYZfZYKGrXWyKQAsde0yucr4Fp8dId8pnyD+X # 82n6GpbWJ22XUvxamcMSEFRXcYDkydi56WkxIz9WU+4aEtW0h42tsCe6tyDK5puG # o25nhxc+TEFJLD/G17tgqhsrUqj4UTZbFSZl2pexPT2jTrzpfA7uGe86gGelTOV3 # tWMyeh+ES0fJomq7e+Wp3OE3oXI3weDxgef0z6V5s1kym+P4qn9uux4YAFB1QPfx # 8aRZyYs89CSeX9EBsbu+0CEKqjBXPBBLFL/qXPMJZPtlTKtoHiIvm2EL5XuzfsUz # U6qjcdXdJH6WnsmsOLq8CYN7NxOUGGlV7TRT1aBBX6TvYJxOkGGPVA9sd77+odPV # BNNLzPJa/V89AKZZSKt8YBk5CiVGXPv6ORSIDNKGN5mXu11cypepx9WN+5nsq8ed # q0UvyoEv5C3264zbB92J7oK1xDtUeJFvzB0t/9RLCqk5zh8mAaI= # =UArT # -----END PGP SIGNATURE----- # gpg: Signature made Wed 17 Jun 2026 06:08:54 EDT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * tag 'firmware-20260617-pull-request' of https://gitlab.com/kraxel/qemu: igvm: fix handling of optional variable header types igvm: replace raw uint32_t with igvm library types hw/uefi: fix parse_hexstr Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -26,6 +26,25 @@
|
||||
#include <igvm/igvm.h>
|
||||
#include <igvm/igvm_defs.h>
|
||||
|
||||
#ifndef IGVM_VHT_OPTIONAL_BIT
|
||||
#define IGVM_VHT_OPTIONAL_BIT (1U << 31)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Bit 31 of the variable header type indicates that the header is
|
||||
* optional and can be safely ignored by a loader that does not
|
||||
* support it. If the bit is clear, the file cannot be loaded.
|
||||
* https://docs.rs/igvm_defs/0.4.0/igvm_defs/struct.IgvmVariableHeaderType.html
|
||||
*/
|
||||
static IgvmVariableHeaderType igvm_vht_type(IgvmVariableHeaderType type)
|
||||
{
|
||||
return type & ~IGVM_VHT_OPTIONAL_BIT;
|
||||
}
|
||||
|
||||
static bool igvm_vht_optional(IgvmVariableHeaderType type)
|
||||
{
|
||||
return !!(type & IGVM_VHT_OPTIONAL_BIT);
|
||||
}
|
||||
|
||||
/*
|
||||
* Some directives are specific to particular confidential computing platforms.
|
||||
@@ -102,8 +121,8 @@ static int qigvm_initialization_guest_policy(QIgvm *ctx,
|
||||
Error **errp);
|
||||
|
||||
struct QIGVMHandler {
|
||||
uint32_t type;
|
||||
uint32_t section;
|
||||
IgvmVariableHeaderType type;
|
||||
IgvmHeaderSection section;
|
||||
int (*handler)(QIgvm *ctx, const uint8_t *header_data, Error **errp);
|
||||
};
|
||||
|
||||
@@ -132,12 +151,14 @@ static struct QIGVMHandler handlers[] = {
|
||||
qigvm_directive_madt },
|
||||
};
|
||||
|
||||
static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp)
|
||||
static int qigvm_handler(QIgvm *ctx, IgvmVariableHeaderType raw_type,
|
||||
Error **errp)
|
||||
{
|
||||
size_t handler;
|
||||
IgvmHandle header_handle;
|
||||
const uint8_t *header_data;
|
||||
int result;
|
||||
IgvmVariableHeaderType type = igvm_vht_type(raw_type);
|
||||
|
||||
for (handler = 0; handler < G_N_ELEMENTS(handlers); handler++) {
|
||||
if (handlers[handler].type != type) {
|
||||
@@ -166,6 +187,13 @@ static int qigvm_handler(QIgvm *ctx, uint32_t type, Error **errp)
|
||||
igvm_free_buffer(ctx->file, header_handle);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (igvm_vht_optional(raw_type)) {
|
||||
warn_report("IGVM: Skipping unsupported optional header type 0x%"
|
||||
PRIX32, type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
error_setg(errp,
|
||||
"IGVM: Unknown header type encountered when processing file: "
|
||||
"(type 0x%X)",
|
||||
@@ -787,6 +815,7 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)
|
||||
header_index++) {
|
||||
IgvmVariableHeaderType typ = igvm_get_header_type(
|
||||
ctx->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
|
||||
typ = igvm_vht_type(typ);
|
||||
if (typ == IGVM_VHT_SUPPORTED_PLATFORM) {
|
||||
header_handle = igvm_get_header(
|
||||
ctx->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
|
||||
@@ -945,10 +974,10 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
|
||||
for (ctx.current_header_index = 0;
|
||||
ctx.current_header_index < (unsigned)header_count;
|
||||
ctx.current_header_index++) {
|
||||
IgvmVariableHeaderType type = igvm_get_header_type(
|
||||
IgvmVariableHeaderType raw_type = igvm_get_header_type(
|
||||
ctx.file, IGVM_HEADER_SECTION_DIRECTIVE, ctx.current_header_index);
|
||||
if (!onlyVpContext || (type == IGVM_VHT_VP_CONTEXT)) {
|
||||
if (qigvm_handler(&ctx, type, errp) < 0) {
|
||||
if (!onlyVpContext || igvm_vht_type(raw_type) == IGVM_VHT_VP_CONTEXT) {
|
||||
if (qigvm_handler(&ctx, raw_type, errp) < 0) {
|
||||
goto cleanup_parameters;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user