From: Wei Liu <wl@xen.org>
To: Xen Development List <xen-devel@lists.xenproject.org>
Cc: "Wei Liu" <liuwe@microsoft.com>, "Wei Liu" <wl@xen.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Paul Durrant" <pdurrant@amazon.com>,
"Michael Kelley" <mikelley@microsoft.com>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH v7 04/10] x86/hypervisor: provide hypervisor_fixup_e820
Date: Tue, 4 Feb 2020 15:36:58 +0000 [thread overview]
Message-ID: <20200204153704.15934-5-liuwe@microsoft.com> (raw)
In-Reply-To: <20200204153704.15934-1-liuwe@microsoft.com>
And implement the hook for Xen guest.
Signed-off-by: Wei Liu <liuwe@microsoft.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
v7:
1. Drop bogus ASSERT_UNREACHABLE from stub
2. Add Jan's Rb, considering #1 doesn't change the meat of the patch
---
xen/arch/x86/e820.c | 4 ++--
xen/arch/x86/guest/hypervisor.c | 6 ++++++
xen/arch/x86/guest/xen/xen.c | 7 +++++++
xen/include/asm-x86/guest/hypervisor.h | 6 ++++++
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index b9f589cac3..160f029edd 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -691,8 +691,8 @@ unsigned long __init init_e820(const char *str, struct e820map *raw)
machine_specific_memory_setup(raw);
- if ( pv_shim )
- pv_shim_fixup_e820(&e820);
+ if ( cpu_has_hypervisor )
+ hypervisor_e820_fixup(&e820);
printk("%s RAM map:\n", str);
print_e820_memory_map(e820.map, e820.nr_map);
diff --git a/xen/arch/x86/guest/hypervisor.c b/xen/arch/x86/guest/hypervisor.c
index e72c92ffdf..5fd433c8d4 100644
--- a/xen/arch/x86/guest/hypervisor.c
+++ b/xen/arch/x86/guest/hypervisor.c
@@ -66,6 +66,12 @@ void hypervisor_resume(void)
ops->resume();
}
+void __init hypervisor_e820_fixup(struct e820map *e820)
+{
+ if ( ops && ops->e820_fixup )
+ ops->e820_fixup(e820);
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/arch/x86/guest/xen/xen.c b/xen/arch/x86/guest/xen/xen.c
index 1cf09886da..5a7f3cce42 100644
--- a/xen/arch/x86/guest/xen/xen.c
+++ b/xen/arch/x86/guest/xen/xen.c
@@ -322,11 +322,18 @@ static void resume(void)
pv_console_init();
}
+static void __init e820_fixup(struct e820map *e820)
+{
+ if ( pv_shim )
+ pv_shim_fixup_e820(e820);
+}
+
static const struct hypervisor_ops ops = {
.name = "Xen",
.setup = setup,
.ap_setup = ap_setup,
.resume = resume,
+ .e820_fixup = e820_fixup,
};
const struct hypervisor_ops *__init xg_probe(void)
diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/asm-x86/guest/hypervisor.h
index 64383f0c3d..ade10e74ea 100644
--- a/xen/include/asm-x86/guest/hypervisor.h
+++ b/xen/include/asm-x86/guest/hypervisor.h
@@ -19,6 +19,8 @@
#ifndef __X86_HYPERVISOR_H__
#define __X86_HYPERVISOR_H__
+#include <asm/e820.h>
+
struct hypervisor_ops {
/* Name of the hypervisor */
const char *name;
@@ -28,6 +30,8 @@ struct hypervisor_ops {
int (*ap_setup)(void);
/* Resume from suspension */
void (*resume)(void);
+ /* Fix up e820 map */
+ void (*e820_fixup)(struct e820map *e820);
};
#ifdef CONFIG_GUEST
@@ -36,6 +40,7 @@ const char *hypervisor_probe(void);
void hypervisor_setup(void);
int hypervisor_ap_setup(void);
void hypervisor_resume(void);
+void hypervisor_e820_fixup(struct e820map *e820);
#else
@@ -46,6 +51,7 @@ static inline const char *hypervisor_probe(void) { return NULL; }
static inline void hypervisor_setup(void) { ASSERT_UNREACHABLE(); }
static inline int hypervisor_ap_setup(void) { return 0; }
static inline void hypervisor_resume(void) { ASSERT_UNREACHABLE(); }
+static inline void hypervisor_e820_fixup(struct e820map *e820) {}
#endif /* CONFIG_GUEST */
--
2.20.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2020-02-04 15:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 15:36 [Xen-devel] [PATCH v7 00/10] More Hyper-V infrastructures Wei Liu
2020-02-04 15:36 ` [Xen-devel] [PATCH v7 01/10] x86/hypervisor: make hypervisor_ap_setup return an error code Wei Liu
2020-02-04 16:48 ` Wei Liu
2020-02-04 16:56 ` Roger Pau Monné
2020-02-04 17:03 ` Wei Liu
2020-02-05 11:12 ` Jan Beulich
2020-02-05 12:09 ` Wei Liu
2020-02-05 12:42 ` Jan Beulich
2020-02-04 15:36 ` [Xen-devel] [PATCH v7 02/10] x86/smp: don't online cpu if hypervisor_ap_setup fails Wei Liu
2020-02-04 15:36 ` [Xen-devel] [PATCH v7 03/10] x86: provide executable fixmap facility Wei Liu
2020-02-05 11:15 ` Jan Beulich
2020-02-04 15:36 ` Wei Liu [this message]
2020-02-04 15:36 ` [Xen-devel] [PATCH v7 05/10] x86/hyperv: setup hypercall page Wei Liu
2020-02-05 14:04 ` Roger Pau Monné
2020-02-05 15:00 ` Wei Liu
2020-02-05 15:03 ` Wei Liu
2020-02-05 15:52 ` Durrant, Paul
2020-02-04 15:37 ` [Xen-devel] [PATCH v7 06/10] x86/hyperv: provide Hyper-V hypercall functions Wei Liu
2020-02-05 11:17 ` Jan Beulich
2020-02-04 15:37 ` [Xen-devel] [PATCH v7 07/10] DO NOT APPLY: x86/hyperv: issue an hypercall Wei Liu
2020-02-04 15:37 ` [Xen-devel] [PATCH v7 08/10] x86/hyperv: provide percpu hypercall input page Wei Liu
2020-02-04 15:37 ` [Xen-devel] [PATCH v7 09/10] x86/hyperv: retrieve vp_index from Hyper-V Wei Liu
2020-02-04 15:37 ` [Xen-devel] [PATCH v7 10/10] x86/hyperv: setup VP assist page 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=20200204153704.15934-5-liuwe@microsoft.com \
--to=wl@xen.org \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=liuwe@microsoft.com \
--cc=mikelley@microsoft.com \
--cc=pdurrant@amazon.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.