: HVM NUMA guest: generate SRAT table
PATCH 1/5 : HVM NUMA guest: generate SRAT table
The attached patch extends the hvm_info_table to include NUMA topology information. The hvmloader will read these entries and will generate an appropriate ACPI SRAT table. For now the information is zeroed in libxc, so that the SRAT generation will be skipped until activated in a later patch. (At least) Linux seems to be quite picky about the SRAT table, "odd" memory borders will crash it early. I am not sure whether sanity checks should be introduced here in the hvmloader or in libxc.
Comments welcome.
Regards,
Andre.
Signature · 9 lines
Andre Przywara AMD-Operating System Research Center (OSRC), Dresden, Germany Tel: +49 351 488-3567-12 ----to satisfy European Law for business letters: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Andrew Bowd; Thomas M. McCoy; Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
commit 9fed27f6b4ca3c3fae6aef792008ee620c3bc28d
Author: Andre Przywara <[email protected]> Date: Mon Feb 1 00:47:32 2010 +0100
generate SRAT table for HVM guests
tools/firmware/hvmloader/acpi/acpi2_0.h +57 -0
@@ -356,6 +356,61 @@ struct acpi_20_madt_intsrcovr { };/* +* System Resource Affinity Table header definition (SRAT). +*/ +struct acpi_20_srat { +struct acpi_header header; +uint32_t table_revision; +uint32_t reserved2[2 ]; +}; + +#define ACPI_SRAT_TABLE_REVISION 1 + +/* +* System Resource Affinity Table structure types. +*/ +#define ACPI_PROCESSOR_AFFIN 0x00 +#define ACPI_MEMORY_AFFIN 0x01 + +struct acpi_20_srat_processor { +uint8_t type; +uint8_t length; +uint8_t domain; +uint8_t apic_id; +uint32_t flags; +uint8_t sapic_id; +uint8_t domain_hi[3 ]; +uint32_t reserved; +}; + +/* +* Local APIC Affinity Flags. All other bits are reserved and must be 0. +*/ +#define ACPI_LOCAL_APIC_AFFIN_ENABLED (1 << 0) + +struct acpi_20_srat_memory { +uint8_t type; +uint8_t length; +uint8_t domain; +uint8_t domain_hi[3 ];/* this is ACPI 3.0, reserved in 2.0 */ +uint16_t reserved; +uint32_t base_address_lo; +uint32_t base_address_hi; +uint32_t length_lo; +uint32_t length_hi; +uint32_t reserved2; +uint32_t flags; +uint32_t reserved3[2 ]; +}; + +/* +* Memory Affinity Flags. All other bits are reserved and must be 0. +*/ +#define ACPI_MEM_AFFIN_ENABLED (1 << 0) +#define ACPI_MEM_AFFIN_HOTPLUGGABLE (1 << 1) +#define ACPI_MEM_AFFIN_NONVOLATILE (1 << 2)/* this is ACPI 3.0 */ + +/* * Table Signatures. */ #define ACPI_2_0_RSDP_SIGNATURE ASCII64('R','S','D',' ','P','T','R',' ')
@@ -366,6 +421,7 @@ struct acpi_20_madt_intsrcovr {#define ACPI_2_0_XSDT_SIGNATURE ASCII32('X','S','D','T')#define ACPI_2_0_TCPA_SIGNATURE ASCII32('T','C','P','A')#define ACPI_2_0_HPET_SIGNATURE ASCII32('H','P','E','T') +#define ACPI_2_0_SRAT_SIGNATURE ASCII32('S','R','A','T')/* * Table revision numbers.
@@ -378,6 +434,7 @@ struct acpi_20_madt_intsrcovr {#define ACPI_2_0_TCPA_REVISION 0x02#define ACPI_2_0_HPET_REVISION 0x01#define ACPI_1_0_FADT_REVISION 0x01 +#define ACPI_2_0_SRAT_REVISION 0x01#pragma pack ()
tools/firmware/hvmloader/acpi/build.c +99 -0
117 lines not on this page · raw message
tools/libxc/xc_hvm_build.c +4 -0
@@ -60,6 +60,10 @@ static void build_hvm_info(void *hvm_info_page, uint64_t mem_size) hvm_info->high_mem_pgend = highmem_end >>PAGE_SHIFT ; hvm_info->reserved_mem_pgstart =special_pfn (0 ); + hvm_info->num_nodes =0 ; +memset (hvm_info->vcpu_to_node,0 ,4 *HVM_MAX_VCPUS ); +memset (hvm_info->node_mem,0 ,4 *64 ); +/* Finish with the checksum. */ for ( i =0 , sum =0 ; i < hvm_info->length; i++ ) sum += ((uint8_t *)hvm_info)[i];
xen/include/public/hvm/hvm_info_table.h +3 -0
@@ -70,6 +70,9 @@ struct hvm_info_table {/* Bitmap of which CPUs are online at boot time. */ uint8_t vcpu_online[HVM_MAX_VCPUS /8 ]; +uint32_t num_nodes; +uint8_t vcpu_to_node[HVM_MAX_VCPUS ]; + uint32_t node_mem[64]; };#endif /* __XEN_PUBLIC_HVM_HVM_INFO_TABLE_H__ */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel