mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 06:19:24 +00:00
hv: add ACPI support for pre-launched VMs
Statically define the per vm RSDP/XSDT/MADT ACPI template tables in vacpi.c, RSDP/XSDT tables are copied to guest physical memory after checksum is calculated. For MADT table, first fix up process id/lapic id in its lapic subtable, then the MADT table's checksum is calculated before it is copies to guest physical memory. Add 8-bit checksum function in util.h Tracked-On: #3601 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
#define ACPI_RSDP_CHECKSUM_LENGTH 20U
|
||||
#define ACPI_RSDP_XCHECKSUM_LENGTH 36U
|
||||
|
||||
#define ACPI_NAME_SIZE 4U
|
||||
#define ACPI_OEM_ID_SIZE 6U
|
||||
@@ -19,6 +20,7 @@
|
||||
#define ACPI_MADT_TYPE_LOCAL_APIC 0U
|
||||
#define ACPI_MADT_TYPE_IOAPIC 1U
|
||||
#define ACPI_MADT_ENABLED 1U
|
||||
#define ACPI_MADT_TYPE_LOCAL_APIC_NMI 4U
|
||||
|
||||
/* FACP field offsets */
|
||||
#define OFFSET_FACS_ADDR 36U
|
||||
@@ -37,6 +39,7 @@
|
||||
#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
|
||||
#define ACPI_SIG_FACS 0x53434146U /* "FACS" */
|
||||
#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Ptr */
|
||||
#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */
|
||||
#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
|
||||
#define ACPI_SIG_DMAR "DMAR"
|
||||
|
||||
@@ -127,13 +130,20 @@ struct acpi_madt_local_apic {
|
||||
uint32_t lapic_flags;
|
||||
} __packed;
|
||||
|
||||
struct acpi_madt_local_apic_nmi {
|
||||
struct acpi_subtable_header header;
|
||||
uint8_t processor_id;
|
||||
uint16_t flags;
|
||||
uint8_t lint;
|
||||
} __packed;
|
||||
|
||||
struct acpi_madt_ioapic {
|
||||
struct acpi_subtable_header header;
|
||||
/* IOAPIC id */
|
||||
uint8_t id;
|
||||
uint8_t rsvd;
|
||||
uint32_t addr;
|
||||
uint32_t gsi_base;
|
||||
uint8_t id;
|
||||
uint8_t rsvd;
|
||||
uint32_t addr;
|
||||
uint32_t gsi_base;
|
||||
} __packed;
|
||||
|
||||
enum acpi_dmar_type {
|
||||
|
Reference in New Issue
Block a user