x86/p2m: hardware-log-dirty related hooks are HVM-only
authorJan Beulich <jbeulich@suse.com>
Mon, 3 May 2021 13:28:16 +0000 (15:28 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 3 May 2021 13:28:16 +0000 (15:28 +0200)
Exclude functions using them from !HVM builds, thus making it possible
to exclude the hooks as well.

By moving an #endif in p2m.c (instead of introducing yet another one)
p2m_{get,set}_ioreq_server() get excluded for !HVM builds as well.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/mm/p2m.c
xen/include/asm-x86/p2m.h

index bb3ac9c81e25af512d759f702801d5bc44a4decf..0e469369b9cf7fa2a098b82311360f61b88973e0 100644 (file)
@@ -369,8 +369,6 @@ void p2m_memory_type_changed(struct domain *d)
     p2m_unlock(hostp2m);
 }
 
-#endif /* CONFIG_HVM */
-
 int p2m_set_ioreq_server(struct domain *d,
                          unsigned int flags,
                          struct ioreq_server *s)
@@ -464,6 +462,8 @@ void p2m_flush_hardware_cached_dirty(struct domain *d)
     }
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Force a synchronous P2M TLB flush if a deferred flush is pending.
  *
index 1084397ffed6fcd8ba42824824ca5740c4829e8a..1ed7da947321312e11cc14be42aed06cf79bbce0 100644 (file)
@@ -261,10 +261,10 @@ struct p2m_domain {
                                     bool_t *sve);
     int                (*recalc)(struct p2m_domain *p2m,
                                  unsigned long gfn);
+#ifdef CONFIG_HVM
     void               (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
     void               (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
-#ifdef CONFIG_HVM
     void               (*change_entry_type_global)(struct p2m_domain *p2m,
                                                    p2m_type_t ot,
                                                    p2m_type_t nt);
@@ -630,6 +630,9 @@ int guest_physmap_add_page(struct domain *d, gfn_t gfn, mfn_t mfn,
 /* Set a p2m range as populate-on-demand */
 int guest_physmap_mark_populate_on_demand(struct domain *d, unsigned long gfn,
                                           unsigned int order);
+
+#ifdef CONFIG_HVM
+
 /* Enable hardware-assisted log-dirty. */
 void p2m_enable_hardware_log_dirty(struct domain *d);
 
@@ -639,6 +642,12 @@ void p2m_disable_hardware_log_dirty(struct domain *d);
 /* Flush hardware cached dirty GFNs */
 void p2m_flush_hardware_cached_dirty(struct domain *d);
 
+#else
+
+static inline void p2m_flush_hardware_cached_dirty(struct domain *d) {}
+
+#endif
+
 /* Change types across all p2m entries in a domain */
 void p2m_change_entry_type_global(struct domain *d, 
                                   p2m_type_t ot, p2m_type_t nt);