diff mbox series

[RFC,03/10] x86/p2m: guard vmx specific ept functions with INTEL_VMX

Message ID 20230213145751.1047236-4-burzalodowa@gmail.com (mailing list archive)
State New, archived
Headers show
Series x86: Make cpu virtualization support configurable | expand

Commit Message

Xenia Ragiadakou Feb. 13, 2023, 2:57 p.m. UTC
The functions ept_p2m_init(), ept_p2m_uninit() and p2m_init_altp2m_ept() are
VT-x specific.
Implement them as unreachable static inline functions when !INTEL_VMX.

No functional change intended.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/arch/x86/mm/p2m.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Jan Beulich Feb. 13, 2023, 4:55 p.m. UTC | #1
On 13.02.2023 15:57, Xenia Ragiadakou wrote:
> --- a/xen/arch/x86/mm/p2m.h
> +++ b/xen/arch/x86/mm/p2m.h
> @@ -35,9 +35,25 @@ void p2m_nestedp2m_init(struct p2m_domain *p2m);
>  int p2m_init_nestedp2m(struct domain *d);
>  void p2m_teardown_nestedp2m(struct domain *d);
>  
> +#ifdef CONFIG_INTEL_VMX
>  int ept_p2m_init(struct p2m_domain *p2m);
>  void ept_p2m_uninit(struct p2m_domain *p2m);

For the calls from p2m_initialise() and p2m_free_one() see my reply
to patch 2. For the calls from altp2m functions, including ...

>  void p2m_init_altp2m_ept(struct domain *d, unsigned int i);

... to this one, I think you want to be more rigorous and hide much
(most?) of altp2m altogether when !VMX. (It is perhaps high time
for more of that code to move from p2m.c to altp2m.c, and altp2m.c
then, if it doesn't already, to become dependent on VMX somewhere
in the Makefile in your series.)

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/mm/p2m.h b/xen/arch/x86/mm/p2m.h
index cc0f6766e4..ac80414688 100644
--- a/xen/arch/x86/mm/p2m.h
+++ b/xen/arch/x86/mm/p2m.h
@@ -35,9 +35,25 @@  void p2m_nestedp2m_init(struct p2m_domain *p2m);
 int p2m_init_nestedp2m(struct domain *d);
 void p2m_teardown_nestedp2m(struct domain *d);
 
+#ifdef CONFIG_INTEL_VMX
 int ept_p2m_init(struct p2m_domain *p2m);
 void ept_p2m_uninit(struct p2m_domain *p2m);
 void p2m_init_altp2m_ept(struct domain *d, unsigned int i);
+#else
+static inline int ept_p2m_init(struct p2m_domain *p2m)
+{
+    ASSERT_UNREACHABLE();
+    return -EINVAL;
+}
+static inline void ept_p2m_uninit(struct p2m_domain *p2m)
+{
+    ASSERT_UNREACHABLE();
+}
+static inline void p2m_init_altp2m_ept(struct domain *d, unsigned int i)
+{
+    ASSERT_UNREACHABLE();
+}
+#endif
 
 /*
  * Local variables: