Browse Source
Add and wire up qigvm_x86_get_mem_map_entry function which converts the e820 table into an igvm memory map parameter. This makes igvm files for the native (non-confidential) platform with memory map parameter work. Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Luigi Leonardi <leonardi@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-ID: <20251029105555.2492276-4-kraxel@redhat.com>pull/307/head
6 changed files with 88 additions and 4 deletions
@ -0,0 +1,21 @@ |
|||
/*
|
|||
* QEMU IGVM, stubs |
|||
* |
|||
* Copyright (C) 2026 Red Hat |
|||
* |
|||
* Authors: |
|||
* Gerd Hoffmann <kraxel@redhat.com> |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
|
|||
#include "system/igvm.h" |
|||
|
|||
int qigvm_x86_get_mem_map_entry(int index, |
|||
ConfidentialGuestMemoryMapEntry *entry, |
|||
Error **errp) |
|||
{ |
|||
return -1; |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
/*
|
|||
* QEMU IGVM, support for native x86 guests |
|||
* |
|||
* Copyright (C) 2026 Red Hat |
|||
* |
|||
* Authors: |
|||
* Gerd Hoffmann <kraxel@redhat.com> |
|||
* |
|||
* SPDX-License-Identifier: GPL-2.0-or-later |
|||
*/ |
|||
|
|||
#include "qemu/osdep.h" |
|||
|
|||
#include "hw/i386/e820_memory_layout.h" |
|||
#include "system/igvm.h" |
|||
|
|||
/*
|
|||
* convert e820 table into igvm memory map |
|||
*/ |
|||
int qigvm_x86_get_mem_map_entry(int index, |
|||
ConfidentialGuestMemoryMapEntry *entry, |
|||
Error **errp) |
|||
{ |
|||
struct e820_entry *table; |
|||
int num_entries; |
|||
|
|||
num_entries = e820_get_table(&table); |
|||
if ((index < 0) || (index >= num_entries)) { |
|||
return 1; |
|||
} |
|||
entry->gpa = table[index].address; |
|||
entry->size = table[index].length; |
|||
switch (table[index].type) { |
|||
case E820_RAM: |
|||
entry->type = CGS_MEM_RAM; |
|||
break; |
|||
case E820_RESERVED: |
|||
entry->type = CGS_MEM_RESERVED; |
|||
break; |
|||
default: |
|||
/* should not happen */ |
|||
error_setg(errp, "unknown e820 type"); |
|||
return -1; |
|||
} |
|||
return 0; |
|||
} |
|||
Loading…
Reference in new issue