Re: [kvm-devel] KVM Test result, kernel 35e0154.. , userspace b0e5e88..

2007-11-07 Thread Avi Kivity
Zhao, Yunfeng wrote:
 Hi, all
 This is today's KVM test result against kvm.git
 35e0154eeb0ace014ecf4cc2bdb93a42ee762aca and kvm-userspace.git
 b0e5e88d4d25e63ae33396fa990f2ca2b539e5a6
 One issue has been fixed, 10 issues still open.


 2. windows xp with acpi hal fails to reboot
 -no-kvm-irqchip has the same issue
 https://sourceforge.net/tracker/index.php?func=detailaid=1805016group_
 id=180599atid=893831
   

This works for me now both with and without -no-kvm-irqchip.

Is this an smp or up guest?


-- 
error compiling committee.c: too many arguments to function


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] A question about virtio and KVM

2007-11-07 Thread Christian Borntraeger
Am Dienstag, 6. November 2007 schrieb Dor Laor:
 The is my latest (old) branch:
 
 -Kernel repo: git://kvm.qumranet.com/home/dor/src/virtio/kvm
 -Userspace repo: git://kvm.qumranet.com/home/dor/src/virtio/kvm-userspace
 Use virt-final branch.

Yes I had a look at these. This code is virtio draft 4 based, right?

 It is not yet updated to latest virtio  latest kvm.
 This version uses a pci device for virtio. Since I'm think Rusty's 
 config space does not matches
 pci config space I might consider changing it. (Preferably not, maybe 
 I'll start using it until we'll have the windows
 implementation).
 I'll start work on it on Sunday.

I currently try to use Rusty's config space as we dont have a PCI bus. 
Carsten told me that HPA suggested to split CONFIG_PCI in a way to use
the hardware independent data structures without providing the hardware.

Carsten do you still remember the full details?

 Can you also publish your tree?

Currently I have no way to publish something via a web page. I could sent you
patches or the code of our prototype code. Currently it has nothing to do with
KVM but we try to move more and more into kvm direction.
As the old code was virtio draft 4 based and I just started to work on it
again I currently rebased everything and try to make it work again. Basically
I currently tried to reuse as much as possible from the lguest code.

Chrisian

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] A question about virtio and KVM

2007-11-07 Thread Carsten Otte
Christian Borntraeger wrote:
 It is not yet updated to latest virtio  latest kvm.
 This version uses a pci device for virtio. Since I'm think Rusty's 
 config space does not matches
 pci config space I might consider changing it. (Preferably not, maybe 
 I'll start using it until we'll have the windows
 implementation).
 I'll start work on it on Sunday.
 
 I currently try to use Rusty's config space as we dont have a PCI bus. 
 Carsten told me that HPA suggested to split CONFIG_PCI in a way to use
 the hardware independent data structures without providing the hardware.
 
 Carsten do you still remember the full details?
*Shrug*. I think Peter suggested that we'd use a PCI bus type, and PCI 
IDs for device identification. We're not going to use PCI to do I/O, 
and we're not going to use IRQ (HPA: irq == 0 is a valid value, which 
means that the PCI device does not have an irq). He suggested to look 
at the virtio bus that he contributed to Rusty's lguest code as an 
example.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] A question about virtio and KVM

2007-11-07 Thread Dor Laor
Christian Borntraeger wrote:

 Am Dienstag, 6. November 2007 schrieb Dor Laor:
  The is my latest (old) branch:
 
  -Kernel repo: git://kvm.qumranet.com/home/dor/src/virtio/kvm
  -Userspace repo: 
 git://kvm.qumranet.com/home/dor/src/virtio/kvm-userspace
  Use virt-final branch.

 Yes I had a look at these. This code is virtio draft 4 based, right?

Yup, I'll rebase every thing next week.


  It is not yet updated to latest virtio  latest kvm.
  This version uses a pci device for virtio. Since I'm think Rusty's
  config space does not matches
  pci config space I might consider changing it. (Preferably not, maybe
  I'll start using it until we'll have the windows
  implementation).
  I'll start work on it on Sunday.

 I currently try to use Rusty's config space as we dont have a PCI bus.
 Carsten told me that HPA suggested to split CONFIG_PCI in a way to use
 the hardware independent data structures without providing the hardware.

 Carsten do you still remember the full details?

The idea was to have pci like configuration space without actually 
support pci.
This is something that Rusty implemented and just today there is a patch 
to convert
the config space to better match pci space.
Anyway you don't really need pci support - exactly like lguest.

  Can you also publish your tree?

 Currently I have no way to publish something via a web page. I could 
 sent you
 patches or the code of our prototype code. Currently it has nothing to 
 do with
 KVM but we try to move more and more into kvm direction.
 As the old code was virtio draft 4 based and I just started to work on it
 again I currently rebased everything and try to make it work again. 
 Basically
 I currently tried to reuse as much as possible from the lguest code.

Me also stole most of the implementation from lguest. Actually Rusty 
made virtio
V5 implementation based on the lguest too. It is now shared, general 
virtio code
in the kernel.


 Chrisian



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] SMP support on AMD64

2007-11-07 Thread Avi Kivity

Lynn Kerby wrote:

Hi KVM developers (and lurkers like myself).

Apologies in advance as this is probably not the right forum for this  
question.
  


It is certainly the right forum.

I've had no success getting an SMP virtual machine running on my AMD  
Athlon64 X2 server.  The base system is Ubuntu 7.10 (recently  
upgraded from 7.04) with a 2.6.22 kernel and I've tried kvm releases  
49  50 with no success.  My memory of whether or not it worked  
months ago with kvm-28 on the Ubuntu 2.6.20-16 kernel is no longer  
with me :-(.  The recent failures have all been BIOS problems at  
rombios.c:10605.  I'm pretty sure I must have something wrong in my  
environment and have spent entirely too much of my spare time trying  
various things with no success.
  


Yes you've been doing something wrong -- you should have reported this 
quickly.  Worst case somebody would have pointed out something trivial 
you're doing wrong and you'd have felt foolish for a bit.  But in this 
particular case...


Can someone that has actually has an SMP virtual machine running  
currently on an AMD processor (preferably a 64-bit guest) give me  
some details on the base system kernel, KVM related bits, and the  
guest OS?


  


Turns out kvm smp on amd is broken.  I committed a fix for kvm-51, and 
now I have FC6 running happily with two vcpus.


If you see problems, please report them soon.  I'd rather have noise on 
the list than problems going unreported.


I'm attaching the patch which fixes the problem, let us know if it helps 
or not (there may be more problems lurking).


--
error compiling committee.c: too many arguments to function

commit 157117844e1d228db58dfe7fbd51c5a225ceafe4
Author: Avi Kivity [EMAIL PROTECTED]
Date:   Wed Nov 7 12:57:23 2007 +0200

KVM: SVM: Fix SMP with kernel apic

AP processor needs to reset to the SIPI vector, not normal INIT.

Signed-off-by: Avi Kivity [EMAIL PROTECTED]

diff --git a/kernel/svm.c b/kernel/svm.c
index 95a3489..ea2cb83 100644
--- a/kernel/svm.c
+++ b/kernel/svm.c
@@ -563,6 +563,12 @@ static int svm_vcpu_reset(struct kvm_vcpu *vcpu)
 
 	init_vmcb(svm-vmcb);
 
+	if (vcpu-vcpu_id != 0) {
+		svm-vmcb-save.rip = 0;
+		svm-vmcb-save.cs.base = svm-vcpu.sipi_vector  12;
+		svm-vmcb-save.cs.selector = svm-vcpu.sipi_vector  8;
+	}
+
 	return 0;
 }
 
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/8] KVM: Move #include asm/kvm_para.h outside of __KERNEL__

2007-11-07 Thread Amit Shah
We have some structures defined which are going to be
used by userspace for ioctls.

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 include/linux/kvm_para.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index e4db25f..ff6ac27 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -12,12 +12,12 @@
 /* Return values for hypercalls */
 #define KVM_ENOSYS 1000
 
-#ifdef __KERNEL__
 /*
  * hypercalls use architecture specific
  */
 #include asm/kvm_para.h
 
+#ifdef __KERNEL__
 static inline int kvm_para_has_feature(unsigned int feature)
 {
if (kvm_arch_para_features()  (1UL  feature))
@@ -26,4 +26,3 @@ static inline int kvm_para_has_feature(unsigned int feature)
 }
 #endif /* __KERNEL__ */
 #endif /* __LINUX_KVM_PARA_H */
-
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvmclock - the host part.

2007-11-07 Thread Glauber de Oliveira Costa
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Avi Kivity escreveu:
 Glauber de Oliveira Costa wrote:
 This is the host part of kvm clocksource implementation. As it does
 not include clockevents, it is a fairly simple implementation. We
 only have to register a per-vcpu area, and start writting to it periodically.

 Signed-off-by: Glauber de Oliveira Costa [EMAIL PROTECTED]
 ---
  drivers/kvm/irq.c  |1 +
  drivers/kvm/kvm_main.c |2 +
  drivers/kvm/svm.c  |1 +
  drivers/kvm/vmx.c  |1 +
  drivers/kvm/x86.c  |   59 
 
  drivers/kvm/x86.h  |   13 ++
  6 files changed, 77 insertions(+), 0 deletions(-)

 diff --git a/drivers/kvm/irq.c b/drivers/kvm/irq.c
 index 22bfeee..0344879 100644
 --- a/drivers/kvm/irq.c
 +++ b/drivers/kvm/irq.c
 @@ -92,6 +92,7 @@ void kvm_vcpu_kick_request(struct kvm_vcpu *vcpu, int 
 request)
  
  void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
  {
 +vcpu-time_needs_update = 1;
   
 
 Why here and not in __vcpu_run()?  It isn't timer irq related.
Because my plan was exactly, updating it at each timer interrupt.
There's a trade off between
updating every run (hopefully more precision, but more overhead), versus
updating at timer irqs, or other events.

What would you prefer?

 @@ -1242,6 +1243,7 @@ static long kvm_dev_ioctl(struct file *filp,
  case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
  case KVM_CAP_USER_MEMORY:
  case KVM_CAP_SET_TSS_ADDR:
 +case KVM_CAP_CLK:
   
 
 It's just a clock source now, right?  so _CLOCK_SOURCE.
Right.

 +static void kvm_write_guest_time(struct kvm_vcpu *vcpu)
 +{
 +struct timespec ts;
 +void *clock_addr;
 +
 +
 +if (!vcpu-clock_page)
 +return;
 +
 +/* Updates version to the next odd number, indicating we're writing */
 +vcpu-hv_clock.version++;
   
 
 No one can actually see this as you're updating a private structure. 
 You need to copy it to guestspace.
That's true, I'm just copying it at the end, the whole thing. thanks.

 +/* Updating the tsc count is the first thing we do */
 +kvm_get_msr(vcpu, MSR_IA32_TIME_STAMP_COUNTER, 
 vcpu-hv_clock.last_tsc);
 +ktime_get_ts(ts);
 +vcpu-hv_clock.now_ns = ts.tv_nsec + (NSEC_PER_SEC * (u64)ts.tv_sec);
 +vcpu-hv_clock.wc_sec = get_seconds();
 +vcpu-hv_clock.version++;
 +
 +clock_addr = vcpu-clock_addr;
 +memcpy(clock_addr, vcpu-hv_clock, sizeof(vcpu-hv_clock));
 +mark_page_dirty(vcpu-kvm, vcpu-clock_gfn);
   
 
 Just use kvm_write_guest().
Too slow. Updating guest time, even only in timer interrupts, was a too
frequent operation, and the kmap / kunmap (atomic) at every iteration
deemed the whole thing
unusable.

 +
 +vcpu-time_needs_update = 0;
 +}
 +
  int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
  {
  unsigned long nr, a0, a1, a2, a3, ret;
 @@ -1648,7 +1674,33 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
  a3 = 0x;
  }
  
 +ret = 0;
  switch (nr) {
 +case  KVM_HCALL_REGISTER_CLOCK: {
 +struct kvm_vcpu *dst_vcpu;
 +
 +if (!((a1  KVM_MAX_VCPUS)  (vcpu-kvm-vcpus[a1]))) {
 +ret = -KVM_EINVAL;
 +break;
 +}
 +
 +dst_vcpu = vcpu-kvm-vcpus[a1];
   
 
 What if !dst_vcpu?  What about locking?
 
 Suggest simply using vcpu.  Every guest cpu can register its own
Earlier version had a check for !dst_vcpu, you are absolutely right.

Locking was not a problem in practice, because these operations are done
 serialized, by the same cpu.

This hypercall is called by cpu_up, which, at least in the beginning,
it's called by cpu0. And that's why each vcpu cannot register its own.
(And why we don't need locking).

Well, theorectically each vcpu do can register its own clocksource, it
will just be a little bit more complicated, we have to fire out an IPI,
and have the other cpu to catch it, and call the hypercall.

But I honestly don't like it.
Usually, the cpu leaves start_secondary with a clock already registered,
so the kernel relies on it.

 
 +dst_vcpu-clock_page = gfn_to_page(vcpu-kvm, a0  PAGE_SHIFT);
   
 
 Shift right?  Why?
a0 is not a gfn, but a physical address.

 +
 +if (!dst_vcpu-clock_page) {
   
 
 IIRC gfn_to_page() never returns NULL, need a different check.
You are right. I developed part of it in an older version of kvm, where
reality was:

struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn)
{
struct kvm_memory_slot *slot;

gfn = unalias_gfn(kvm, gfn);
slot = __gfn_to_memslot(kvm, gfn);
if (!slot)
return NULL;
return slot-phys_mem[gfn - slot-base_gfn];
}

Will update.

 +ret = -KVM_EINVAL;
 +break;
 +}
 +dst_vcpu-clock_gfn = a0  PAGE_SHIFT;
 +
 +dst_vcpu-hv_clock.tsc_mult = clocksource_khz2mult(tsc_khz, 22);
 + 

[kvm-devel] [PATCH 1/8] KVM: PVDMA Host: Handle reqeusts for guest DMA mappings

2007-11-07 Thread Amit Shah
Introduce three hypercalls and one ioctl for enabling guest
DMA mappings.

An ioctl comes from userspace (qemu) to notify of a physical
device being assigned to a guest. Guests make a hypercall (once
per device) to find out if the device is a passthrough device
and if any DMA translations are necessary.

Two other hypercalls map and unmap DMA regions respectively
for the guest. We basically look up the host page address
and return it in case of a single-page request.

For a multi-page request, we do a dma_map_sg.

Since guests are pageable, we pin all the pages under the DMA
operation on the map request and unpin them on the unmap
operation.

Major tasks still to be done: implement proper locking (get a
vm-lock), we never free some part of memory

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 drivers/kvm/x86.c  |  273 
 include/asm-x86/kvm_para.h |   23 -
 include/linux/kvm.h|3 +
 3 files changed, 297 insertions(+), 2 deletions(-)

diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index e905d46..60ea93a 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -21,8 +21,11 @@
 
 #include linux/kvm.h
 #include linux/fs.h
+#include linux/list.h
+#include linux/pci.h
 #include linux/vmalloc.h
 #include linux/module.h
+#include linux/highmem.h
 
 #include asm/uaccess.h
 
@@ -61,6 +64,254 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
{ NULL }
 };
 
+/* Paravirt DMA: We pin the host-side pages for the GPAs that we get
+ * for the DMA operation. We do a sg_map on the host pages for a DMA
+ * operation on the guest side. We un-pin the pages on the
+ * unmap_hypercall.
+ */
+struct dma_map {
+   struct list_head list;
+   int nents;
+   struct scatterlist *sg;
+};
+
+/* This list is to store the guest bus:device:function and host
+ * bus:device:function mapping for passthrough'ed devices.
+ */
+/* FIXME: make this per-vm */
+/* FIXME: delete this list at the end of a vm session */
+struct pv_pci_dev_list {
+   struct list_head list;
+   struct kvm_pv_passthrough_dev pt_dev;
+};
+
+/* FIXME: This should be a per-vm list */
+static LIST_HEAD(dmap_head);
+static LIST_HEAD(pt_dev_head);
+
+static struct dma_map*
+find_matching_dmap(struct list_head *head, dma_addr_t dma)
+{
+   struct list_head *ptr;
+   struct dma_map *match;
+
+   list_for_each(ptr, head) {
+   match = list_entry(ptr, struct dma_map, list);
+   if (match  match-sg[0].dma_address == dma)
+   return match;
+   }
+   return NULL;
+}
+
+static void
+prepare_sg_entry(struct scatterlist *sg, unsigned long addr)
+{
+   unsigned int offset, len;
+
+   offset = addr  ~PAGE_MASK;
+   len = PAGE_SIZE - offset;
+
+   /* FIXME: Use the sg chaining features */
+   sg_set_page(sg, pfn_to_page(addr  PAGE_SHIFT),
+   len, offset);
+}
+
+static int pv_map_hypercall(struct kvm_vcpu *vcpu, int npages, gfn_t page_gfn)
+{
+   int i, r = 0;
+   gpa_t gpa;
+   hpa_t page_hpa, hpa;
+   struct dma_map *dmap;
+   struct page *host_page;
+   struct scatterlist *sg;
+   unsigned long *shared_addr, *hcall_page;
+
+   /* We currently don't support dma mappings which have more than
+* PAGE_SIZE/sizeof(unsigned long *) pages
+*/
+   if (!npages || npages  MAX_PVDMA_PAGES) {
+   printk(KERN_INFO %s: Illegal number of pages: %d\n,
+  __FUNCTION__, npages);
+   goto out;
+   }
+
+   page_hpa = gpa_to_hpa(vcpu-kvm, page_gfn  PAGE_SHIFT);
+   if (is_error_hpa(page_hpa)) {
+   printk(KERN_INFO %s: page hpa %p not valid for page_gfn %p\n,
+  __FUNCTION__, (void *)page_hpa, (void *)page_gfn);
+   goto out;
+   }
+   host_page = pfn_to_page(page_hpa  PAGE_SHIFT);
+   hcall_page = shared_addr = kmap(host_page);
+
+   /* scatterlist to map guest dma pages into host physical
+* memory -- if they exceed the DMA map limit
+*/
+   sg = kcalloc(npages, sizeof(struct scatterlist), GFP_KERNEL);
+   if (sg == NULL) {
+   printk(KERN_INFO %s: Couldn't allocate memory (sg)\n,
+  __FUNCTION__);
+   goto out_unmap;
+   }
+
+   /* List to store all guest pages mapped into host. This will
+* be used later to free pages on the host. Think of this as a
+* translation table from guest dma addresses into host dma
+* addresses
+*/
+   dmap = kmalloc(sizeof(struct dma_map), GFP_KERNEL);
+   if (dmap == NULL) {
+   printk(KERN_INFO %s: Couldn't allocate memory\n,
+  __FUNCTION__);
+   goto out_unmap_sg;
+   }
+
+   /* FIXME: consider the length of the last page. Guest should
+* send this info.
+*/
+   for (i = 0; i  npages; i++) {
+   gpa = 

[kvm-devel] [PATCH 5/8] KVM: PVDMA: Update dma_alloc_coherent to make it paravirt-aware

2007-11-07 Thread Amit Shah
Of all the DMA calls, only dma_alloc_coherent might not actually
call dma_ops-alloc_coherent. We make sure that gets called
if the device that's being worked on is a PV device

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 arch/x86/kernel/pci-dma_64.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index aa805b1..d4b1713 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -11,6 +11,7 @@
 #include asm/io.h
 #include asm/gart.h
 #include asm/calgary.h
+#include linux/kvm_para.h
 
 int iommu_merge __read_mostly = 1;
 EXPORT_SYMBOL(iommu_merge);
@@ -134,6 +135,18 @@ dma_alloc_coherent(struct device *dev, size_t size, 
dma_addr_t *dma_handle,
memset(memory, 0, size);
if (!mmu) {
*dma_handle = virt_to_bus(memory);
+   if (unlikely(dma_ops-is_pv_device)
+unlikely(dma_ops-is_pv_device(dev, 
dev-bus_id))) {
+   void *r;
+   r = dma_ops-alloc_coherent(dev, size,
+   dma_handle,
+   gfp);
+   if (r == NULL) {
+   free_pages((unsigned long)memory,
+  get_order(size));
+   memory = NULL;
+   }
+   }
return memory;
}
}
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] include files for kvmclock

2007-11-07 Thread Glauber de Oliveira Costa
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jeremy Fitzhardinge escreveu:
 Avi Kivity wrote:
 Glauber de Oliveira Costa wrote:
   
 +union kvm_hv_clock {
 +   struct {
 +   u64 tsc_mult;
 +   u64 now_ns;
 +   /* That's the wall clock, not the water closet */
 +   u64 wc_sec;
 +   u64 wc_nsec;
 
   
 Do we really need 128-bit time?  you must be planning to live forever.
   
 
 Well, he's planning on having lots of very small nanoseconds.
 
 J
The wc_nsec is legacy, and should be gone. It's not really used in
current code. However, you gave me a very good idea. Living forever
would be awesome! Where can I apply ?
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Remi - http://enigmail.mozdev.org

iD8DBQFHMbRfjYI8LaFUWXMRAjsQAJ4vDBW0M48fMaL9sl6XfN0+Pd82egCgutwe
9rR7+H8MUQznyinlJc76kbo=
=b3wx
-END PGP SIGNATURE-

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Add accessor for kvm-vm_fd

2007-11-07 Thread Amit Shah
With the declaration in libkvm.h this time:

From 8313b87bcab415746e6eed86ac3f5b6c562b9764 Mon Sep 17 00:00:00 2001
From: Amit Shah [EMAIL PROTECTED]
Date: Thu, 8 Nov 2007 00:13:07 +0530
Subject: [PATCH] Add accessor for kvm-vm_fd

Introduce kvm_get_vm_fd to get the VM FD

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 libkvm/libkvm.c |5 +
 libkvm/libkvm.h |7 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 5c8352e..fc2c60a 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -918,3 +918,8 @@ int kvm_irqchip_in_kernel(kvm_context_t kvm)
 {
 return kvm-irqchip_in_kernel;
 }
+
+int kvm_get_vm_fd(kvm_context_t kvm)
+{
+   return kvm-vm_fd;
+}
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index b00d658..d5be0b9 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -509,6 +509,13 @@ int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct 
kvm_lapic_state *s);
  */
 int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s);
 
+/*!
+ * \brief Return the vm_fd field from kvm_context
+ *
+ * \param kvm Pointer to the current kvm_context
+ */
+int kvm_get_vm_fd(kvm_context_t kvm);
+
 #endif
 
 #endif
-- 
1.4.4.2


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [ANNOUNCE] kvm-51 release

2007-11-07 Thread Haydn Solomon
First , thank you for new release of kvm. I have a few problems to 
report with kvm-51.


1. When running an exisiting winxp ACPI multiprocessor HAL with -smp 2, 
sometimes it will hang on boot.
2. This may not be a major problem but cpu usage is a litte higher when 
idle on release 51 than 50. It was very low on 50, the lowest I've seen 
in a long time.

3. For me personally, the best performing release to date is release 50.

Regards

Haydn

Avi Kivity wrote:

If you're having trouble on AMD systems, please try this out.

Changes from kvm-50:
- fix some x86 emulator one-byte insns (fixes W2K3 installer again)
- fix host hangs with NMI watchdog on AMD
- fix guest SMP on AMD
- fix dirty page tracking when clearing a guest page (Dor Laor)
- more portability work (Hollis Blanchard, Jerone Young)
- fix FlexPriority with guest smp (Sheng Yang)
- improve rpm specfile (Akio Takebe, me)
- fix external module vs portability work (Andrea Arcangeli)
- remove elpin bios due to license violation
- testsuite shutdown pio port
- don't advertise svm on the guest
- fix reset with kernel apic (Markus Rechberger)


Notes:
  If you use the modules bundled with kvm-51, you can use any version
of Linux from 2.6.9 upwards.
  If you use the modules bundled with Linux 2.6.20, you need to use
kvm-12.
  If you use the modules bundled with Linux 2.6.21, you need to use
kvm-17.
  Modules from Linux 2.6.22 and up will work with any kvm version from
kvm-22.  Some features may only be available in newer releases.
  For best performance, use Linux 2.6.23-rc2 or later as the host.

http://kvm.qumranet.com


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
  

adfdf
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] Starting a VM reboots my machine

2007-11-07 Thread Cam Macdonell
Avi Kivity wrote:
 Cam Macdonell wrote:
 Dor Laor wrote:
   
 Cam Macdonell wrote:
 
 Hi,

 I'm running an AMD

 vendor_id   : AuthenticAMD
 cpu family  : 15
 model   : 75
 model name  : AMD Athlon(tm) 64 X2 Dual Core Processor 4600+

 with 4GB of RAM and Scientific Linux 5.0. I've compiled kvm-48 on it and
 the compile works and loading the modules works fine, the only dmesg
 line referring to kvm is SELinux: initialized (dev kvm_anon_inodefs,
 type kvm_anon_inodefs), not configured for labeling.

 However, when I boot any KVM, the machine reboots.  It works fine with
 the no-kvm flag.  Has anyone else seen this behaviour?

   
 We have some instabilities with AMD. These issues are under debug these 
 days.
 Can you please supply netconsole debug messages from the host. This can 
 be very helpful.
 Also what's the guest OS?
 
 Hi Dor,

 Sorry for the delay, here's the netConsole dump.  This is trying to boot 
 FC6 on Scientific Linux 5.  Let me know if you need more info.
 This is with kvm-50 with the flag -no-kvm-irqchip.  Also, this time it 
 didn't reboot, but froze.
   
 
 Does running the vm with 'taskset 1' help?
 

It runs a few seconds longer and then reboots.  With netconsole, I don't 
always get a full dump, here's what I have.

Unable to handle kernel NULL pointer dereference at 0041 RIP:
  [800285cd] sock_poll+0x11/0x18
PGD 10fcf0067 PUD 114b53067 PMD 0
Oops:  [1] SMP
last sysfs file: /class/misc/kvm/dev
CPU 1
Modules linked in: kvm_amd(U) kvm(U) netconsole nfs lockd fscache 
nfs_acl autofs4 hidp rfcomm l2cap bluetooth sunrpc dm_mirror dm_mod 
video sbs i2c_ec button battery asus_acpi acpi_memhotplug ac ipv6 lp 
snd_hda_intel snd_hda_codec snd_seq_dummy snd_seq_oss snd_seq_midi_event 
snd_seq snd_pcm_oss parport_pc snd_mixer_oss shpchp parport sg snd_pcm 
i2c_nforce2 snd_mpu401 snd_mpu401_uart snd_rawmidi snd_seq_device 
snd_timer fglrx

Cam

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] RFC: Paravirtualized DMA accesses for KVM

2007-11-07 Thread Amit Shah

This patchset is work in progress and is sent out for comments.

Guests within KVM can have paravirtualized DMA access. I've tested
the e1000 driver, and that works fine. A few problems/conditions to
get things to work:

- The pv driver should only be used as a module. If built into the
  kernel, It freezes during the HD bringup
- Locks aren't taken on the host; multiple guests with passthrough
  won't work
- Only 64 bit host and 64 bit guests are supported

And there are several FIXMEs mentioned in the code, but none
as grave as the ones already mentioned above.

The bulk of the passthrough work is done in userspace (qemu). Patches
will be sent shortly to the kvm-devel and qemu lists.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvmclock - the host part.

2007-11-07 Thread Avi Kivity
Glauber de Oliveira Costa wrote:
  void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
  {
 +   vcpu-time_needs_update = 1;
   
   
 Why here and not in __vcpu_run()?  It isn't timer irq related.
 
 Because my plan was exactly, updating it at each timer interrupt.
   

I think kvm_inject_pending_timer_irqs() is called every __vcpu_run(), so 
your cunning plan has been foiled.

Did you mean each guest interrupt of host interrupt?

 There's a trade off between
 updating every run (hopefully more precision, but more overhead), versus
 updating at timer irqs, or other events.

 What would you prefer?
   

I think that we should update it every time a heavyweight exit has been 
taken.  That takes care of the tradeoff quite nicely -- heavyweight 
exits are already dog slow.

   

 +   /* Updating the tsc count is the first thing we do */
 +   kvm_get_msr(vcpu, MSR_IA32_TIME_STAMP_COUNTER, 
 vcpu-hv_clock.last_tsc);
 +   ktime_get_ts(ts);
 +   vcpu-hv_clock.now_ns = ts.tv_nsec + (NSEC_PER_SEC * (u64)ts.tv_sec);
 +   vcpu-hv_clock.wc_sec = get_seconds();
 +   vcpu-hv_clock.version++;
 +
 +   clock_addr = vcpu-clock_addr;
 +   memcpy(clock_addr, vcpu-hv_clock, sizeof(vcpu-hv_clock));
 +   mark_page_dirty(vcpu-kvm, vcpu-clock_gfn);
   
   
 Just use kvm_write_guest().
 
 Too slow. Updating guest time, even only in timer interrupts, was a too
 frequent operation, and the kmap / kunmap (atomic) at every iteration
 deemed the whole thing
 unusable.
   

kvm_write_guest() will eventually be a copy_to_user(), so you need not 
fear the overhead.


  
 +   ret = 0;
 switch (nr) {
 +   case  KVM_HCALL_REGISTER_CLOCK: {
 +   struct kvm_vcpu *dst_vcpu;
 +
 +   if (!((a1  KVM_MAX_VCPUS)  (vcpu-kvm-vcpus[a1]))) {
 +   ret = -KVM_EINVAL;
 +   break;
 +   }
 +
 +   dst_vcpu = vcpu-kvm-vcpus[a1];
   
   
 What if !dst_vcpu?  What about locking?

 Suggest simply using vcpu.  Every guest cpu can register its own
 
 Earlier version had a check for !dst_vcpu, you are absolutely right.

 Locking was not a problem in practice, because these operations are done
  serialized, by the same cpu.
   

Think evil guest that cares not for the well-being of the host.

 This hypercall is called by cpu_up, which, at least in the beginning,
 it's called by cpu0. And that's why each vcpu cannot register its own.
 (And why we don't need locking).

 Well, theorectically each vcpu do can register its own clocksource, it
 will just be a little bit more complicated, we have to fire out an IPI,
 and have the other cpu to catch it, and call the hypercall.

   

Can it not be done via the processor startup sequence?  Then there's no 
need for ipis and locking.

I imagine a normal guest initializes the apic in the same way.

 But I honestly don't like it.
 Usually, the cpu leaves start_secondary with a clock already registered,
 so the kernel relies on it.

   
 +   dst_vcpu-clock_page = gfn_to_page(vcpu-kvm, a0  PAGE_SHIFT);
   
   
 Shift right?  Why?
 
 a0 is not a gfn, but a physical address.
   

What if the guest wants to place it in address 5GB?  That's unlikely for 
Linux and Windows, but let's do it right anyway.

-- 
error compiling committee.c: too many arguments to function


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 00 of 17] [v4] libkvm refactor

2007-11-07 Thread Avi Kivity
Jerone Young wrote:
 Here is the 4th revision of the refactoring of libkvm. This revision
 changes since the 3rd revision:
   - removes libkvm-x86.h
   - keeps functions kvm_create_default_phys_mem  kvm_create_phys_mem
 in place
   - added kvm_arch_create_default_phys_mem
   - Adds needed copyrights to new files
   - Adds void to slots() -- slots(void) decleartions

   

Applied the lot; thanks.


-- 
error compiling committee.c: too many arguments to function


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/2] KVM Userspace: IRQ injection into guest

2007-11-07 Thread Amit Shah
This kernel module injects IRQs specified on the command line
via the passthrough parameter

This doesn't handle shared interrupts.

These patches don't yet work with the in-kernel apic, so you have
to use -no-kvm-irqchip.

These will soon be overridden by a new mechanism that utilises
the in-kernel apic.

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 Makefile   |   10 ++-
 irqhook/Kbuild |3 +
 irqhook/Makefile   |   25 ++
 irqhook/irqhook_main.c |  217 
 4 files changed, 251 insertions(+), 4 deletions(-)
 create mode 100644 irqhook/Kbuild
 create mode 100644 irqhook/Makefile
 create mode 100644 irqhook/irqhook_main.c

diff --git a/Makefile b/Makefile
index 776ff01..4ba6221 100644
--- a/Makefile
+++ b/Makefile
@@ -5,13 +5,13 @@ DESTDIR=
 
 rpmrelease = devel
 
-.PHONY: kernel user libkvm qemu bios clean
+.PHONY: kernel irqhook user libkvm qemu bios clean
 
-all: $(if $(WANT_MODULE), kernel) user libkvm qemu
+all: $(if $(WANT_MODULE), kernel irqhook) user libkvm qemu
 
 kcmd = $(if $(WANT_MODULE),,@\#)
 
-qemu kernel user libkvm:
+qemu kernel user irqhook libkvm:
$(MAKE) -C $@
 
 qemu: libkvm
@@ -42,6 +42,7 @@ install-rpm:
 
 install:
$(kcmd)make -C kernel DESTDIR=$(DESTDIR) install
+   $(kcmd)make -C irqhook DESTDIR=$(DESTDIR) install
make -C libkvm DESTDIR=$(DESTDIR) install
make -C qemu DESTDIR=$(DESTDIR) install
 
@@ -62,13 +63,14 @@ srpm:
tar czf SOURCES/user.tar.gz user
tar czf SOURCES/libkvm.tar.gz libkvm
tar czf SOURCES/kernel.tar.gz kernel
+   tar czf SOURCES/irqhook.tar.gz irqhook
tar czf SOURCES/scripts.tar.gz scripts
cp Makefile configure kvm_stat SOURCES
rpmbuild  --define=_topdir $$(pwd) -bs $(tmpspec)
$(RM) $(tmpspec)
 
 clean:
-   for i in $(if $(WANT_MODULE), kernel) user libkvm qemu; do \
+   for i in $(if $(WANT_MODULE), kernel irqhook) user libkvm qemu; do \
make -C $$i clean; \
done
rm -f config.mak user/config.mak
diff --git a/irqhook/Kbuild b/irqhook/Kbuild
new file mode 100644
index 000..9af75a4
--- /dev/null
+++ b/irqhook/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS := -I$(src)/include
+obj-m := irqhook.o
+irqhook-objs := irqhook_main.o
diff --git a/irqhook/Makefile b/irqhook/Makefile
new file mode 100644
index 000..3b1d851
--- /dev/null
+++ b/irqhook/Makefile
@@ -0,0 +1,25 @@
+include ../config.mak
+
+KVERREL = $(patsubst /lib/modules/%/build,%,$(KERNELDIR))
+
+DESTDIR=
+
+INSTALLDIR = $(patsubst %/build,%/extra,$(KERNELDIR))
+
+rpmrelease = devel
+
+LINUX = ../linux-2.6
+
+all::
+   $(MAKE) -C $(KERNELDIR) M=`pwd` $$@
+
+#sync:
+#  rsync --exclude='*.mod.c' $(LINUX)/drivers/irqhook/*.[ch] .
+
+install:
+   mkdir -p $(DESTDIR)/$(INSTALLDIR)
+   cp *.ko $(DESTDIR)/$(INSTALLDIR)
+   /sbin/depmod -a
+
+clean:
+   $(MAKE) -C $(KERNELDIR) M=`pwd` $@
diff --git a/irqhook/irqhook_main.c b/irqhook/irqhook_main.c
new file mode 100644
index 000..812b714
--- /dev/null
+++ b/irqhook/irqhook_main.c
@@ -0,0 +1,217 @@
+#include linux/module.h
+#include linux/kernel.h
+#include linux/fs.h
+#include linux/bitmap.h
+#include linux/interrupt.h
+#include linux/spinlock.h
+#include linux/miscdevice.h
+#include linux/pci.h
+
+#include asm/uaccess.h
+
+#define irqh_VERSION 0.0.1
+#define irqh_MODULE_NAME irqhook
+#define irqh_DRIVER_NAME   irqh_MODULE_NAME  HW IRQ hook  irqh_VERSION
+
+// based on earlier proprietary Tutis code; this modified version goes under 
GPL
+MODULE_AUTHOR(Nir Peleg - Tutis);
+MODULE_DESCRIPTION(IRQ hook driver);
+MODULE_LICENSE(GPL);
+
+//#define irqh_DEBUG /* define to enable copious debugging info */
+
+#ifdef irqh_DEBUG
+#define DPRINTK(fmt, args...) printk(1 %s:  fmt, __FUNCTION__ , ## args)
+#else
+#define DPRINTK(fmt, args...)
+#endif
+
+#define ERROR(fmt, args...) printk(1 %s:  fmt, __FUNCTION__ , ## args)
+
+static spinlock_t irqh_lock;
+static wait_queue_head_t irqh_proc_list;
+
+enum {NINTR = 256};
+
+static DECLARE_BITMAP(pending, NINTR);
+static DECLARE_BITMAP(handled, NINTR);
+
+#define irqh_on(which, bit)test_bit(bit, which)
+#define irqh_set(which, bit)   set_bit(bit, which)
+#define irqh_clear(which, bit) clear_bit(bit, which)
+#define irqh_ffs(which)find_first_bit(which, NINTR)
+
+static irqreturn_t
+irqh_interrupt(int irq, void *p)
+{
+   unsigned long flags;
+
+   DPRINTK(interrupt: %d\n, irq);
+   if (!irqh_on(handled, irq))
+   return IRQ_HANDLED;
+   spin_lock_irqsave(irqh_lock, flags);
+   irqh_set(pending, irq);
+   wake_up_interruptible(irqh_proc_list);
+   spin_unlock_irqrestore(irqh_lock, flags);
+   disable_irq_nosync(irq);
+   return IRQ_HANDLED;
+}
+
+static ssize_t
+irqh_dev_write(struct file *fp, const char *buf, size_t size, loff_t *offp)
+{
+   int n, device, func, devfn;
+   char arg[32], *cp, *cp1;
+   struct pci_dev *pdp 

[kvm-devel] [PATCH 4/8] KVM: PVDMA: Introduce is_pv_device() dma operation

2007-11-07 Thread Amit Shah
A guest can call dma_ops-is_pv_device() to find out
if a device is a passthrough'ed device (device passed
on to a guest by the host). If this is true, a hypercall
will be made to translate DMA mapping operations.

This function can be done away with and just a
kvm_is_pv_device() call can be added, which can be no-op
on a non-pv guest (or on the host).

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 include/asm-x86/dma-mapping_64.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/asm-x86/dma-mapping_64.h b/include/asm-x86/dma-mapping_64.h
index ecd0f61..3943edd 100644
--- a/include/asm-x86/dma-mapping_64.h
+++ b/include/asm-x86/dma-mapping_64.h
@@ -48,6 +48,8 @@ struct dma_mapping_ops {
int direction);
int (*dma_supported)(struct device *hwdev, u64 mask);
int is_phys;
+   /* Is this a physical device in a paravirtualized guest? */
+   int (*is_pv_device)(struct device *hwdev, const char *name);
 };
 
 extern dma_addr_t bad_dma_address;
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 6/8] KVM: PVDMA Guest: Add Makefile rule

2007-11-07 Thread Amit Shah
Add Makefile rule for compiling the new file
that we create

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 drivers/kvm/Makefile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/Makefile b/drivers/kvm/Makefile
index cf18ad4..f492e3e 100644
--- a/drivers/kvm/Makefile
+++ b/drivers/kvm/Makefile
@@ -8,3 +8,5 @@ kvm-intel-objs = vmx.o
 obj-$(CONFIG_KVM_INTEL) += kvm-intel.o
 kvm-amd-objs = svm.o
 obj-$(CONFIG_KVM_AMD) += kvm-amd.o
+kvm-pv-dma-objs = kvm_pv_dma.o
+obj-$(CONFIG_KVM_PV_DMA) += kvm_pv_dma.o
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [ANNOUNCE] kvm-51 release

2007-11-07 Thread Amit Shah
On Thursday 08 November 2007 01:05:32 Haydn Solomon wrote:
 First , thank you for new release of kvm. I have a few problems to
 report with kvm-51.

 1. When running an exisiting winxp ACPI multiprocessor HAL with -smp 2,
 sometimes it will hang on boot.

You mean the guest hangs, right? What's your host system?

 2. This may not be a major problem but cpu usage is a litte higher when
 idle on release 51 than 50. It was very low on 50, the lowest I've seen
 in a long time.
 3. For me personally, the best performing release to date is release 50.

 Regards

 Haydn

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] include files for kvmclock

2007-11-07 Thread Akio Takebe
Hi, 

 Why does kvm_hv_clock need page_align?
Each vcpu will register a page on its own. In the guest side, it will be
an array of pages. So, we make it page sized.

 And also the kvm_hv_clock is alloced with kvm_vcpu,
There's no requirements on the host part at all. So it doesn't really
matter. In the next version, I may make it even a simple pointer.

 so the align is not enough, isn't it?
 I thik __atribute__((__aligne__(PAGE_SIZE is better than it.
It deals with the start of the structure, but not with its size. See the
guest part: Where it matters, I do use it.
Oh, I confused the guest/host part, but I could understand it.
Thank you for your explanation.

Best Regards,

Akio Takebe


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/2] KVM userspace: Add PCI device passthrough support

2007-11-07 Thread Amit Shah
This patch introduces support for device passthrough
from the host to a paravirtualized guest.

A new command-line option, -passthrough is added.
For example, to invoke it for an Ethernet device sitting at
PCI bus:dev.fn 04:08.0 with host IRQ 18, use this:

-passthrough Ethernet/04:08.0-18

The host driver is to be removed before doing the passthrough.

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 qemu/Makefile  |6 +-
 qemu/Makefile.target   |4 +-
 qemu/exec.c|1 +
 qemu/hw/apic.c |2 +
 qemu/hw/passthrough/neo_pci_tree.h |   44 +++
 qemu/hw/passthrough/passthrough.c  |  604 
 qemu/hw/passthrough/passthrough.h  |   64 
 qemu/hw/pc.c   |3 +
 qemu/hw/pci.c  |5 +
 qemu/hw/piix_pci.c |6 +
 qemu/vl.c  |6 +
 tools/pci_barsize.c|   53 
 tools/pci_mmio.c   |   82 +
 13 files changed, 876 insertions(+), 4 deletions(-)
 create mode 100644 qemu/hw/passthrough/neo_pci_tree.h
 create mode 100644 qemu/hw/passthrough/passthrough.c
 create mode 100644 qemu/hw/passthrough/passthrough.h
 create mode 100644 tools/pci_barsize.c
 create mode 100644 tools/pci_mmio.c

diff --git a/qemu/Makefile b/qemu/Makefile
index 053c88c..3e599f3 100644
--- a/qemu/Makefile
+++ b/qemu/Makefile
@@ -37,7 +37,7 @@ qemu-img$(EXESUF): qemu-img.c cutils.c block.c block-raw.c 
block-cow.c block-qco
 dyngen$(EXESUF): dyngen.c
$(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
 
-clean:
+clean: 
 # avoid old build problems by removing potentially incorrect old files
rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h op-arm.h 
opc-arm.h gen-op-arm.h
rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~ */*~
@@ -88,8 +88,8 @@ endif
 test speed test2: all
$(MAKE) -C tests $@
 
-TAGS:
-   etags *.[ch] tests/*.[ch]
+TAGS: 
+   etags *.[ch] tests/*.[ch] hw/passthrough/*.[ch]
 
 cscope:
rm -f ./cscope.*
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 65f449e..9a96011 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -24,7 +24,7 @@ ifeq ($(TARGET_ARCH), sparc64)
 TARGET_BASE_ARCH:=sparc
 endif
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
-VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
+VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/hw/passthrough:$(SRC_PATH)/audio
 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_DARWIN_USER
 VPATH+=:$(SRC_PATH)/darwin-user
@@ -454,6 +454,8 @@ VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o 
$(AUDIODRV)
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
 VL_OBJS+= cirrus_vga.o apic.o parallel.o acpi.o piix_pci.o
 VL_OBJS+= usb-uhci.o smbus_eeprom.o vmmouse.o vmport.o vmware_vga.o
+# passthrough support
+VL_OBJS+= passthrough.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ppc)
diff --git a/qemu/exec.c b/qemu/exec.c
index 3e588d5..7a21ca5 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -2484,6 +2484,7 @@ int cpu_register_io_memory(int io_index,
 if (io_mem_nb = IO_MEM_NB_ENTRIES)
 return -1;
 io_index = io_mem_nb++;
+   fprintf(stderr, iomem index %d out of %d\n, io_index, 
IO_MEM_NB_ENTRIES);
 } else {
 if (io_index = IO_MEM_NB_ENTRIES)
 return -1;
diff --git a/qemu/hw/apic.c b/qemu/hw/apic.c
index 60d31fa..5b1bdf4 100644
--- a/qemu/hw/apic.c
+++ b/qemu/hw/apic.c
@@ -349,6 +349,7 @@ static void apic_eoi(APICState *s)
 /* XXX: send the EOI packet to the APIC bus to allow the I/O APIC to
 set the remote IRR bit for level triggered interrupts. */
 apic_update_irq(s);
+pt_ack_mirq(isrv);
 }
 
 static void apic_get_delivery_bitmask(uint32_t *deliver_bitmask,
@@ -1122,6 +1123,7 @@ static void ioapic_mem_writel(void *opaque, 
target_phys_addr_t addr, uint32_t va
 } else {
 s-ioredtbl[index] = ~0xULL;
 s-ioredtbl[index] |= val;
+pt_set_vector(index, (val  24)  24);
 }
 ioapic_service(s);
 }
diff --git a/qemu/hw/passthrough/neo_pci_tree.h 
b/qemu/hw/passthrough/neo_pci_tree.h
new file mode 100644
index 000..79adef9
--- /dev/null
+++ b/qemu/hw/passthrough/neo_pci_tree.h
@@ -0,0 +1,44 @@
+/*
+
+Some data structures to save the result of the PCI probing.
+
+Copyright (c) 2007, Neocleus: Guy Zana, Alex Novik
+
+**/
+
+#ifndef __XC_NEO_PCI_TREE_H__
+#define __XC_NEO_PCI_TREE_H__
+
+#include linux/types.h
+
+typedef __u8 u8;
+typedef 

[kvm-devel] [PATCH 8/8] KVM: Update drivers/Makefile to check for CONFIG_VIRTUALIZATION

2007-11-07 Thread Amit Shah
Check for CONFIG_VIRTUALIZATION instead of CONFIG_KVM,
since the PV drivers won't depend on CONFIG_KVM and we
still want to be selectable

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 drivers/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/Makefile b/drivers/Makefile
index 8cb37e3..6f1c287 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -47,7 +47,7 @@ obj-$(CONFIG_SPI) += spi/
 obj-$(CONFIG_PCCARD)   += pcmcia/
 obj-$(CONFIG_DIO)  += dio/
 obj-$(CONFIG_SBUS) += sbus/
-obj-$(CONFIG_KVM)  += kvm/
+obj-$(CONFIG_VIRTUALIZATION)   += kvm/
 obj-$(CONFIG_ZORRO)+= zorro/
 obj-$(CONFIG_MAC)  += macintosh/
 obj-$(CONFIG_ATA_OVER_ETH) += block/aoe/
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 07 of 17] Move kvm_create_memory_alias kvm_destroy_memory_alias to libkvm-x86.c

2007-11-07 Thread Avi Kivity
Jerone Young wrote:
 # HG changeset patch
 # User Jerone Young [EMAIL PROTECTED]
 # Date 1194367649 21600
 # Node ID cb186258bc6ecf05ded03d81a3d2ee820e58f605
 # Parent  7ea01f673a05fe66cb0d9c514b5a43ddcd72c07f
 Move kvm_create_memory_alias  kvm_destroy_memory_alias to libkvm-x86.c

 Signed-off-by: Jerone Young [EMAIL PROTECTED]

 diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
 --- a/libkvm/libkvm-x86.c
 +++ b/libkvm/libkvm-x86.c
 @@ -294,3 +294,32 @@ void *kvm_create_kernel_phys_mem(kvm_con
   return ptr;
  }
  
 +int kvm_create_memory_alias(kvm_context_t kvm,
 + uint64_t phys_addr,
 + uint64_t phys_start,
 + uint64_t len,
 + uint64_t target_phys)
 +{
 + struct kvm_memory_alias alias = {
 + .flags = 0,
 + .guest_phys_addr = phys_start,
 + .memory_size = len,
 + .target_phys_addr = target_phys,
 + };
 + int fd = kvm-vm_fd;
 + int r;
 +
 + alias.slot = get_slot(phys_addr);
 +
 + r = ioctl(fd, KVM_SET_MEMORY_ALIAS, alias);
 + if (r == -1)
 + return -errno;
 +
 + return 0;
 +}
 +
 +int kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_addr)
 +{
 + return kvm_create_memory_alias(kvm, phys_addr, 0, 0, 0);
 +}
 +

   

This is missing the delete part of the move.  I supplied it.

-- 
error compiling committee.c: too many arguments to function


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [Patch][Fix win2k install] Add delay between dma issue result.

2007-11-07 Thread Dor Laor
Fix win2k install] Add delay between dma issue  result.

Using synchonous io leads the guest to unexplored places:
If it issues a dma command, it goes to qemu and executed
synchrnously and return with irq for data ready.
This is not real world scenario and happens when not using asyncio.
This fix adds a delay of 1msec once every 8 dma writes.

Signed-off-by: Dor Laor [EMAIL PROTECTED]

btw: It also applies against qemu cvs head.

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 329d053..da972c8 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -366,6 +366,8 @@ typedef struct IDEState {
 uint32_t mdata_size;
 uint8_t *mdata_storage;
 int media_changed;
+
+QEMUTimer *dma_write_timer; /* only used for win2k instal hack */
 } IDEState;
 
 #define BM_STATUS_DMAING 0x01
@@ -862,9 +864,21 @@ static void ide_sector_read_dma(IDEState *s)
 static void ide_sector_write_timer_cb(void *opaque)
 {
 IDEState *s = opaque;
+
 ide_set_irq(s);
 }
 
+static void ide_write_dma_cb(void *opaque, int ret);
+static void ide_dma_write_timer_cb(void *opaque)
+{
+  IDEState *s = opaque;
+  
+  s-status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
+  s-io_buffer_index = 0;
+  s-io_buffer_size = 0;
+  ide_dma_start(s, ide_write_dma_cb);
+}
+
 static void ide_sector_write_aio_cb(void *opaque, int ret)
 {
 BMDMAState *bm = opaque;
@@ -975,10 +989,19 @@ static void ide_write_dma_cb(void *opaque, int ret)
 
 static void ide_sector_write_dma(IDEState *s)
 {
-s-status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
-s-io_buffer_index = 0;
-s-io_buffer_size = 0;
-ide_dma_start(s, ide_write_dma_cb);
+#ifdef TARGET_I386
+if (win2k_install_hack  ((++s-irq_count % 8) == 0)) {
+/* It seems there is a bug in the Windows 2000 installer HDD
+   IDE driver which fills the disk with empty logs when the
+   IDE write IRQ comes too early. This hack tries to correct
+   that at the expense of slower write performances. Use this
+   option _only_ to install Windows 2000. You must disable it
+   for normal use. */
+   qemu_mod_timer(s-dma_write_timer,
+  qemu_get_clock(vm_clock) + (ticks_per_sec / 
1000));
+} else
+#endif
+ide_dma_write_timer_cb(s);
 }
 
 static void ide_atapi_cmd_ok(IDEState *s)
@@ -2497,6 +2520,8 @@ static void ide_init2(IDEState *ide_state,
 s-irq = irq;
 s-sector_write_timer = qemu_new_timer(vm_clock,

ide_sector_write_timer_cb, s);
+s-dma_write_timer = qemu_new_timer(vm_clock,
+   ide_dma_write_timer_cb, s);
 ide_reset(s);
 }
 }


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 7/8] PVDMA: Guest: Add Kconfig options to select PVDMA

2007-11-07 Thread Amit Shah
This is to be enabled on a guest. Currently, only
'module' works; compiling it in freezes at HD bringup

Signed-off-by: Amit Shah [EMAIL PROTECTED]
---
 drivers/kvm/Kconfig |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 6569206..3385c10 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -47,6 +47,14 @@ config KVM_AMD
  Provides support for KVM on AMD processors equipped with the AMD-V
  (SVM) extensions.
 
+config KVM_PV_DMA
+   tristate Para-virtualized DMA access
+   ---help---
+ Provides support for DMA operations in the guest. A hypercall
+is raised to the host to enable devices owned by guest to use
+DMA. Select this if compiling a guest kernel and you need
+paravirtualized DMA operations.
+
 # OK, it's a little counter-intuitive to do this, but it puts it neatly under
 # the virtualization menu.
 source drivers/lguest/Kconfig
-- 
1.5.3


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] A question about virtio and KVM

2007-11-07 Thread H. Peter Anvin
Carsten Otte wrote:
 Christian Borntraeger wrote:
 It is not yet updated to latest virtio  latest kvm.
 This version uses a pci device for virtio. Since I'm think Rusty's 
 config space does not matches
 pci config space I might consider changing it. (Preferably not, maybe 
 I'll start using it until we'll have the windows
 implementation).
 I'll start work on it on Sunday.

 I currently try to use Rusty's config space as we dont have a PCI bus. 
 Carsten told me that HPA suggested to split CONFIG_PCI in a way to use
 the hardware independent data structures without providing the hardware.

 Carsten do you still remember the full details?
 *Shrug*. I think Peter suggested that we'd use a PCI bus type, and PCI 
 IDs for device identification. We're not going to use PCI to do I/O, and 
 we're not going to use IRQ (HPA: irq == 0 is a valid value, which means 
 that the PCI device does not have an irq). He suggested to look at the 
 virtio bus that he contributed to Rusty's lguest code as an example.

Yep, that's pretty much it.

Config space above 0x3F is device-specific; we can add well-known 
structures for virtio there is appropriate, preferrably via a PCI 
capability structure.

-hpa

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 0/3] virtio PCI driver

2007-11-07 Thread Anthony Liguori
This patch series implements a PCI driver for virtio.  This allows virtio
devices (like block and network) to be used in QEMU/KVM.  I'll post a very
early KVM userspace backend in kvm-devel for those that are interested.

This series depends on the two virtio fixes I've posted and Rusty's config_ops
refactoring.  I've tested with these patches on Rusty's experimental virtio
tree.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [Patch]1/5 Move some includes to x86, since the related functions have been moved to x86.c

2007-11-07 Thread Zhang, Xiantao
From fc56bda0f599ccd00d992bf196654101e82d1413 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao [EMAIL PROTECTED]
Date: Wed, 7 Nov 2007 11:39:23 +0800
Subject: [PATCH] move some header files form kvm_main.c to x86.c, since
the
related functions have been moved to x86.c
Signed-off-by: Zhang Xiantao [EMAIL PROTECTED]
---
 drivers/kvm/kvm_main.c |2 --
 drivers/kvm/x86.c  |2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 0b8edca..010f079 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -17,7 +17,6 @@
 
 #include kvm.h
 #include x86.h
