Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 342193 | Differences between
and this patch

Collapse All | Expand All

(-)original//vmmon-only/linux/driver.c (+1 lines)
Lines 165-180 Link Here
165
 *
165
 *
166
 *----------------------------------------------------------------------
166
 *----------------------------------------------------------------------
167
 */
167
 */
168
static int LinuxDriver_Open(struct inode *inode, struct file *filp);
168
static int LinuxDriver_Open(struct inode *inode, struct file *filp);
169
169
170
static int LinuxDriver_Ioctl(struct inode *inode, struct file *filp,
170
static int LinuxDriver_Ioctl(struct inode *inode, struct file *filp,
171
                           u_int iocmd, unsigned long ioarg);
171
                           u_int iocmd, unsigned long ioarg);
172
#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
172
#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
173
#define VMW_HAVE_UNLOCKED_IOCTL
173
static long LinuxDriver_UnlockedIoctl(struct file *filp,
174
static long LinuxDriver_UnlockedIoctl(struct file *filp,
174
                           u_int iocmd, unsigned long ioarg);
175
                           u_int iocmd, unsigned long ioarg);
175
#endif
176
#endif
176
177
177
static int LinuxDriver_Close(struct inode *inode, struct file *filp);
178
static int LinuxDriver_Close(struct inode *inode, struct file *filp);
178
static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
179
static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
179
#if defined(VMW_NOPAGE_2624)
180
#if defined(VMW_NOPAGE_2624)
180
static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
181
static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
(-)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 3225-3241 Link Here
3225
   }
3225
   }
3226
3226
3227
   /*
3227
   /*
3228
    * The receive path will handle all communication until we are able to enter
3228
    * The receive path will handle all communication until we are able to enter
3229
    * the connected state.  Here we wait for the connection to be completed or
3229
    * the connected state.  Here we wait for the connection to be completed or
3230
    * a notification of an error.
3230
    * a notification of an error.
3231
    */
3231
    */
3232
   timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
3232
   timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
3233
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3233
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
3234
3234
3235
   while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
3235
   while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
3236
      if (timeout == 0) {
3236
      if (timeout == 0) {
3237
         /*
3237
         /*
3238
          * If we're not going to block, skip ahead to preserve error code set
3238
          * If we're not going to block, skip ahead to preserve error code set
3239
          * above.
3239
          * above.
3240
          */
3240
          */
3241
         goto outWait;
3241
         goto outWait;
Lines 3248-3276 Link Here
3248
      if (signal_pending(current)) {
3248
      if (signal_pending(current)) {
3249
         err = sock_intr_errno(timeout);
3249
         err = sock_intr_errno(timeout);
3250
         goto outWaitError;
3250
         goto outWaitError;
3251
      } else if (timeout == 0) {
3251
      } else if (timeout == 0) {
3252
         err = -ETIMEDOUT;
3252
         err = -ETIMEDOUT;
3253
         goto outWaitError;
3253
         goto outWaitError;
3254
      }
3254
      }
3255
3255
3256
      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3256
      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
3257
   }
3257
   }
3258
3258
3259
   if (sk->compat_sk_err) {
3259
   if (sk->compat_sk_err) {
3260
      err = -sk->compat_sk_err;
3260
      err = -sk->compat_sk_err;
3261
      goto outWaitError;
3261
      goto outWaitError;
3262
   } else {
3262
   } else {
3263
      ASSERT(sk->compat_sk_state == SS_CONNECTED);
3263
      ASSERT(sk->compat_sk_state == SS_CONNECTED);
3264
      err = 0;
3264
      err = 0;
3265
   }
3265
   }
3266
3266
3267
outWait:
3267
outWait:
3268
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
3268
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
3269
out:
3269
out:
3270
   release_sock(sk);
3270
   release_sock(sk);
3271
   return err;
3271
   return err;
3272
3272
3273
outWaitError:
3273
outWaitError:
3274
   sk->compat_sk_state = SS_UNCONNECTED;
3274
   sk->compat_sk_state = SS_UNCONNECTED;
3275
   sock->state = SS_UNCONNECTED;
3275
   sock->state = SS_UNCONNECTED;
3276
   goto outWait;
3276
   goto outWait;
Lines 3320-3352 Link Here
3320
      goto out;
3320
      goto out;
3321
   }
3321
   }
3322
3322
3323
   /*
3323
   /*
3324
    * Wait for children sockets to appear; these are the new sockets created
3324
    * Wait for children sockets to appear; these are the new sockets created
3325
    * upon connection establishment.
3325
    * upon connection establishment.
3326
    */
3326
    */
3327
   timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
3327
   timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
