|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] hvmloader: move passthrough initialization from ACPI code
commit bea437908b27c751012abe14c4312dd4d159ff23
Author: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
AuthorDate: Tue Aug 9 17:31:15 2016 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 9 17:31:15 2016 +0200
hvmloader: move passthrough initialization from ACPI code
Initialize it in hvmloader, avoiding ACPI code's use of xenstore_read()
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
tools/firmware/hvmloader/acpi/build.c | 28 +++++++++-------------------
tools/firmware/hvmloader/acpi/libacpi.h | 5 +++++
tools/firmware/hvmloader/util.c | 11 +++++++++++
3 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/tools/firmware/hvmloader/acpi/build.c
b/tools/firmware/hvmloader/acpi/build.c
index e5a63bc..360dd1c 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -287,37 +287,27 @@ static struct acpi_20_slit *construct_slit(void)
}
static int construct_passthrough_tables(unsigned long *table_ptrs,
- int nr_tables)
+ int nr_tables,
+ struct acpi_config *config)
{
- const char *s;
- uint8_t *acpi_pt_addr;
- uint32_t acpi_pt_length;
+ unsigned long pt_addr;
struct acpi_header *header;
int nr_added;
int nr_max = (ACPI_MAX_SECONDARY_TABLES - nr_tables - 1);
uint32_t total = 0;
uint8_t *buffer;
- s = xenstore_read(HVM_XS_ACPI_PT_ADDRESS, NULL);
- if ( s == NULL )
- 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);
- if ( s == NULL )
+ if ( config->pt.addr == 0 )
return 0;
- acpi_pt_length = (uint32_t)strtoll(s, NULL, 0);
+ pt_addr = config->pt.addr;
for ( nr_added = 0; nr_added < nr_max; nr_added++ )
{
- if ( (acpi_pt_length - total) < sizeof(struct acpi_header) )
+ if ( (config->pt.length - total) < sizeof(struct acpi_header) )
break;
- header = (struct acpi_header*)acpi_pt_addr;
+ header = (struct acpi_header*)pt_addr;
buffer = mem_alloc(header->length, 16);
if ( buffer == NULL )
@@ -326,7 +316,7 @@ static int construct_passthrough_tables(unsigned long
*table_ptrs,
table_ptrs[nr_tables++] = (unsigned long)buffer;
total += header->length;
- acpi_pt_addr += header->length;
+ pt_addr += header->length;
}
return nr_added;
@@ -447,7 +437,7 @@ static int construct_secondary_tables(unsigned long
*table_ptrs,
}
/* Load any additional tables passed through. */
- nr_tables += construct_passthrough_tables(table_ptrs, nr_tables);
+ nr_tables += construct_passthrough_tables(table_ptrs, nr_tables, config);
table_ptrs[nr_tables] = 0;
return nr_tables;
diff --git a/tools/firmware/hvmloader/acpi/libacpi.h
b/tools/firmware/hvmloader/acpi/libacpi.h
index c2da152..de4470a 100644
--- a/tools/firmware/hvmloader/acpi/libacpi.h
+++ b/tools/firmware/hvmloader/acpi/libacpi.h
@@ -44,6 +44,11 @@ struct acpi_config {
uint64_t vm_gid[2];
unsigned long vm_gid_addr; /* OUT parameter */
+ struct {
+ uint32_t addr;
+ uint32_t length;
+ } pt;
+
/*
* Address where acpi_info should be placed.
* This must match the OperationRegion(BIOS, SystemMemory, ....)
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index f01a3fd..b2d3421 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -27,6 +27,7 @@
#include <xen/xen.h>
#include <xen/memory.h>
#include <xen/sched.h>
+#include <xen/hvm/hvm_xs_strings.h>
#include <xen/hvm/params.h>
/*
@@ -900,6 +901,16 @@ void hvmloader_acpi_build_tables(struct acpi_config
*config,
config->vm_gid[1] = strtoll(end+1, NULL, 0);
}
+ s = xenstore_read(HVM_XS_ACPI_PT_ADDRESS, NULL);
+ if ( s )
+ {
+ config->pt.addr = strtoll(s, NULL, 0);
+
+ s = xenstore_read(HVM_XS_ACPI_PT_LENGTH, NULL);
+ if ( s )
+ config->pt.length = strtoll(s, NULL, 0);
+ }
+
if ( battery_port_exists() )
config->table_flags |= ACPI_HAS_SSDT_PM;
if ( !strncmp(xenstore_read("platform/acpi_s3", "1"), "1", 1) )
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |