From: Haozhong Zhang <haozhong.zhang@intel.com>
To: xen-devel@lists.xen.org
Cc: Haozhong Zhang <haozhong.zhang@intel.com>,
Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Jan Beulich <jbeulich@suse.com>, Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH 4/4] hvmloader: add support to load extra ACPI tables from qemu
Date: Tue, 29 Dec 2015 19:31:51 +0800 [thread overview]
Message-ID: <1451388711-18646-5-git-send-email-haozhong.zhang@intel.com> (raw)
In-Reply-To: <1451388711-18646-1-git-send-email-haozhong.zhang@intel.com>
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@intel.com>
---
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
next prev parent reply other threads:[~2015-12-29 11:31 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-29 11:31 [PATCH 0/4] add support for vNVDIMM Haozhong Zhang
2015-12-29 11:31 ` [PATCH 1/4] x86/hvm: allow guest to use clflushopt and clwb Haozhong Zhang
2015-12-29 15:46 ` Andrew Cooper
2015-12-30 1:35 ` Haozhong Zhang
2015-12-30 2:16 ` Haozhong Zhang
2015-12-30 10:33 ` Andrew Cooper
2015-12-29 11:31 ` [PATCH 2/4] x86/hvm: add support for pcommit instruction Haozhong Zhang
2015-12-29 11:31 ` [PATCH 3/4] tools/xl: add a new xl configuration 'nvdimm' Haozhong Zhang
2016-01-04 11:16 ` Wei Liu
2016-01-06 12:40 ` Jan Beulich
2016-01-06 15:28 ` Haozhong Zhang
2015-12-29 11:31 ` Haozhong Zhang [this message]
2016-01-15 17:10 ` [PATCH 4/4] hvmloader: add support to load extra ACPI tables from qemu Jan Beulich
2016-01-18 0:52 ` Haozhong Zhang
2016-01-18 8:46 ` Jan Beulich
2016-01-19 11:37 ` Wei Liu
2016-01-19 11:46 ` Jan Beulich
2016-01-20 5:14 ` Tian, Kevin
2016-01-20 5:58 ` Zhang, Haozhong
2016-01-20 5:31 ` Haozhong Zhang
2016-01-20 8:46 ` Jan Beulich
2016-01-20 8:58 ` Andrew Cooper
2016-01-20 10:15 ` Haozhong Zhang
2016-01-20 10:36 ` Xiao Guangrong
2016-01-20 13:16 ` Andrew Cooper
2016-01-20 14:29 ` Stefano Stabellini
2016-01-20 14:42 ` Haozhong Zhang
2016-01-20 14:45 ` Andrew Cooper
2016-01-20 14:53 ` Haozhong Zhang
2016-01-20 15:13 ` Konrad Rzeszutek Wilk
2016-01-20 15:29 ` Haozhong Zhang
2016-01-20 15:41 ` Konrad Rzeszutek Wilk
2016-01-20 15:54 ` Haozhong Zhang
2016-01-21 3:35 ` Bob Liu
2016-01-20 15:05 ` Stefano Stabellini
2016-01-20 18:14 ` Andrew Cooper
2016-01-20 14:38 ` Haozhong Zhang
2016-01-20 11:04 ` Haozhong Zhang
2016-01-20 11:20 ` Jan Beulich
2016-01-20 15:29 ` Xiao Guangrong
2016-01-20 15:47 ` Konrad Rzeszutek Wilk
2016-01-20 16:25 ` Xiao Guangrong
2016-01-20 16:47 ` Konrad Rzeszutek Wilk
2016-01-20 16:55 ` Xiao Guangrong
2016-01-20 17:18 ` Konrad Rzeszutek Wilk
2016-01-20 17:23 ` Xiao Guangrong
2016-01-20 17:48 ` Konrad Rzeszutek Wilk
2016-01-21 3:12 ` Haozhong Zhang
2016-01-20 17:07 ` Jan Beulich
2016-01-20 17:17 ` Xiao Guangrong
2016-01-21 8:18 ` Jan Beulich
2016-01-21 8:25 ` Xiao Guangrong
2016-01-21 8:53 ` Jan Beulich
2016-01-21 9:10 ` Xiao Guangrong
2016-01-21 9:29 ` Andrew Cooper
2016-01-21 10:26 ` Jan Beulich
2016-01-21 10:25 ` Jan Beulich
2016-01-21 14:01 ` Haozhong Zhang
2016-01-21 14:52 ` Jan Beulich
2016-01-22 2:43 ` Haozhong Zhang
2016-01-26 11:44 ` George Dunlap
2016-01-26 12:44 ` Jan Beulich
2016-01-26 12:54 ` Juergen Gross
2016-01-26 14:44 ` Konrad Rzeszutek Wilk
2016-01-26 15:37 ` Jan Beulich
2016-01-26 15:57 ` Haozhong Zhang
2016-01-26 16:34 ` Jan Beulich
2016-01-26 19:32 ` Konrad Rzeszutek Wilk
2016-01-27 7:22 ` Haozhong Zhang
2016-01-27 10:16 ` Jan Beulich
2016-01-27 14:50 ` Konrad Rzeszutek Wilk
2016-01-27 10:55 ` George Dunlap
2016-01-26 13:58 ` George Dunlap
2016-01-26 14:46 ` Konrad Rzeszutek Wilk
2016-01-26 15:30 ` Haozhong Zhang
2016-01-26 15:33 ` Haozhong Zhang
2016-01-26 15:57 ` Jan Beulich
2016-01-27 2:23 ` Haozhong Zhang
2016-01-20 15:07 ` Konrad Rzeszutek Wilk
2016-01-06 15:37 ` [PATCH 0/4] add support for vNVDIMM Ian Campbell
2016-01-06 15:47 ` Haozhong Zhang
2016-01-20 3:28 ` Tian, Kevin
2016-01-20 12:43 ` Stefano Stabellini
2016-01-20 14:26 ` Zhang, Haozhong
2016-01-20 14:35 ` Stefano Stabellini
2016-01-20 14:47 ` Zhang, Haozhong
2016-01-20 14:54 ` Andrew Cooper
2016-01-20 15:59 ` Haozhong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451388711-18646-5-git-send-email-haozhong.zhang@intel.com \
--to=haozhong.zhang@intel.com \
--cc=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).