3328
   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3328
   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
3329
3329
3330
   while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
3330
   while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
3331
          listener->compat_sk_err == 0) {
3331
          listener->compat_sk_err == 0) {
3332
      release_sock(listener);
3332
      release_sock(listener);
3333
      timeout = schedule_timeout(timeout);
3333
      timeout = schedule_timeout(timeout);
3334
      lock_sock(listener);
3334
      lock_sock(listener);
3335
3335
3336
      if (signal_pending(current)) {
3336
      if (signal_pending(current)) {
3337
         err = sock_intr_errno(timeout);
3337
         err = sock_intr_errno(timeout);
3338
         goto outWait;
3338
         goto outWait;
3339
      } else if (timeout == 0) {
3339
      } else if (timeout == 0) {
3340
         err = -EAGAIN;
3340
         err = -EAGAIN;
3341
         goto outWait;
3341
         goto outWait;
3342
      }
3342
      }
3343
3343
3344
      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
3344
      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
3345
   }
3345
   }
3346
3346
3347
   if (listener->compat_sk_err) {
3347
   if (listener->compat_sk_err) {
3348
      err = -listener->compat_sk_err;
3348
      err = -listener->compat_sk_err;
3349
   }
3349
   }
3350
3350
3351
   if (connected) {
3351
   if (connected) {
3352
      listener->compat_sk_ack_backlog--;
3352
      listener->compat_sk_ack_backlog--;
Lines 3370-3386 Link Here
3370
3370
3371
      newsock->state = SS_CONNECTED;
3371
      newsock->state = SS_CONNECTED;
3372
      sock_graft(connected, newsock);
3372
      sock_graft(connected, newsock);
3373
      release_sock(connected);
3373
      release_sock(connected);
3374
      sock_put(connected);
3374
      sock_put(connected);
3375
   }
3375
   }
3376
3376
3377
outWait:
3377
outWait:
3378
   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
3378
   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
3379
out:
3379
out:
3380
   release_sock(listener);
3380
   release_sock(listener);
3381
   return err;
3381
   return err;
3382
}
3382
}
3383
3383
3384
3384
3385
/*
3385
/*
3386
 *----------------------------------------------------------------------------
3386
 *----------------------------------------------------------------------------
Lines 3468-3484 Link Here
3468
{
3468
{
3469
   struct sock *sk;
3469
   struct sock *sk;
3470
   unsigned int mask;
3470
   unsigned int mask;
3471
   VSockVmciSock *vsk;
3471
   VSockVmciSock *vsk;
3472
3472
3473
   sk = sock->sk;
3473
   sk = sock->sk;
3474
   vsk = vsock_sk(sk);
3474
   vsk = vsock_sk(sk);
3475
3475
3476
   poll_wait(file, sk->compat_sk_sleep, wait);
3476
   poll_wait(file, compat_sk_sleep(sk), wait);
3477
   mask = 0;
3477
   mask = 0;
3478
3478
3479
   if (sk->compat_sk_err) {
3479
   if (sk->compat_sk_err) {
3480
      /* Signify that there has been an error on this socket. */
3480
      /* Signify that there has been an error on this socket. */
3481
      mask |= POLLERR;
3481
      mask |= POLLERR;
3482
   }
3482
   }
3483
3483
3484
   /*
3484
   /*
Lines 4108-4124 Link Here
4108
    */
4108
    */
4109
   timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
4109
   timeout = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
4110
4110
4111
   NOTIFYCALLRET(vsk, err, sendInit, sk, &sendData);
4111
   NOTIFYCALLRET(vsk, err, sendInit, sk, &sendData);
4112
   if (err < 0) {
4112
   if (err < 0) {
4113
      goto out;
4113
      goto out;
4114
   }
4114
   }
4115
4115
4116
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4116
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4117
4117
4118
   while (totalWritten < len) {
4118
   while (totalWritten < len) {
4119
      Bool sentWrote;
4119
      Bool sentWrote;
4120
      unsigned int retries;
4120
      unsigned int retries;
4121
      ssize_t written;
4121
      ssize_t written;
4122
4122
4123
      sentWrote = FALSE;
4123
      sentWrote = FALSE;
4124
      retries = 0;
4124
      retries = 0;
Lines 4145-4161 Link Here
4145
         if (signal_pending(current)) {
4145
         if (signal_pending(current)) {
4146
            err = sock_intr_errno(timeout);
4146
            err = sock_intr_errno(timeout);
4147
            goto outWait;
4147
            goto outWait;
4148
         } else if (timeout == 0) {
4148
         } else if (timeout == 0) {
4149
            err = -EAGAIN;
4149
            err = -EAGAIN;
4150
            goto outWait;
4150
            goto outWait;
4151
         }
4151
         }
4152
4152
4153
         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
4153
         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
4154
                                     &wait, TASK_INTERRUPTIBLE);
4154
                                     &wait, TASK_INTERRUPTIBLE);
4155
      }
4155
      }
4156
4156
4157
      /*
4157
      /*
4158
       * These checks occur both as part of and after the loop conditional
4158
       * These checks occur both as part of and after the loop conditional
4159
       * since we need to check before and after sleeping.
4159
       * since we need to check before and after sleeping.
4160
       */
4160
       */
4161
      if (sk->compat_sk_err) {
4161
      if (sk->compat_sk_err) {
Lines 4198-4214 Link Here
4198
   }
4198
   }
4199
4199
4200
   ASSERT(totalWritten <= INT_MAX);
4200
   ASSERT(totalWritten <= INT_MAX);
4201
4201
4202
outWait:
4202
outWait:
4203
   if (totalWritten > 0) {
4203
   if (totalWritten > 0) {
4204
      err = totalWritten;
4204
      err = totalWritten;
4205
   }
4205
   }
4206
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
4206
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
4207
out:
4207
out:
4208
   release_sock(sk);
4208
   release_sock(sk);
4209
   return err;
4209
   return err;
4210
}
4210
}
4211
4211
4212
4212
4213
/*
4213
/*
4214
 *----------------------------------------------------------------------------
4214
 *----------------------------------------------------------------------------
Lines 4432-4448 Link Here
4432
   timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
4432
   timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
4433
   copied = 0;
4433
   copied = 0;
4434
4434
4435
   NOTIFYCALLRET(vsk, err, recvInit, sk, target, &recvData);
4435
   NOTIFYCALLRET(vsk, err, recvInit, sk, target, &recvData);
4436
   if (err < 0) {
4436
   if (err < 0) {
4437
      goto out;
4437
      goto out;
4438
   }
4438
   }
4439
4439
4440
   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4440
   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4441
4441
4442
   while ((ready = VSockVmciStreamHasData(vsk)) < target &&
4442
   while ((ready = VSockVmciStreamHasData(vsk)) < target &&
4443
          sk->compat_sk_err == 0 &&
4443
          sk->compat_sk_err == 0 &&
4444
          !(sk->compat_sk_shutdown & RCV_SHUTDOWN) &&
4444
          !(sk->compat_sk_shutdown & RCV_SHUTDOWN) &&
4445
          !(vsk->peerShutdown & SEND_SHUTDOWN)) {
4445
          !(vsk->peerShutdown & SEND_SHUTDOWN)) {
4446
4446
4447
      if (ready < 0) {
4447
      if (ready < 0) {
4448
         /*
4448
         /*
Lines 4472-4488 Link Here
4472
      if (signal_pending(current)) {
4472
      if (signal_pending(current)) {
4473
         err = sock_intr_errno(timeout);
4473
         err = sock_intr_errno(timeout);
4474
         goto outWait;
4474
         goto outWait;
4475
      } else if (timeout == 0) {
4475
      } else if (timeout == 0) {
4476
         err = -EAGAIN;
4476
         err = -EAGAIN;
4477
         goto outWait;
4477
         goto outWait;
4478
      }
4478
      }
4479
4479
4480
      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
4480
      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
4481
   }
4481
   }
4482
4482
4483
   if (sk->compat_sk_err) {
4483
   if (sk->compat_sk_err) {
4484
      err = -sk->compat_sk_err;
4484
      err = -sk->compat_sk_err;
4485
      goto outWait;
4485
      goto outWait;
4486
   } else if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
4486
   } else if (sk->compat_sk_shutdown & RCV_SHUTDOWN) {
4487
      err = 0;
4487
      err = 0;
4488
      goto outWait;
4488
      goto outWait;
Lines 4538-4554 Link Here
4538
   if (err < 0) {
4538
   if (err < 0) {
4539
      goto outWait;
4539
      goto outWait;
4540
   }
4540
   }
4541
4541
4542
   ASSERT(copied <= INT_MAX);
4542
   ASSERT(copied <= INT_MAX);
4543
   err = copied;
4543
   err = copied;
4544
4544
4545
outWait:
4545
outWait:
4546
   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
4546
   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
4547
out:
4547
out:
4548
   release_sock(sk);
4548
   release_sock(sk);
4549
   return err;
4549
   return err;
4550
}
4550
}
4551
4551
4552
4552
4553
/*
4553
/*
4554
 * Protocol operation.
4554
 * Protocol operation.

Return to bug 342193