Page MenuHomeFreeBSD

D31355.1775840152.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D31355.1775840152.diff

Index: sys/dev/xen/bus/xen_intr.c
===================================================================
--- sys/dev/xen/bus/xen_intr.c
+++ sys/dev/xen/bus/xen_intr.c
@@ -410,10 +410,11 @@
*
* \returns 0 on success, otherwise an errno.
*/
-#define BIND_PARAMS(type, cpu, ...) \
+#define BIND_PARAMS(type, close, cpu, ...) \
{ \
.xi_cookie = NULL, \
.xi_type = (type), \
+ .xi_close = (close), \
.xi_cpu = (cpu), \
__VA_ARGS__ \
}
@@ -1050,8 +1051,7 @@
* The Event Channel API didn't open this port, so it is not
* responsible for closing it automatically on unbind.
*/
- struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, ~0U,
- .xi_close = 0,
+ struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, 0, ~0U,
.xi_port = local_port,
);
@@ -1065,7 +1065,7 @@
enum intr_type flags, xen_intr_handle_t *port_handlep)
{
struct xenisrc *isrc;
- struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, ~0U);
+ struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, 1, ~0U);
struct evtchn_alloc_unbound alloc_unbound;
int error;
@@ -1082,17 +1082,8 @@
}
params.xi_port = alloc_unbound.port;
- error = xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
- filter, handler, arg, flags, port_handlep);
- if (error != 0) {
- evtchn_close_t close = { .port = alloc_unbound.port };
- if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
- panic("EVTCHNOP_close failed");
- return (error);
- }
-
- isrc->xi_close = 1;
- return (0);
+ return (xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
+ filter, handler, arg, flags, port_handlep));
}
int
@@ -1101,7 +1092,11 @@
void *arg, enum intr_type flags, xen_intr_handle_t *port_handlep)
{
struct xenisrc *isrc;
- struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, ~0U);
+ /*
+ * The Event Channel API opened this port, so it is
+ * responsible for closing it automatically on unbind.
+ */
+ struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_PORT, 1, ~0U);
struct evtchn_bind_interdomain bind_interdomain;
int error;
@@ -1118,21 +1113,8 @@
}
params.xi_port = bind_interdomain.local_port;
- error = xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
- filter, handler, arg, flags, port_handlep);
- if (error) {
- evtchn_close_t close = { .port = bind_interdomain.local_port };
- if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
- panic("EVTCHNOP_close failed");
- return (error);
- }
-
- /*
- * The Event Channel API opened this port, so it is
- * responsible for closing it automatically on unbind.
- */
- isrc->xi_close = 1;
- return (0);
+ return (xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
+ filter, handler, arg, flags, port_handlep));
}
int
@@ -1142,7 +1124,11 @@
{
u_int vcpu_id = XEN_CPUID_TO_VCPUID(cpu);
struct xenisrc *isrc;
- struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_VIRQ, cpu,
+ /*
+ * The Event Channel API opened this port, so it is
+ * responsible for closing it automatically on unbind.
+ */
+ struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_VIRQ, 1, cpu,
.xi_virq = virq,
);
struct evtchn_bind_virq bind_virq = { .virq = virq, .vcpu = vcpu_id };
@@ -1159,24 +1145,8 @@
}
params.xi_port = bind_virq.port;
- error = xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
- filter, handler, arg, flags, port_handlep);
-
- if (error != 0) {
- evtchn_close_t close = { .port = bind_virq.port };
-
- if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
- panic("EVTCHNOP_close failed");
- return (error);
- }
-
- /*
- * The Event Channel API opened this port, so it is
- * responsible for closing it automatically on unbind.
- */
- isrc->xi_close = 1;
-
- return (0);
+ return (xen_intr_bind_isrc(&isrc, &params, device_get_nameunit(dev),
+ filter, handler, arg, flags, port_handlep));
}
int
@@ -1186,7 +1156,11 @@
#ifdef SMP
u_int vcpu_id = XEN_CPUID_TO_VCPUID(cpu);
struct xenisrc *isrc;
- struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_IPI, cpu);
+ /*
+ * The Event Channel API opened this port, so it is
+ * responsible for closing it automatically on unbind.
+ */
+ struct xenisrc params = BIND_PARAMS(EVTCHN_TYPE_IPI, 1, cpu);
struct evtchn_bind_ipi bind_ipi = { .vcpu = vcpu_id };
/* Same size as the one used by intr_handler->ih_name. */
char name[MAXCOMLEN + 1];
@@ -1205,22 +1179,8 @@
params.xi_port = bind_ipi.port;
snprintf(name, sizeof(name), "cpu%u", cpu);
- error = xen_intr_bind_isrc(&isrc, &params, name, filter, NULL, NULL,
- flags, port_handlep);
- if (error != 0) {
- evtchn_close_t close = { .port = bind_ipi.port };
-
- if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close))
- panic("EVTCHNOP_close failed");
- return (error);
- }
-
- /*
- * The Event Channel API opened this port, so it is
- * responsible for closing it automatically on unbind.
- */
- isrc->xi_close = 1;
- return (0);
+ return (xen_intr_bind_isrc(&isrc, &params, name, filter, NULL, NULL,
+ flags, port_handlep));
#else
return (EOPNOTSUPP);
#endif

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 10, 4:55 PM (1 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28317686
Default Alt Text
D31355.1775840152.diff (4 KB)

Event Timeline