-#include x86_emulate.h
 #include irq.h
 
 #include linux/kvm.h
@@ -44,7 +43,6 @@
 #include linux/mman.h
 
 #include asm/processor.h
-#include asm/msr.h
 #include asm/io.h
 #include asm/uaccess.h
 #include asm/desc.h
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index e905d46..7ea470e 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -16,6 +16,7 @@
 
 #include kvm.h
 #include x86.h
+#include x86_emulate.h
 #include segment_descriptor.h
 #include irq.h
 
@@ -25,6 +26,7 @@
 #include linux/module.h
 
 #include asm/uaccess.h
+#include asm/msr.h
 
 #define MAX_IO_MSRS 256
 #define CR0_RESERVED_BITS
\
-- 
1.5.1.2

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] SMP support on AMD64

2007-11-07 Thread Avi Kivity
Alexey Eremenko wrote:
 Hi Avi,

 Speaking of AMD host - with KVM-51 it doesn't crashes anymore !

 But there is still fonts rendering problem with Fedora7/ 32-bit guests.

   

Can you update the relevant bug trackers?  Please add xpdyinfo output as
well.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH]0/5 Patch to split x86 specific code from kvm_main.c

2007-11-07 Thread Zhang, Xiantao
Hi Avi,
This series of patches are intended to further split x86 specific code
from kvm_main.c, and make kvm_main.c arch-independent.  
For easy review, I splitted them into small patches. With these patches,
we almost finish the first stage work for code split. 

[1/5] Remove unused header files include from kvm_main.c since the
corresponding functions have been moved to x86.c
[2/5] Move kvm_x86_ops definition to x86, and prepare for next step's
work.
[3/5] Using kvm_arch prefix to redefine kvm_x86_ops-ops in x86.c. and
make kvm_x86_ops as x86_specific part.
[4/5] Combine kvm_init and kvm_init_x86 into one kvm_init function, and
meanwhile, remove module_init and module_exit function since kvm_init
will called by svm and vmx.
[5/5] Make kvm_init as arch-indepenent, through defining a void pointer
type parameter . All archs will register their corresponding functions
into kvm module. For example, x86 will use this parameter to register
vmx/svm's ops. 

CC to Hollis and Carste to check whether they block your sides. :) 

Thanks 
Xiantao

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] 4/5 Combine kvm_init and kvm_init_x86 into one function

2007-11-07 Thread Zhang, Xiantao
From 959bc19b0e2ca7edcb3389aabdecf99ba9f1794e Mon Sep 17 00:00:00 2001
From: Zhang Xiantao [EMAIL PROTECTED]
Date: Thu, 8 Nov 2007 13:19:06 +0800
Subject: [PATCH] Combine kvm_init and kvm_init_x86 into one function,
and
meanwhile remove module_init module_exit function, since they will be
called
once new arch is registered. 
Signed-off-by: Zhang Xiantao [EMAIL PROTECTED]
---
 drivers/kvm/kvm.h  |4 +-
 drivers/kvm/kvm_main.c |   60
+--
 drivers/kvm/svm.c  |4 +-
 drivers/kvm/vmx.c  |4 +-
 4 files changed, 28 insertions(+), 44 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 4b2421a..33b4629 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -494,9 +494,9 @@ void vcpu_load(struct kvm_vcpu *vcpu);
 void vcpu_put(struct kvm_vcpu *vcpu);
 
 
-int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size,
+int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
  struct module *module);
-void kvm_exit_x86(void);
+void kvm_exit(void);
 
 int kvm_mmu_module_init(void);
 void kvm_mmu_module_exit(void);
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index da7fb22..8f09170 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1503,12 +1503,27 @@ static void kvm_sched_out(struct
preempt_notifier *pn,
kvm_arch_vcpu_put(vcpu);
 }
 
