|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 3/5] xen/include: customize headers for host builds
On 13.02.2026 03:49, dmukhin@xxxxxxxx wrote: > From: Denis Mukhin <dmukhin@xxxxxxxx> > > Update hypervisor headers to allow vpci.c to compile in a host build > environment, as required for the vPCI unit test. > > Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx> > --- > Changes since v2: > - new patch I'm firmly against such scattering around of "#ifdef __XEN__". It should be the harnesses to carry the burden of re-using hypervisor headers. Jan > --- a/xen/include/xen/irq.h > +++ b/xen/include/xen/irq.h > @@ -1,5 +1,6 @@ > #ifndef __XEN_IRQ_H__ > #define __XEN_IRQ_H__ > +#ifdef __XEN__ > > #include <xen/cpumask.h> > #include <xen/rcupdate.h> > @@ -208,4 +209,5 @@ unsigned int arch_hwdom_irqs(const struct domain *d); > void arch_evtchn_bind_pirq(struct domain *d, int pirq); > #endif > > +#endif /* __XEN__ */ > #endif /* __XEN_IRQ_H__ */ > diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h > index 98d8482daba1..06d2fa3aed15 100644 > --- a/xen/include/xen/list.h > +++ b/xen/include/xen/list.h > @@ -7,8 +7,10 @@ > #ifndef __XEN_LIST_H__ > #define __XEN_LIST_H__ > > +#ifdef __XEN__ > #include <xen/bug.h> > #include <asm/system.h> > +#endif > > /* > * These are non-NULL pointers that will result in faults under normal > diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h > index f6c1f27ca105..80d60fd49178 100644 > --- a/xen/include/xen/numa.h > +++ b/xen/include/xen/numa.h > @@ -1,5 +1,6 @@ > #ifndef _XEN_NUMA_H > #define _XEN_NUMA_H > +#ifdef __XEN__ > > #include <xen/mm-frame.h> > > @@ -152,4 +153,5 @@ static inline nodeid_t mfn_to_nid(mfn_t mfn) > > #define page_to_nid(pg) mfn_to_nid(page_to_mfn(pg)) > > +#endif /* __XEN__ */ > #endif /* _XEN_NUMA_H */ > diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h > index afb6bbf50d05..f52dc7875e16 100644 > --- a/xen/include/xen/pci.h > +++ b/xen/include/xen/pci.h > @@ -14,7 +14,9 @@ > #include <xen/numa.h> > #include <xen/pci_regs.h> > #include <xen/pfn.h> > +#ifdef __XEN__ > #include <asm/device.h> > +#endif > > /* > * The PCI interface treats multi-function devices as independent > diff --git a/xen/include/xen/pfn.h b/xen/include/xen/pfn.h > index 1ca9b095e0df..98ff669d7def 100644 > --- a/xen/include/xen/pfn.h > +++ b/xen/include/xen/pfn.h > @@ -1,7 +1,9 @@ > #ifndef __XEN_PFN_H__ > #define __XEN_PFN_H__ > > +#ifdef __XEN__ > #include <xen/page-size.h> > +#endif > > #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) > #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) > diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h > index ca9d8c7ec0a1..ad5094c4eb92 100644 > --- a/xen/include/xen/spinlock.h > +++ b/xen/include/xen/spinlock.h > @@ -1,5 +1,6 @@ > #ifndef __SPINLOCK_H__ > #define __SPINLOCK_H__ > +#ifdef __XEN__ > > #include <xen/nospec.h> > #include <xen/time.h> > @@ -360,4 +361,5 @@ static always_inline void nrspin_lock_irq(rspinlock_t *l) > #define nrspin_unlock_irqrestore(l, f) _nrspin_unlock_irqrestore(l, f) > #define nrspin_unlock_irq(l) _nrspin_unlock_irq(l) > > +#endif /* __XEN__ */ > #endif /* __SPINLOCK_H__ */ > diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h > index 73ddccbbd5dc..e5d702b48ac0 100644 > --- a/xen/include/xen/types.h > +++ b/xen/include/xen/types.h > @@ -4,6 +4,7 @@ > #include <xen/stdbool.h> > #include <xen/stdint.h> > > +#ifdef __XEN__ > /* Linux inherited types which are being phased out */ > typedef uint8_t u8; > typedef uint16_t u16; > @@ -15,6 +16,7 @@ typedef uint64_t u64; > typedef __SIZE_TYPE__ size_t; > > typedef signed long ssize_t; > +#endif /* __XEN__ */ > > typedef __PTRDIFF_TYPE__ ptrdiff_t; > typedef __UINTPTR_TYPE__ uintptr_t; > @@ -33,6 +35,7 @@ typedef __UINTPTR_TYPE__ uintptr_t; > #define NULL ((void*)0) > #endif > > +#ifdef __XEN__ > #define INT8_MIN (-127-1) > #define INT16_MIN (-32767-1) > #define INT32_MIN (-2147483647-1) > @@ -52,6 +55,7 @@ typedef __UINTPTR_TYPE__ uintptr_t; > #define LONG_MAX ((long)(~0UL>>1)) > #define LONG_MIN (-LONG_MAX - 1) > #define ULONG_MAX (~0UL) > +#endif /* __XEN__ */ > > typedef uint16_t __le16; > typedef uint16_t __be16;
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |