Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 330019
Collapse All | Expand All

(-)original//vmmon-only/linux/iommu.c (-2 / +2 lines)
Lines 148-164 Link Here
148
            printk(KERN_ERR "%s: the physical page number 0x%x is not valid.\n",
148
            printk(KERN_ERR "%s: the physical page number 0x%x is not valid.\n",
149
                   __func__, mpn);
149
                   __func__, mpn);
150
            status = -EINVAL;
150
            status = -EINVAL;
151
            goto out;
151
            goto out;
152
         }
152
         }
153
         map_to =  PPN_2_PA(mpn);
153
         map_to =  PPN_2_PA(mpn);
154
         map_prot = IOMMU_READ | IOMMU_WRITE;
154
         map_prot = IOMMU_READ | IOMMU_WRITE;
155
      }
155
      }
156
      if ((status = iommu_map_range(vmLinux->iommuDomain,
156
      if ((status = iommu_map(vmLinux->iommuDomain,
157
                                    PPN_2_PA(ppn),
157
                                    PPN_2_PA(ppn),
158
                                    map_to, PAGE_SIZE, map_prot))) {
158
                                    map_to, PAGE_SIZE, map_prot))) {
159
         printk(KERN_ERR "%s: IOMMU Mapping of PPN 0x%x -> MPN 0x%x "
159
         printk(KERN_ERR "%s: IOMMU Mapping of PPN 0x%x -> MPN 0x%x "
160
                "could not be established.\n", __func__, ppn, mpn);
160
                "could not be established.\n", __func__, ppn, mpn);
161
         goto out;
161
         goto out;
162
      }
162
      }
163
   }
163
   }
164
   printk(KERN_DEBUG "%s: IOMMU domain is created.\n", __func__);
164
   printk(KERN_DEBUG "%s: IOMMU domain is created.\n", __func__);
Lines 395-411 Link Here
395
         list_del(&passthruDevice->list);
395
         list_del(&passthruDevice->list);
396
         IOMMUUnregisterDeviceInt(passthruDevice);
396
         IOMMUUnregisterDeviceInt(passthruDevice);
397
      }
397
      }
398
   }
398
   }
399
   spin_unlock(&passthruDeviceListLock);
399
   spin_unlock(&passthruDeviceListLock);
400
400
401
   /* Relinquish the IOMMU domain used by this VM. */
401
   /* Relinquish the IOMMU domain used by this VM. */
402
   for (ppn = 0; ppn < vmLinux->numPages; ppn++) {
402
   for (ppn = 0; ppn < vmLinux->numPages; ppn++) {
403
      iommu_unmap_range(vmLinux->iommuDomain, PPN_2_PA(ppn), PAGE_SIZE);
403
      iommu_unmap(vmLinux->iommuDomain, PPN_2_PA(ppn), PAGE_SIZE);
404
   }
404
   }
405
   if (vmLinux->iommuDomain) {
405
   if (vmLinux->iommuDomain) {
406
      iommu_domain_free(vmLinux->iommuDomain);
406
      iommu_domain_free(vmLinux->iommuDomain);
407
      vmLinux->iommuDomain = NULL;
407
      vmLinux->iommuDomain = NULL;
408
      printk(KERN_INFO "%s: IOMMU domain is destroyed.\n", __func__);
408
      printk(KERN_INFO "%s: IOMMU domain is destroyed.\n", __func__);
409
   }
409
   }
410
}
410
}
411
411
(-)original//vsock-only/linux/af_vsock.c (-13 / +13 lines)
Lines 3216-3232 Link Here
3216
   }
3216
   }
3217
3217
3218
   /*
3218
   /*
3219
    * The receive path will handle all communication until we are able to enter
3219
    * The receive path will handle all communication until we are able to enter
3220
    * the connected state.  Here we wait for the connection to be completed or
3220
    * the connected state.  Here we wait for the connection to be completed or
3221
    * a notification of an error.
3221
    * a notification of an error.
3222
    */
