Page MenuHomeFreeBSD

D29500.id86849.diff
No OneTemporary

D29500.id86849.diff

Index: sys/x86/xen/xen_intr.c
===================================================================
--- sys/x86/xen/xen_intr.c
+++ sys/x86/xen/xen_intr.c
@@ -200,6 +200,38 @@
static boolean_t xen_intr_pirq_eoi_map_enabled;
/*------------------------- Private Functions --------------------------------*/
+
+/**
+ * Retrieve a handle for a Xen interrupt source.
+ *
+ * \param isrc A valid Xen interrupt source structure.
+ *
+ * \returns A handle suitable for use with xen_intr_isrc_from_handle()
+ * to retrieve the original Xen interrupt source structure.
+ */
+
+static __inline xen_intr_handle_t
+xen_intr_handle_from_isrc(struct xenisrc *isrc)
+{
+ return (isrc);
+}
+
+/**
+ * Lookup a Xen interrupt source object given an interrupt binding handle.
+ *
+ * \param handle A handle initialized by a previous call to
+ * xen_intr_bind_isrc().
+ *
+ * \returns A pointer to the Xen interrupt source object associated
+ * with the given interrupt handle. NULL if no association
+ * currently exists.
+ */
+static __inline struct xenisrc *
+xen_intr_isrc_from_handle(xen_intr_handle_t handle)
+{
+ return ((struct xenisrc *)handle);
+}
+
/**
* Disable signal delivery for an event channel port on the
* specified CPU.
@@ -427,8 +459,8 @@
refcount_init(&isrc->xi_refcount, 1);
mtx_unlock(&xen_intr_isrc_lock);
- /* Assign the opaque handler (the event channel port) */
- *port_handlep = &isrc->xi_vector;
+ /* Assign the opaque handler */
+ *port_handlep = xen_intr_handle_from_isrc(isrc);
#ifdef SMP
if (type == EVTCHN_TYPE_PORT) {
@@ -461,32 +493,6 @@
return (0);
}
-/**
- * Lookup a Xen interrupt source object given an interrupt binding handle.
- *
- * \param handle A handle initialized by a previous call to
- * xen_intr_bind_isrc().
- *
- * \returns A pointer to the Xen interrupt source object associated
- * with the given interrupt handle. NULL if no association
- * currently exists.
- */
-static struct xenisrc *
-xen_intr_isrc(xen_intr_handle_t handle)
-{
- int vector;
-
- if (handle == NULL)
- return (NULL);
-
- vector = *(int *)handle;
- KASSERT(vector >= first_evtchn_irq &&
- vector < (first_evtchn_irq + xen_intr_auto_vector_count),
- ("Xen interrupt vector is out of range"));
-
- return ((struct xenisrc *)intr_lookup_source(vector));
-}
-
/**
* Determine the event channel ports at the given section of the
* event port bitmap which have pending events for the given cpu.
@@ -1514,7 +1520,7 @@
struct xenisrc *isrc;
va_list ap;
- isrc = xen_intr_isrc(port_handle);
+ isrc = xen_intr_isrc_from_handle(port_handle);
if (isrc == NULL)
return (EINVAL);
@@ -1532,7 +1538,7 @@
KASSERT(port_handlep != NULL,
("NULL xen_intr_handle_t passed to xen_intr_unbind"));
- isrc = xen_intr_isrc(*port_handlep);
+ isrc = xen_intr_isrc_from_handle(*port_handlep);
*port_handlep = NULL;
if (isrc == NULL)
return;
@@ -1554,7 +1560,7 @@
{
struct xenisrc *isrc;
- isrc = xen_intr_isrc(handle);
+ isrc = xen_intr_isrc_from_handle(handle);
if (isrc != NULL) {
KASSERT(isrc->xi_type == EVTCHN_TYPE_PORT ||
isrc->xi_type == EVTCHN_TYPE_IPI,
@@ -1569,7 +1575,7 @@
{
struct xenisrc *isrc;
- isrc = xen_intr_isrc(handle);
+ isrc = xen_intr_isrc_from_handle(handle);
if (isrc == NULL)
return (0);
@@ -1584,7 +1590,7 @@
struct xenisrc *isrc;
int error;
- isrc = xen_intr_isrc(handle);
+ isrc = xen_intr_isrc_from_handle(handle);
if (isrc == NULL || isrc->xi_cookie != NULL)
return (EINVAL);
@@ -1618,8 +1624,8 @@
refcount_acquire(&xen_intr_port_to_isrc[port]->xi_refcount);
mtx_unlock(&xen_intr_isrc_lock);
- /* Assign the opaque handler (the event channel port) */
- *handlep = &xen_intr_port_to_isrc[port]->xi_vector;
+ /* Assign the opaque handler */
+ *handlep = xen_intr_handle_from_isrc(xen_intr_port_to_isrc[port]);
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 25, 12:16 AM (8 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27917177
Default Alt Text
D29500.id86849.diff (3 KB)

Event Timeline