linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maran Wilson <maran.wilson@oracle.com>
To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, pbonzini@redhat.com, jgross@suse.com
Cc: JBeulich@suse.com, roger.pau@citrix.com,
	boris.ostrovsky@oracle.com, rkrcmar@redhat.com,
	maran.wilson@oracle.com
Subject: [PATCH v8 6/7] xen/pvh: Add memory map pointer to hvm_start_info struct
Date: Wed,  5 Dec 2018 22:06:02 -0800	[thread overview]
Message-ID: <1544076362-22090-1-git-send-email-maran.wilson@oracle.com> (raw)
In-Reply-To: <1544076152-21637-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>
Reviewed-by: Juergen Gross <jgross@suse.com>
---
 include/xen/interface/hvm/start_info.h | 63 +++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/include/xen/interface/hvm/start_info.h b/include/xen/interface/hvm/start_info.h
index 648415976ead..50af9ea2ff1e 100644
--- a/include/xen/interface/hvm/start_info.h
+++ b/include/xen/interface/hvm/start_info.h
@@ -33,7 +33,7 @@
  *    | 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.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
@@ -48,6 +48,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,13 +71,51 @@
  *    | 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. 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.
  *
@@ -86,6 +133,13 @@ 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.                                */
+    /* All following fields only present in version 1 and newer */
+    uint64_t memmap_paddr;      /* Physical address of an array of           */
+                                /* hvm_memmap_table_entry.                   */
+    uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
+                                /* Value will be zero if there is no memory  */
+                                /* map being provided.                       */
+    uint32_t reserved;          /* Must be zero.                             */
 };
 
 struct hvm_modlist_entry {
@@ -95,4 +149,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__ */
-- 
2.16.1


  parent reply	other threads:[~2018-12-06  6:06 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  6:02 [PATCH v8 0/7] KVM: x86: Allow Qemu/KVM to use PVH entry point Maran Wilson
2018-12-06  6:04 ` [PATCH v8 1/7] xen/pvh: Split CONFIG_XEN_PVH into CONFIG_PVH and CONFIG_XEN_PVH Maran Wilson
2018-12-06 22:11   ` Paolo Bonzini
2018-12-06 22:34     ` Boris Ostrovsky
2018-12-06 22:49       ` Paolo Bonzini
2018-12-06 23:11         ` Boris Ostrovsky
2018-12-06 23:30           ` Paolo Bonzini
2018-12-06 23:36             ` [Xen-devel] " Andrew Cooper
2018-12-07  6:02     ` Juergen Gross
2018-12-07 13:41       ` Paolo Bonzini
2018-12-07 13:50         ` Juergen Gross
2018-12-07 13:52           ` Paolo Bonzini
2018-12-07 13:58             ` Juergen Gross
2018-12-07 15:14               ` Paolo Bonzini
2018-12-07 18:21                 ` Maran Wilson
2018-12-06  6:04 ` [PATCH v8 2/7] xen/pvh: Move PVH entry code out of Xen specific tree Maran Wilson
2018-12-06  6:05 ` [PATCH v8 3/7] xen/pvh: Create a new file for Xen specific PVH code Maran Wilson
2018-12-06  6:05 ` [PATCH v8 4/7] xen/pvh: Move Xen specific PVH VM initialization out of common file Maran Wilson
2018-12-06  6:05 ` [PATCH v8 5/7] xen/pvh: Move Xen code for getting mem map via hcall " Maran Wilson
2018-12-06  6:06 ` Maran Wilson [this message]
2018-12-06  6:06 ` [PATCH v8 7/7] KVM: x86: Allow Qemu/KVM to use PVH entry point Maran Wilson
2018-12-06 22:05   ` Paolo Bonzini
2018-12-06 21:21 ` [PATCH v8 0/7] " Paolo Bonzini
2018-12-06 21:37   ` Borislav Petkov
2018-12-06 21:58     ` Boris Ostrovsky
2018-12-06 22:14       ` Paolo Bonzini
2018-12-07 10:25         ` Borislav Petkov
2018-12-07 16:07           ` [Xen-devel] " Boris Ostrovsky
2018-12-07 19:22             ` Borislav Petkov
2018-12-12 18:09   ` Maran Wilson
2018-12-12 18:17     ` Boris Ostrovsky
2018-12-13 13:13     ` Paolo Bonzini

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=1544076362-22090-1-git-send-email-maran.wilson@oracle.com \
    --to=maran.wilson@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.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).