-int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size,
+int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
  struct module *module)
 {
int r;
int cpu;
 
+   r = kvm_mmu_module_init();
+   if (r)
+   goto out4;
+
+   kvm_init_debug();
+
+   kvm_arch_init();
+
+   bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
+
+   if (bad_page == NULL) {
+   r = -ENOMEM;
+   goto out;
+   }
+
if (kvm_x86_ops) {
printk(KERN_ERR kvm: already loaded the other
module\n);
return -EEXIST;
@@ -1589,11 +1604,14 @@ out_free_0:
kvm_arch_hardware_unsetup();
 out:
kvm_x86_ops = NULL;
+   kvm_exit_debug();
+   kvm_mmu_module_exit();
+out44:
return r;
 }
-EXPORT_SYMBOL_GPL(kvm_init_x86);
+EXPORT_SYMBOL_GPL(kvm_init);
 
-void kvm_exit_x86(void)
+void kvm_exit(void)
 {
misc_deregister(kvm_dev);
kmem_cache_destroy(kvm_vcpu_cache);
@@ -1604,43 +1622,9 @@ void kvm_exit_x86(void)
on_each_cpu(hardware_disable, NULL, 0, 1);
kvm_arch_hardware_unsetup();
kvm_x86_ops = NULL;
-}
-EXPORT_SYMBOL_GPL(kvm_exit_x86);
-
-static __init int kvm_init(void)
-{
-   int r;
-
-   r = kvm_mmu_module_init();
-   if (r)
-   goto out4;
-
-   kvm_init_debug();
-
-   kvm_arch_init();
-
-   bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
-
-   if (bad_page == NULL) {
-   r = -ENOMEM;
-   goto out;
-   }
-
-   return 0;
-
-out:
-   kvm_exit_debug();
-   kvm_mmu_module_exit();
-out4:
-   return r;
-}
-
-static __exit void kvm_exit(void)
-{
kvm_exit_debug();
__free_page(bad_page);
kvm_mmu_module_exit();
 }
+EXPORT_SYMBOL_GPL(kvm_exit);
 
-module_init(kvm_init)
-module_exit(kvm_exit)
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 95a3489..cc71a07 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1716,13 +1716,13 @@ static struct kvm_x86_ops svm_x86_ops = {
 
 static int __init svm_init(void)
 {
-   return kvm_init_x86(svm_x86_ops, sizeof(struct vcpu_svm),
+   return kvm_init(svm_x86_ops, sizeof(struct vcpu_svm),
  THIS_MODULE);
 }
 
 static void __exit svm_exit(void)
 {
-   kvm_exit_x86();
+   kvm_exit();
 }
 
 module_init(svm_init)
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index da3a339..d5a77bc 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -2657,7 +2657,7 @@ static int __init vmx_init(void)
memset(iova, 0xff, PAGE_SIZE);
kunmap(vmx_io_bitmap_b);
 
-   r = kvm_init_x86(vmx_x86_ops, sizeof(struct vcpu_vmx),
THIS_MODULE);
+   r = kvm_init(vmx_x86_ops, sizeof(struct vcpu_vmx),
THIS_MODULE);
if (r)
goto out1;
 
@@ -2678,7 +2678,7 @@ static void __exit vmx_exit(void)
__free_page(vmx_io_bitmap_b);
__free_page(vmx_io_bitmap_a);
 
-   kvm_exit_x86();
+   kvm_exit();
 }
 
 module_init(vmx_init)
-- 
1.5.1.2

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] 5/5 Make kvm_init as arch-indepenent

2007-11-07 Thread Zhang, Xiantao
From 2d6ee07b96f1a91cef9327f241077af3698ed4dc Mon Sep 17 00:00:00 2001
From: Zhang Xiantao [EMAIL PROTECTED]
Date: Thu, 8 Nov 2007 13:37:38 +0800
Subject: [PATCH] Make kvm_init as arch-indepenent, through defining a
void
pointer type variable. All archs will register their corresponding arch
functions
into kvm module. For example, x86 will use it to register vmx/svm's ops.
Signed-off-by: Zhang Xiantao [EMAIL PROTECTED]
---
 drivers/kvm/kvm.h  |5 +++--
 drivers/kvm/kvm_main.c |   26 ++
 drivers/kvm/x86.c  |   27 ++-
 3 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 33b4629..9b6087f 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -494,7 +494,7 @@ void vcpu_load(struct kvm_vcpu *vcpu);
 void vcpu_put(struct kvm_vcpu *vcpu);
 
 
-int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
+int kvm_init(void *opaque, unsigned int vcpu_size,
  struct module *module);
 void kvm_exit(void);
 
@@ -647,7 +647,8 @@ int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu
*vcpu,
struct kvm_debug_guest *dbg);
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run
*kvm_run);
 
-__init void kvm_arch_init(void);
+int kvm_arch_init(void *opaque);
+void kvm_arch_exit(void);
 
 
 void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 8f09170..70bc4d4 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1503,7 +1503,7 @@ static void kvm_sched_out(struct preempt_notifier
*pn,
kvm_arch_vcpu_put(vcpu);
 }
 
-int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size,
+int kvm_init(void *opaque, unsigned int vcpu_size,
  struct module *module)
 {
int r;
@@ -1515,7 +1515,9 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned int
vcpu_size,
 
kvm_init_debug();
 
-   kvm_arch_init();
+   r = kvm_arch_init(opaque);
+   if (r)
+   goto out4;
 
bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
 
@@ -1524,22 +1526,6 @@ int kvm_init(struct kvm_x86_ops *ops, unsigned
int vcpu_size,
goto out;
}
 
-   if (kvm_x86_ops) {
-   printk(KERN_ERR kvm: already loaded the other
module\n);
-   return -EEXIST;
-   }
-
-   if (!ops-cpu_has_kvm_support()) {
-   printk(KERN_ERR kvm: no hardware support\n);
-   return -EOPNOTSUPP;
-   }
-   if (ops-disabled_by_bios()) {
-   printk(KERN_ERR kvm: disabled by bios\n);
-   return -EOPNOTSUPP;
-   }
-
-   kvm_x86_ops = ops;
-
r = kvm_arch_hardware_setup();
if (r  0)
goto out;
@@ -1603,7 +1589,7 @@ out_free_1:
 out_free_0:
kvm_arch_hardware_unsetup();
 out:
-   kvm_x86_ops = NULL;
+   kvm_arch_exit();
kvm_exit_debug();
kvm_mmu_module_exit();
 out4:   
@@ -1621,7 +1607,7 @@ void kvm_exit(void)
unregister_cpu_notifier(kvm_cpu_notifier);
on_each_cpu(hardware_disable, NULL, 0, 1);
kvm_arch_hardware_unsetup();
-   kvm_x86_ops = NULL;
+   kvm_arch_exit();
kvm_exit_debug();
__free_page(bad_page);
kvm_mmu_module_exit();
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 8aea240..22b3cc6 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1611,9 +1611,34 @@ int kvm_emulate_pio_string(struct kvm_vcpu *vcpu,
struct kvm_run *run, int in,
 }
 EXPORT_SYMBOL_GPL(kvm_emulate_pio_string);
 
-__init void kvm_arch_init(void)
+int kvm_arch_init(void *opaque)
 {
+   struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
+
kvm_init_msr_list();
+
+   if (kvm_x86_ops) {
+   printk(KERN_ERR kvm: already loaded the other
module\n);
+   return -EEXIST;
+   }
+
+   if (!ops-cpu_has_kvm_support()) {
+   printk(KERN_ERR kvm: no hardware support\n);
+   return -EOPNOTSUPP;
+   }
+   if (ops-disabled_by_bios()) {
+   printk(KERN_ERR kvm: disabled by bios\n);
+   return -EOPNOTSUPP;
+   }
+
+   kvm_x86_ops = ops;
+
+   return 0;
+}
+
+void kvm_arch_exit(void)
+{
+   kvm_x86_ops = NULL;
 }
 
 int kvm_emulate_halt(struct kvm_vcpu *vcpu)
-- 
1.5.1.2

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] 2/5 mov kvm_x86_ops to x86.c

2007-11-07 Thread Zhang, Xiantao
From 7473192cc0c529b8ce35c13d0e83a9b663072831 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao [EMAIL PROTECTED]
Date: Wed, 7 Nov 2007 11:41:50 +0800
Subject: [PATCH] mov kvm_x86_ops to x86.c for next step's work
Signed-off-by: Zhang Xiantao [EMAIL PROTECTED]
---
 drivers/kvm/kvm_main.c |1 -
 drivers/kvm/x86.c  |2 ++
 drivers/kvm/x86.h  |2 ++
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 010f079..f1cf8f0 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -55,7 +55,6 @@ static LIST_HEAD(vm_list);
 
 static cpumask_t cpus_hardware_enabled;
 
-struct kvm_x86_ops *kvm_x86_ops;
 struct kmem_cache *kvm_vcpu_cache;
 EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
 
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 7ea470e..e26e46a 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -44,6 +44,8 @@
 
 #define STAT_OFFSET(x) offsetof(struct kvm_vcpu, stat.x)
 
+struct kvm_x86_ops *kvm_x86_ops;
+
 struct kvm_stats_debugfs_item debugfs_entries[] = {
{ pf_fixed, STAT_OFFSET(pf_fixed) },
{ pf_guest, STAT_OFFSET(pf_guest) },
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
index 663b822..ec32c26 100644
--- a/drivers/kvm/x86.h
+++ b/drivers/kvm/x86.h
@@ -85,6 +85,8 @@ struct kvm_vcpu {
struct x86_emulate_ctxt emulate_ctxt;
 };
 
+extern struct kvm_x86_ops *kvm_x86_ops;
+
 int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32
error_code);
 
 static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
-- 
1.5.1.2

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/3] Put the virtio under the virtualization menu

2007-11-07 Thread Avi Kivity
Anthony Liguori wrote:
 This patch moves virtio under the virtualization menu and changes virtio
 devices to not claim to only be for lguest.
   

Perhaps the virt menu needs to be split into a host-side support menu
and guest-side support menu.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Add accessor for kvm-vm_fd

2007-11-07 Thread Avi Kivity
Amit Shah wrote:
 Introduce kvm_get_vm_fd to get the VM FD
   
 What, so you can issue ioctls like there's no tomorrow?  Add function
 wrappers for your ioctls instead.
 

 Hmm. this might not be needed now since the kvm_context moved to a .h file. 
 It 
 was a static in a .c earlier.
   

That .h is not meant to be included by libkvm users.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Add accessor for kvm-vm_fd

2007-11-07 Thread Amit Shah
On Thursday 08 November 2007 11:56:24 Avi Kivity wrote:
 Amit Shah wrote:
  With the declaration in libkvm.h this time:
  From 8313b87bcab415746e6eed86ac3f5b6c562b9764 Mon Sep 17 00:00:00 2001
 
  From: Amit Shah [EMAIL PROTECTED]
  Date: Thu, 8 Nov 2007 00:13:07 +0530
  Subject: [PATCH] Add accessor for kvm-vm_fd
 
  Introduce kvm_get_vm_fd to get the VM FD

 What, so you can issue ioctls like there's no tomorrow?  Add function
 wrappers for your ioctls instead.

Hmm. this might not be needed now since the kvm_context moved to a .h file. It 
was a static in a .c earlier.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 3/3] virtio PCI device

2007-11-07 Thread Avi Kivity
Anthony Liguori wrote:
 This is a PCI device that implements a transport for virtio.  It allows virtio
 devices to be used by QEMU based VMMs like KVM or Xen.

   

Didn't see support for dma. I think that with Amit's pvdma patches you
can support dma-capable devices as well without too much fuss.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/3] Export vring functions for modules to use

2007-11-07 Thread Anthony Liguori
This is needed for the virtio PCI device to be compiled as a module.

Signed-off-by: Anthony Liguori [EMAIL PROTECTED]

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 0e1bf05..3f28b47 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -260,6 +260,8 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
return IRQ_HANDLED;
 }
 
+EXPORT_SYMBOL_GPL(vring_interrupt);
+
 static struct virtqueue_ops vring_vq_ops = {
.add_buf = vring_add_buf,
.get_buf = vring_get_buf,
@@ -306,8 +308,12 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
return vq-vq;
 }
 
+EXPORT_SYMBOL_GPL(vring_new_virtqueue);
+
 void vring_del_virtqueue(struct virtqueue *vq)
 {
kfree(to_vvq(vq));
 }
 
+EXPORT_SYMBOL_GPL(vring_del_virtqueue);
+

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] SMP support on AMD64

2007-11-07 Thread Avi Kivity
Lynn Kerby wrote:
 On Nov 7, 2007, at 3:06 AM, Avi Kivity wrote:

   
 Lynn Kerby wrote:
 
 Hi KVM developers (and lurkers like myself).

 Apologies in advance as this is probably not the right forum for  
 this  question.

   
 It is certainly the right forum.
 

 Good to know.  There doesn't seem to be a lot of user oriented info  
 for KVM and I was wondering if I just couldn't find the forums or what.

   

Well, there's a lot of overlap between kvm and qemu, and there's little
setup or black magic needed to use kvm.  What particularly are you missing?

The intent is that kvm be very easy to use to a unix user proficient in
the command line, with the gui junkies served by what virt-manager aims
to be (or competing solutions).

 Yes you've been doing something wrong -- you should have reported  
 this quickly.  Worst case somebody would have pointed out something  
 trivial you're doing wrong and you'd have felt foolish for a bit.   
 But in this particular case...
 

 I'd assumed (there's *that* word) that core developer types were  
 using KVM on all kinds of hardware and that basics like this would  
 have been shaken out.  

Well, it is a reasonable assumption, but the sad fact is, we do little
regression testing on smp here, and Intel doesn't test AMD for some
reason.  It used to work but regressed.

