diff mbox series

[v2,06/12] x86/p2m: hardware-log-dirty related hooks are HVM-only

Message ID e11aa162-9a07-9326-5b5b-5f4114f80255@suse.com (mailing list archive)
State New, archived
Headers show
Series x86/p2m: restrict more code to build just for HVM | expand

Commit Message

Jan Beulich April 12, 2021, 2:08 p.m. UTC
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>
---
v2: New.

Comments

Roger Pau Monne April 29, 2021, 4:05 p.m. UTC | #1
On Mon, Apr 12, 2021 at 04:08:50PM +0200, Jan Beulich wrote:
> 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>

Thanks, Roger.
diff mbox series

Patch

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -369,8 +369,6 @@  void p2m_memory_type_changed(struct doma
     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(str
     }
 }
 
+#endif /* CONFIG_HVM */
+
 /*
  * Force a synchronous P2M TLB flush if a deferred flush is pending.
  *
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -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
 /* 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(stru
 /* 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);