xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Maran Wilson <maran.wilson@oracle.com>
To: xen-devel@lists.xen.org
Cc: andrew.cooper3@citrix.com, boris.ostrovsky@oracle.com,
	roger.pau@citrix.com, jbeulich@suse.com, maran.wilson@oracle.com
Subject: [PATCH v3 1/4] x86/PVHv2: Add memory map pointer to hvm_start_info struct
Date: Thu, 15 Mar 2018 14:33:09 -0700	[thread overview]
Message-ID: <1521149589-21200-2-git-send-email-maran.wilson@oracle.com> (raw)
In-Reply-To: <1521149589-21200-1-git-send-email-maran.wilson@oracle.com>

The start info structure that is defined as part of the x86/HVM direct boot
ABI and used for starting Xen PVH guests would be more versatile if it also
included a way to pass information about the memory map to the guest. This
would allow KVM guests to share the same entry point.

Signed-off-by: Maran Wilson <maran.wilson@oracle.com>
---
 xen/include/public/arch-x86/hvm/start_info.h | 66 +++++++++++++++++++++++++++-
 1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/xen/include/public/arch-x86/hvm/start_info.h b/xen/include/public/arch-x86/hvm/start_info.h
index 6484159..f2e8ba6 100644
--- a/xen/include/public/arch-x86/hvm/start_info.h
+++ b/xen/include/public/arch-x86/hvm/start_info.h
@@ -33,8 +33,9 @@
  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
  *  4 +----------------+
- *    | version        | Version of this structure. Current version is 0. New
+ *    | version        | Version of this structure. Current version is 1. New
  *    |                | versions are guaranteed to be backwards-compatible.
+ *    |                | For PV guests only 0 allowed, for PVH 0 or 1 allowed.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
  * 12 +----------------+
@@ -48,6 +49,15 @@
  * 32 +----------------+
  *    | rsdp_paddr     | Physical address of the RSDP ACPI data structure.
  * 40 +----------------+
+ *    | memmap_paddr   | Physical address of the (optional) memory map. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 48 +----------------+
+ *    | memmap_entries | Number of entries in the memory map table. Zero
+ *    |                | if there is no memory map being provided. Only
+ *    |                | present in version 1 and newer of the structure.
+ * 52 +----------------+
+ *    | reserved       | Version 1 and newer only.
+ * 56 +----------------+
  *
  * The layout of each entry in the module structure is the following:
  *
@@ -62,14 +72,53 @@
  *    | reserved       |
  * 32 +----------------+
  *
+ * The layout of each entry in the memory map table is as follows:
+ *
+ *  0 +----------------+
+ *    | addr           | Base address
+ *  8 +----------------+
+ *    | size           | Size of mapping in bytes
+ * 16 +----------------+
+ *    | type           | Type of mapping as defined between the hypervisor
+ *    |                | and guest it's starting. See XEN_HVM_MEMMAP_TYPE_*
+ *    |                | values below.
+ * 20 +----------------|
+ *    | reserved       |
+ * 24 +----------------+
+ *
  * The address and sizes are always a 64bit little endian unsigned integer.
  *
  * NB: Xen on x86 will always try to place all the data below the 4GiB
  * boundary.
+ *
+ * Version numbers of the hvm_start_info structure have evolved like this:
+ *
+ * Version 0:  Initial implementation.
+ *
+ * Version 1:  Added the memmap_paddr/memmap_entries fields (plus 4 bytes of
+ *             padding) to the end of the hvm_start_info struct. These new
+ *             fields can be used to pass a memory map to the guest. The
+ *             memory map is optional and so guests that understand version 1
+ *             of the structure must check that memmap_entries is non-zero
+ *             before trying to read the memory map.
  */
 #define XEN_HVM_START_MAGIC_VALUE 0x336ec578
 
 /*
+ * The values used in the type field of the memory map table entries are
+ * defined below and match the Address Range Types as defined in the "System
+ * Address Map Interfaces" section of the ACPI Specification. Please refer to
+ * section 15 in version 6.2 of the ACPI spec: http://uefi.org/specifications
+ */
+#define XEN_HVM_MEMMAP_TYPE_RAM       1
+#define XEN_HVM_MEMMAP_TYPE_RESERVED  2
+#define XEN_HVM_MEMMAP_TYPE_ACPI      3
+#define XEN_HVM_MEMMAP_TYPE_NVS       4
+#define XEN_HVM_MEMMAP_TYPE_UNUSABLE  5
+#define XEN_HVM_MEMMAP_TYPE_DISABLED  6
+#define XEN_HVM_MEMMAP_TYPE_PMEM      7
+
+/*
  * C representation of the x86/HVM start info layout.
  *
  * The canonical definition of this layout is above, this is just a way to
@@ -86,6 +135,14 @@ struct hvm_start_info {
     uint64_t cmdline_paddr;     /* Physical address of the command line.     */
     uint64_t rsdp_paddr;        /* Physical address of the RSDP ACPI data    */
                                 /* structure.                                */
