[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 1/5] Update XENBUS interface headers
> -----Original Message----- > From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel- > bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of Rafal Wojdyla > Sent: 07 October 2015 05:48 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Subject: [win-pv-devel] [PATCH 1/5] Update XENBUS interface headers > > Also add headers needed for next patches in the series. > > Signed-off-by: Rafal Wojdyla <omeg@xxxxxxxxxxxxxxxxxxxxxx> Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > --- > include/cache_interface.h | 233 ++++++++++++++++++++++++++++++++ > include/evtchn_interface.h | 325 > +++++++++++++++++++++++++++++++++++++++++++++ > include/gnttab_interface.h | 249 > ++++++++++++++++++++++++++++++++++ > include/store_interface.h | 68 +++++++++- > 4 files changed, 871 insertions(+), 4 deletions(-) > create mode 100644 include/cache_interface.h > create mode 100644 include/evtchn_interface.h > create mode 100644 include/gnttab_interface.h > > diff --git a/include/cache_interface.h b/include/cache_interface.h > new file mode 100644 > index 0000000..dae3ac6 > --- /dev/null > +++ b/include/cache_interface.h > @@ -0,0 +1,233 @@ > +/* Copyright (c) Citrix Systems Inc. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, > + * with or without modification, are permitted provided > + * that the following conditions are met: > + * > + * * Redistributions of source code must retain the above > + * copyright notice, this list of conditions and the > + * following disclaimer. > + * * Redistributions in binary form must reproduce the above > + * copyright notice, this list of conditions and the > + * following disclaimer in the documentation and/or other > + * materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, > + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR > + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, > + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +/*! \file cache_interface.h > + \brief XENBUS CACHE Interface > + > + This interface provides access to XENBUS's object cache > + implementation. > +*/ > + > +#ifndef _XENBUS_CACHE_INTERFACE_H > +#define _XENBUS_CACHE_INTERFACE_H > + > +#ifndef _WINDLL > + > +/*! \typedef XENBUS_CACHE > + \brief Cache handle > +*/ > +typedef struct _XENBUS_CACHE XENBUS_CACHE, *PXENBUS_CACHE; > + > +/*! \typedef XENBUS_CACHE_ACQUIRE > + \brief Acquire a reference to the CACHE interface > + > + \param Interface The interface header > +*/ > +typedef NTSTATUS > +(*XENBUS_CACHE_ACQUIRE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_CACHE_RELEASE > + \brief Release a reference to the CACHE interface > + > + \param Interface The interface header > +*/ > +typedef VOID > +(*XENBUS_CACHE_RELEASE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_CACHE_CTOR > + \brief Object creator callback > + > + \param Argument Context \a Argument supplied to \a > XENBUS_CACHE_CREATE > + \param Object Newly allocated object > + > + This callback is invoked just after a new object is allocated and may > + be used to initialize any object data prior to its insertion into the > + cache. > +*/ > +typedef NTSTATUS > +(*XENBUS_CACHE_CTOR)( > + IN PVOID Argument, > + IN PVOID Object > + ); > + > +/*! \typedef XENBUS_CACHE_DTOR > + \brief Object destructor callback > + > + \param Argument Context \a Argument supplied to \a > XENBUS_CACHE_CREATE > + \param Object Object about to be freed > + > + This callback is invoked just after an object is removed from the > + cache and before it is freed and may be used to tear down any object > data. > +*/ > +typedef VOID > +(*XENBUS_CACHE_DTOR)( > + IN PVOID Argument, > + IN PVOID Object > + ); > + > +/*! \typedef XENBUS_CACHE_ACQUIRE_LOCK > + \brief Cache lock callback > + > + \param Argument Context \a Argument supplied to \a > XENBUS_CACHE_CREATE > + > + This callback is invoked if the cache implementation requires mutual > + exclusion. > +*/ > +typedef VOID > +(*XENBUS_CACHE_ACQUIRE_LOCK)( > + IN PVOID Argument > + ); > + > +/*! \typedef XENBUS_CACHE_RELEASE_LOCK > + \brief Cache unlock callback > + > + \param Argument Context \a Argument supplied to \a > XENBUS_CACHE_CREATE > + > + This callback is invoked to release the mutual exclusion lock acquired > + by a previous invocation of \a XENBUS_CACHE_ACQUIRE_LOCK. > +*/ > +typedef VOID > +(*XENBUS_CACHE_RELEASE_LOCK)( > + IN PVOID Argument > + ); > + > +/*! \typedef XENBUS_CACHE_CREATE > + \brief Create a cache of objects of the given \a Size > + > + \param Interface The interface header > + \param Name A name for the cache which will be used in debug output > + \param Size The size of each object in bytes > + \param Reservation The target minimum population of the cache > + \param Ctor A callback which is invoked when a new object created > + \param Dtor A callback which is invoked when an object is destroyed > + \param AcquireLock A callback invoked to acquire a spinlock > + \param ReleaseLock A callback invoked to release the spinlock > + \param Argument An optional context argument passed to the callbacks > + \param Cache A pointer to a cache handle to be initialized > + > + If a non-zero \a Reservation is specified then this method will fail > + unless that number of objects can be immediately created. > +*/ > +typedef NTSTATUS > +(*XENBUS_CACHE_CREATE)( > + IN PINTERFACE Interface, > + IN const CHAR *Name, > + IN ULONG Size, > + IN ULONG Reservation, > + IN XENBUS_CACHE_CTOR Ctor, > + IN XENBUS_CACHE_DTOR Dtor, > + IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, > + IN XENBUS_CACHE_RELEASE_LOCK ReleaseLock, > + IN PVOID Argument OPTIONAL, > + OUT PXENBUS_CACHE *Cache > + ); > + > +/*! \typedef XENBUS_CACHE_GET > + \brief Get an object from a \a Cache > + > + \param Interface The interface header > + \param Cache The cache handle > + \param Locked If mutually exclusive access to the cache is already > + guaranteed then set this to TRUE > +*/ > +typedef PVOID > +(*XENBUS_CACHE_GET)( > + IN PINTERFACE Interface, > + IN PXENBUS_CACHE Cache, > + IN BOOLEAN Locked > + ); > + > +/*! \typedef XENBUS_CACHE_PUT > + \brief Return an object to a \a Cache > + > + \param Interface The interface header > + \param Cache The cache handle > + \param Locked If mutually exclusive access to the cache is already > + guaranteed then set this to TRUE > +*/ > +typedef VOID > +(*XENBUS_CACHE_PUT)( > + IN PINTERFACE Interface, > + IN PXENBUS_CACHE Cache, > + IN PVOID Object, > + IN BOOLEAN Locked > + ); > + > +/*! \typedef XENBUS_CACHE_DESTROY > + \brief Destroy a \a Cache > + > + \param Interface The interface header > + \param Cache The cache handle > + > + All objects must have been returned to the cache prior to destruction > +*/ > +typedef VOID > +(*XENBUS_CACHE_DESTROY)( > + IN PINTERFACE Interface, > + IN PXENBUS_CACHE Cache > + ); > + > +// {A98DFD78-416A-4949-92A5-E084F2F4B44E} > +DEFINE_GUID(GUID_XENBUS_CACHE_INTERFACE, > +0xa98dfd78, 0x416a, 0x4949, 0x92, 0xa5, 0xe0, 0x84, 0xf2, 0xf4, 0xb4, 0x4e); > + > +/*! \struct _XENBUS_CACHE_INTERFACE_V1 > + \brief CACHE interface version 1 > + \ingroup interfaces > +*/ > +struct _XENBUS_CACHE_INTERFACE_V1 { > + INTERFACE Interface; > + XENBUS_CACHE_ACQUIRE CacheAcquire; > + XENBUS_CACHE_RELEASE CacheRelease; > + XENBUS_CACHE_CREATE CacheCreate; > + XENBUS_CACHE_GET CacheGet; > + XENBUS_CACHE_PUT CachePut; > + XENBUS_CACHE_DESTROY CacheDestroy; > +}; > + > +typedef struct _XENBUS_CACHE_INTERFACE_V1 > XENBUS_CACHE_INTERFACE, *PXENBUS_CACHE_INTERFACE; > + > +/*! \def XENBUS_CACHE > + \brief Macro at assist in method invocation > +*/ > +#define XENBUS_CACHE(_Method, _Interface, ...) \ > + (_Interface)->Cache ## _Method((PINTERFACE)(_Interface), > __VA_ARGS__) > + > +#endif // _WINDLL > + > +#define XENBUS_CACHE_INTERFACE_VERSION_MIN 1 > +#define XENBUS_CACHE_INTERFACE_VERSION_MAX 1 > + > +#endif // _XENBUS_CACHE_INTERFACE_H > diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h > new file mode 100644 > index 0000000..c63f063 > --- /dev/null > +++ b/include/evtchn_interface.h > @@ -0,0 +1,325 @@ > +/* Copyright (c) Citrix Systems Inc. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, > + * with or without modification, are permitted provided > + * that the following conditions are met: > + * > + * * Redistributions of source code must retain the above > + * copyright notice, this list of conditions and the > + * following disclaimer. > + * * Redistributions in binary form must reproduce the above > + * copyright notice, this list of conditions and the > + * following disclaimer in the documentation and/or other > + * materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, > + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR > + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, > + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +/*! \file evtchn_interface.h > + \brief XENBUS EVTCHN Interface > + > + This interface provides access to hypervisor event channels > +*/ > + > +#ifndef _XENBUS_EVTCHN_INTERFACE_H > +#define _XENBUS_EVTCHN_INTERFACE_H > + > +#ifndef _WINDLL > + > +/*! \enum _XENBUS_EVTCHN_TYPE > + \brief Event channel type to be opened > +*/ > +typedef enum _XENBUS_EVTCHN_TYPE { > + XENBUS_EVTCHN_TYPE_INVALID = 0, > + XENBUS_EVTCHN_TYPE_FIXED, /*!< Fixed */ > + XENBUS_EVTCHN_TYPE_UNBOUND, /*!< Unbound */ > + XENBUS_EVTCHN_TYPE_INTER_DOMAIN, /*!< Interdomain */ > + XENBUS_EVTCHN_TYPE_VIRQ /*!< VIRQ */ > +} XENBUS_EVTCHN_TYPE, *PXENBUS_EVTCHN_TYPE; > + > +/*! \typedef XENBUS_EVTCHN_CHANNEL > + \brief Event channel handle > +*/ > +typedef struct _XENBUS_EVTCHN_CHANNEL XENBUS_EVTCHN_CHANNEL, > *PXENBUS_EVTCHN_CHANNEL; > + > +/*! \typedef XENBUS_EVTCHN_ACQUIRE > + \brief Acquire a reference to the EVTCHN interface > + > + \param Interface The interface header > +*/ > +typedef NTSTATUS > +(*XENBUS_EVTCHN_ACQUIRE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_EVTCHN_RELEASE > + \brief Release a reference to the EVTCHN interface > + > + \param Interface The interface header > +*/ > +typedef VOID > +(*XENBUS_EVTCHN_RELEASE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_EVTCHN_OPEN > + \brief Open an event channel > + > + \param Interface The interface header > + \param Type The type of event channel to open > + \param Function The callback function > + \param Argument An optional context argument passed to the callback > + \param ... Additional parameters required by \a Type > + > + \b Fixed: > + \param LocalPort The local port number of the (already bound) channel > + \param Mask Set to TRUE if the channel should be automatically masked > before invoking the callback > + > + \b Unbound: > + \param RemoteDomain The domid of the remote domain which will bind > the channel > + \param Mask Set to TRUE if the channel should be automatically masked > before invoking the callback > + > + \b Interdomain: > + \param RemoteDomain The domid of the remote domain which has > already bound the channel > + \param RemotePort The port number bound to the channel in the > remote domain > + \param Mask Set to TRUE if the channel should be automatically masked > before invoking the callback > + > + \b VIRQ: > + \param Index The index number of the VIRQ > + > + \return Event channel handle > +*/ > +typedef PXENBUS_EVTCHN_CHANNEL > +(*XENBUS_EVTCHN_OPEN)( > + IN PINTERFACE Interface, > + IN XENBUS_EVTCHN_TYPE Type, > + IN PKSERVICE_ROUTINE Function, > + IN PVOID Argument OPTIONAL, > + ... > + ); > + > +typedef NTSTATUS > +(*XENBUS_EVTCHN_BIND_V2)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel, > + IN ULONG Cpu > + ); > + > +/*! \typedef XENBUS_EVTCHN_BIND > + \brief Bind an event channel to a specific CPU > + > + \param Interface The interface header > + \param Channel The channel handle > + \param Group The group number of the CPU that should handle events > + \param Number The relative number of the CPU that should handle > events > +*/ > +typedef NTSTATUS > +(*XENBUS_EVTCHN_BIND)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel, > + IN USHORT Group, > + IN UCHAR Number > + ); > + > +typedef BOOLEAN > +(*XENBUS_EVTCHN_UNMASK_V1)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel, > + IN BOOLEAN InCallback > + ); > + > +/*! \typedef XENBUS_EVTCHN_UNMASK > + \brief Unmask an event channel > + > + \param Interface The interface header > + \param Channel The channel handle > + \param InCallback Set to TRUE if this method is invoked in context of the > channel callback > +*/ > +typedef VOID > +(*XENBUS_EVTCHN_UNMASK)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel, > + IN BOOLEAN InCallback > + ); > + > +/*! \typedef XENBUS_EVTCHN_SEND > + \brief Send an event to the remote end of the channel > + > + \param Interface The interface header > + \param Channel The channel handle > +*/ > +typedef VOID > +(*XENBUS_EVTCHN_SEND)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel > + ); > + > +/*! \typedef XENBUS_EVTCHN_TRIGGER > + \brief Send an event to the local end of the channel > + > + \param Interface The interface header > + \param Channel The channel handle > +*/ > +typedef VOID > +(*XENBUS_EVTCHN_TRIGGER)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel > + ); > + > +/*! \typedef XENBUS_EVTCHN_WAIT > + \brief Wait for an event to the local end of the channel > + > + \param Interface The interface header > + \param Channel The channel handle > + \param Timeout An optional timeout value (similar to > KeWaitForSingleObject(), but non-zero values are allowed at > DISPATCH_LEVEL). > +*/ > +typedef NTSTATUS > +(*XENBUS_EVTCHN_WAIT)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel, > + IN PLARGE_INTEGER Timeout OPTIONAL > + ); > + > +/*! \typedef XENBUS_EVTCHN_GET_PORT > + \brief Get the local port number bound to the channel > + > + \param Interface The interface header > + \param Channel The channel handle > + \return The port number > +*/ > +typedef ULONG > +(*XENBUS_EVTCHN_GET_PORT)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel > + ); > + > +/*! \typedef XENBUS_EVTCHN_CLOSE > + \brief Close an event channel > + > + \param Interface The interface header > + \param Channel The channel handle > +*/ > +typedef VOID > +(*XENBUS_EVTCHN_CLOSE)( > + IN PINTERFACE Interface, > + IN PXENBUS_EVTCHN_CHANNEL Channel > + ); > + > +// {BE2440AC-1098-4150-AF4D-452FADCEF923} > +DEFINE_GUID(GUID_XENBUS_EVTCHN_INTERFACE, > +0xbe2440ac, 0x1098, 0x4150, 0xaf, 0x4d, 0x45, 0x2f, 0xad, 0xce, 0xf9, 0x23); > + > +/*! \struct _XENBUS_EVTCHN_INTERFACE_V1 > + \brief EVTCHN interface version 1 > + \ingroup interfaces > +*/ > +struct _XENBUS_EVTCHN_INTERFACE_V1 { > + INTERFACE Interface; > + XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; > + XENBUS_EVTCHN_RELEASE EvtchnRelease; > + XENBUS_EVTCHN_OPEN EvtchnOpen; > + XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1; > + XENBUS_EVTCHN_SEND EvtchnSend; > + XENBUS_EVTCHN_TRIGGER EvtchnTrigger; > + XENBUS_EVTCHN_GET_PORT EvtchnGetPort; > + XENBUS_EVTCHN_CLOSE EvtchnClose; > +}; > + > +/*! \struct _XENBUS_EVTCHN_INTERFACE_V2 > + \brief EVTCHN interface version 2 > + \ingroup interfaces > +*/ > +struct _XENBUS_EVTCHN_INTERFACE_V2 { > + INTERFACE Interface; > + XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; > + XENBUS_EVTCHN_RELEASE EvtchnRelease; > + XENBUS_EVTCHN_OPEN EvtchnOpen; > + XENBUS_EVTCHN_BIND_V2 EvtchnBindVersion2; > + XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1; > + XENBUS_EVTCHN_SEND EvtchnSend; > + XENBUS_EVTCHN_TRIGGER EvtchnTrigger; > + XENBUS_EVTCHN_GET_PORT EvtchnGetPort; > + XENBUS_EVTCHN_CLOSE EvtchnClose; > +}; > + > +/*! \struct _XENBUS_EVTCHN_INTERFACE_V3 > + \brief EVTCHN interface version 3 > + \ingroup interfaces > +*/ > +struct _XENBUS_EVTCHN_INTERFACE_V3 { > + INTERFACE Interface; > + XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; > + XENBUS_EVTCHN_RELEASE EvtchnRelease; > + XENBUS_EVTCHN_OPEN EvtchnOpen; > + XENBUS_EVTCHN_BIND_V2 EvtchnBindVersion2; > + XENBUS_EVTCHN_UNMASK EvtchnUnmask; > + XENBUS_EVTCHN_SEND EvtchnSend; > + XENBUS_EVTCHN_TRIGGER EvtchnTrigger; > + XENBUS_EVTCHN_GET_PORT EvtchnGetPort; > + XENBUS_EVTCHN_CLOSE EvtchnClose; > +}; > + > +/*! \struct _XENBUS_EVTCHN_INTERFACE_V4 > + \brief EVTCHN interface version 4 > + \ingroup interfaces > +*/ > +struct _XENBUS_EVTCHN_INTERFACE_V4 { > + INTERFACE Interface; > + XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; > + XENBUS_EVTCHN_RELEASE EvtchnRelease; > + XENBUS_EVTCHN_OPEN EvtchnOpen; > + XENBUS_EVTCHN_BIND EvtchnBind; > + XENBUS_EVTCHN_UNMASK EvtchnUnmask; > + XENBUS_EVTCHN_SEND EvtchnSend; > + XENBUS_EVTCHN_TRIGGER EvtchnTrigger; > + XENBUS_EVTCHN_GET_PORT EvtchnGetPort; > + XENBUS_EVTCHN_CLOSE EvtchnClose; > +}; > + > +/*! \struct _XENBUS_EVTCHN_INTERFACE_V5 > + \brief EVTCHN interface version 5 > + \ingroup interfaces > +*/ > +struct _XENBUS_EVTCHN_INTERFACE_V5 { > + INTERFACE Interface; > + XENBUS_EVTCHN_ACQUIRE EvtchnAcquire; > + XENBUS_EVTCHN_RELEASE EvtchnRelease; > + XENBUS_EVTCHN_OPEN EvtchnOpen; > + XENBUS_EVTCHN_BIND EvtchnBind; > + XENBUS_EVTCHN_UNMASK EvtchnUnmask; > + XENBUS_EVTCHN_SEND EvtchnSend; > + XENBUS_EVTCHN_TRIGGER EvtchnTrigger; > + XENBUS_EVTCHN_WAIT EvtchnWait; > + XENBUS_EVTCHN_GET_PORT EvtchnGetPort; > + XENBUS_EVTCHN_CLOSE EvtchnClose; > +}; > + > +typedef struct _XENBUS_EVTCHN_INTERFACE_V5 > XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVTCHN_INTERFACE; > + > +/*! \def XENBUS_EVTCHN > + \brief Macro at assist in method invocation > +*/ > +#define XENBUS_EVTCHN(_Method, _Interface, ...) \ > + (_Interface)->Evtchn ## _Method((PINTERFACE)(_Interface), > __VA_ARGS__) > + > +#endif // _WINDLL > + > +#define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 1 > +#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 5 > + > +#endif // _XENBUS_EVTCHN_INTERFACE_H > + > diff --git a/include/gnttab_interface.h b/include/gnttab_interface.h > new file mode 100644 > index 0000000..b0f4adf > --- /dev/null > +++ b/include/gnttab_interface.h > @@ -0,0 +1,249 @@ > +/* Copyright (c) Citrix Systems Inc. > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, > + * with or without modification, are permitted provided > + * that the following conditions are met: > + * > + * * Redistributions of source code must retain the above > + * copyright notice, this list of conditions and the > + * following disclaimer. > + * * Redistributions in binary form must reproduce the above > + * copyright notice, this list of conditions and the > + * following disclaimer in the documentation and/or other > + * materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, > + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE > + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR > + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, > + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, > + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING > + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +/*! \file gnttab_interface.h > + \brief XENBUS GNTTAB Interface > + > + This interface provides access to the hypervisor grant table > +*/ > + > +#ifndef _XENBUS_GNTTAB_INTERFACE_H > +#define _XENBUS_GNTTAB_INTERFACE_H > + > +#include <cache_interface.h> > + > +#ifndef _WINDLL > + > +/*! \typedef XENBUS_GNTTAB_ENTRY > + \brief Grant table entry handle > +*/ > +typedef struct _XENBUS_GNTTAB_ENTRY XENBUS_GNTTAB_ENTRY, > *PXENBUS_GNTTAB_ENTRY; > + > +/*! \typedef XENBUS_GNTTAB_CACHE > + \brief Grant table cache handle > +*/ > +typedef struct _XENBUS_GNTTAB_CACHE XENBUS_GNTTAB_CACHE, > *PXENBUS_GNTTAB_CACHE; > + > +/*! \typedef XENBUS_GNTTAB_ACQUIRE > + \brief Acquire a reference to the GNTTAB interface > + > + \param Interface The interface header > +*/ > +typedef NTSTATUS > +(*XENBUS_GNTTAB_ACQUIRE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_GNTTAB_RELEASE > + \brief Release a reference to the GNTTAB interface > + > + \param Interface The interface header > +*/ > +typedef VOID > +(*XENBUS_GNTTAB_RELEASE)( > + IN PINTERFACE Interface > + ); > + > +/*! \typedef XENBUS_GNTTAB_CREATE_CACHE > + \brief Create a cache of grant table entries > + > + \param Interface The interface header > + \param Name A name for the cache which will be used in debug output > + \param Reservation The target minimum population of the cache > + \param AcquireLock A callback invoked to acquire a spinlock > + \param ReleaseLock A callback invoked to release the spinlock > + \param Argument An optional context argument passed to the callbacks > + \param Cache A pointer to a grant table cache handle to be initialized > +*/ > +typedef NTSTATUS > +(*XENBUS_GNTTAB_CREATE_CACHE)( > + IN PINTERFACE Interface, > + IN const CHAR *Name, > + IN ULONG Reservation, > + IN XENBUS_CACHE_ACQUIRE_LOCK AcquireLock, > + IN XENBUS_CACHE_RELEASE_LOCK ReleaseLock, > + IN PVOID Argument OPTIONAL, > + OUT PXENBUS_GNTTAB_CACHE *Cache > + ); > + > +/*! \typedef XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS > + \brief Get a table entry from the \a Cache permitting access to a given > \a > Pfn > + > + \param Interface The interface header > + \param Cache The grant table cache handle > + \param Locked If mutually exclusive access to the cache is already > + guaranteed then set this to TRUE > + \param Domain The domid of the domain being granted access > + \param Pfn The frame number of the page that we are granting access to > + \param ReadOnly Set to TRUE if the foreign domain is only being granted > + read access > + \param Entry A pointer to a grant table entry handle to be initialized > +*/ > +typedef NTSTATUS > +(*XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS)( > + IN PINTERFACE Interface, > + IN PXENBUS_GNTTAB_CACHE Cache, > + IN BOOLEAN Locked, > + IN USHORT Domain, > + IN PFN_NUMBER Pfn, > + IN BOOLEAN ReadOnly, > + OUT PXENBUS_GNTTAB_ENTRY *Entry > + ); > + > +/*! \typedef XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS > + \brief Revoke foreign access and return the \a Entry to the \a Cache > + > + \param Interface The interface header > + \param Cache The grant table cache handle > + \param Locked If mutually exclusive access to the cache is already > + guaranteed then set this to TRUE > + \param Entry The grant table entry handle > +*/ > +typedef NTSTATUS > +(*XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS)( > + IN PINTERFACE Interface, > + IN PXENBUS_GNTTAB_CACHE Cache, > + IN BOOLEAN Locked, > + IN PXENBUS_GNTTAB_ENTRY Entry > + ); > + > +/*! \typedef XENBUS_GNTTAB_GET_REFERENCE > + \brief Get the reference number of the entry > + > + \param Interface The interface header > + \param Entry The grant table entry handle > + \return The reference number > +*/ > +typedef ULONG > +(*XENBUS_GNTTAB_GET_REFERENCE)( > + IN PINTERFACE Interface, > + IN PXENBUS_GNTTAB_ENTRY Entry > + ); > + > +/*! \typedef XENBUS_GNTTAB_DESTROY_CACHE > + \brief Destroy a cache of grant table entries > + > + \param Interface The interface header > + \param Cache The grant table cache handle > + > + All grant table entries must have been revoked prior to destruction > + of the cache > +*/ > +typedef VOID > +(*XENBUS_GNTTAB_DESTROY_CACHE)( > + IN PINTERFACE Interface, > + IN PXENBUS_GNTTAB_CACHE Cache > + ); > + > +/*! \typedef XENBUS_GNTTAB_MAP_FOREIGN_PAGES > + \brief Map foreign memory pages into the system address space > + > + \param Interface The interface header > + \param Domain The domid of the foreign domain that granted the pages > + \param NumberPages Number of pages to map > + \param References Array of grant reference numbers shared by the > foreign domain > + \param ReadOnly If TRUE, pages are mapped with read-only access > + \param Address The physical address that the foreign pages are mapped > under > +*/ > + > +typedef NTSTATUS > +(*XENBUS_GNTTAB_MAP_FOREIGN_PAGES)( > + IN PINTERFACE Interface, > + IN USHORT Domain, > + IN ULONG NumberPages, > + IN PULONG References, > + IN BOOLEAN ReadOnly, > + OUT PHYSICAL_ADDRESS *Address > + ); > + > +/*! \typedef XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES > + \brief Unmap foreign memory pages from the system address space > + > + \param Interface The interface header > + \param Address The physical address that the foreign pages are mapped > under > +*/ > +typedef NTSTATUS > +(*XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES)( > + IN PINTERFACE Interface, > + IN PHYSICAL_ADDRESS Address > + ); > + > +// {763679C5-E5C2-4A6D-8B88-6BB02EC42D8E} > +DEFINE_GUID(GUID_XENBUS_GNTTAB_INTERFACE, > +0x763679c5, 0xe5c2, 0x4a6d, 0x8b, 0x88, 0x6b, 0xb0, 0x2e, 0xc4, 0x2d, 0x8e); > + > +/*! \struct _XENBUS_GNTTAB_INTERFACE_V1 > + \brief GNTTAB interface version 1 > + \ingroup interfaces > +*/ > +struct _XENBUS_GNTTAB_INTERFACE_V1 { > + INTERFACE Interface; > + XENBUS_GNTTAB_ACQUIRE GnttabAcquire; > + XENBUS_GNTTAB_RELEASE GnttabRelease; > + XENBUS_GNTTAB_CREATE_CACHE GnttabCreateCache; > + XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS > GnttabPermitForeignAccess; > + XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS > GnttabRevokeForeignAccess; > + XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; > + XENBUS_GNTTAB_DESTROY_CACHE GnttabDestroyCache; > +}; > + > +/*! \struct _XENBUS_GNTTAB_INTERFACE_V2 > + \brief GNTTAB interface version 2 > + \ingroup interfaces > +*/ > +struct _XENBUS_GNTTAB_INTERFACE_V2 { > + INTERFACE Interface; > + XENBUS_GNTTAB_ACQUIRE GnttabAcquire; > + XENBUS_GNTTAB_RELEASE GnttabRelease; > + XENBUS_GNTTAB_CREATE_CACHE GnttabCreateCache; > + XENBUS_GNTTAB_PERMIT_FOREIGN_ACCESS > GnttabPermitForeignAccess; > + XENBUS_GNTTAB_REVOKE_FOREIGN_ACCESS > GnttabRevokeForeignAccess; > + XENBUS_GNTTAB_GET_REFERENCE GnttabGetReference; > + XENBUS_GNTTAB_DESTROY_CACHE GnttabDestroyCache; > + XENBUS_GNTTAB_MAP_FOREIGN_PAGES GnttabMapForeignPages; > + XENBUS_GNTTAB_UNMAP_FOREIGN_PAGES > GnttabUnmapForeignPages; > +}; > + > +typedef struct _XENBUS_GNTTAB_INTERFACE_V2 > XENBUS_GNTTAB_INTERFACE, *PXENBUS_GNTTAB_INTERFACE; > + > +/*! \def XENBUS_GNTTAB > + \brief Macro at assist in method invocation > +*/ > +#define XENBUS_GNTTAB(_Method, _Interface, ...) \ > + (_Interface)->Gnttab ## _Method((PINTERFACE)(_Interface), > __VA_ARGS__) > + > +#endif // _WINDLL > + > +#define XENBUS_GNTTAB_INTERFACE_VERSION_MIN 1 > +#define XENBUS_GNTTAB_INTERFACE_VERSION_MAX 2 > + > +#endif // _XENBUS_GNTTAB_INTERFACE_H > + > diff --git a/include/store_interface.h b/include/store_interface.h > index 5bcbba3..52f1a1d 100644 > --- a/include/store_interface.h > +++ b/include/store_interface.h > @@ -50,6 +50,23 @@ typedef struct _XENBUS_STORE_TRANSACTION > XENBUS_STORE_TRANSACTION, *PXENBUS_S > */ > typedef struct _XENBUS_STORE_WATCH XENBUS_STORE_WATCH, > *PXENBUS_STORE_WATCH; > > +/*! \typedef XENBUS_STORE_PERMISSION_MASK > + \brief Bitmask of XenStore key permissions > +*/ > +typedef enum _XENBUS_STORE_PERMISSION_MASK { > + XENBUS_STORE_PERM_NONE = 0, > + XENBUS_STORE_PERM_READ = 1, > + XENBUS_STORE_PERM_WRITE = 2, > +} XENBUS_STORE_PERMISSION_MASK; > + > +/*! \typedef XENBUS_STORE_PERMISSION > + \brief XenStore key permissions entry for a single domain > +*/ > +typedef struct _XENBUS_STORE_PERMISSION { > + USHORT Domain; > + XENBUS_STORE_PERMISSION_MASK Mask; > +} XENBUS_STORE_PERMISSION, *PXENBUS_STORE_PERMISSION; > + > /*! \typedef XENBUS_STORE_ACQUIRE > \brief Acquire a reference to the STORE interface > > @@ -247,10 +264,36 @@ typedef VOID > IN PINTERFACE Interface > ); > > +/*! \typedef XENBUS_STORE_PERMISSIONS_SET > + \brief Set permissions for a XenStore key > + > + \param Interface The interface header > + \param Transaction The transaction handle (NULL if this is not > + part of a transaction) > + \param Prefix An optional prefix for the \a Node > + \param Node The concatenation of the \a Prefix and this value specifies > + the XenStore key to set permissions of > + \param Permissions An array of permissions to set > + \param NumberPermissions Number of elements in the \a Permissions > array > +*/ > +typedef NTSTATUS > +(*XENBUS_STORE_PERMISSIONS_SET)( > + IN PINTERFACE Interface, > + IN PXENBUS_STORE_TRANSACTION Transaction OPTIONAL, > + IN PCHAR Prefix OPTIONAL, > + IN PCHAR Node, > + IN PXENBUS_STORE_PERMISSION Permissions, > + IN ULONG NumberPermissions > + ); > + > // {86824C3B-D34E-4753-B281-2F1E3AD214D7} > DEFINE_GUID(GUID_XENBUS_STORE_INTERFACE, > 0x86824c3b, 0xd34e, 0x4753, 0xb2, 0x81, 0x2f, 0x1e, 0x3a, 0xd2, 0x14, 0xd7); > > +/*! \struct _XENBUS_STORE_INTERFACE_V1 > + \brief STORE interface version 1 > + \ingroup interfaces > +*/ > struct _XENBUS_STORE_INTERFACE_V1 { > INTERFACE Interface; > XENBUS_STORE_ACQUIRE StoreAcquire; > @@ -267,11 +310,28 @@ struct _XENBUS_STORE_INTERFACE_V1 { > XENBUS_STORE_POLL StorePoll; > }; > > -/*! \struct _XENBUS_STORE_INTERFACE_V1 > - \brief STORE interface version 1 > +/*! \struct _XENBUS_STORE_INTERFACE_V2 > + \brief STORE interface version 2 > \ingroup interfaces > */ > -typedef struct _XENBUS_STORE_INTERFACE_V1 > XENBUS_STORE_INTERFACE, *PXENBUS_STORE_INTERFACE; > +struct _XENBUS_STORE_INTERFACE_V2 { > + INTERFACE Interface; > + XENBUS_STORE_ACQUIRE StoreAcquire; > + XENBUS_STORE_RELEASE StoreRelease; > + XENBUS_STORE_FREE StoreFree; > + XENBUS_STORE_READ StoreRead; > + XENBUS_STORE_PRINTF StorePrintf; > + XENBUS_STORE_PERMISSIONS_SET StorePermissionsSet; > + XENBUS_STORE_REMOVE StoreRemove; > + XENBUS_STORE_DIRECTORY StoreDirectory; > + XENBUS_STORE_TRANSACTION_START StoreTransactionStart; > + XENBUS_STORE_TRANSACTION_END StoreTransactionEnd; > + XENBUS_STORE_WATCH_ADD StoreWatchAdd; > + XENBUS_STORE_WATCH_REMOVE StoreWatchRemove; > + XENBUS_STORE_POLL StorePoll; > +}; > + > +typedef struct _XENBUS_STORE_INTERFACE_V2 > XENBUS_STORE_INTERFACE, *PXENBUS_STORE_INTERFACE; > > /*! \def XENBUS_STORE > \brief Macro at assist in method invocation > @@ -282,7 +342,7 @@ typedef struct _XENBUS_STORE_INTERFACE_V1 > XENBUS_STORE_INTERFACE, *PXENBUS_STORE > #endif // _WINDLL > > #define XENBUS_STORE_INTERFACE_VERSION_MIN 1 > -#define XENBUS_STORE_INTERFACE_VERSION_MAX 1 > +#define XENBUS_STORE_INTERFACE_VERSION_MAX 2 > > #endif // _XENBUS_STORE_INTERFACE_H > > -- > 1.8.1.msysgit.1 > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |