[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 11/15] Update EVTCHN to version 3



Since the Unmask method no longer returns any useful information, make it
void. This means we need to bump the interface version to 3.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/evtchn_interface.h | 33 ++++++++++++++++++++++++++++-----
 src/xenbus/evtchn.c        | 44 ++++++++++++++++++++++++++++++++++++++++++--
 src/xenbus/fdo.c           | 13 ++++---------
 src/xenbus/store.c         | 13 ++++---------
 4 files changed, 78 insertions(+), 25 deletions(-)

diff --git a/include/evtchn_interface.h b/include/evtchn_interface.h
index 4ab2b28..1bc456a 100644
--- a/include/evtchn_interface.h
+++ b/include/evtchn_interface.h
@@ -126,15 +126,21 @@ typedef NTSTATUS
     IN  ULONG                   Cpu
     );
 
+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
-    \return TRUE if there was an event pending at the point of unmask, FALSE 
otherwise
 */
-typedef BOOLEAN
+typedef VOID
 (*XENBUS_EVTCHN_UNMASK)(
     IN  PINTERFACE              Interface,
     IN  PXENBUS_EVTCHN_CHANNEL  Channel,
@@ -203,7 +209,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V1 {
     XENBUS_EVTCHN_ACQUIRE   EvtchnAcquire;
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
-    XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
+    XENBUS_EVTCHN_UNMASK_V1 EvtchnUnmaskVersion1;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
     XENBUS_EVTCHN_GET_PORT  EvtchnGetPort;
@@ -220,6 +226,23 @@ struct _XENBUS_EVTCHN_INTERFACE_V2 {
     XENBUS_EVTCHN_RELEASE   EvtchnRelease;
     XENBUS_EVTCHN_OPEN      EvtchnOpen;
     XENBUS_EVTCHN_BIND      EvtchnBind;
+    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      EvtchnBind;
     XENBUS_EVTCHN_UNMASK    EvtchnUnmask;
     XENBUS_EVTCHN_SEND      EvtchnSend;
     XENBUS_EVTCHN_TRIGGER   EvtchnTrigger;
@@ -227,7 +250,7 @@ struct _XENBUS_EVTCHN_INTERFACE_V2 {
     XENBUS_EVTCHN_CLOSE     EvtchnClose;
 };
 
-typedef struct _XENBUS_EVTCHN_INTERFACE_V2 XENBUS_EVTCHN_INTERFACE, 
*PXENBUS_EVTCHN_INTERFACE;
+typedef struct _XENBUS_EVTCHN_INTERFACE_V3 XENBUS_EVTCHN_INTERFACE, 
*PXENBUS_EVTCHN_INTERFACE;
 
 /*! \def XENBUS_EVTCHN
     \brief Macro at assist in method invocation
@@ -238,7 +261,7 @@ typedef struct _XENBUS_EVTCHN_INTERFACE_V2 
XENBUS_EVTCHN_INTERFACE, *PXENBUS_EVT
 #endif  // _WINDLL
 
 #define XENBUS_EVTCHN_INTERFACE_VERSION_MIN 1
-#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 2
+#define XENBUS_EVTCHN_INTERFACE_VERSION_MAX 3
 
 #endif  // _XENBUS_EVTCHN_INTERFACE_H
 
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index e33a68e..4cb00eb 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -484,7 +484,7 @@ EvtchnTrigger(
     KeReleaseSpinLock(&Channel->Lock, Irql);
 }
 
-static BOOLEAN
+static VOID
 EvtchnUnmask(
     IN  PINTERFACE              Interface,
     IN  PXENBUS_EVTCHN_CHANNEL  Channel,
@@ -515,6 +515,16 @@ EvtchnUnmask(
 done:
     if (!InUpcall)
         KeReleaseSpinLock(&Channel->Lock, Irql);
+}
+
+static BOOLEAN
+EvtchnUnmaskVersion1(
+    IN  PINTERFACE              Interface,
+    IN  PXENBUS_EVTCHN_CHANNEL  Channel,
+    IN  BOOLEAN                 InUpcall
+    )
+{
+    EvtchnUnmask(Interface, Channel, InUpcall);
 
     return FALSE;
 }
@@ -1162,7 +1172,7 @@ static struct _XENBUS_EVTCHN_INTERFACE_V1 
EvtchnInterfaceVersion1 = {
     EvtchnAcquire,
     EvtchnRelease,
     EvtchnOpen,
-    EvtchnUnmask,
+    EvtchnUnmaskVersion1,
     EvtchnSend,
     EvtchnTrigger,
     EvtchnGetPort,
@@ -1175,6 +1185,19 @@ static struct _XENBUS_EVTCHN_INTERFACE_V2 
EvtchnInterfaceVersion2 = {
     EvtchnRelease,
     EvtchnOpen,
     EvtchnBind,
+    EvtchnUnmaskVersion1,
+    EvtchnSend,
+    EvtchnTrigger,
+    EvtchnGetPort,
+    EvtchnClose
+};
+
+static struct _XENBUS_EVTCHN_INTERFACE_V3 EvtchnInterfaceVersion3 = {
+    { sizeof (struct _XENBUS_EVTCHN_INTERFACE_V3), 3, NULL, NULL, NULL },
+    EvtchnAcquire,
+    EvtchnRelease,
+    EvtchnOpen,
+    EvtchnBind,
     EvtchnUnmask,
     EvtchnSend,
     EvtchnTrigger,
@@ -1325,6 +1348,23 @@ EvtchnGetInterface(
         status = STATUS_SUCCESS;
         break;
     }
+    case 3: {
+        struct _XENBUS_EVTCHN_INTERFACE_V3  *EvtchnInterface;
+
+        EvtchnInterface = (struct _XENBUS_EVTCHN_INTERFACE_V3 *)Interface;
+
+        status = STATUS_BUFFER_OVERFLOW;
+        if (Size < sizeof (struct _XENBUS_EVTCHN_INTERFACE_V3))
+            break;
+
+        *EvtchnInterface = EvtchnInterfaceVersion3;
+
+        ASSERT3U(Interface->Version, ==, Version);
+        Interface->Context = Context;
+
+        status = STATUS_SUCCESS;
+        break;
+    }
     default:
         status = STATUS_NOT_SUPPORTED;
         break;
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 1a122c0..7115d8e 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -2016,7 +2016,6 @@ __FdoD3ToD0(
     IN  PXENBUS_FDO Fdo
     )
 {
-    BOOLEAN         Pending;
     NTSTATUS        status;
 
     Trace("====>\n");
@@ -2034,14 +2033,10 @@ __FdoD3ToD0(
     if (Fdo->Channel == NULL)
         goto fail1;
 
-    Pending = XENBUS_EVTCHN(Unmask,
-                            &Fdo->EvtchnInterface,
-                            Fdo->Channel,
-                            FALSE);
-    if (Pending)
-        XENBUS_EVTCHN(Trigger,
-                      &Fdo->EvtchnInterface,
-                      Fdo->Channel);
+    XENBUS_EVTCHN(Unmask,
+                  &Fdo->EvtchnInterface,
+                  Fdo->Channel,
+                  FALSE);
 
     status = XENBUS_STORE(WatchAdd,
                           &Fdo->StoreInterface,
diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index 04fce3a..9d581f5 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -1827,7 +1827,6 @@ StoreEnable(
 {
     ULONGLONG                   Value;
     ULONG                       Port;
-    BOOLEAN                     Pending;
     NTSTATUS                    status;
 
     status = HvmGetParam(HVM_PARAM_STORE_EVTCHN, &Value);
@@ -1857,14 +1856,10 @@ StoreEnable(
                          Context->Channel,
                          KeNumberProcessors - 1);
 
-    Pending = XENBUS_EVTCHN(Unmask,
-                            &Context->EvtchnInterface,
-                            Context->Channel,
-                            FALSE);
-    if (Pending)
-        XENBUS_EVTCHN(Trigger,
-                      &Context->EvtchnInterface,
-                      Context->Channel);
+    XENBUS_EVTCHN(Unmask,
+                  &Context->EvtchnInterface,
+                  Context->Channel,
+                  FALSE);
 }
 
 static PHYSICAL_ADDRESS
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.