+    uint64_t memmap_paddr;	/* Physical address of an array of           */
+				/* hvm_memmap_table_entry. Only present in   */
+				/* version 1 and newer of the structure      */
+    uint32_t memmap_entries;	/* Number of entries in the memmap table.    */
+				/* Only present in version 1 and newer of    */
+				/* the structure. Value will be zero if      */
+				/* there is no memory map being provided.    */
+    uint32_t reserved;		/* Must be zero for Version 1.		     */
 };
 
 struct hvm_modlist_entry {
@@ -95,4 +152,11 @@ struct hvm_modlist_entry {
     uint64_t reserved;
 };
 
+struct hvm_memmap_table_entry {
+    uint64_t addr;		/* Base address of the memory region         */
+    uint64_t size;		/* Size of the memory region in bytes        */
+    uint32_t type;		/* Mapping type                              */
+    uint32_t reserved;		/* Must be zero for Version 1.		     */
+};
+
 #endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-03-15 21:33 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 21:33 [PATCH v3 0/4] x86/PVHv2: Add memory map pointer to hvm_start_info struct Maran Wilson
2018-03-15 21:33 ` Maran Wilson [this message]
2018-03-16 11:02   ` [PATCH v3 1/4] " Jan Beulich
2018-03-16 11:11   ` Roger Pau Monné
2018-03-16 11:29     ` Jan Beulich
2018-03-16 11:37       ` Roger Pau Monné
2018-03-16 11:48         ` Jan Beulich
2018-03-16 11:58           ` Roger Pau Monné
2018-03-16 12:05           ` Juergen Gross
2018-03-16 12:25             ` Jan Beulich
2018-03-16 17:00     ` Maran Wilson
2018-03-16 17:59       ` Roger Pau Monné
2018-03-20 16:05       ` Konrad Rzeszutek Wilk
2018-03-15 21:35 ` [PATCH v3 2/4] libxl: Move libxl__arch_domain_construct_memmap() earlier Maran Wilson
2018-03-16 18:12   ` Roger Pau Monné
2018-03-16 18:34     ` Boris Ostrovsky
2018-03-15 21:35 ` [PATCH v3 3/4] libxl: Store PVH guest's e820 map in xc_dom_image Maran Wilson
2018-03-16 18:20   ` Roger Pau Monné
2018-03-16 18:44     ` Boris Ostrovsky
2018-03-15 21:35 ` [PATCH v3 4/4] libxc: Pass e820 map to PVH guest via hvm_start_info Maran Wilson
2018-03-16 18:29   ` Roger Pau Monné
2018-03-21 16:00     ` Wei Liu
2018-03-20 16:48 ` [PATCH v4 0/4] x86/PVHv2: Add memory map pointer to hvm_start_info struct Maran Wilson
2018-03-20 16:48   ` [PATCH v4 1/4] " Maran Wilson
2018-03-20 17:03     ` Jan Beulich
2018-03-21  9:28     ` Roger Pau Monné
2018-03-21  9:40       ` Juergen Gross
2018-03-21 16:46         ` Maran Wilson
2018-03-21 16:48           ` Juergen Gross
2018-03-21 16:58           ` Roger Pau Monné
2018-03-20 16:50   ` [PATCH v4 2/4] libxl/x86: Build e820 map earlier for HVM/PVH guests Maran Wilson
2018-03-21  9:37     ` Roger Pau Monné
2018-03-21 17:49     ` Wei Liu
2018-03-21 17:56       ` Boris Ostrovsky
2018-03-20 16:50   ` [PATCH v4 3/4] libxl: Store e820 map in xc_dom_image Maran Wilson
2018-03-21  9:42     ` Roger Pau Monné
2018-03-21 13:26       ` Boris Ostrovsky
2018-03-20 16:50   ` [PATCH v4 4/4] libxc: Pass e820 map to HVM/PVH guests via hvm_start_info Maran Wilson
2018-03-21 10:07     ` Roger Pau Monné
2018-03-21 13:37       ` Boris Ostrovsky
2018-03-21 14:18         ` Roger Pau Monné
2018-03-21 17:53           ` Boris Ostrovsky
2018-03-22  9:15             ` Roger Pau Monné
2018-03-28 11:05             ` Wei Liu

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=1521149589-21200-2-git-send-email-maran.wilson@oracle.com \
    --to=maran.wilson@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@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).