Commit ced9795c authored by Jan Beulich's avatar Jan Beulich

mm: split out mfn_t / gfn_t / pfn_t definitions and helpers

xen/mm.h has heavy dependencies, while in a number of cases only these
type definitions are needed. This separation then also allows pulling in
these definitions when including xen/mm.h would cause cyclic
dependencies.

Replace xen/mm.h inclusion where possible in include/xen/. (In
xen/iommu.h also take the opportunity and correct the few remaining
sorting issues.)

While the change could be dropped, remove an unnecessary asm/io.h
inclusion from xen/arch/x86/acpi/power.c. This was the initial attempt
to address build issues with it, until it became clear that the header
itself needs adjustment.
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Acked-by: default avatarJulien Grall <jgrall@amazon.com>
parent aa4b9d1e
......@@ -10,7 +10,6 @@
* Slimmed with Xen specific support.
*/
#include <asm/io.h>
#include <xen/acpi.h>
#include <xen/errno.h>
#include <xen/iocap.h>
......
......@@ -18,7 +18,9 @@
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#include <xen/errno.h>
#include <xen/irq.h>
#include <xen/mm.h>
#include <xen/serial.h>
#include <xen/vmap.h>
#include <asm/io.h>
......
......@@ -18,7 +18,9 @@
* License along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#include <xen/errno.h>
#include <xen/irq.h>
#include <xen/mm.h>
#include <xen/serial.h>
#include <xen/vmap.h>
#include <asm/io.h>
......
......@@ -49,6 +49,7 @@ __OUT(l,,int)
/* Function pointer used to handle platform specific I/O port emulation. */
#define IOEMUL_QUIRK_STUB_BYTES 9
struct cpu_user_regs;
extern unsigned int (*ioemul_handle_quirk)(
u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs);
......
......@@ -23,7 +23,7 @@
#ifndef __XEN_GRANT_TABLE_H__
#define __XEN_GRANT_TABLE_H__
#include <xen/mm.h>
#include <xen/mm-frame.h>
#include <xen/rwlock.h>
#include <public/grant_table.h>
#include <asm/grant_table.h>
......
......@@ -19,14 +19,13 @@
#ifndef _IOMMU_H_
#define _IOMMU_H_
#include <xen/mm-frame.h>
#include <xen/init.h>
#include <xen/page-defs.h>
#include <xen/spinlock.h>
#include <xen/pci.h>
#include <xen/typesafe.h>
#include <xen/mm.h>
#include <public/hvm/ioreq.h>
#include <xen/spinlock.h>
#include <public/domctl.h>
#include <public/hvm/ioreq.h>
#include <asm/device.h>
TYPE_SAFE(uint64_t, dfn);
......
#ifndef __XEN_FRAME_NUM_H__
#define __XEN_FRAME_NUM_H__
#include <xen/kernel.h>
#include <xen/typesafe.h>
TYPE_SAFE(unsigned long, mfn);
#define PRI_mfn "05lx"
#define INVALID_MFN _mfn(~0UL)
/*
* To be used for global variable initialization. This workaround a bug
* in GCC < 5.0.
*/
#define INVALID_MFN_INITIALIZER { ~0UL }
#ifndef mfn_t
#define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
#define _mfn
#define mfn_x
#undef mfn_t
#undef _mfn
#undef mfn_x
#endif
static inline mfn_t mfn_add(mfn_t mfn, unsigned long i)
{
return _mfn(mfn_x(mfn) + i);
}
static inline mfn_t mfn_max(mfn_t x, mfn_t y)
{
return _mfn(max(mfn_x(x), mfn_x(y)));
}
static inline mfn_t mfn_min(mfn_t x, mfn_t y)
{
return _mfn(min(mfn_x(x), mfn_x(y)));
}
static inline bool_t mfn_eq(mfn_t x, mfn_t y)
{
return mfn_x(x) == mfn_x(y);
}
TYPE_SAFE(unsigned long, gfn);
#define PRI_gfn "05lx"
#define INVALID_GFN _gfn(~0UL)
/*
* To be used for global variable initialization. This workaround a bug
* in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
*/
#define INVALID_GFN_INITIALIZER { ~0UL }
#ifndef gfn_t
#define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
#define _gfn
#define gfn_x
#undef gfn_t
#undef _gfn
#undef gfn_x
#endif
static inline gfn_t gfn_add(gfn_t gfn, unsigned long i)
{
return _gfn(gfn_x(gfn) + i);
}
static inline gfn_t gfn_max(gfn_t x, gfn_t y)
{
return _gfn(max(gfn_x(x), gfn_x(y)));
}
static inline gfn_t gfn_min(gfn_t x, gfn_t y)
{
return _gfn(min(gfn_x(x), gfn_x(y)));
}
static inline bool_t gfn_eq(gfn_t x, gfn_t y)
{
return gfn_x(x) == gfn_x(y);
}
TYPE_SAFE(unsigned long, pfn);
#define PRI_pfn "05lx"
#define INVALID_PFN (~0UL)
#ifndef pfn_t
#define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */
#define _pfn
#define pfn_x
#undef pfn_t
#undef _pfn
#undef pfn_x
#endif
#endif /* __XEN_FRAME_NUM_H__ */
......@@ -51,103 +51,13 @@
#define __XEN_MM_H__
#include <xen/compiler.h>
#include <xen/mm-frame.h>
#include <xen/types.h>
#include <xen/list.h>
#include <xen/spinlock.h>
#include <xen/typesafe.h>
#include <xen/kernel.h>
#include <xen/perfc.h>
#include <public/memory.h>
TYPE_SAFE(unsigned long, mfn);
#define PRI_mfn "05lx"
#define INVALID_MFN _mfn(~0UL)
/*
* To be used for global variable initialization. This workaround a bug
* in GCC < 5.0.
*/
#define INVALID_MFN_INITIALIZER { ~0UL }
#ifndef mfn_t
#define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
#define _mfn
#define mfn_x
#undef mfn_t
#undef _mfn
#undef mfn_x
#endif
static inline mfn_t mfn_add(mfn_t mfn, unsigned long i)
{
return _mfn(mfn_x(mfn) + i);
}
static inline mfn_t mfn_max(mfn_t x, mfn_t y)
{
return _mfn(max(mfn_x(x), mfn_x(y)));
}
static inline mfn_t mfn_min(mfn_t x, mfn_t y)
{
return _mfn(min(mfn_x(x), mfn_x(y)));
}
static inline bool_t mfn_eq(mfn_t x, mfn_t y)
{
return mfn_x(x) == mfn_x(y);
}
TYPE_SAFE(unsigned long, gfn);
#define PRI_gfn "05lx"
#define INVALID_GFN _gfn(~0UL)
/*
* To be used for global variable initialization. This workaround a bug
* in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
*/
#define INVALID_GFN_INITIALIZER { ~0UL }
#ifndef gfn_t
#define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
#define _gfn
#define gfn_x
#undef gfn_t
#undef _gfn
#undef gfn_x
#endif
static inline gfn_t gfn_add(gfn_t gfn, unsigned long i)
{
return _gfn(gfn_x(gfn) + i);
}
static inline gfn_t gfn_max(gfn_t x, gfn_t y)
{
return _gfn(max(gfn_x(x), gfn_x(y)));
}
static inline gfn_t gfn_min(gfn_t x, gfn_t y)
{
return _gfn(min(gfn_x(x), gfn_x(y)));
}
static inline bool_t gfn_eq(gfn_t x, gfn_t y)
{
return gfn_x(x) == gfn_x(y);
}
TYPE_SAFE(unsigned long, pfn);
#define PRI_pfn "05lx"
#define INVALID_PFN (~0UL)
#ifndef pfn_t
#define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */
#define _pfn
#define pfn_x
#undef pfn_t
#undef _pfn
#undef pfn_x
#endif
struct page_info;
void put_page(struct page_info *);
......
#ifndef _XEN_P2M_COMMON_H
#define _XEN_P2M_COMMON_H
#include <xen/mm.h>
#include <xen/mm-frame.h>
/* Remove a page from a domain's p2m table */
int __must_check
......
#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START)
#define __XEN_VMAP_H__
#include <xen/mm.h>
#include <xen/mm-frame.h>
#include <xen/page-size.h>
enum vmap_region {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment