ia64/xen-unstable

annotate xen/common/event_channel.c @ 1329:1adc57be9bfa

bitkeeper revision 1.879.2.1 (4092738fCfvp-pu-UzwhXsHdzHbYPw)

Completed first cut of new blkdev i/o world.
author kaf24@scramble.cl.cam.ac.uk
date Fri Apr 30 15:41:03 2004 +0000 (2004-04-30)
parents 369b77bc3884
children c31e790d45bd
rev   line source
kaf24@954 1 /******************************************************************************
kaf24@954 2 * event_channel.c
kaf24@954 3 *
kaf24@954 4 * Event channels between domains.
kaf24@954 5 *
kaf24@1127 6 * Copyright (c) 2003-2004, K A Fraser.
kaf24@954 7 *
kaf24@954 8 * This program is distributed in the hope that it will be useful,
kaf24@954 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
kaf24@954 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kaf24@954 11 * GNU General Public License for more details.
kaf24@954 12 *
kaf24@954 13 * You should have received a copy of the GNU General Public License
kaf24@954 14 * along with this program; if not, write to the Free Software
kaf24@954 15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
kaf24@954 16 */
kaf24@954 17
kaf24@1210 18 #include <xen/config.h>
kaf24@1210 19 #include <xen/init.h>
kaf24@1210 20 #include <xen/lib.h>
kaf24@1210 21 #include <xen/errno.h>
kaf24@1210 22 #include <xen/sched.h>
kaf24@1210 23 #include <xen/event.h>
kaf24@1239 24 #include <xen/irq.h>
kaf24@954 25
kaf24@1127 26 #include <hypervisor-ifs/hypervisor-if.h>
kaf24@1127 27 #include <hypervisor-ifs/event_channel.h>
kaf24@1127 28
kaf24@1218 29 #define INIT_EVENT_CHANNELS 16
kaf24@1218 30 #define MAX_EVENT_CHANNELS 1024
kaf24@954 31
kaf24@1127 32 static int get_free_port(struct task_struct *p)
kaf24@954 33 {
kaf24@1127 34 int max, port;
kaf24@1127 35 event_channel_t *chn;
kaf24@1127 36
kaf24@1127 37 max = p->max_event_channel;
kaf24@1127 38 chn = p->event_channel;
kaf24@1127 39
kaf24@1127 40 for ( port = 0; port < max; port++ )
kaf24@1127 41 if ( chn[port].state == ECS_FREE )
kaf24@1127 42 break;
kaf24@1127 43
kaf24@1127 44 if ( port == max )
kaf24@1127 45 {
kaf24@1127 46 if ( max == MAX_EVENT_CHANNELS )
kaf24@1127 47 return -ENOSPC;
kaf24@1127 48
kaf24@1258 49 max *= 2;
kaf24@1127 50
kaf24@1127 51 chn = kmalloc(max * sizeof(event_channel_t), GFP_KERNEL);
kaf24@1127 52 if ( unlikely(chn == NULL) )
kaf24@1127 53 return -ENOMEM;
kaf24@1127 54
kaf24@1127 55 memset(chn, 0, max * sizeof(event_channel_t));
kaf24@1127 56
kaf24@1127 57 if ( p->event_channel != NULL )
kaf24@1127 58 {
kaf24@1127 59 memcpy(chn, p->event_channel, (max/2) * sizeof(event_channel_t));
kaf24@1127 60 kfree(p->event_channel);
kaf24@1127 61 }
kaf24@1127 62
kaf24@1127 63 p->event_channel = chn;
kaf24@1127 64 p->max_event_channel = max;
kaf24@1127 65 }
kaf24@1127 66
kaf24@1127 67 return port;
kaf24@1127 68 }
kaf24@1127 69
kaf24@1218 70 static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind)
kaf24@1127 71 {
kaf24@1129 72 struct task_struct *p1, *p2;
kaf24@1129 73 int port1 = 0, port2 = 0;
kaf24@1218 74 domid_t dom1 = bind->dom1, dom2 = bind->dom2;
kaf24@954 75 long rc = 0;
kaf24@954 76
kaf24@1127 77 if ( !IS_PRIV(current) )
kaf24@1127 78 return -EPERM;
kaf24@954 79
kaf24@1129 80 if ( dom1 == DOMID_SELF )
kaf24@1129 81 dom1 = current->domain;
kaf24@1129 82 if ( dom2 == DOMID_SELF )
kaf24@1135 83 dom2 = current->domain;
kaf24@1127 84
kaf24@1129 85 if ( ((p1 = find_domain_by_id(dom1)) == NULL) ||
kaf24@1129 86 ((p2 = find_domain_by_id(dom2)) == NULL) )
kaf24@1127 87 {
kaf24@1129 88 if ( p1 != NULL )
kaf24@1129 89 put_task_struct(p1);
kaf24@1127 90 return -ESRCH;
kaf24@1127 91 }
kaf24@1127 92
kaf24@1127 93 /* Avoid deadlock by first acquiring lock of domain with smaller id. */
kaf24@1129 94 if ( dom1 < dom2 )
kaf24@954 95 {
kaf24@1129 96 spin_lock(&p1->event_channel_lock);
kaf24@1129 97 spin_lock(&p2->event_channel_lock);
kaf24@954 98 }
kaf24@954 99 else
kaf24@954 100 {
kaf24@1135 101 if ( p1 != p2 )
kaf24@1135 102 spin_lock(&p2->event_channel_lock);
kaf24@1129 103 spin_lock(&p1->event_channel_lock);
kaf24@954 104 }
kaf24@954 105
kaf24@1129 106 if ( (port1 = get_free_port(p1)) < 0 )
kaf24@954 107 {
kaf24@1129 108 rc = port1;
kaf24@1127 109 goto out;
kaf24@954 110 }
kaf24@954 111
kaf24@1329 112 /* 'Allocate' port1 before searching for a free port2. */
kaf24@1329 113 p1->event_channel[port1].state = ECS_INTERDOMAIN;
kaf24@1329 114
kaf24@1129 115 if ( (port2 = get_free_port(p2)) < 0 )
kaf24@954 116 {
kaf24@1329 117 p1->event_channel[port1].state = ECS_FREE;
kaf24@1129 118 rc = port2;
kaf24@1127 119 goto out;
kaf24@1127 120 }
kaf24@954 121
kaf24@1218 122 p1->event_channel[port1].u.remote.dom = p2;
kaf24@1218 123 p1->event_channel[port1].u.remote.port = (u16)port2;
kaf24@954 124
kaf24@1218 125 p2->event_channel[port2].u.remote.dom = p1;
kaf24@1218 126 p2->event_channel[port2].u.remote.port = (u16)port1;
kaf24@1218 127 p2->event_channel[port2].state = ECS_INTERDOMAIN;
kaf24@1127 128
kaf24@1218 129 evtchn_set_pending(p1, port1);
kaf24@1218 130 evtchn_set_pending(p2, port2);
kaf24@954 131
kaf24@954 132 out:
kaf24@1129 133 spin_unlock(&p1->event_channel_lock);
kaf24@1135 134 if ( p1 != p2 )
kaf24@1135 135 spin_unlock(&p2->event_channel_lock);
kaf24@1127 136
kaf24@1129 137 put_task_struct(p1);
kaf24@1129 138 put_task_struct(p2);
kaf24@1127 139
kaf24@1218 140 bind->port1 = port1;
kaf24@1218 141 bind->port2 = port2;
kaf24@954 142
kaf24@954 143 return rc;
kaf24@954 144 }
kaf24@954 145
kaf24@954 146
kaf24@1218 147 static long evtchn_bind_virq(evtchn_bind_virq_t *bind)
kaf24@1218 148 {
kaf24@1218 149 struct task_struct *p = current;
kaf24@1218 150 int virq = bind->virq;
kaf24@1218 151 int port;
kaf24@1218 152
kaf24@1235 153 if ( virq >= ARRAY_SIZE(p->virq_to_evtchn) )
kaf24@1218 154 return -EINVAL;
kaf24@1218 155
kaf24@1218 156 spin_lock(&p->event_channel_lock);
kaf24@1218 157
kaf24@1218 158 /*
kaf24@1218 159 * Port 0 is the fallback port for VIRQs that haven't been explicitly
kaf24@1249 160 * bound yet. The exception is the 'misdirect VIRQ', which is permanently
kaf24@1218 161 * bound to port 0.
kaf24@1218 162 */
kaf24@1218 163 if ( ((port = p->virq_to_evtchn[virq]) != 0) ||
kaf24@1249 164 (virq == VIRQ_MISDIRECT) ||
kaf24@1218 165 ((port = get_free_port(p)) < 0) )
kaf24@1218 166 goto out;
kaf24@1218 167
kaf24@1218 168 p->event_channel[port].state = ECS_VIRQ;
kaf24@1218 169 p->event_channel[port].u.virq = virq;
kaf24@1218 170
kaf24@1218 171 p->virq_to_evtchn[virq] = port;
kaf24@1218 172
kaf24@1218 173 out:
kaf24@1218 174 spin_unlock(&p->event_channel_lock);
kaf24@1218 175
kaf24@1218 176 if ( port < 0 )
kaf24@1218 177 return port;
kaf24@1218 178
kaf24@1218 179 bind->port = port;
kaf24@1218 180 return 0;
kaf24@1218 181 }
kaf24@1218 182
kaf24@1218 183
kaf24@1235 184 static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind)
kaf24@1235 185 {
kaf24@1235 186 struct task_struct *p = current;
kaf24@1235 187 int pirq = bind->pirq;
kaf24@1239 188 int port, rc;
kaf24@1235 189
kaf24@1235 190 if ( pirq >= ARRAY_SIZE(p->pirq_to_evtchn) )
kaf24@1235 191 return -EINVAL;
kaf24@1235 192
kaf24@1235 193 spin_lock(&p->event_channel_lock);
kaf24@1235 194
kaf24@1239 195 if ( ((rc = port = p->pirq_to_evtchn[pirq]) != 0) ||
kaf24@1239 196 ((rc = port = get_free_port(p)) < 0) )
kaf24@1235 197 goto out;
kaf24@1235 198
kaf24@1239 199 p->pirq_to_evtchn[pirq] = port;
kaf24@1253 200 rc = pirq_guest_bind(p, pirq,
kaf24@1253 201 !!(bind->flags & BIND_PIRQ__WILL_SHARE));
kaf24@1253 202 if ( rc != 0 )
kaf24@1239 203 {
kaf24@1239 204 p->pirq_to_evtchn[pirq] = 0;
kaf24@1251 205 DPRINTK("Couldn't bind to PIRQ %d (error=%d)\n", pirq, rc);
kaf24@1239 206 goto out;
kaf24@1239 207 }
kaf24@1239 208
kaf24@1235 209 p->event_channel[port].state = ECS_PIRQ;
kaf24@1235 210 p->event_channel[port].u.pirq = pirq;
kaf24@1235 211
kaf24@1235 212 out:
kaf24@1235 213 spin_unlock(&p->event_channel_lock);
kaf24@1235 214
kaf24@1239 215 if ( rc < 0 )
kaf24@1239 216 return rc;
kaf24@1235 217
kaf24@1235 218 bind->port = port;
kaf24@1235 219 return 0;
kaf24@1235 220 }
kaf24@1235 221
kaf24@1235 222
kaf24@1218 223 static long __evtchn_close(struct task_struct *p1, int port1)
kaf24@954 224 {
kaf24@1129 225 struct task_struct *p2 = NULL;
kaf24@1129 226 event_channel_t *chn1, *chn2;
kaf24@1129 227 int port2;
kaf24@954 228 long rc = 0;
kaf24@954 229
kaf24@954 230 again:
kaf24@1129 231 spin_lock(&p1->event_channel_lock);
kaf24@954 232
kaf24@1129 233 chn1 = p1->event_channel;
kaf24@954 234
kaf24@1249 235 /* NB. Port 0 is special (VIRQ_MISDIRECT). Never let it be closed. */
kaf24@1218 236 if ( (port1 <= 0) || (port1 >= p1->max_event_channel) )
kaf24@954 237 {
kaf24@954 238 rc = -EINVAL;
kaf24@954 239 goto out;
kaf24@954 240 }
kaf24@954 241
kaf24@1218 242 switch ( chn1[port1].state )
kaf24@954 243 {
kaf24@1218 244 case ECS_FREE:
kaf24@1218 245 rc = -EINVAL;
kaf24@1218 246 goto out;
kaf24@1218 247
kaf24@1218 248 case ECS_UNBOUND:
kaf24@1218 249 break;
kaf24@1218 250
kaf24@1218 251 case ECS_PIRQ:
kaf24@1239 252 if ( (rc = pirq_guest_unbind(p1, chn1[port1].u.pirq)) == 0 )
kaf24@1239 253 p1->pirq_to_evtchn[chn1[port1].u.pirq] = 0;
kaf24@1218 254 break;
kaf24@1218 255
kaf24@1218 256 case ECS_VIRQ:
kaf24@1218 257 p1->virq_to_evtchn[chn1[port1].u.virq] = 0;
kaf24@1218 258 break;
kaf24@1218 259
kaf24@1218 260 case ECS_INTERDOMAIN:
kaf24@1129 261 if ( p2 == NULL )
kaf24@954 262 {
kaf24@1218 263 p2 = chn1[port1].u.remote.dom;
kaf24@1129 264 get_task_struct(p2);
kaf24@1127 265
kaf24@1129 266 if ( p1->domain < p2->domain )
kaf24@954 267 {
kaf24@1129 268 spin_lock(&p2->event_channel_lock);
kaf24@954 269 }
kaf24@1135 270 else if ( p1 != p2 )
kaf24@954 271 {
kaf24@1129 272 spin_unlock(&p1->event_channel_lock);
kaf24@1129 273 spin_lock(&p2->event_channel_lock);
kaf24@954 274 goto again;
kaf24@954 275 }
kaf24@954 276 }
kaf24@1218 277 else if ( p2 != chn1[port1].u.remote.dom )
kaf24@954 278 {
kaf24@954 279 rc = -EINVAL;
kaf24@954 280 goto out;
kaf24@954 281 }
kaf24@954 282
kaf24@1129 283 chn2 = p2->event_channel;
kaf24@1218 284 port2 = chn1[port1].u.remote.port;
kaf24@954 285
kaf24@1129 286 if ( port2 >= p2->max_event_channel )
kaf24@1127 287 BUG();
kaf24@1218 288 if ( chn2[port2].state != ECS_INTERDOMAIN )
kaf24@1127 289 BUG();
kaf24@1218 290 if ( chn2[port2].u.remote.dom != p1 )
kaf24@1127 291 BUG();
kaf24@954 292
kaf24@1258 293 chn2[port2].state = ECS_UNBOUND;
kaf24@1218 294 evtchn_set_exception(p2, port2);
kaf24@1218 295
kaf24@1218 296 break;
kaf24@1218 297
kaf24@1218 298 default:
kaf24@1218 299 BUG();
kaf24@954 300 }
kaf24@954 301
kaf24@1258 302 chn1[port1].state = ECS_FREE;
kaf24@1218 303 evtchn_set_exception(p1, port1);
kaf24@1133 304
kaf24@954 305 out:
kaf24@1129 306 if ( p2 != NULL )
kaf24@954 307 {
kaf24@1135 308 if ( p1 != p2 )
kaf24@1135 309 spin_unlock(&p2->event_channel_lock);
kaf24@1129 310 put_task_struct(p2);
kaf24@954 311 }
kaf24@954 312
kaf24@1145 313 spin_unlock(&p1->event_channel_lock);
kaf24@1145 314
kaf24@954 315 return rc;
kaf24@954 316 }
kaf24@954 317
kaf24@954 318
kaf24@1218 319 static long evtchn_close(evtchn_close_t *close)
kaf24@1127 320 {
kaf24@1129 321 struct task_struct *p;
kaf24@1127 322 long rc;
kaf24@1129 323 domid_t dom = close->dom;
kaf24@1127 324
kaf24@1129 325 if ( dom == DOMID_SELF )
kaf24@1129 326 dom = current->domain;
kaf24@1127 327 else if ( !IS_PRIV(current) )
kaf24@1127 328 return -EPERM;
kaf24@1127 329
kaf24@1129 330 if ( (p = find_domain_by_id(dom)) == NULL )
kaf24@1127 331 return -ESRCH;
kaf24@1127 332
kaf24@1218 333 rc = __evtchn_close(p, close->port);
kaf24@1127 334
kaf24@1129 335 put_task_struct(p);
kaf24@1127 336 return rc;
kaf24@1127 337 }
kaf24@1127 338
kaf24@1127 339
kaf24@1218 340 static long evtchn_send(int lport)
kaf24@954 341 {
kaf24@954 342 struct task_struct *lp = current, *rp;
kaf24@1127 343 int rport;
kaf24@954 344
kaf24@954 345 spin_lock(&lp->event_channel_lock);
kaf24@954 346
kaf24@1127 347 if ( unlikely(lport < 0) ||
kaf24@1127 348 unlikely(lport >= lp->max_event_channel) ||
kaf24@1218 349 unlikely(lp->event_channel[lport].state != ECS_INTERDOMAIN) )
kaf24@954 350 {
kaf24@954 351 spin_unlock(&lp->event_channel_lock);
kaf24@954 352 return -EINVAL;
kaf24@954 353 }
kaf24@954 354
kaf24@1218 355 rp = lp->event_channel[lport].u.remote.dom;
kaf24@1218 356 rport = lp->event_channel[lport].u.remote.port;
kaf24@1127 357
kaf24@1127 358 get_task_struct(rp);
kaf24@954 359
kaf24@954 360 spin_unlock(&lp->event_channel_lock);
kaf24@954 361
kaf24@1218 362 evtchn_set_pending(rp, rport);
kaf24@954 363
kaf24@954 364 put_task_struct(rp);
kaf24@1127 365
kaf24@954 366 return 0;
kaf24@954 367 }
kaf24@954 368
kaf24@954 369
kaf24@1218 370 static long evtchn_status(evtchn_status_t *status)
kaf24@954 371 {
kaf24@1129 372 struct task_struct *p;
kaf24@1218 373 domid_t dom = status->dom;
kaf24@1218 374 int port = status->port;
kaf24@1129 375 event_channel_t *chn;
kaf24@1266 376 long rc = 0;
kaf24@1127 377
kaf24@1129 378 if ( dom == DOMID_SELF )
kaf24@1129 379 dom = current->domain;
kaf24@1127 380 else if ( !IS_PRIV(current) )
kaf24@1127 381 return -EPERM;
kaf24@1127 382
kaf24@1129 383 if ( (p = find_domain_by_id(dom)) == NULL )
kaf24@1127 384 return -ESRCH;
kaf24@954 385
kaf24@1129 386 spin_lock(&p->event_channel_lock);
kaf24@954 387
kaf24@1129 388 chn = p->event_channel;
kaf24@954 389
kaf24@1129 390 if ( (port < 0) || (port >= p->max_event_channel) )
kaf24@954 391 {
kaf24@1266 392 rc = -EINVAL;
kaf24@1266 393 goto out;
kaf24@1127 394 }
kaf24@1127 395
kaf24@1129 396 switch ( chn[port].state )
kaf24@1127 397 {
kaf24@1127 398 case ECS_FREE:
kaf24@1127 399 status->status = EVTCHNSTAT_closed;
kaf24@1127 400 break;
kaf24@1218 401 case ECS_UNBOUND:
kaf24@1218 402 status->status = EVTCHNSTAT_unbound;
kaf24@1127 403 break;
kaf24@1218 404 case ECS_INTERDOMAIN:
kaf24@1218 405 status->status = EVTCHNSTAT_interdomain;
kaf24@1218 406 status->u.interdomain.dom = chn[port].u.remote.dom->domain;
kaf24@1218 407 status->u.interdomain.port = chn[port].u.remote.port;
kaf24@1218 408 break;
kaf24@1218 409 case ECS_PIRQ:
kaf24@1218 410 status->status = EVTCHNSTAT_pirq;
kaf24@1218 411 status->u.pirq = chn[port].u.pirq;
kaf24@1218 412 break;
kaf24@1218 413 case ECS_VIRQ:
kaf24@1218 414 status->status = EVTCHNSTAT_virq;
kaf24@1218 415 status->u.virq = chn[port].u.virq;
kaf24@1127 416 break;
kaf24@1127 417 default:
kaf24@1127 418 BUG();
kaf24@954 419 }
kaf24@954 420
kaf24@1266 421 out:
kaf24@1129 422 spin_unlock(&p->event_channel_lock);
kaf24@1266 423 put_task_struct(p);
kaf24@1266 424 return rc;
kaf24@954 425 }
kaf24@954 426
kaf24@954 427
kaf24@1127 428 long do_event_channel_op(evtchn_op_t *uop)
kaf24@954 429 {
kaf24@954 430 long rc;
kaf24@1127 431 evtchn_op_t op;
kaf24@954 432
kaf24@1127 433 if ( copy_from_user(&op, uop, sizeof(op)) != 0 )
kaf24@1127 434 return -EFAULT;
kaf24@1127 435
kaf24@1127 436 switch ( op.cmd )
kaf24@954 437 {
kaf24@1218 438 case EVTCHNOP_bind_interdomain:
kaf24@1218 439 rc = evtchn_bind_interdomain(&op.u.bind_interdomain);
kaf24@1235 440 if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
kaf24@1218 441 rc = -EFAULT; /* Cleaning up here would be a mess! */
kaf24@1218 442 break;
kaf24@1218 443
kaf24@1218 444 case EVTCHNOP_bind_virq:
kaf24@1218 445 rc = evtchn_bind_virq(&op.u.bind_virq);
kaf24@1235 446 if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
kaf24@1235 447 rc = -EFAULT; /* Cleaning up here would be a mess! */
kaf24@1235 448 break;
kaf24@1235 449
kaf24@1235 450 case EVTCHNOP_bind_pirq:
kaf24@1235 451 rc = evtchn_bind_pirq(&op.u.bind_pirq);
kaf24@1235 452 if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
kaf24@1127 453 rc = -EFAULT; /* Cleaning up here would be a mess! */
kaf24@954 454 break;
kaf24@954 455
kaf24@954 456 case EVTCHNOP_close:
kaf24@1218 457 rc = evtchn_close(&op.u.close);
kaf24@954 458 break;
kaf24@954 459
kaf24@954 460 case EVTCHNOP_send:
kaf24@1218 461 rc = evtchn_send(op.u.send.local_port);
kaf24@954 462 break;
kaf24@954 463
kaf24@954 464 case EVTCHNOP_status:
kaf24@1218 465 rc = evtchn_status(&op.u.status);
kaf24@1235 466 if ( (rc == 0) && (copy_to_user(uop, &op, sizeof(op)) != 0) )
kaf24@1127 467 rc = -EFAULT;
kaf24@954 468 break;
kaf24@954 469
kaf24@954 470 default:
kaf24@954 471 rc = -ENOSYS;
kaf24@954 472 break;
kaf24@954 473 }
kaf24@954 474
kaf24@954 475 return rc;
kaf24@954 476 }
kaf24@954 477
kaf24@954 478
kaf24@1218 479 int init_event_channels(struct task_struct *p)
kaf24@1218 480 {
kaf24@1218 481 spin_lock_init(&p->event_channel_lock);
kaf24@1218 482 p->event_channel = kmalloc(INIT_EVENT_CHANNELS * sizeof(event_channel_t),
kaf24@1218 483 GFP_KERNEL);
kaf24@1218 484 if ( unlikely(p->event_channel == NULL) )
kaf24@1218 485 return -ENOMEM;
kaf24@1218 486 p->max_event_channel = INIT_EVENT_CHANNELS;
kaf24@1218 487 memset(p->event_channel, 0, INIT_EVENT_CHANNELS * sizeof(event_channel_t));
kaf24@1218 488 p->event_channel[0].state = ECS_VIRQ;
kaf24@1249 489 p->event_channel[0].u.virq = VIRQ_MISDIRECT;
kaf24@1218 490 return 0;
kaf24@1218 491 }
kaf24@1218 492
kaf24@1218 493
kaf24@954 494 void destroy_event_channels(struct task_struct *p)
kaf24@954 495 {
kaf24@954 496 int i;
kaf24@954 497 if ( p->event_channel != NULL )
kaf24@954 498 {
kaf24@954 499 for ( i = 0; i < p->max_event_channel; i++ )
kaf24@1218 500 (void)__evtchn_close(p, i);
kaf24@954 501 kfree(p->event_channel);
kaf24@954 502 }
kaf24@954 503 }