[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH 07/10] Separate event channel ABI from core evtchn interface code
The event channel ABI now known as two-level is implemented using the domain shared info. Use of the SHARED_INFO interface is therefore baked into the EVTCHN interface. Xen has recently acquired a new event channel ABI called fifo, which improves on both scalability and performance as compared to two-level. Hence this patch separates the ABI code from the core EVTCHN interface code so that a subsequent patch can add support for the fifo ABI on capable versions of Xen. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenbus/evtchn.c | 180 +++++++++++++++++++++----- src/xenbus/evtchn_2l.c | 293 +++++++++++++++++++++++++++++++++++++++++++ src/xenbus/evtchn_2l.h | 59 +++++++++ src/xenbus/evtchn_abi.h | 109 ++++++++++++++++ vs2012/xenbus/xenbus.vcxproj | 1 + vs2013/xenbus/xenbus.vcxproj | 1 + 6 files changed, 609 insertions(+), 34 deletions(-) create mode 100644 src/xenbus/evtchn_2l.c create mode 100644 src/xenbus/evtchn_2l.h create mode 100644 src/xenbus/evtchn_abi.h diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c index 5a0822d..f13667e 100644 --- a/src/xenbus/evtchn.c +++ b/src/xenbus/evtchn.c @@ -35,6 +35,7 @@ #include <util.h> #include "evtchn.h" +#include "evtchn_2l.h" #include "fdo.h" #include "hash_table.h" #include "dbg_print.h" @@ -89,9 +90,12 @@ struct _XENBUS_EVTCHN_CONTEXT { BOOLEAN Enabled; XENBUS_SUSPEND_INTERFACE SuspendInterface; PXENBUS_SUSPEND_CALLBACK SuspendCallbackEarly; + PXENBUS_SUSPEND_CALLBACK SuspendCallbackLate; XENBUS_DEBUG_INTERFACE DebugInterface; PXENBUS_DEBUG_CALLBACK DebugCallback; XENBUS_SHARED_INFO_INTERFACE SharedInfoInterface; + PXENBUS_EVTCHN_ABI_CONTEXT EvtchnTwoLevelContext; + XENBUS_EVTCHN_ABI EvtchnAbi; PXENBUS_HASH_TABLE Table; LIST_ENTRY List; }; @@ -345,11 +349,17 @@ EvtchnOpen( LocalPort = Channel->LocalPort; + status = XENBUS_EVTCHN_ABI(PortEnable, + &Context->EvtchnAbi, + LocalPort); + if (!NT_SUCCESS(status)) + goto fail3; + status = HashTableAdd(Context->Table, LocalPort, (ULONG_PTR)Channel); if (!NT_SUCCESS(status)) - goto fail3; + goto fail4; Channel->Active = TRUE; @@ -368,6 +378,13 @@ EvtchnOpen( return Channel; +fail4: + Error("fail4\n"); + + XENBUS_EVTCHN_ABI(PortDisable, + &Context->EvtchnAbi, + LocalPort); + fail3: Error("fail3\n"); @@ -415,14 +432,14 @@ EvtchnUnmask( ASSERT3U(KeGetCurrentIrql(), >=, DISPATCH_LEVEL); if (Channel->Active) { - Pending = XENBUS_SHARED_INFO(EvtchnUnmask, - &Context->SharedInfoInterface, - Channel->LocalPort); + Pending = XENBUS_EVTCHN_ABI(PortUnmask, + &Context->EvtchnAbi, + Channel->LocalPort); if (Pending && Channel->Mask) - XENBUS_SHARED_INFO(EvtchnMask, - &Context->SharedInfoInterface, - Channel->LocalPort); + XENBUS_EVTCHN_ABI(PortMask, + &Context->EvtchnAbi, + Channel->LocalPort); } if (!InCallback) @@ -538,9 +555,9 @@ EvtchnClose( Channel->Active = FALSE; - XENBUS_SHARED_INFO(EvtchnMask, - &Context->SharedInfoInterface, - LocalPort); + XENBUS_EVTCHN_ABI(PortMask, + &Context->EvtchnAbi, + LocalPort); if (Channel->Type != XENBUS_EVTCHN_TYPE_FIXED) (VOID) EventChannelClose(LocalPort); @@ -598,22 +615,22 @@ EvtchnPollCallback( if (!NT_SUCCESS(status)) { Warning("[%d]: INVALID PORT\n", LocalPort); - XENBUS_SHARED_INFO(EvtchnMask, - &Context->SharedInfoInterface, - LocalPort); + XENBUS_EVTCHN_ABI(PortMask, + &Context->EvtchnAbi, + LocalPort); DoneSomething = FALSE; goto done; } if (Channel->Mask) - XENBUS_SHARED_INFO(EvtchnMask, - &Context->SharedInfoInterface, - LocalPort); + XENBUS_EVTCHN_ABI(PortMask, + &Context->EvtchnAbi, + LocalPort); - XENBUS_SHARED_INFO(EvtchnAck, - &Context->SharedInfoInterface, - LocalPort); + XENBUS_EVTCHN_ABI(PortAck, + &Context->EvtchnAbi, + LocalPort); DoneSomething = EvtchnCallback(Context, Channel); @@ -633,15 +650,47 @@ EvtchnInterrupt( while (XENBUS_SHARED_INFO(UpcallPending, &Context->SharedInfoInterface, 0)) - DoneSomething |= XENBUS_SHARED_INFO(EvtchnPoll, - &Context->SharedInfoInterface, - 0, - EvtchnPollCallback, - Context); + DoneSomething |= XENBUS_EVTCHN_ABI(Poll, + &Context->EvtchnAbi, + 0, + EvtchnPollCallback, + Context); return DoneSomething; } +static NTSTATUS +EvtchnAbiAcquire( + IN PXENBUS_EVTCHN_CONTEXT Context + ) +{ + NTSTATUS status; + + EvtchnTwoLevelGetAbi(Context->EvtchnTwoLevelContext, + &Context->EvtchnAbi); + + status = XENBUS_EVTCHN_ABI(Acquire, &Context->EvtchnAbi); + if (!NT_SUCCESS(status)) + goto fail1; + + return STATUS_SUCCESS; + +fail1: + Error("fail1 (%08x)\n", status); + + return status; +} + +static VOID +EvtchnAbiRelease( + IN PXENBUS_EVTCHN_CONTEXT Context + ) +{ + XENBUS_EVTCHN_ABI(Release, &Context->EvtchnAbi); + + RtlZeroMemory(&Context->EvtchnAbi, sizeof (XENBUS_EVTCHN_ABI)); +} + static VOID EvtchnSuspendCallbackEarly( IN PVOID Argument @@ -667,6 +716,20 @@ EvtchnSuspendCallbackEarly( ASSERT(NT_SUCCESS(status)); } } +} + +static VOID +EvtchnSuspendCallbackLate( + IN PVOID Argument + ) +{ + PXENBUS_EVTCHN_CONTEXT Context = Argument; + NTSTATUS status; + + EvtchnAbiRelease(Context); + + status = EvtchnAbiAcquire(Context); + ASSERT(NT_SUCCESS(status)); if (Context->Enabled) EvtchnInterruptEnable(Context); @@ -772,6 +835,8 @@ EvtchnAcquire( Trace("====>\n"); + Context->Vector = FdoGetInterruptVector(Fdo); + status = XENBUS_SUSPEND(Acquire, &Context->SuspendInterface); if (!NT_SUCCESS(status)) goto fail1; @@ -785,10 +850,19 @@ EvtchnAcquire( if (!NT_SUCCESS(status)) goto fail2; - status = XENBUS_DEBUG(Acquire, &Context->DebugInterface); + status = XENBUS_SUSPEND(Register, + &Context->SuspendInterface, + SUSPEND_CALLBACK_LATE, + EvtchnSuspendCallbackLate, + Context, + &Context->SuspendCallbackLate); if (!NT_SUCCESS(status)) goto fail3; + status = XENBUS_DEBUG(Acquire, &Context->DebugInterface); + if (!NT_SUCCESS(status)) + goto fail4; + status = XENBUS_DEBUG(Register, &Context->DebugInterface, __MODULE__ "|EVTCHN", @@ -796,13 +870,15 @@ EvtchnAcquire( Context, &Context->DebugCallback); if (!NT_SUCCESS(status)) - goto fail4; + goto fail5; status = XENBUS_SHARED_INFO(Acquire, &Context->SharedInfoInterface); if (!NT_SUCCESS(status)) - goto fail5; + goto fail6; - Context->Vector = FdoGetInterruptVector(Fdo); + status = EvtchnAbiAcquire(Context); + if (!NT_SUCCESS(status)) + goto fail7; Trace("<====\n"); @@ -811,18 +887,31 @@ done: return STATUS_SUCCESS; -fail5: - Error("fail5\n"); +fail7: + Error("fail7\n"); + + XENBUS_SHARED_INFO(Release, &Context->SharedInfoInterface); + +fail6: + Error("fail6\n"); XENBUS_DEBUG(Deregister, &Context->DebugInterface, Context->DebugCallback); Context->DebugCallback = NULL; +fail5: + Error("fail5\n"); + + XENBUS_DEBUG(Release, &Context->DebugInterface); + fail4: Error("fail4\n"); - XENBUS_DEBUG(Release, &Context->DebugInterface); + XENBUS_SUSPEND(Deregister, + &Context->SuspendInterface, + Context->SuspendCallbackLate); + Context->SuspendCallbackLate = NULL; fail3: Error("fail3\n"); @@ -837,6 +926,8 @@ fail2: XENBUS_SUSPEND(Release, &Context->SuspendInterface); + Context->Vector = 0; + fail1: Error("fail1 (%08x)\n", status); @@ -865,7 +956,7 @@ EvtchnRelease( if (!IsListEmpty(&Context->List)) BUG("OUTSTANDING EVENT CHANNELS"); - Context->Vector = 0; + EvtchnAbiRelease(Context); XENBUS_SHARED_INFO(Release, &Context->SharedInfoInterface); @@ -878,11 +969,18 @@ EvtchnRelease( XENBUS_SUSPEND(Deregister, &Context->SuspendInterface, + Context->SuspendCallbackLate); + Context->SuspendCallbackLate = NULL; + + XENBUS_SUSPEND(Deregister, + &Context->SuspendInterface, Context->SuspendCallbackEarly); Context->SuspendCallbackEarly = NULL; XENBUS_SUSPEND(Release, &Context->SuspendInterface); + Context->Vector = 0; + Trace("<====\n"); done: @@ -921,6 +1019,11 @@ EvtchnInitialize( if (!NT_SUCCESS(status)) goto fail2; + status = EvtchnTwoLevelInitialize(Fdo, + &(*Context)->EvtchnTwoLevelContext); + if (!NT_SUCCESS(status)) + goto fail3; + status = SuspendGetInterface(FdoGetSuspendContext(Fdo), XENBUS_SUSPEND_INTERFACE_VERSION_MAX, (PINTERFACE)&(*Context)->SuspendInterface, @@ -951,11 +1054,17 @@ EvtchnInitialize( return STATUS_SUCCESS; +fail3: + Error("fail3\n"); + + HashTableDestroy((*Context)->Table); + (*Context)->Table = NULL; + fail2: Error("fail2\n"); - ASSERT(IsZeroMemory(Context, sizeof (XENBUS_EVTCHN_CONTEXT))); - __EvtchnFree(Context); + ASSERT(IsZeroMemory(*Context, sizeof (XENBUS_EVTCHN_CONTEXT))); + __EvtchnFree(*Context); fail1: Error("fail1 (%08x)\n", status); @@ -1022,6 +1131,9 @@ EvtchnTeardown( RtlZeroMemory(&Context->SuspendInterface, sizeof (XENBUS_SUSPEND_INTERFACE)); + EvtchnTwoLevelTeardown(Context->EvtchnTwoLevelContext); + Context->EvtchnTwoLevelContext = NULL; + HashTableDestroy(Context->Table); Context->Table = NULL; diff --git a/src/xenbus/evtchn_2l.c b/src/xenbus/evtchn_2l.c new file mode 100644 index 0000000..0f839ee --- /dev/null +++ b/src/xenbus/evtchn_2l.c @@ -0,0 +1,293 @@ +/* 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. + */ + +#include <ntddk.h> +#include <stdarg.h> +#include <xen.h> +#include <util.h> + +#include "evtchn_2l.h" +#include "shared_info.h" +#include "fdo.h" +#include "dbg_print.h" +#include "assert.h" + +typedef struct _XENBUS_EVTCHN_TWO_LEVEL_CONTEXT { + PXENBUS_FDO Fdo; + KSPIN_LOCK Lock; + LONG References; + XENBUS_SHARED_INFO_INTERFACE SharedInfoInterface; +} XENBUS_EVTCHN_TWO_LEVEL_CONTEXT, *PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT; + +#define XENBUS_EVTCHN_TWO_LEVEL_TAG 'L2' + +static FORCEINLINE PVOID +__EvtchnTwoLevelAllocate( + IN ULONG Length + ) +{ + return __AllocatePoolWithTag(NonPagedPool, Length, XENBUS_EVTCHN_TWO_LEVEL_TAG); +} + +static FORCEINLINE VOID +__EvtchnTwoLevelFree( + IN PVOID Buffer + ) +{ + ExFreePoolWithTag(Buffer, XENBUS_EVTCHN_TWO_LEVEL_TAG); +} + +static BOOLEAN +EvtchnTwoLevelPoll( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Cpu, + IN XENBUS_EVTCHN_ABI_EVENT Event, + IN PVOID Argument + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + return XENBUS_SHARED_INFO(EvtchnPoll, + &Context->SharedInfoInterface, + Cpu, + Event, + Argument); +} + +static NTSTATUS +EvtchnTwoLevelPortEnable( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Port + ) +{ + UNREFERENCED_PARAMETER(_Context); + UNREFERENCED_PARAMETER(Port); + + return STATUS_SUCCESS; +} + +static VOID +EvtchnTwoLevelPortDisable( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Port + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + XENBUS_SHARED_INFO(EvtchnMask, + &Context->SharedInfoInterface, + Port); +} + +static VOID +EvtchnTwoLevelPortAck( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Port + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + XENBUS_SHARED_INFO(EvtchnAck, + &Context->SharedInfoInterface, + Port); +} + +static VOID +EvtchnTwoLevelPortMask( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Port + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + XENBUS_SHARED_INFO(EvtchnMask, + &Context->SharedInfoInterface, + Port); +} + +static BOOLEAN +EvtchnTwoLevelPortUnmask( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + IN ULONG Port + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + return XENBUS_SHARED_INFO(EvtchnUnmask, + &Context->SharedInfoInterface, + Port); +} + +static NTSTATUS +EvtchnTwoLevelAcquire( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + KIRQL Irql; + NTSTATUS status; + + KeAcquireSpinLock(&Context->Lock, &Irql); + + if (Context->References++ != 0) + goto done; + + Trace("====>\n"); + + status = XENBUS_SHARED_INFO(Acquire, &Context->SharedInfoInterface); + if (!NT_SUCCESS(status)) + goto fail1; + + Trace("<====\n"); + +done: + KeReleaseSpinLock(&Context->Lock, Irql); + + return STATUS_SUCCESS; + +fail1: + Error("fail1 (%08x)\n", status); + + XENBUS_SHARED_INFO(Release, &Context->SharedInfoInterface); + + --Context->References; + ASSERT3U(Context->References, ==, 0); + KeReleaseSpinLock(&Context->Lock, Irql); + + return status; +} + +VOID +EvtchnTwoLevelRelease( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + KIRQL Irql; + + KeAcquireSpinLock(&Context->Lock, &Irql); + + if (--Context->References > 0) + goto done; + + Trace("====>\n"); + + XENBUS_SHARED_INFO(Release, &Context->SharedInfoInterface); + + Trace("<====\n"); + +done: + KeReleaseSpinLock(&Context->Lock, Irql); +} + +static XENBUS_EVTCHN_ABI EvtchnAbiTwoLevel = { + NULL, + EvtchnTwoLevelAcquire, + EvtchnTwoLevelRelease, + EvtchnTwoLevelPoll, + EvtchnTwoLevelPortEnable, + EvtchnTwoLevelPortDisable, + EvtchnTwoLevelPortAck, + EvtchnTwoLevelPortMask, + EvtchnTwoLevelPortUnmask +}; + +NTSTATUS +EvtchnTwoLevelInitialize( + IN PXENBUS_FDO Fdo, + OUT PXENBUS_EVTCHN_ABI_CONTEXT *_Context + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context; + NTSTATUS status; + + Trace("====>\n"); + + Context = __EvtchnTwoLevelAllocate(sizeof (XENBUS_EVTCHN_TWO_LEVEL_CONTEXT)); + + status = STATUS_NO_MEMORY; + if (Context == NULL) + goto fail1; + + status = SharedInfoGetInterface(FdoGetSharedInfoContext(Fdo), + XENBUS_SHARED_INFO_INTERFACE_VERSION_MAX, + (PINTERFACE)&Context->SharedInfoInterface, + sizeof (Context->SharedInfoInterface)); + ASSERT(NT_SUCCESS(status)); + ASSERT(Context->SharedInfoInterface.Interface.Context != NULL); + + KeInitializeSpinLock(&Context->Lock); + + Context->Fdo = Fdo; + + *_Context = (PVOID)Context; + + Trace("<====\n"); + + return STATUS_SUCCESS; + +fail1: + Error("fail1 (%08x)\n", status); + + return status; +} + +VOID +EvtchnTwoLevelGetAbi( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context, + OUT PXENBUS_EVTCHN_ABI Abi) +{ + *Abi = EvtchnAbiTwoLevel; + + Abi->Context = (PVOID)_Context; +} + +VOID +EvtchnTwoLevelTeardown( + IN PXENBUS_EVTCHN_ABI_CONTEXT _Context + ) +{ + PXENBUS_EVTCHN_TWO_LEVEL_CONTEXT Context = (PVOID)_Context; + + Trace("====>\n"); + + Context->Fdo = NULL; + + RtlZeroMemory(&Context->Lock, sizeof (KSPIN_LOCK)); + + RtlZeroMemory(&Context->SharedInfoInterface, + sizeof (XENBUS_SHARED_INFO_INTERFACE)); + + ASSERT(IsZeroMemory(Context, sizeof (XENBUS_EVTCHN_TWO_LEVEL_CONTEXT))); + __EvtchnTwoLevelFree(Context); + + Trace("<====\n"); +} diff --git a/src/xenbus/evtchn_2l.h b/src/xenbus/evtchn_2l.h new file mode 100644 index 0000000..c69c555 --- /dev/null +++ b/src/xenbus/evtchn_2l.h @@ -0,0 +1,59 @@ +/* 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. + */ + +#ifndef _XENBUS_EVTCHN_2L_H +#define _XENBUS_EVTCHN_2L_H + +#include <ntddk.h> +#include <xen.h> + +#include "evtchn_abi.h" +#include "fdo.h" + +extern NTSTATUS +EvtchnTwoLevelInitialize( + IN PXENBUS_FDO Fdo, + OUT PXENBUS_EVTCHN_ABI_CONTEXT *Context + ); + +extern VOID +EvtchnTwoLevelGetAbi( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + OUT PXENBUS_EVTCHN_ABI Abi + ); + +extern VOID +EvtchnTwoLevelTeardown( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context + ); + +#endif // _XENBUS_EVTCHN_H + diff --git a/src/xenbus/evtchn_abi.h b/src/xenbus/evtchn_abi.h new file mode 100644 index 0000000..237ce7d --- /dev/null +++ b/src/xenbus/evtchn_abi.h @@ -0,0 +1,109 @@ +/* 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 WARRAN4TIES, + * 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. + */ + +#ifndef _XENBUS_EVTCHN_ABI_H +#define _XENBUS_EVTCHN_ABI_H + +#include <ntddk.h> +#include <xen.h> + +typedef PVOID *PXENBUS_EVTCHN_ABI_CONTEXT; + +typedef NTSTATUS +(*XENBUS_EVTCHN_ABI_ACQUIRE)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context + ); + +typedef VOID +(*XENBUS_EVTCHN_ABI_RELEASE)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context + ); + +typedef BOOLEAN +(*XENBUS_EVTCHN_ABI_EVENT)( + IN PVOID Argument, + IN ULONG Port + ); + +typedef BOOLEAN +(*XENBUS_EVTCHN_ABI_POLL)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Cpu, + IN XENBUS_EVTCHN_ABI_EVENT Event, + IN PVOID Argument + ); + +typedef NTSTATUS +(*XENBUS_EVTCHN_ABI_PORT_ENABLE)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Port + ); + +typedef VOID +(*XENBUS_EVTCHN_ABI_PORT_DISABLE)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Port + ); + +typedef VOID +(*XENBUS_EVTCHN_ABI_PORT_ACK)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Port + ); + +typedef VOID +(*XENBUS_EVTCHN_ABI_PORT_MASK)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Port + ); + +typedef BOOLEAN +(*XENBUS_EVTCHN_ABI_PORT_UNMASK)( + IN PXENBUS_EVTCHN_ABI_CONTEXT Context, + IN ULONG Port + ); + +typedef struct _XENBUS_EVTCHN_ABI { + PXENBUS_EVTCHN_ABI_CONTEXT Context; + XENBUS_EVTCHN_ABI_ACQUIRE EvtchnAbiAcquire; + XENBUS_EVTCHN_ABI_RELEASE EvtchnAbiRelease; + XENBUS_EVTCHN_ABI_POLL EvtchnAbiPoll; + XENBUS_EVTCHN_ABI_PORT_ENABLE EvtchnAbiPortEnable; + XENBUS_EVTCHN_ABI_PORT_DISABLE EvtchnAbiPortDisable; + XENBUS_EVTCHN_ABI_PORT_ACK EvtchnAbiPortAck; + XENBUS_EVTCHN_ABI_PORT_MASK EvtchnAbiPortMask; + XENBUS_EVTCHN_ABI_PORT_UNMASK EvtchnAbiPortUnmask; +} XENBUS_EVTCHN_ABI, *PXENBUS_EVTCHN_ABI; + +#define XENBUS_EVTCHN_ABI(_Method, _Abi, ...) \ + (_Abi)->EvtchnAbi ## _Method((_Abi)->Context, __VA_ARGS__) + +#endif // _XENBUS_EVTCHN_ABI_H diff --git a/vs2012/xenbus/xenbus.vcxproj b/vs2012/xenbus/xenbus.vcxproj index a648bce..6cd12d1 100644 --- a/vs2012/xenbus/xenbus.vcxproj +++ b/vs2012/xenbus/xenbus.vcxproj @@ -88,6 +88,7 @@ <ClCompile Include="..\..\src\xenbus\debug.c" /> <ClCompile Include="..\..\src\xenbus\driver.c" /> <ClCompile Include="..\..\src\xenbus\evtchn.c" /> + <ClCompile Include="..\..\src\xenbus\evtchn_2l.c" /> <ClCompile Include="..\..\src\xenbus\fdo.c" /> <ClCompile Include="..\..\src\xenbus\gnttab.c" /> <ClCompile Include="..\..\src\xenbus\pdo.c" /> diff --git a/vs2013/xenbus/xenbus.vcxproj b/vs2013/xenbus/xenbus.vcxproj index 2c34ed1..0f37f68 100644 --- a/vs2013/xenbus/xenbus.vcxproj +++ b/vs2013/xenbus/xenbus.vcxproj @@ -128,6 +128,7 @@ <ClCompile Include="..\..\src\xenbus\debug.c" /> <ClCompile Include="..\..\src\xenbus\driver.c" /> <ClCompile Include="..\..\src\xenbus\evtchn.c" /> + <ClCompile Include="..\..\src\xenbus\evtchn_2l.c" /> <ClCompile Include="..\..\src\xenbus\fdo.c" /> <ClCompile Include="..\..\src\xenbus\gnttab.c" /> <ClCompile Include="..\..\src\xenbus\pdo.c" /> -- 2.1.1 _______________________________________________ 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 |