lkml.org 
[lkml]   [2008]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/16] initialize vcpu
Date
this patch initializes the first vcpu in the initialize() routing,
which is responsible for starting the process of putting the guest up.
right now, as much of the fields are still not per-vcpu, it does not
do much.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
---
drivers/lguest/lguest_user.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index 3b92a61..34be8e7 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -88,6 +88,20 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
return run_guest(lg, (unsigned long __user *)user);
}

+static int vcpu_start(struct lg_vcpu *vcpu, int vcpu_id,
+ unsigned long start_ip)
+{
+ if (vcpu_id > NR_CPUS)
+ return -EINVAL;
+
+ vcpu->vcpu_id = vcpu_id;
+
+ vcpu->lg = container_of((vcpu - vcpu_id), struct lguest, vcpus[0]);
+ vcpu->lg->nr_vcpus++;
+
+ return 0;
+}
+
/*L:020 The initialization write supplies 4 pointer sized (32 or 64 bit)
* values (in addition to the LHREQ_INITIALIZE value). These are:
*
@@ -134,6 +148,12 @@ static int initialize(struct file *file, const unsigned long __user *input)
lg->mem_base = (void __user *)(long)args[0];
lg->pfn_limit = args[1];

+ /* This is the first cpu */
+ lg->nr_vcpus = 0;
+ err = vcpu_start(&lg->vcpus[0], 0, args[3]);
+ if (err)
+ goto release_guest;
+
/* We need a complete page for the Guest registers: they are accessible
* to the Guest and we can only grant it access to whole pages. */
lg->regs_page = get_zeroed_page(GFP_KERNEL);
--
1.5.0.6


\
 
 \ /
  Last update: 2008-01-07 14:09    [W:0.045 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site