3222
    */
3223
   timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
3223
   timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
3224
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3224
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
3225
3225
3226
   while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
3226
   while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
3227
      if (timeout == 0) {
3227
      if (timeout == 0) {
3228
         /*
3228
         /*
3229
          * If we're not going to block, skip ahead to preserve error code set
3229
          * If we're not going to block, skip ahead to preserve error code set
3230
          * above.
3230
          * above.
3231
          */
3231
          */
3232
         goto outWait;
3232
         goto outWait;
Lines 3239-3267 Link Here
3239
      if (signal_pending(current)) {
3239
      if (signal_pending(current)) {
3240
         err = sock_intr_errno(timeout);
3240
         err = sock_intr_errno(timeout);
3241
         goto outWaitError;
3241
         goto outWaitError;
3242
      } else if (timeout == 0) {
3242
      } else if (timeout == 0) {
3243
         err = -ETIMEDOUT;
3243
         err = -ETIMEDOUT;
3244
         goto outWaitError;
3244
         goto outWaitError;
3245
      }
3245
      }
3246
3246
3247
      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3247
      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
3248
   }
3248
   }
3249
3249
3250
   if (sk->compat_sk_err) {
3250
   if (sk->compat_sk_err) {
3251
      err = -sk->compat_sk_err;
3251
      err = -sk->compat_sk_err;
3252
      goto outWaitError;
3252
      goto outWaitError;
3253
   } else {
3253
   } else {
3254
      ASSERT(sk->compat_sk_state == SS_CONNECTED);
3254
      ASSERT(sk->compat_sk_state == SS_CONNECTED);
3255
      err = 0;
3255
      err = 0;
3256
   }
3256
   }
3257
3257
3258
outWait:
3258
outWait:
3259
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
3259
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
3260
out:
3260
out:
3261
   release_sock(sk);
3261
   release_sock(sk);
3262
   return err;
3262
   return err;
3263
3263
3264
outWaitError:
3264
outWaitError:
3265
   sk->compat_sk_state = SS_UNCONNECTED;
3265
   sk->compat_sk_state = SS_UNCONNECTED;
3266
   sock->state = SS_UNCONNECTED;
3266
   sock->state = SS_UNCONNECTED;
3267
   goto outWait;
3267
   goto outWait;
Lines 3311-3343 Link Here
3311
      goto out;
3311
      goto out;
3312
   }
3312
   }
3313
3313
3314
   /*
3314
   /*
3315
    * Wait for children sockets to appear; these are the new sockets created
3315
    * Wait for children sockets to appear; these are the new sockets created
3316
    * upon connection establishment.
3316
    * upon connection establishment.
3317
    */
3317
    */
3318
   timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
3318
   timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
3319
   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3319
   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
3320
3320
3321
   while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
3321
   while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
3322
          listener->compat_sk_err == 0) {
3322
          listener->compat_sk_err == 0) {
3323
      release_sock(listener);
3323
      release_sock(listener);
3324
      timeout = schedule_timeout(timeout);
3324
      timeout = schedule_timeout(timeout);
3325
      lock_sock(listener);
3325
      lock_sock(listener);
3326
3326
3327
      if (signal_pending(current)) {
3327
      if (signal_pending(current)) {
3328
         err = sock_intr_errno(timeout);
3328
         err = sock_intr_errno(timeout);
3329
         goto outWait;
3329
         goto outWait;
3330
      } else if (timeout == 0) {
3330
      } else if (timeout == 0) {
3331
         err = -EAGAIN;
3331
         err = -EAGAIN;
3332
         goto outWait;
3332
         goto outWait;
3333
      }
3333
      }
3334
3334
3335
      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3335
      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
3336
   }
3336
   }
3337
3337
3338
   if (listener->compat_sk_err) {
3338
   if (listener->compat_sk_err) {
3339
      err = -listener->compat_sk_err;
3339
      err = -listener->compat_sk_err;
3340
   }
3340
   }
3341
3341
3342
   if (connected) {
3342
   if (connected) {
3343
      listener->compat_sk_ack_backlog--;
3343
      listener->compat_sk_ack_backlog--;
Lines 3361-3377 Link Here
3361
3361
3362
      newsock->state = SS_CONNECTED;
3362
      newsock->state = SS_CONNECTED;
3363
      sock_graft(connected, newsock);
3363
      sock_graft(connected, newsock);
3364
      release_sock(connected);
3364
      release_sock(connected);
3365
      sock_put(connected);
3365
      sock_put(connected);
3366
   }
3366
   }
3367
3367
3368
outWait:
3368
outWait:
3369
   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
3369
   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
3370
out:
3370
out:
3371
   release_sock(listener);
3371
   release_sock(listener);
3372
   return err;
3372
   return err;
3373
}
3373
}
3374
3374
3375
3375
3376
/*
3376
/*
3377
 *----------------------------------------------------------------------------
3377
 *----------------------------------------------------------------------------
Lines 3459-3475 Link Here
3459
{
3459
{
3460
   struct sock *sk;
3460
   struct sock *sk;
3461
   unsigned int mask;
3461
   unsigned int mask;
3462
   VSockVmciSock *vsk;
3462
   VSockVmciSock *vsk;
3463
3463
3464
   sk = sock->sk;
3464
   sk = sock->sk;
3465
   vsk = vsock_sk(sk);
3465
   vsk = vsock_sk(sk);
3466
3466
3467
   poll_wait(file, sk->compat_sk_sleep, wait);
3467
   poll_wait(file, compat_sk_sleep(sk), wait);
3468
   mask = 0;
3468
   mask = 0;
3469
3469
3470
   if (sk->compat_sk_err) {
3470
   if (sk->compat_sk_err) {
3471
      /* Signify that there has been an error on this socket. */
3471
      /* Signify that there has been an error on this socket. */
3472
      mask |= POLLERR;
3472
      mask |= POLLERR;
3473
   }
3473
   }
3474
3474
3475
   /*
3475
   /*
Lines 4099-4115 Link Here
4099
    */
4099
    */
4100
   timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
4100
   timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
4101
4101
4102
   NOTIFYCALLRET(vsk, err, sendInit, sk, &sendData);
4102
   NOTIFYCALLRET(vsk, err, sendInit, sk, &sendData);
4103
   if (err < 0) {
4103
   if (err < 0) {
4104
      goto out;
4104
      goto out;
4105
   }
4105
   }
4106
4106
4107
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4107
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4108
4108
4109
   while (totalWritten < len) {
4109
   while (totalWritten < len) {
4110
      Bool sentWrote;
4110
      Bool sentWrote;
4111
      unsigned int retries;
4111
      unsigned int retries;
4112
      ssize_t written;
4112
      ssize_t written;
4113
4113
4114
      sentWrote = FALSE;
4114
      sentWrote = FALSE;
4115
      retries = 0;
4115
      retries = 0;
Lines 4136-4152 Link Here
4136
         if (signal_pending(current)) {
4136
         if (signal_pending(current)) {
4137
            err = sock_intr_errno(timeout);
4137
            err = sock_intr_errno(timeout);
4138
            goto outWait;
4138
            goto outWait;
4139
         } else if (timeout == 0) {
4139
         } else if (timeout == 0) {
4140
            err = -EAGAIN;
4140
            err = -EAGAIN;
4141
            goto outWait;
4141
            goto outWait;
4142
         }
4142
         }
4143
4143
4144
         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
4144
         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
4145
                                     &wait, TASK_INTERRUPTIBLE);
4145
                                     &wait, TASK_INTERRUPTIBLE);
4146
      }
4146
      }
4147
4147
4148
      /*
4148
      /*
4149
       * These checks occur both as part of and after the loop conditional
4149
       * These checks occur both as part of and after the loop conditional
4150
       * since we need to check before and after sleeping.
4150
       * since we need to check before and after sleeping.
4151
       */
4151
       */
4152
      if (sk->compat_sk_err) {
4152
      if (sk->compat_sk_err) {
Lines 4189-4205 Link Here
4189
   }
4189
   }
4190
4190
4191
   ASSERT(totalWritten <= INT_MAX);
4191
   ASSERT(totalWritten <= INT_MAX);
4192
4192
4193
outWait:
4193
outWait:
4194
   if (totalWritten > 0) {
4194
   if (totalWritten > 0) {
4195
      err = totalWritten;
4195
      err = totalWritten;
4196
   }
4196
   }
4197
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
4197
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
4198
out:
4198
out:
4199
   release_sock(sk);
4199
   release_sock(sk);
4200
   return err;
4200
   return err;
4201
}
4201
}
4202
4202
4203
4203
4204
/*
4204
/*
4205
 *----------------------------------------------------------------------------
4205
 *----------------------------------------------------------------------------
Lines 4423-4439 Link Here
4423
   timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
4423
   timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
4424
   copied = 0;
4424
   copied = 0;
4425
4425
4426
   NOTIFYCALLRET(vsk, err, recvInit, sk, target, &recvData);
4426
   NOTIFYCALLRET(vsk, err, recvInit, sk, target, &recvData);
4427
   if (err < 0) {
4427
   if (err < 0) {
4428
      goto out;
4428
      goto out;
4429
   }
4429
   }
4430
4430
4431
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4431
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4432
4432
4433
   while ((ready = VSockVmciStreamHasData(vsk)) < target &&
4433
   while ((ready = VSockVmciStreamHasData(vsk)) < target &&
4434
          sk->compat_sk_err == 0 &&
4434
          sk->compat_sk_err == 0 &&
4435
          !(sk->compat_sk_shutdown & RCV_SHUTDOWN) &&
4435
          !(sk->compat_sk_shutdown & RCV_SHUTDOWN) &&
4436
          !(vsk->peerShutdown & SEND_SHUTDOWN)) {
4436
          !(vsk->peerShutdown & SEND_SHUTDOWN)) {
4437
4437
4438
      if (ready < 0) {
4438
      if (ready < 0) {
4439
         /*
4439
         /*
Lines 4463-4479 Link Here
4463
      if (signal_pending(current)) {
4463
      if (signal_pending(current)) {
4464
         err = sock_intr_errno(timeout);
4464
         err = sock_intr_errno(timeout);
4465
         goto outWait;
4465
         goto outWait;
4466
      } else if (timeout == 0) {
4466
      } else if (timeout == 0) {
4467
         err = -EAGAIN;
4467
         err = -EAGAIN;
4468
         goto outWait;
4468
         goto outWait;
4469
      }
4469
      }
4470
4470
4471
      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4471
      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4472
   }
4472
   }
4473
4473
4474
   if (sk->compat_sk_err) {
4474
   if (sk->compat_sk_err) {
4475
      err = -sk->compat_sk_err;
4475
      err = -sk->compat_sk_err;
4476
      goto outWait;
4476
      goto outWait;
4477
   } else if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
4477
   } else if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
4478
      err = 0;
4478
      err = 0;
4479
      goto outWait;
4479
      goto outWait;
Lines 4529-4545 Link Here
4529
   if (err < 0) {
4529
   if (err < 0) {
4530
      goto outWait;
4530
      goto outWait;
4531
   }
4531
   }
4532
4532
4533
   ASSERT(copied <= INT_MAX);
4533
   ASSERT(copied <= INT_MAX);
4534
   err = copied;
4534
   err = copied;
4535
4535
4536
outWait:
4536
outWait:
4537
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
4537
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
4538
out:
4538
out:
4539
   release_sock(sk);
4539
   release_sock(sk);
4540
   return err;
4540
   return err;
4541
}
4541
}
4542
4542
4543
4543
4544
/*
4544
/*
4545
 * Protocol operation.
4545
 * Protocol operation.

Return to bug 330019