|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 15/23] x86/mm: put HVM only code under CONFIG_HVM
On Sun, Aug 26, 2018 at 01:19:48PM +0100, Wei Liu wrote:
> Going through the code, HAP, EPT, PoD 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 | 7 ++++---
> xen/arch/x86/mm/p2m.c | 17 ++++++++++-------
> xen/common/vm_event.c | 2 ++
> xen/include/asm-x86/hvm/domain.h | 4 ++++
> 4 files changed, 20 insertions(+), 10 deletions(-)
>
> diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
> index 3017119..e3b7be8 100644
> --- a/xen/arch/x86/mm/Makefile
> +++ b/xen/arch/x86/mm/Makefile
> @@ -1,9 +1,10 @@
> subdir-y += shadow
> -subdir-y += hap
> +subdir-$(CONFIG_HVM) += 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
> +obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.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/p2m.c b/xen/arch/x86/mm/p2m.c
> index c82db32..e41d6bf 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -535,7 +535,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;
> @@ -1712,12 +1712,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);
> -}
> -
> #ifdef CONFIG_HVM
> 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;
> }
>
> +#ifdef 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..4d06c8f 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);
>
> +#ifdef 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..4517f89 100644
> --- a/xen/include/asm-x86/hvm/domain.h
> +++ b/xen/include/asm-x86/hvm/domain.h
> @@ -202,7 +202,11 @@ struct hvm_domain {
> };
> };
>
> +#ifdef CONFIG_HVM
> #define hap_enabled(d) ((d)->arch.hvm_domain.hap_enabled)
> +#else
> +#define hap_enabled(d) false
> +#endif
Hmm... I thought I had rewritten this to be a static inline function.
I will try to make it a static inline function.
Wei.
>
> #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 |