That's something we need to improve on, and quickly.  I'm counting on
Anthony's plan to flood the known universe with kvm-testing nanobots.

 I set up a few KVM virtual machines about 6  
 months ago with the intent of migrating my mail server and some other  
 functions to them but never quite got it working to my satisfaction.   
 Now I've got major problems with the 10+ year old hardware (and  
 software) with that system and it is becoming urgent.
   

Let us know what's not working and we will try to address it.


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] SMP support on AMD64

2007-11-07 Thread Lynn Kerby

On Nov 7, 2007, at 3:06 AM, Avi Kivity wrote:

 Lynn Kerby wrote:
 Hi KVM developers (and lurkers like myself).

 Apologies in advance as this is probably not the right forum for  
 this  question.


 It is certainly the right forum.

Good to know.  There doesn't seem to be a lot of user oriented info  
for KVM and I was wondering if I just couldn't find the forums or what.

 I've had no success getting an SMP virtual machine running on my  
 AMD  Athlon64 X2 server.  The base system is Ubuntu 7.10  
 (recently  upgraded from 7.04) with a 2.6.22 kernel and I've tried  
 kvm releases  49  50 with no success.  My memory of whether or  
 not it worked  months ago with kvm-28 on the Ubuntu 2.6.20-16  
 kernel is no longer  with me :-(.  The recent failures have all  
 been BIOS problems at  rombios.c:10605.  I'm pretty sure I must  
 have something wrong in my  environment and have spent entirely  
 too much of my spare time trying  various things with no success.


 Yes you've been doing something wrong -- you should have reported  
 this quickly.  Worst case somebody would have pointed out something  
 trivial you're doing wrong and you'd have felt foolish for a bit.   
 But in this particular case...

I'd assumed (there's *that* word) that core developer types were  
using KVM on all kinds of hardware and that basics like this would  
have been shaken out.  I set up a few KVM virtual machines about 6  
months ago with the intent of migrating my mail server and some other  
functions to them but never quite got it working to my satisfaction.   
Now I've got major problems with the 10+ year old hardware (and  
software) with that system and it is becoming urgent.

 Can someone that has actually has an SMP virtual machine running   
 currently on an AMD processor (preferably a 64-bit guest) give me   
 some details on the base system kernel, KVM related bits, and the   
 guest OS?



 Turns out kvm smp on amd is broken.  I committed a fix for kvm-51,  
 and now I have FC6 running happily with two vcpus.

 If you see problems, please report them soon.  I'd rather have  
 noise on the list than problems going unreported.

 I'm attaching the patch which fixes the problem, let us know if it  
 helps or not (there may be more problems lurking).

Yes, that patch works nicely for me as does the kvm-51 release.

Thanks,

Lynn Kerby
San Martin, CA

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 11 of 17] Move msrs functions to libkvm-x86.c

2007-11-07 Thread Carlo Marcelo Arenas Belon
On Tue, Nov 06, 2007 at 10:48:52AM -0600, Jerone Young wrote:
 Move msrs functions to libkvm-x86.c
 
 This patch moves functions:
   kvm_msr_list
   move kvm_get_msrs
   move kvm_set_msrs

the problem is that with this the definitions were moved as well from libkvm.h
to kvm-x86.h which is private and not meant to be exported outside of libkvm
but those 3 functions are used by qemu-kvm.c as shown by :

/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function
`load_regs':
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:319:
warning: implicit declaration of function `kvm_set_msrs'
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function
`save_regs':
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:457:
warning: implicit declaration of function `kvm_get_msrs'
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function
`kvm_qemu_create_context':
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:1020:
warning: implicit declaration of function `kvm_get_msr_list'
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:1020:
warning: assignment makes pointer from integer without a cast

the following patch moves them to a new public arch specific header for libkvm
named libkvm-x86.h and that needs to be installed in userspace as well but is
not completely independent and would had been as well ifdef inside libkvm.h
for simplicity.

Jerone or anyone else that is working in the architectural work care to
comment?

Carlo

PS. tested in amd64
--
diff --git a/libkvm/Makefile b/libkvm/Makefile
index 65efb3a..bbeb564 100644
--- a/libkvm/Makefile
+++ b/libkvm/Makefile
@@ -26,6 +26,7 @@ libkvm.a: libkvm.o $(libkvm-$(ARCH)-objs)
 
 install:
install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h
+   install -D libkvm-x86.h $(DESTDIR)/$(PREFIX)/include/libkvm-x86.h
install -D $(KERNELDIR)/include/linux/kvm.h \
$(DESTDIR)/$(PREFIX)/include/linux/kvm.h
install -D $(KERNELDIR)/include/linux/kvm_para.h \
diff --git a/libkvm/kvm-x86.h b/libkvm/kvm-x86.h
index b531a3b..1e1c718 100644
--- a/libkvm/kvm-x86.h
+++ b/libkvm/kvm-x86.h
@@ -19,8 +19,7 @@
 #define KVM_X86_H
 
 #include kvm-common.h
-
-#include kvm-common.h
+#include libkvm-x86.h
 
 #define PAGE_SIZE 4096ul
 #define PAGE_MASK (~(PAGE_SIZE - 1))
@@ -42,8 +41,4 @@ int kvm_run_abi10(kvm_context_t kvm, int vcpu);
 
 void kvm_show_code(kvm_context_t kvm, int vcpu);
 
-struct kvm_msr_list *kvm_get_msr_list(kvm_context_t);
-int kvm_get_msrs(kvm_context_t, int vcpu, struct kvm_msr_entry *msrs, int n);
-int kvm_set_msrs(kvm_context_t, int vcpu, struct kvm_msr_entry *msrs, int n);
-
 #endif
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
new file mode 100644
index 000..6531d1f
--- /dev/null
+++ b/libkvm/libkvm-x86.h
@@ -0,0 +1,12 @@
+/** \file libkvm-x86.h
+ * libkvm for x86 API
+ */
+
+#ifndef LIBKVM_X86_H
+#define LIBKVM_X86_H
+
+struct kvm_msr_list *kvm_get_msr_list(kvm_context_t kvm);
+int kvm_get_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs, int 
n);
+int kvm_set_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs, int 
n);
+
+#endif
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
index b00d658..173566f 100644
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -19,6 +19,10 @@ struct kvm_context;
 
 typedef struct kvm_context *kvm_context_t;
 
