|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 22/34] x86/mm: put HVM only code under CONFIG_HVM
Going through the code, nested EPT, EPT, and ALTP2M depend on HVM code. Put
these components under CONFIG_HVM. This further requires putting one
of the vm event under CONFIG_HVM.
Also make hap_enabled evaluate to false when !CONFIG_HVM. This in turn
requires marking a variable in p2m_set_entry as __maybe_unused.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
xen/arch/x86/mm/Makefile | 5 +++--
xen/arch/x86/mm/hap/Makefile | 2 +-
xen/arch/x86/mm/p2m.c | 17 ++++++++++-------
xen/common/vm_event.c | 2 ++
xen/include/asm-x86/hvm/domain.h | 4 ++++
5 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 3017119..156a321 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -2,8 +2,9 @@ subdir-y += shadow
subdir-y += hap
obj-y += paging.o
-obj-y += p2m.o p2m-pt.o p2m-ept.o p2m-pod.o
-obj-y += altp2m.o
+obj-y += p2m.o p2m-pt.o p2m-pod.o
+obj-$(CONFIG_HVM) += p2m-ept.o
+obj-$(CONFIG_HVM) += altp2m.o
obj-y += guest_walk_2.o
obj-y += guest_walk_3.o
obj-y += guest_walk_4.o
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index b14a9af..a8e44de 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -3,7 +3,7 @@ obj-y += guest_walk_2level.o
obj-y += guest_walk_3level.o
obj-y += guest_walk_4level.o
obj-y += nested_hap.o
-obj-y += nested_ept.o
+obj-$(CONFIG_HVM) += nested_ept.o
guest_walk_%level.o: guest_walk.c Makefile
$(CC) $(CFLAGS) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1a04b34..2111cb6 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -531,7 +531,7 @@ struct page_info *p2m_get_page_from_gfn(
int p2m_set_entry(struct p2m_domain *p2m, gfn_t gfn, mfn_t mfn,
unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
{
- struct domain *d = p2m->domain;
+ struct domain * __maybe_unused d = p2m->domain;
unsigned long todo = 1ul << page_order;
unsigned int order;
int set_rc, rc = 0;
@@ -1708,12 +1708,6 @@ void p2m_mem_paging_resume(struct domain *d,
vm_event_response_t *rsp)
}
}
-void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
-{
- if ( altp2m_active(v->domain) )
- p2m_switch_vcpu_altp2m_by_id(v, idx);
-}
-
static struct p2m_domain *
p2m_getlru_nestedp2m(struct domain *d, struct p2m_domain *p2m)
{
@@ -2165,6 +2159,14 @@ int unmap_mmio_regions(struct domain *d,
return i == nr ? 0 : i ?: ret;
}
+#if CONFIG_HVM
+
+void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
+{
+ if ( altp2m_active(v->domain) )
+ p2m_switch_vcpu_altp2m_by_id(v, idx);
+}
+
bool_t p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx)
{
struct domain *d = v->domain;
@@ -2542,6 +2544,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t
gfn,
return ret;
}
+#endif /* CONFIG_HVM */
/*** Audit ***/
diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c
index 144ab81..2824673 100644
--- a/xen/common/vm_event.c
+++ b/xen/common/vm_event.c
@@ -429,9 +429,11 @@ void vm_event_resume(struct domain *d, struct
vm_event_domain *ved)
*/
vm_event_toggle_singlestep(d, v, &rsp);
+#if CONFIG_HVM
/* Check for altp2m switch */
if ( rsp.flags & VM_EVENT_FLAG_ALTERNATE_P2M )
p2m_altp2m_check(v, rsp.altp2m_idx);
+#endif
if ( rsp.flags & VM_EVENT_FLAG_SET_REGISTERS )
vm_event_set_registers(v, &rsp);
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index 5885950..8d28b54 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -202,7 +202,11 @@ struct hvm_domain {
};
};
+#if CONFIG_HVM
#define hap_enabled(d) ((d)->arch.hvm_domain.hap_enabled)
+#else
+#define hap_enabled(d) false
+#endif
#endif /* __ASM_X86_HVM_DOMAIN_H__ */
--
git-series 0.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |