]> xenbits.xensource.com Git - people/sstabellini/xen-unstable.git/.git/commitdiff
p2m: move p2m-common.h inclusion point
authorJan Beulich <jbeulich@suse.com>
Wed, 7 Nov 2018 08:35:14 +0000 (09:35 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 7 Nov 2018 08:35:14 +0000 (09:35 +0100)
The header is (hence its name) supposed to be a helper for the per-arch
p2m.h files. It was never supposed to be included directly, and for the
purpose of putting common function declarations into the common header
it is more helpful if things like p2m_t are already available at the
inclusion point.

This also undoes parts of 02ede7dc03 ("memory: add
check_get_page_from_gfn() as a wrapper..."), which had been there just
because of the unhelpful original way of including p2m-common.h.

Take the opportunity and also ditch a duplicate public/memory.h from the
ARM header.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: George Dunlap <george.dunlap@citrix.com>
xen/drivers/vpci/header.c
xen/include/asm-arm/p2m.h
xen/include/asm-x86/p2m.h
xen/include/xen/p2m-common.h

index 0ec4c082a6efe17ad0f0879492ace56abbdc7230..4573ccadf0a83f00ea03f5f061e957efc783276b 100644 (file)
  * License along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <xen/p2m-common.h>
 #include <xen/sched.h>
 #include <xen/softirq.h>
 #include <xen/vpci.h>
 
 #include <asm/event.h>
+#include <asm/p2m.h>
 
 #define MAPPABLE_BAR(x)                                                 \
     ((x)->type == VPCI_BAR_MEM32 || (x)->type == VPCI_BAR_MEM64_LO ||   \
index c03557544ad75bdc31b1afa609e1c618139c3474..7b2863da653f7252b2a7350444b1510f610e8452 100644 (file)
@@ -7,8 +7,6 @@
 #include <xen/mem_access.h>
 #include <public/vm_event.h> /* for vm_event_response_t */
 #include <public/memory.h>
-#include <xen/p2m-common.h>
-#include <public/memory.h>
 
 #define paddr_bits PADDR_BITS
 
@@ -110,7 +108,7 @@ struct p2m_domain {
  * future, it's possible to use higher value for pseudo-type and don't store
  * them in the p2m entry.
  */
-enum p2m_type {
+typedef enum {
     p2m_invalid = 0,    /* Nothing mapped here */
     p2m_ram_rw,         /* Normal read/write guest RAM */
     p2m_ram_ro,         /* Read-only; writes are silently dropped */
@@ -124,7 +122,7 @@ enum p2m_type {
     p2m_iommu_map_rw,   /* Read/write iommu mapping */
     p2m_iommu_map_ro,   /* Read-only iommu mapping */
     p2m_max_real_type,  /* Types after this won't be store in the p2m */
-};
+} p2m_type_t;
 
 /* We use bitmaps and mask to handle groups of types */
 #define p2m_to_mask(_t) (1UL << (_t))
@@ -144,6 +142,12 @@ enum p2m_type {
                             (P2M_RAM_TYPES | P2M_GRANT_TYPES |  \
                              p2m_to_mask(p2m_map_foreign)))
 
+/* All common type definitions should live ahead of this inclusion. */
+#ifdef _XEN_P2M_COMMON_H
+# error "xen/p2m-common.h should not be included directly"
+#endif
+#include <xen/p2m-common.h>
+
 static inline
 void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
 {
index d08c5958879ed6446004ea3973448ff1939d0b55..ac33f5086b6cb3e884b680318cad1860089201d0 100644 (file)
@@ -27,7 +27,6 @@
 #define _XEN_ASM_X86_P2M_H
 
 #include <xen/paging.h>
-#include <xen/p2m-common.h>
 #include <xen/mem_access.h>
 #include <asm/mem_sharing.h>
 #include <asm/page.h>    /* for pagetable_t */
@@ -52,7 +51,7 @@ extern bool_t opt_hap_1gb, opt_hap_2mb;
  * cannot be non-zero, otherwise, hardware generates io page faults when 
  * device access those pages. Therefore, p2m_ram_rw has to be defined as 0.
  */
-enum p2m_type {
+typedef enum {
     p2m_ram_rw = 0,             /* Normal read/write guest RAM */
     p2m_invalid = 1,            /* Nothing mapped here */
     p2m_ram_logdirty = 2,       /* Temporarily read-only for log-dirty */
@@ -72,7 +71,7 @@ enum p2m_type {
     p2m_ram_broken = 13,          /* Broken page, access cause domain crash */
     p2m_map_foreign  = 14,        /* ram pages from foreign domain */
     p2m_ioreq_server = 15,
-};
+} p2m_type_t;
 
 /* Modifiers to the query */
 typedef unsigned int p2m_query_t;
@@ -368,6 +367,12 @@ struct p2m_domain {
 /* get host p2m table */
 #define p2m_get_hostp2m(d)      ((d)->arch.p2m)
 
+/* All common type definitions should live ahead of this inclusion. */
+#ifdef _XEN_P2M_COMMON_H
+# error "xen/p2m-common.h should not be included directly"
+#endif
+#include <xen/p2m-common.h>
+
 /*
  * Updates vCPU's n2pm to match its np2m_base in VMCx12 and returns that np2m.
  */
index f4d30efe5f193b739878c9247e140b9d477eb007..58031a6ea83d65984ec8521ce71af8f7b8b22fc3 100644 (file)
@@ -32,8 +32,6 @@ unsigned long
 p2m_pod_decrease_reservation(struct domain *d, gfn_t gfn,
                              unsigned int order);
 
-typedef enum p2m_type p2m_type_t;
-
 int __must_check check_get_page_from_gfn(struct domain *d, gfn_t gfn,
                                          bool readonly, p2m_type_t *p2mt_p,
                                          struct page_info **page_p);