Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1695555 > unrolled thread
| Started by | Juergen Gross <jgross@suse.com> |
|---|---|
| First post | 2017-07-25 12:00 +0200 |
| Last post | 2017-07-26 09:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/3] x86: provide an init_mem_mapping hypervisor hook Juergen Gross <jgross@suse.com> - 2017-07-25 12:00 +0200
Re: [PATCH 1/3] x86: provide an init_mem_mapping hypervisor hook Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-07-25 16:10 +0200
Re: [PATCH 1/3] x86: provide an init_mem_mapping hypervisor hook Juergen Gross <jgross@suse.com> - 2017-07-26 09:50 +0200
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-07-25 12:00 +0200 |
| Subject | [PATCH 1/3] x86: provide an init_mem_mapping hypervisor hook |
| Message-ID | <u74Nb-1aa-9@gated-at.bofh.it> |
Provide a hook in hypervisor_x86 called after setting up initial
memory mapping.
This is needed e.g. by Xen HVM guests to map the hypervisor shared
info page.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/include/asm/hypervisor.h | 10 ++++++++++
arch/x86/mm/init.c | 3 +++
2 files changed, 13 insertions(+)
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index 21126155a739..60ebda5e5101 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -43,6 +43,9 @@ struct hypervisor_x86 {
/* pin current vcpu to specified physical cpu (run rarely) */
void (*pin_vcpu)(int);
+
+ /* called during init_mem_mapping() to setup early mappings. */
+ void (*init_mem_mapping)(void);
};
extern const struct hypervisor_x86 *x86_hyper;
@@ -57,8 +60,15 @@ extern const struct hypervisor_x86 x86_hyper_kvm;
extern void init_hypervisor_platform(void);
extern bool hypervisor_x2apic_available(void);
extern void hypervisor_pin_vcpu(int cpu);
+
+static inline void hypervisor_init_mem_mapping(void)
+{
+ if (x86_hyper->init_mem_mapping)
+ x86_hyper->init_mem_mapping();
+}
#else
static inline void init_hypervisor_platform(void) { }
static inline bool hypervisor_x2apic_available(void) { return false; }
+static inline void hypervisor_init_mem_mapping(void) { }
#endif /* CONFIG_HYPERVISOR_GUEST */
#endif /* _ASM_X86_HYPERVISOR_H */
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 673541eb3b3f..bf3f1065d6ad 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -18,6 +18,7 @@
#include <asm/dma.h> /* for MAX_DMA_PFN */
#include <asm/microcode.h>
#include <asm/kaslr.h>
+#include <asm/hypervisor.h>
/*
* We need to define the tracepoints somewhere, and tlb.c
@@ -636,6 +637,8 @@ void __init init_mem_mapping(void)
load_cr3(swapper_pg_dir);
__flush_tlb_all();
+ hypervisor_init_mem_mapping();
+
early_memtest(0, max_pfn_mapped << PAGE_SHIFT);
}
--
2.12.3
[toc] | [next] | [standalone]
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
|---|---|
| Date | 2017-07-25 16:10 +0200 |
| Message-ID | <u78H8-3MX-21@gated-at.bofh.it> |
| In reply to | #1695555 |
On 07/25/2017 05:50 AM, Juergen Gross wrote: > Provide a hook in hypervisor_x86 called after setting up initial > memory mapping. > > This is needed e.g. by Xen HVM guests to map the hypervisor shared > info page. This is not necessarily a problem specific to guests so I wonder whether the hook should be part of x86_platform_ops or some other x86 structure. -boris
[toc] | [prev] | [next] | [standalone]
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-07-26 09:50 +0200 |
| Message-ID | <u7peV-5RS-5@gated-at.bofh.it> |
| In reply to | #1695767 |
On 25/07/17 16:09, Boris Ostrovsky wrote: > On 07/25/2017 05:50 AM, Juergen Gross wrote: >> Provide a hook in hypervisor_x86 called after setting up initial >> memory mapping. >> >> This is needed e.g. by Xen HVM guests to map the hypervisor shared >> info page. > > This is not necessarily a problem specific to guests so I wonder whether > the hook should be part of x86_platform_ops or some other x86 structure. I'm fine with any solution. I've chosen the hypervisor struct as right now there seems to be a need for HVM Xen guests only. Juergen
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web