+#if defined(__x86_64__) || defined(__i386__)
+#include libkvm-x86.h
+#endif
+
 /*!
  * \brief KVM callbacks structure
  *

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 11 of 17] Move msrs functions to libkvm-x86.c

2007-11-07 Thread Avi Kivity
Carlo Marcelo Arenas Belon wrote:
 On Tue, Nov 06, 2007 at 10:48:52AM -0600, Jerone Young wrote:
   
 Move msrs functions to libkvm-x86.c

 This patch moves functions:
  kvm_msr_list
  move kvm_get_msrs
  move kvm_set_msrs
 

 the problem is that with this the definitions were moved as well from libkvm.h
 to kvm-x86.h which is private and not meant to be exported outside of libkvm
 but those 3 functions are used by qemu-kvm.c as shown by :

   

They need to be moved back to libkvm.h with a #ifdef.  And to the #ifdef
purists I say: deorbit.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 1/2] KVM userspace: Add PCI device passthrough support

2007-11-07 Thread Amit Shah
On Thursday 08 November 2007 01:31:32 Hollis Blanchard wrote:
 I'm sorry these comments aren't substantive, but please watch your
 whitespace...

Hi Hollis,

Thanks for going through this. We know about these issues; the userspace is 
kind of messy since it's collected from various sources and we are urging the 
people who have done this to provide good patches.

These aren't ready yet for inclusion, we've sent them out to get comments on 
the overall solution for PCI passthrough.

 On Wed, 2007-11-07 at 21:45 +0200, Amit Shah wrote:
  diff --git a/qemu/Makefile b/qemu/Makefile
  index 053c88c..3e599f3 100644
  --- a/qemu/Makefile
  +++ b/qemu/Makefile
  @@ -37,7 +37,7 @@ qemu-img$(EXESUF): qemu-img.c cutils.c block.c
  block-raw.c block-cow.c block-qco
   dyngen$(EXESUF): dyngen.c
  $(HOST_CC) $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) -o $@ $^
 
  -clean:
  +clean:
   # avoid old build problems by removing potentially incorrect old
  files
  rm -f config.mak config.h op-i386.h opc-i386.h gen-op-i386.h
  op-arm.h opc-arm.h gen-op-arm.h
  rm -f *.o *.a $(TOOLS) dyngen$(EXESUF) TAGS cscope.* *.pod *~
  */*~

 Extra space.

  @@ -88,8 +88,8 @@ endif
   test speed test2: all
  $(MAKE) -C tests $@
 
  -TAGS:
  -   etags *.[ch] tests/*.[ch]
  +TAGS:
  +   etags *.[ch] tests/*.[ch] hw/passthrough/*.[ch]
 
   cscope:
  rm -f ./cscope.*

 Another extra space.

  diff --git a/qemu/exec.c b/qemu/exec.c
  index 3e588d5..7a21ca5 100644
  --- a/qemu/exec.c
  +++ b/qemu/exec.c
  @@ -2484,6 +2484,7 @@ int cpu_register_io_memory(int io_index,
   if (io_mem_nb = IO_MEM_NB_ENTRIES)
   return -1;
   io_index = io_mem_nb++;
  +   fprintf(stderr, iomem index %d out of %d\n, io_index,
  IO_MEM_NB_ENTRIES);
   } else {
   if (io_index = IO_MEM_NB_ENTRIES)
   return -1;

 Bad indentation.

 I didn't check the rest of your patches for this, so you should skim
 them...



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 3/3] virtio PCI device

2007-11-07 Thread Anthony Liguori
This is a PCI device that implements a transport for virtio.  It allows virtio
devices to be used by QEMU based VMMs like KVM or Xen.

Signed-off-by: Anthony Liguori [EMAIL PROTECTED]

diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 9e33fc4..c81e0f3 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -6,3 +6,20 @@ config VIRTIO
 config VIRTIO_RING
bool
depends on VIRTIO
+
+config VIRTIO_PCI
+   tristate PCI driver for virtio devices (EXPERIMENTAL)
+   depends on PCI  EXPERIMENTAL
+   select VIRTIO
+   select VIRTIO_RING
+   ---help---
+ This drivers provides support for virtio based paravirtual device
+ drivers over PCI.  This requires that your VMM has appropriate PCI
+ virtio backends.  Most QEMU based VMMs should support these devices
+ (like KVM or Xen).
+
+ Currently, the ABI is not considered stable so there is no guarantee
+ that this version of the driver will work with your VMM.
+
+ If unsure, say M.
+  
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
index f70e409..cc84999 100644
--- a/drivers/virtio/Makefile
+++ b/drivers/virtio/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_VIRTIO) += virtio.o
 obj-$(CONFIG_VIRTIO_RING) += virtio_ring.o
+obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
new file mode 100644
index 000..85ae096
--- /dev/null
+++ b/drivers/virtio/virtio_pci.c
@@ -0,0 +1,469 @@
+#include linux/module.h
+#include linux/list.h
+#include linux/pci.h
+#include linux/interrupt.h
+#include linux/virtio.h
+#include linux/virtio_config.h
+#include linux/virtio_ring.h
+#include linux/virtio_pci.h
+#include linux/highmem.h
+#include linux/spinlock.h
+
+MODULE_AUTHOR(Anthony Liguori [EMAIL PROTECTED]);
+MODULE_DESCRIPTION(virtio-pci);
+MODULE_LICENSE(GPL);
+MODULE_VERSION(1);
+
+/* Our device structure */
+struct virtio_pci_device
+{
+   /* the virtio device */
+   struct virtio_device vdev;
+   /* the PCI device */
+   struct pci_dev *pci_dev;
+   /* the IO mapping for the PCI config space */
+   void *ioaddr;
+
+   spinlock_t lock;
+   struct list_head virtqueues;
+};
+
+struct virtio_pci_vq_info
+{
+   /* the number of entries in the queue */
+   int num;
+   /* the number of pages the device needs for the ring queue */
+   int n_pages;
+   /* the index of the queue */
+   int queue_index;
+   /* the struct page of the ring queue */
+   struct page *pages;
+   /* the virtual address of the ring queue */
+   void *queue;
+   /* a pointer to the virtqueue */
+   struct virtqueue *vq;
+   /* the node pointer */
+   struct list_head node;
+};
+
+/* We have to enumerate here all virtio PCI devices. */
+static struct pci_device_id virtio_pci_id_table[] = {
+   { 0x5002, 0x2258, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* Dummy entry */
+   { 0 },
+};
+
+MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
+
+/* A PCI device has it's own struct device and so does a virtio device so
+ * we create a place for the virtio devices to show up in sysfs.  I think it
+ * would make more sense for virtio to not insist on having it's own device. */
+static struct device virtio_pci_root = {
+   .parent = NULL,
+   .bus_id = virtio-pci,
+};
+
+/* Unique numbering for devices under the kvm root */
+static unsigned int dev_index;
+
+/* Convert a generic virtio device to our structure */
+static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
+{
+   return container_of(vdev, struct virtio_pci_device, vdev);
+}
+
+/* virtio config-feature() implementation */
+static bool vp_feature(struct virtio_device *vdev, unsigned bit)
+{
+   struct virtio_pci_device *vp_dev = to_vp_device(vdev);
+   u32 mask;
+
+   /* Since this function is supposed to have the side effect of
+* enabling a queried feature, we simulate that by doing a read
+* from the host feature bitmask and then writing to the guest
+* feature bitmask */
+   mask = ioread32(vp_dev-ioaddr + VIRTIO_PCI_HOST_FEATURES);
+   if (mask  (1  bit)) {
+   mask |= (1  bit);
+   iowrite32(mask, vp_dev-ioaddr + VIRTIO_PCI_GUEST_FEATURES);
+   }
+
+   return !!(mask  (1  bit));
+}
+
+/* virtio config-get() implementation */
+static void vp_get(struct virtio_device *vdev, unsigned offset,
+  void *buf, unsigned len)
+{
+   struct virtio_pci_device *vp_dev = to_vp_device(vdev);
+   void *ioaddr = vp_dev-ioaddr + VIRTIO_PCI_CONFIG + offset;
+
+   /* We translate appropriately sized get requests into more natural
+* IO operations.  These functions also take care of endianness
+* conversion. */
+   switch (len) {
+   case 1: {
+   u8 val;
+   val = ioread8(ioaddr);
+   memcpy(buf, 

[kvm-devel] [PATCH 2/3] Put the virtio under the virtualization menu

2007-11-07 Thread Anthony Liguori
This patch moves virtio under the virtualization menu and changes virtio
devices to not claim to only be for lguest.

Signed-off-by: Anthony Liguori [EMAIL PROTECTED]

diff --git a/drivers/Kconfig b/drivers/Kconfig
index f4076d9..d945ffc 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -93,6 +93,4 @@ source drivers/auxdisplay/Kconfig
 source drivers/kvm/Kconfig
 
 source drivers/uio/Kconfig
-
-source drivers/virtio/Kconfig
 endmenu
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 4d0119e..be4b224 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -429,6 +429,7 @@ config VIRTIO_BLK
tristate Virtio block driver (EXPERIMENTAL)
depends on EXPERIMENTAL  VIRTIO
---help---
- This is the virtual block driver for lguest.  Say Y or M.
+ This is the virtual block driver for virtio.  It can be used with
+  lguest or QEMU based VMMs (like KVM or Xen).  Say Y or M.
 
 endif # BLK_DEV
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 6569206..ac4bcdf 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -50,5 +50,6 @@ config KVM_AMD
 # OK, it's a little counter-intuitive to do this, but it puts it neatly under
 # the virtualization menu.
 source drivers/lguest/Kconfig
+source drivers/virtio/Kconfig
 
 endif # VIRTUALIZATION
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 86b8641..e66aec4 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -3107,6 +3107,7 @@ config VIRTIO_NET
tristate Virtio network driver (EXPERIMENTAL)
depends on EXPERIMENTAL  VIRTIO
---help---
- This is the virtual network driver for lguest.  Say Y or M.
+ This is the virtual network driver for virtio.  It can be used with
+  lguest or QEMU based VMMs (like KVM or Xen).  Say Y or M.
 
 endif # NETDEVICES

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [RFC] virtio-blk PCI backend

2007-11-07 Thread Avi Kivity
Anthony Liguori wrote:
 +case VIRTIO_PCI_QUEUE_NOTIFY:
 + if (val  VIRTIO_PCI_QUEUE_MAX)
 + virtio_ring_kick(vdev, vdev-vq[val]);
 + break;
   

I see you're not using hypercalls for this, presumably for compatibility
with -no-kvm.  Well I think I have a solution: advertise vmcall,
vmmcall, pio to some port, and int $some_vector as hypercall feature
bits in cpuid (for kvm, kvm, qemu, and kvm-lite respectively).  Early
setup code could patch the instruction as appropriate (I hear code
patching is now taught in second grade).

(kvm could advertise all four, or maybe just the first two)

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Add accessor for kvm-vm_fd

2007-11-07 Thread Avi Kivity
Amit Shah wrote:
 With the declaration in libkvm.h this time:

 From 8313b87bcab415746e6eed86ac3f5b6c562b9764 Mon Sep 17 00:00:00 2001
 From: Amit Shah [EMAIL PROTECTED]
 Date: Thu, 8 Nov 2007 00:13:07 +0530
 Subject: [PATCH] Add accessor for kvm-vm_fd

 Introduce kvm_get_vm_fd to get the VM FD

   

What, so you can issue ioctls like there's no tomorrow?  Add function
wrappers for your ioctls instead.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 1/2] KVM userspace: Add PCI device passthrough support

2007-11-07 Thread Avi Kivity
Amit Shah wrote:
 This patch introduces support for device passthrough
 from the host to a paravirtualized guest.

 A new command-line option, -passthrough is added.
 For example, to invoke it for an Ethernet device sitting at
 PCI bus:dev.fn 04:08.0 with host IRQ 18, use this:

 -passthrough Ethernet/04:08.0-18

   

Could be named '-pci' or '-pcidevice' like '-usb' or '-usbdevice'.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] FreeBSD image hangs during boot

2007-11-07 Thread Avi Kivity
Aurelien Jarno wrote:
 Well the IDE code hasn't changed a lot recently, so I checked the CVS
 history and easily (first test) found the commit that causes the problem:

 Last AIO patch, by Vladimir N. Oleynik.

 http://cvs.savannah.nongnu.org/viewvc/qemu/hw/ide.c?root=qemur1=1.64r2=1.65

   

Have we learned something about this issue?  Should I revert the patch
from kvm?  Should qemu?

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] SMP support on AMD64

2007-11-07 Thread Alexey Eremenko
Hi Avi,

Speaking of AMD host - with KVM-51 it doesn't crashes anymore !

But there is still fonts rendering problem with Fedora7/ 32-bit guests.

-- 
-Alexey Eremenko Technologov

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now  http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH]3/5 Using kvm_arch prefix to define functions, and replace

2007-11-07 Thread Zhang, Xiantao
From cba4340cef2217343c540ca5de9b67cc8826b63f Mon Sep 17 00:00:00 2001
From: Zhang Xiantao [EMAIL PROTECTED]
Date: Thu, 8 Nov 2007 13:07:23 +0800
Subject: [PATCH] Using kvm_arch prefix to define functions, and replace
kvm_x86_ops callback.
Signed-off-by: Zhang Xiantao [EMAIL PROTECTED]
---
 drivers/kvm/kvm.h  |   15 +++
 drivers/kvm/kvm_main.c |   26 +-
 drivers/kvm/x86.c  |   48

 3 files changed, 76 insertions(+), 13 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 091f9b7..4b2421a 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -649,6 +649,21 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu,
struct kvm_run *kvm_run);
 
 __init void kvm_arch_init(void);
 
+
+void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
+void kvm_arch_vcpu_decache(struct kvm_vcpu *vcpu);
+void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
+void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
+struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int
id);
+
+int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
+void kvm_arch_hardware_enable(void *garbage);
+void kvm_arch_hardware_disable(void *garbage);
+int kvm_arch_hardware_setup(void);
+void kvm_arch_hardware_unsetup(void);
+void kvm_arch_check_processor_compat(void *rtn);
+
+
 static inline void kvm_guest_enter(void)
 {
account_system_vtime(current);
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index f1cf8f0..da7fb22 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -240,7 +240,7 @@ static void kvm_free_vcpus(struct kvm *kvm)
kvm_unload_vcpu_mmu(kvm-vcpus[i]);
for (i = 0; i  KVM_MAX_VCPUS; ++i) {
if (kvm-vcpus[i]) {
-   kvm_x86_ops-vcpu_free(kvm-vcpus[i]);
+   kvm_arch_vcpu_free(kvm-vcpus[i]);
kvm-vcpus[i] = NULL;
}
}
@@ -890,7 +890,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm,
int n)
if (!valid_vcpu(n))
return -EINVAL;
 
-   vcpu = kvm_x86_ops-vcpu_create(kvm, n);
+   vcpu = kvm_arch_vcpu_create(kvm, n);
if (IS_ERR(vcpu))
return PTR_ERR(vcpu);
 
@@ -900,7 +900,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm,
int n)
BUG_ON((unsigned long)vcpu-host_fx_image  0xF);
 
vcpu_load(vcpu);
-   r = kvm_x86_ops-vcpu_reset(vcpu);
+   r = kvm_arch_vcpu_reset(vcpu);
if (r == 0)
r = kvm_mmu_setup(vcpu);
vcpu_put(vcpu);
@@ -933,7 +933,7 @@ mmu_unload:
vcpu_put(vcpu);
 
 free_vcpu:
-   kvm_x86_ops-vcpu_free(vcpu);
+   kvm_arch_vcpu_free(vcpu);
return r;
 }
 
@@ -1297,7 +1297,7 @@ static void decache_vcpus_on_cpu(int cpu)
 */
if (mutex_trylock(vcpu-mutex)) {
if (vcpu-cpu == cpu) {
-   kvm_x86_ops-vcpu_decache(vcpu);
+   kvm_arch_vcpu_decache(vcpu);
vcpu-cpu = -1;
}
mutex_unlock(vcpu-mutex);
@@ -1313,7 +1313,7 @@ static void hardware_enable(void *junk)
if (cpu_isset(cpu, cpus_hardware_enabled))
return;
cpu_set(cpu, cpus_hardware_enabled);
-   kvm_x86_ops-hardware_enable(NULL);
+   kvm_arch_hardware_enable(NULL);
 }
 
 static void hardware_disable(void *junk)
@@ -1324,7 +1324,7 @@ static void hardware_disable(void *junk)
return;
cpu_clear(cpu, cpus_hardware_enabled);
decache_vcpus_on_cpu(cpu);
-   kvm_x86_ops-hardware_disable(NULL);
+   kvm_arch_hardware_disable(NULL);
 }
 
 static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned
long val,
@@ -1492,7 +1492,7 @@ static void kvm_sched_in(struct preempt_notifier
*pn, int cpu)
 {
struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn);
 
-   kvm_x86_ops-vcpu_load(vcpu, cpu);
+   kvm_arch_vcpu_load(vcpu, cpu);
 }
 
 static void kvm_sched_out(struct preempt_notifier *pn,
@@ -1500,7 +1500,7 @@ static void kvm_sched_out(struct preempt_notifier
*pn,
 {
struct kvm_vcpu *vcpu = preempt_notifier_to_vcpu(pn);
 
-   kvm_x86_ops-vcpu_put(vcpu);
+   kvm_arch_vcpu_put(vcpu);
 }
 
 int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size,
@@ -1525,13 +1525,13 @@ int kvm_init_x86(struct kvm_x86_ops *ops,
unsigned int vcpu_size,
 
kvm_x86_ops = ops;
 
-   r = kvm_x86_ops-hardware_setup();
+   r = kvm_arch_hardware_setup();
if (r  0)
goto out;
 
for_each_online_cpu(cpu) {
smp_call_function_single(cpu,
-
kvm_x86_ops-check_processor_compatibility,
+   kvm_arch_check_processor_compat,
r, 0, 1);
if