[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/4] hvmloader: add support to load extra ACPI tables from qemu
NVDIMM devices are detected and configured by software through ACPI. Currently, QEMU maintains ACPI tables of vNVDIMM devices. This patch extends the existing mechanism in hvmloader of loading passthrough ACPI tables to load extra ACPI tables built by QEMU. Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx> --- tools/firmware/hvmloader/acpi/build.c | 34 +++++++++++++++++++++++++++------ xen/include/public/hvm/hvm_xs_strings.h | 3 +++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c index 503648c..72be3e0 100644 --- a/tools/firmware/hvmloader/acpi/build.c +++ b/tools/firmware/hvmloader/acpi/build.c @@ -292,8 +292,10 @@ static struct acpi_20_slit *construct_slit(void) return slit; } -static int construct_passthrough_tables(unsigned long *table_ptrs, - int nr_tables) +static int construct_passthrough_tables_common(unsigned long *table_ptrs, + int nr_tables, + const char *xs_acpi_pt_addr, + const char *xs_acpi_pt_length) { const char *s; uint8_t *acpi_pt_addr; @@ -304,26 +306,28 @@ static int construct_passthrough_tables(unsigned long *table_ptrs, uint32_t total = 0; uint8_t *buffer; - s = xenstore_read(HVM_XS_ACPI_PT_ADDRESS, NULL); + s = xenstore_read(xs_acpi_pt_addr, NULL); if ( s == NULL ) - return 0; + return 0; acpi_pt_addr = (uint8_t*)(uint32_t)strtoll(s, NULL, 0); if ( acpi_pt_addr == NULL ) return 0; - s = xenstore_read(HVM_XS_ACPI_PT_LENGTH, NULL); + s = xenstore_read(xs_acpi_pt_length, NULL); if ( s == NULL ) return 0; acpi_pt_length = (uint32_t)strtoll(s, NULL, 0); for ( nr_added = 0; nr_added < nr_max; nr_added++ ) - { + { if ( (acpi_pt_length - total) < sizeof(struct acpi_header) ) break; header = (struct acpi_header*)acpi_pt_addr; + set_checksum(header, offsetof(struct acpi_header, checksum), + header->length); buffer = mem_alloc(header->length, 16); if ( buffer == NULL ) @@ -338,6 +342,21 @@ static int construct_passthrough_tables(unsigned long *table_ptrs, return nr_added; } +static int construct_passthrough_tables(unsigned long *table_ptrs, + int nr_tables) +{ + return construct_passthrough_tables_common(table_ptrs, nr_tables, + HVM_XS_ACPI_PT_ADDRESS, + HVM_XS_ACPI_PT_LENGTH); +} + +static int construct_dm_tables(unsigned long *table_ptrs, int nr_tables) +{ + return construct_passthrough_tables_common(table_ptrs, nr_tables, + HVM_XS_DM_ACPI_PT_ADDRESS, + HVM_XS_DM_ACPI_PT_LENGTH); +} + static int construct_secondary_tables(unsigned long *table_ptrs, struct acpi_info *info) { @@ -454,6 +473,9 @@ static int construct_secondary_tables(unsigned long *table_ptrs, /* Load any additional tables passed through. */ nr_tables += construct_passthrough_tables(table_ptrs, nr_tables); + /* Load any additional tables from device model */ + nr_tables += construct_dm_tables(table_ptrs, nr_tables); + table_ptrs[nr_tables] = 0; return nr_tables; } diff --git a/xen/include/public/hvm/hvm_xs_strings.h b/xen/include/public/hvm/hvm_xs_strings.h index 146b0b0..4698495 100644 --- a/xen/include/public/hvm/hvm_xs_strings.h +++ b/xen/include/public/hvm/hvm_xs_strings.h @@ -41,6 +41,9 @@ #define HVM_XS_ACPI_PT_ADDRESS "hvmloader/acpi/address" #define HVM_XS_ACPI_PT_LENGTH "hvmloader/acpi/length" +#define HVM_XS_DM_ACPI_PT_ADDRESS "hvmloader/dm-acpi/address" +#define HVM_XS_DM_ACPI_PT_LENGTH "hvmloader/dm-acpi/length" + /* Any number of SMBIOS types can be passed through to an HVM guest using * the following xenstore values. The values specify the guest physical * address and length of a block of SMBIOS structures for hvmloader to use. -- 2.4.8 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |