Re: [kvm-devel] [PATCH] MMU: fix cmpxchg8b emulation on i386 to use the right address

2008-01-03 Thread Carlo Marcelo Arenas Belon
On Fri, Jan 04, 2008 at 12:57:49AM -0600, Carlo Marcelo Arenas Belon wrote:
> change the function parameter to use vaddr instead of addr to avoid a
> variable name redefinition from 9a5ee611ca79bec98e9d97e93f11df8083b8af6e

this implementation has been already patched 6 times (not including this one)
since it was originally introduced in Dec 12, including compilation and logic
fixes as can be seen by :

  24a673eb377069509e8dad5ff7fa146e363df739
  eb9270cee7061e5a985eb9eac559270292b1d7ec
  a5e8e8a4f7ddb211d856eb30e93e70af9d51b735
  d5855a0ec163afd591f272e13e1f2c366794306f
  9bfdd08f0a65e67d0842ca35516669bec523fbe0
  91051a4955255317cab0d09d8849ec12db85f924

it was meant to fix some sort of bug on i386 because it wasn't atomic but
with so many changes I am not sure if what it was meant to do has been really
preserved, so I think it would be better if anyone with more experience and a
better understanding of this patch could  sheed some light on this.

Carlo

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] MMU: fix cmpxchg8b emulation on i386 to use the right address

2008-01-03 Thread Carlo Marcelo Arenas Belon
change the function parameter to use vaddr instead of addr to avoid a
variable name redefinition from 9a5ee611ca79bec98e9d97e93f11df8083b8af6e
that resulted in :

  kernel/x86.c:1746: warning: passing argument 2 of 'vcpu->arch.mmu.gva_to_gpa' 
makes integer from pointer without a cast
  kernel/x86.c:1746: warning: 'addr' is used uninitialized in this function

Signed-off-by: Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
---
 arch/x86/kvm/x86.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c5b4825..abe08d1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1722,7 +1722,7 @@ int emulator_write_emulated(unsigned long addr,
 }
 EXPORT_SYMBOL_GPL(emulator_write_emulated);
 
-static int emulator_cmpxchg_emulated(unsigned long addr,
+static int emulator_cmpxchg_emulated(unsigned long vaddr,
 const void *old,
 const void *new,
 unsigned int bytes,
@@ -1743,7 +1743,7 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
u64 val;
 
down_read(¤t->mm->mmap_sem);
-   gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, addr);
+   gpa = vcpu->arch.mmu.gva_to_gpa(vcpu, vaddr);
 
if (gpa == UNMAPPED_GVA ||
   (gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
@@ -1763,7 +1763,7 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
}
 #endif
 
-   return emulator_write_emulated(addr, new, bytes, vcpu);
+   return emulator_write_emulated(vaddr, new, bytes, vcpu);
 }
 
 static unsigned long get_segment_base(struct kvm_vcpu *vcpu, int seg)
-- 
1.5.3.7


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] qemu: use statically allocate 512 byte buffer in the stack for sector in bdrv_commit

2008-01-03 Thread Carlo Marcelo Arenas Belon
revert a merge conflict from 075da586c92f09bd9a7401f1e80d72fde27c173 that
redefined sector as an array of pointers to char, instead of a statically
allocated buffer of chars, that was triggering the following warnings :

block.c: In function `bdrv_commit':
block.c:480: warning: passing arg 3 of `bdrv_read' from incompatible pointer 
type
block.c:484: warning: passing arg 3 of `bdrv_write' from incompatible pointer 
type

Signed-off-by: Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
---
 qemu/block.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu/block.c b/qemu/block.c
index 519be24..492a4d3 100644
--- a/qemu/block.c
+++ b/qemu/block.c
@@ -460,7 +460,7 @@ int bdrv_commit(BlockDriverState *bs)
 BlockDriver *drv = bs->drv;
 int64_t i, total_sectors;
 int n, j;
-unsigned char *sector[512];
+unsigned char sector[512];
 
 if (!drv)
 return -ENOMEDIUM;
-- 
1.5.3.7


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] remove redundant VM Exit for non-aligned guest pte write or part of pte write.

2008-01-03 Thread Dong, Eddie
Avi Kivity wrote:
> Dong, Eddie wrote:
>> I observed 1-2 seconds faster in Windows XPSP2 ACPI bootup with
>> total of 23 seconds.
>> I can;t say it is exactly caused by this patch, but anyway it
>> simplifies the logic and code w/o any additional complexity.
>> thx,eddie 
>> 
>> 
>> 
> 
> Patch looks good, but will delay so that the guest scaling patch can
> be merged.  kvm_read_guest() will need to change to
> kvm_read_guest_inatomic(), since the mmu is becoming spinlocked.  

Rebased.
Thx, eddie

A guest non-aligned pte write or part of pte
update will leave shadow_trap_nonpresent_pte
in spte, which expects a new VM Exit at next
access time.

This patch fixed this by reading guest pte
in advance and thus be able to update spte
and reduce next VM Exit.

Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index c478ee2..644254a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1309,8 +1309,7 @@ static void mmu_pte_write_zap_pte(struct kvm_vcpu
*vcpu,
 static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,
  struct kvm_mmu_page *sp,
  u64 *spte,
- const void *new, int bytes,
- int offset_in_pte)
+ const void *new)
 {
if (sp->role.level != PT_PAGE_TABLE_LEVEL) {
++vcpu->kvm->stat.mmu_pde_zapped;
@@ -1319,9 +1318,9 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu
*vcpu,
 
++vcpu->kvm->stat.mmu_pte_updated;
if (sp->role.glevels == PT32_ROOT_LEVEL)
-   paging32_update_pte(vcpu, sp, spte, new, bytes,
offset_in_pte);
+   paging32_update_pte(vcpu, sp, spte, new);
else
-   paging64_update_pte(vcpu, sp, spte, new, bytes,
offset_in_pte);
+   paging64_update_pte(vcpu, sp, spte, new);
 }
 
 static bool need_remote_flush(u64 old, u64 new)
@@ -1397,8 +1396,8 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu,
gpa_t gpa,
struct hlist_node *node, *n;
struct hlist_head *bucket;
unsigned index;
-   u64 entry;
-   u64 *spte;
+   u64 entry, gentry;
+   u64 *spte, *gpte;
unsigned offset = offset_in_page(gpa);
unsigned pte_size;
unsigned page_offset;
@@ -1407,6 +1406,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu,
gpa_t gpa,
int level;
int flooded = 0;
int npte;
+   int r;
 
pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes);
mmu_guess_page_from_pte_write(vcpu, gpa, new, bytes);
@@ -1470,11 +1470,20 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu,
gpa_t gpa,
continue;
}
spte = &sp->spt[page_offset / sizeof(*spte)];
+   if ((gpa & (pte_size - 1)) || (bytes < pte_size)) {
+   gentry = 0;
+   gpte = &gentry;
+   r = kvm_read_guest_atomic(vcpu->kvm,
+   gpa & ~(pte_size - 1),
+   gpte, pte_size);
+   if (r < 0)
+   continue;
+   } else
+   gpte = (u64 *)new;
while (npte--) {
entry = *spte;
mmu_pte_write_zap_pte(vcpu, sp, spte);
-   mmu_pte_write_new_pte(vcpu, sp, spte, new,
bytes,
- page_offset & (pte_size -
1));
+   mmu_pte_write_new_pte(vcpu, sp, spte, gpte);
mmu_pte_write_flush_tlb(vcpu, entry, *spte);
++spte;
}
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 03ba860..1678071 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -240,8 +240,7 @@ err:
 }
 
 static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct
kvm_mmu_page *page,
- u64 *spte, const void *pte, int bytes,
- int offset_in_pte)
+ u64 *spte, const void *pte)
 {
pt_element_t gpte;
unsigned pte_access;
@@ -249,12 +248,10 @@ static void FNAME(update_pte)(struct kvm_vcpu
*vcpu, struct kvm_mmu_page *page,
 
gpte = *(const pt_element_t *)pte;
if (~gpte & (PT_PRESENT_MASK | PT_ACCESSED_MASK)) {
-   if (!offset_in_pte && !is_present_pte(gpte))
+   if (!is_present_pte(gpte))
set_shadow_pte(spte,
shadow_notrap_nonpresent_pte);
return;
}
-   if (bytes < sizeof(pt_element_t))
-   return;
pgprintk("%s: gpte %llx spte %p\n", __FUNCTION__, (u64)gpte,
spte);
pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte);
if (gpte_to_gfn(gpte) != vcpu->arch.update_pte.gfn)


tl

Re: [kvm-devel] [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD

2008-01-03 Thread Dong, Eddie
Anthony Liguori wrote:
> Yang, Sheng wrote:
>> From 9743b5299bae1779c2b893cbeb86122bcccb9b2d Mon Sep 17 00:00:00
>> 2001 
>> From: Sheng Yang <[EMAIL PROTECTED]>
>> Date: Wed, 2 Jan 2008 14:49:22 +0800
>> Subject: [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by
>> #UD 
>> 
>> When executing a test program called "crashme", we found the KVM
>> guest 
>> cannot survived more than ten seconds, then encounterd kernel panic.
>> The basic concept of "crashme" is graduating random assembly code and
>> trying to execute them in a fork process.
>> 
>> After some fix on emulator valid judgment, we found it's hard to get
>> the current emulator handle the invalid instructions correctly, for
>> the #UD trap for hypercall patching caused troubles. The problem is,
>> if the opcode itself was OK, but combination of opcode and modrm_reg
>> was invalid, and one operand of the opcode was memory(SrcMem or
>> DstMem), emulator would fetched the memory operand first rather than
>> judged the validity, and may encounter error there. 
>> 
> 
> Nice catch!
> 
> Regards,
> 
> Anthony Liguori
> 
Anthony:
Actually I am wondering if the binary used for VMMCALL could be
assumed will never be used by Intel processor or vice versa.  BTW, what
is the nenefit to remove hypercall page, which provide more clean
approach IMO?
thx,eddie

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Use memset(0) instead of setting cb_mode explicitly

2008-01-03 Thread Rusty Russell
On Friday 04 January 2008 02:57:14 Anthony Liguori wrote:
> hrtimer's only have a cb_mode if CONFIG_HIGH_RES_TIMER is enabled.  This
> patch memset()s the tx_timer structure to 0 which has the same effect as
> setting cb_mode to HRTIMER_CB_SOFTIRQ without requiring
> CONFIG_HIGH_RES_TIMER to be set.  This seems to be what other drivers do.

Thanks, applied.

Rusty.

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD

2008-01-03 Thread Anthony Liguori
Yang, Sheng wrote:
> From 9743b5299bae1779c2b893cbeb86122bcccb9b2d Mon Sep 17 00:00:00 2001
> From: Sheng Yang <[EMAIL PROTECTED]>
> Date: Wed, 2 Jan 2008 14:49:22 +0800
> Subject: [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD
>
> When executing a test program called "crashme", we found the KVM guest cannot 
> survived more than ten seconds, then encounterd kernel panic. The basic 
> concept of "crashme" is graduating random assembly code and trying to execute 
> them in a fork process.
>
> After some fix on emulator valid judgment, we found it's hard to get the 
> current emulator handle the invalid instructions correctly, for the #UD trap 
> for hypercall patching caused troubles. The problem is, if the opcode itself 
> was OK, but combination of opcode and modrm_reg was invalid, and one operand 
> of the opcode was memory(SrcMem or DstMem), emulator would fetched the memory 
> operand first rather than judged the validity, and may encounter error there. 
>   

Nice catch!

Regards,

Anthony Liguori

> For example, ".byte 0xfe, 0x34, 0xcd" got this trouble.
>
> In the patch, we simply check that if the invalid opcode isn't 
> vmcall/vmmcall, 
> then return from emulate_instruction() and inject a #UD to guest. With the 
> patch, the guest had been run for more than 12 hours.
>
> Signed-off-by: Feng (Eric) Liu <[EMAIL PROTECTED]>
> Signed-off-by: Sheng Yang <[EMAIL PROTECTED]>
> ---
>  arch/x86/kvm/svm.c |2 +-
>  arch/x86/kvm/vmx.c |2 +-
>  arch/x86/kvm/x86.c |   18 +++---
>  include/asm-x86/kvm_host.h |4 +++-
>  4 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 11e5baf..2da9e11 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -942,7 +942,7 @@ static int ud_interception(struct vcpu_svm *svm, struct 
> kvm_run *kvm_run)
>  {
>   int er;
>  
> - er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0);
> + er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, EMULTYPE_TRAP_UD);
>   if (er != EMULATE_DONE)
>   kvm_queue_exception(&svm->vcpu, UD_VECTOR);
>   return 1;
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 4741806..5346e42 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -1862,7 +1862,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, 
> struct kvm_run *kvm_run)
>   }
>  
>   if (is_invalid_opcode(intr_info)) {
> - er = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
> + er = emulate_instruction(vcpu, kvm_run, 0, 0, EMULTYPE_TRAP_UD);
>   if (er != EMULATE_DONE)
>   kvm_queue_exception(vcpu, UD_VECTOR);
>   return 1;
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index c5b4825..2a659ce 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1840,9 +1840,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
>   struct kvm_run *run,
>   unsigned long cr2,
>   u16 error_code,
> - int no_decode)
> + int emulation_type)
>  {
>   int r;
> + struct decode_cache *c;
>  
>   vcpu->arch.mmio_fault_cr2 = cr2;
>   kvm_x86_ops->cache_regs(vcpu);
> @@ -1850,7 +1851,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
>   vcpu->mmio_is_write = 0;
>   vcpu->arch.pio.string = 0;
>  
> - if (!no_decode) {
> + if (!(emulation_type & EMULTYPE_NO_DECODE)) {
>   int cs_db, cs_l;
>   kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
>  
> @@ -1884,6 +1885,16 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
>   get_segment_base(vcpu, VCPU_SREG_FS);
>  
>   r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
> +
> + /* Reject the instructions other than VMCALL/VMMCALL when
> +  * try to emulate invalid opcode */
> + c = &vcpu->arch.emulate_ctxt.decode;
> + if ((emulation_type & EMULTYPE_TRAP_UD) &&
> + (!(c->twobyte && c->b == 0x01 &&
> +   (c->modrm_reg == 0 || c->modrm_reg == 3) &&
> +c->modrm_mod == 3 && c->modrm_rm == 1)))
> + return EMULATE_FAIL;
> +
>   ++vcpu->stat.insn_emulation;
>   if (r)  {
>   ++vcpu->stat.insn_emulation_fail;
> @@ -2639,7 +2650,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, 
> struct kvm_run *kvm_run)
>   vcpu->mmio_read_completed = 1;
>   vcpu->mmio_needed = 0;
>   r = emulate_instruction(vcpu, kvm_run,
> - vcpu->arch.mmio_fault_cr2, 0, 1);
> + vcpu->arch.mmio_fault_cr2, 0,
> + EMULTYPE_NO_DECODE);
>   if (r == EMULATE_DO_MMIO) {
>   /*
>

[kvm-devel] [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD

2008-01-03 Thread Yang, Sheng
From 9743b5299bae1779c2b893cbeb86122bcccb9b2d Mon Sep 17 00:00:00 2001
From: Sheng Yang <[EMAIL PROTECTED]>
Date: Wed, 2 Jan 2008 14:49:22 +0800
Subject: [PATCH] KVM: emulator: Only allow VMCALL/VMMCALL trapped by #UD

When executing a test program called "crashme", we found the KVM guest cannot 
survived more than ten seconds, then encounterd kernel panic. The basic 
concept of "crashme" is graduating random assembly code and trying to execute 
them in a fork process.

After some fix on emulator valid judgment, we found it's hard to get the 
current emulator handle the invalid instructions correctly, for the #UD trap 
for hypercall patching caused troubles. The problem is, if the opcode itself 
was OK, but combination of opcode and modrm_reg was invalid, and one operand 
of the opcode was memory(SrcMem or DstMem), emulator would fetched the memory 
operand first rather than judged the validity, and may encounter error there. 
For example, ".byte 0xfe, 0x34, 0xcd" got this trouble.

In the patch, we simply check that if the invalid opcode isn't vmcall/vmmcall, 
then return from emulate_instruction() and inject a #UD to guest. With the 
patch, the guest had been run for more than 12 hours.

Signed-off-by: Feng (Eric) Liu <[EMAIL PROTECTED]>
Signed-off-by: Sheng Yang <[EMAIL PROTECTED]>
---
 arch/x86/kvm/svm.c |2 +-
 arch/x86/kvm/vmx.c |2 +-
 arch/x86/kvm/x86.c |   18 +++---
 include/asm-x86/kvm_host.h |4 +++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 11e5baf..2da9e11 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -942,7 +942,7 @@ static int ud_interception(struct vcpu_svm *svm, struct 
kvm_run *kvm_run)
 {
int er;
 
-   er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0);
+   er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, EMULTYPE_TRAP_UD);
if (er != EMULATE_DONE)
kvm_queue_exception(&svm->vcpu, UD_VECTOR);
return 1;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4741806..5346e42 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1862,7 +1862,7 @@ static int handle_exception(struct kvm_vcpu *vcpu, 
struct kvm_run *kvm_run)
}
 
if (is_invalid_opcode(intr_info)) {
-   er = emulate_instruction(vcpu, kvm_run, 0, 0, 0);
+   er = emulate_instruction(vcpu, kvm_run, 0, 0, EMULTYPE_TRAP_UD);
if (er != EMULATE_DONE)
kvm_queue_exception(vcpu, UD_VECTOR);
return 1;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c5b4825..2a659ce 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1840,9 +1840,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
struct kvm_run *run,
unsigned long cr2,
u16 error_code,
-   int no_decode)
+   int emulation_type)
 {
int r;
+   struct decode_cache *c;
 
vcpu->arch.mmio_fault_cr2 = cr2;
kvm_x86_ops->cache_regs(vcpu);
@@ -1850,7 +1851,7 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
vcpu->mmio_is_write = 0;
vcpu->arch.pio.string = 0;
 
-   if (!no_decode) {
+   if (!(emulation_type & EMULTYPE_NO_DECODE)) {
int cs_db, cs_l;
kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
 
@@ -1884,6 +1885,16 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
get_segment_base(vcpu, VCPU_SREG_FS);
 
r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
+
+   /* Reject the instructions other than VMCALL/VMMCALL when
+* try to emulate invalid opcode */
+   c = &vcpu->arch.emulate_ctxt.decode;
+   if ((emulation_type & EMULTYPE_TRAP_UD) &&
+   (!(c->twobyte && c->b == 0x01 &&
+ (c->modrm_reg == 0 || c->modrm_reg == 3) &&
+  c->modrm_mod == 3 && c->modrm_rm == 1)))
+   return EMULATE_FAIL;
+
++vcpu->stat.insn_emulation;
if (r)  {
++vcpu->stat.insn_emulation_fail;
@@ -2639,7 +2650,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, 
struct kvm_run *kvm_run)
vcpu->mmio_read_completed = 1;
vcpu->mmio_needed = 0;
r = emulate_instruction(vcpu, kvm_run,
-   vcpu->arch.mmio_fault_cr2, 0, 1);
+   vcpu->arch.mmio_fault_cr2, 0,
+   EMULTYPE_NO_DECODE);
if (r == EMULATE_DO_MMIO) {
/*
 * Read-modify-write.  Back to userspace.
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h
index 20597bc..4702b04 100644
--- a/include/asm-x86/kvm_h

Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Jerry Geis


Anthony Liguori wrote:
> Jerry Geis wrote:
>> Anthony Liguori wrote:
>>> Jerry Geis wrote:
 I have kvm-amd working fine.

 when I am at my desktop everything works normal.
 However, when I vncviewer into my desktop and startup my
 session I mouse over the XP desktop but I cannot click in the desktop
 and make it active. I get the little square mouse pointer.

 I have to do the crl-alt to release the mouse but I cannot click 
 into the desktop
 to run anything.
   
>>>
>>> vncviewer does not do mouse grab so I'm not terribly sure what 
>>> you're talking about.  Are you sure you're using vncviewer and not SDL?
>>>
>>> Regards,
>>>
>>> Anthony Liguori
>>>
 What might I be missing?

 jerry

 - 

>>>
>>
>> Anthony,
>>
>> I dont exactly know what SDL is.
>>
>> All I know is when I am at my desk everything is working fine...
>> Then I go home and use "vncviewer machine" to remote into my desktop.
>> Everything runs normal of course but when I select my minimized kvm 
>> session,
>> it maximizes but I cannot click in the XP session to give it focus. 
>> All I get is the
>> little square mouse pointer like you get when you move the mouse off 
>> the kvm window
>> and kvm has grabbed the mouse. I cannot ever select anything in the 
>> XP window accessing my
>> machine with vncviewer.
>
> If you add "-usb -usbdevice tablet" to your QEMU command, you should 
> haven't this problem anymore.
>
> Regards,
>
> Anthony Liguori
>
>> I am using centos 5.1 and now kvm-59.
>>
>> Jerry
>>
>
>
Thanks - that does work.

Jerry

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Anthony Liguori
Jerry Geis wrote:
> Anthony Liguori wrote:
>> Jerry Geis wrote:
>>> I have kvm-amd working fine.
>>>
>>> when I am at my desktop everything works normal.
>>> However, when I vncviewer into my desktop and startup my
>>> session I mouse over the XP desktop but I cannot click in the desktop
>>> and make it active. I get the little square mouse pointer.
>>>
>>> I have to do the crl-alt to release the mouse but I cannot click 
>>> into the desktop
>>> to run anything.
>>>   
>>
>> vncviewer does not do mouse grab so I'm not terribly sure what you're 
>> talking about.  Are you sure you're using vncviewer and not SDL?
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>> What might I be missing?
>>>
>>> jerry
>>>
>>> - 
>>>
>>
>
> Anthony,
>
> I dont exactly know what SDL is.
>
> All I know is when I am at my desk everything is working fine...
> Then I go home and use "vncviewer machine" to remote into my desktop.
> Everything runs normal of course but when I select my minimized kvm 
> session,
> it maximizes but I cannot click in the XP session to give it focus. 
> All I get is the
> little square mouse pointer like you get when you move the mouse off 
> the kvm window
> and kvm has grabbed the mouse. I cannot ever select anything in the XP 
> window accessing my
> machine with vncviewer.

If you add "-usb -usbdevice tablet" to your QEMU command, you should 
haven't this problem anymore.

Regards,

Anthony Liguori

> I am using centos 5.1 and now kvm-59.
>
> Jerry
>


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] acpi sci polarity

2008-01-03 Thread Avi Kivity
Guido Guenther wrote:
> On Thu, Jan 03, 2008 at 07:11:32PM +0100, Guido Guenther wrote:
>   
>> simulate the pressing of a fixed feature acpi power button. The patch
>> has one issue though, it currently needs --no-kvm-irqchip (see my other
>> mail). Please apply if appropriate.
>> 
> When running without --no-kvm-irqchip the ACPI irq never gets delivered,
> the ACPI interrupt always stays at zero in /proc/interrupt. However I
> can hack around this with:
>
> --- a/kernel/ioapic.c
> +++ b/kernel/ioapic.c
> @@ -248,6 +253,8 @@ void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int 
> irq, int level)
>  
>   if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
>   entry = ioapic->redirtbl[irq];
> + if(irq == 10) /* ACPI interrupt */
> + entry.fields.polarity = 0;
>   level ^= entry.fields.polarity;
>   if (!level)
>   ioapic->irr &= ~mask;
>
> If I understand the docs correctly the ACPI SCI should be an (active low
> not active high) leveled interrupt. Where would be the proper place to
> fix this?
>   

While pci interrupts are documented as active high, the documentation 
for the piix4 pic elcr registers suggests piix4 level-triggered 
interrupts are active high.  So there is some inconsistency somewhere 
involving qemu interrupt generation (which IIRC treats all interrupts as 
active high), the ioapic (qemu doesn't implement polarity), bios setup, 
and the acpi dsdt.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [Qemu-devel] [PATCH 2 of 3] Optionally link against libuuid if present

2008-01-03 Thread Ryan Harper
* Filip Navara <[EMAIL PROTECTED]> [2007-12-11 15:29]:
> Hi Ryan & others,
> 
> now I have been holding a SMBIOS patch on my hard disk for way to long it
> seems. I used a different approach from yours, so I decided to publish it
> for review or further ideas. What I did was to modify the bochs bios to
> produce the SMBIOS tables and I get the UUID using VMware backdoor port from
> the virtual machine.
> 
> Attached are just the changed files, creating a patch will take a while
> because it's against VERY OLD version of the sources.

Filip,

Thanks for posting this.  I agree with Fabrice that doing the SMBIOS
tables in rombios is a better approach.  The rombio32.c file you
included didn't look that old to me; it has a CVS release tag of:
'rombios32.c,v 1.11 2007/08/03 13:56:13'  

AFAICT, it looks like a straight-forward SMBIOS implementation.  The
only thing worth adding to yours is the BIOS release date string in the
type 0 table.  Setting this date to something newer than typical
CONFIG_ACPI_BLACKLIST_YEAR value (2000 in Gutsy's kernels) lets the
kernel enable ACPI features (like power-off).

Any idea on when you might have a patch that I can test?

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] acpi sci polarity

2008-01-03 Thread Guido Guenther
On Thu, Jan 03, 2008 at 07:11:32PM +0100, Guido Guenther wrote:
> simulate the pressing of a fixed feature acpi power button. The patch
> has one issue though, it currently needs --no-kvm-irqchip (see my other
> mail). Please apply if appropriate.
When running without --no-kvm-irqchip the ACPI irq never gets delivered,
the ACPI interrupt always stays at zero in /proc/interrupt. However I
can hack around this with:

--- a/kernel/ioapic.c
+++ b/kernel/ioapic.c
@@ -248,6 +253,8 @@ void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, 
int level)
 
if (irq >= 0 && irq < IOAPIC_NUM_PINS) {
entry = ioapic->redirtbl[irq];
+   if(irq == 10) /* ACPI interrupt */
+   entry.fields.polarity = 0;
level ^= entry.fields.polarity;
if (!level)
ioapic->irr &= ~mask;

If I understand the docs correctly the ACPI SCI should be an (active low
not active high) leveled interrupt. Where would be the proper place to
fix this?
 -- Guido

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 20/52] KVM: Add missing #include

2008-01-03 Thread Adrian Bunk
On Sun, Dec 30, 2007 at 09:10:06AM +0200, Avi Kivity wrote:
> Needed for empty_zero_page.
> 
> Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
> ---
>  drivers/kvm/kvm_main.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
> index 469e6b4..d6c5191 100644
> --- a/drivers/kvm/kvm_main.c
> +++ b/drivers/kvm/kvm_main.c
> @@ -46,6 +46,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  MODULE_AUTHOR("Qumranet");
>  MODULE_LICENSE("GPL");

Can you merge this patch into the previous one for the final submission?

For being able to bisect (which has proven to be a very valuable help) 
we aim at having the tree between any two commits both compiling and 
working.

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] system_powerdown via acpi power button

2008-01-03 Thread Guido Guenther
Hi,
in order to be able to shutdown kvm cleanly with libvirt (currently
libvirt simply sends a SIGTERM) I implemented system_powerdown() to
simulate the pressing of a fixed feature acpi power button. The patch
has one issue though, it currently needs --no-kvm-irqchip (see my other
mail). Please apply if appropriate.

diff --git a/bios/rombios32.c b/bios/rombios32.c
index 314df94..7a96ece 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -1318,8 +1318,8 @@ void acpi_bios_init(void)
 fadt->pm_tmr_len = 4;
 fadt->plvl2_lat = cpu_to_le16(0x0fff); // C2 state not supported
 fadt->plvl3_lat = cpu_to_le16(0x0fff); // C3 state not supported
-/* WBINVD + PROC_C1 + PWR_BUTTON + SLP_BUTTON + FIX_RTC */
-fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 4) | (1 << 5) | (1 
<< 6));
+/* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */
+fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6));
 acpi_build_table_header((struct acpi_table_header *)fadt, "FACP", 
 sizeof(*fadt));
 
diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index a2efd9c..fa78b81 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -71,6 +71,8 @@ typedef struct PIIX4PMState {
 #define SMBHSTDAT1 0x06
 #define SMBBLKDAT 0x07
 
+PIIX4PMState *pm_state;
+
 static uint32_t get_pmtmr(PIIX4PMState *s)
 {
 uint32_t d;
@@ -475,6 +477,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t 
smb_io_base)
 s = (PIIX4PMState *)pci_register_device(bus,
  "PM", sizeof(PIIX4PMState),
  devfn, NULL, pm_write_config);
+pm_state = s;
 pci_conf = s->dev.config;
 pci_conf[0x00] = 0x86;
 pci_conf[0x01] = 0x80;
@@ -516,3 +519,13 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t 
smb_io_base)
 s->smbus = i2c_init_bus();
 return s->smbus;
 }
+
+#if defined(TARGET_I386)
+void qemu_system_powerdown(void)
+{
+if(pm_state->pmen & PWRBTN_EN) {
+   pm_state->pmsts |= PWRBTN_EN;
+   pm_update_sci(pm_state);
+}
+}
+#endif
diff --git a/qemu/pc-bios/bios.bin b/qemu/pc-bios/bios.bin
index d2729cd..fb3a72b 100644
Binary files a/qemu/pc-bios/bios.bin and b/qemu/pc-bios/bios.bin differ
diff --git a/qemu/sysemu.h b/qemu/sysemu.h
index c8478ec..5fd7fc2 100644
--- a/qemu/sysemu.h
+++ b/qemu/sysemu.h
@@ -33,7 +33,7 @@ void qemu_system_powerdown_request(void);
 int qemu_shutdown_requested(void);
 int qemu_reset_requested(void);
 int qemu_powerdown_requested(void);
-#if !defined(TARGET_SPARC)
+#if !defined(TARGET_SPARC) && !defined(TARGET_I386)
 // Please implement a power failure function to signal the OS
 #define qemu_system_powerdown() do{}while(0)
 #else

Cheers,
 -- Guido

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] Use memset(0) instead of setting cb_mode explicitly

2008-01-03 Thread Anthony Liguori
hrtimer's only have a cb_mode if CONFIG_HIGH_RES_TIMER is enabled.  This patch
memset()s the tx_timer structure to 0 which has the same effect as setting
cb_mode to HRTIMER_CB_SOFTIRQ without requiring CONFIG_HIGH_RES_TIMER to be
set.  This seems to be what other drivers do.

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

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 47e4fce..d11a670 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -434,9 +434,9 @@ static int virtnet_probe(struct virtio_device *vdev)
netif_napi_add(dev, &vi->napi, virtnet_poll, napi_weight);
vi->dev = dev;
vi->vdev = vdev;
+   memset(&vi->tx_timer, 0, sizeof(vi->tx_timer));
hrtimer_init(&vi->tx_timer, CLOCK_REALTIME, HRTIMER_MODE_REL);
vi->tx_timer.function = kick_xmit;
-   vi->tx_timer.cb_mode = HRTIMER_CB_SOFTIRQ;
vi->out_max = -1U;
 
tasklet_init(&vi->xmit_free, xmit_free, (unsigned long)vi);

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Amit Shah
On Thursday 03 January 2008 20:58:17 Jerry Geis wrote:
> I dont exactly know what SDL is.
>
> All I know is when I am at my desk everything is working fine...
> Then I go home and use "vncviewer machine" to remote into my desktop.
> Everything runs normal of course but when I select my minimized kvm
> session, it maximizes but I cannot click in the XP session to give it
> focus. All I get is the
> little square mouse pointer like you get when you move the mouse off the
> kvm window
> and kvm has grabbed the mouse. I cannot ever select anything in the XP
> window accessing my
> machine with vncviewer.
>
> I am using centos 5.1 and now kvm-59.

You should try something like this:

Start kvm with the -vnc :1 switch. This won't give you the usual qemu/kvm 
window that you see. You will need to use vncviewer on the host to see the 
kvm window.

Use this setup then from your home pc; it should be better.

Amit

>
> Jerry
>
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [kvm-ppc-devel] [PATCH] Add powerpc dcr callbacks to kvm callback structrure

2008-01-03 Thread Avi Kivity
Jerone Young wrote:
> That would be my sketchy idea. Though I was going to wait and see what
> the feedback would be doing this :-) It can go either way. Since it's
> just callbacks it really doesn't matter. But it does affect the
> structure size never the less. 
>
> So what are everyone thoughs about arch specific callbacks ?
>   

#ifdefs are fine, if only for documenting which tla belongs to which 
arch.  Actual runtime savings are probably negligible.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Fix up kvm-powerpc.h in libkvm

2008-01-03 Thread Avi Kivity
Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <[EMAIL PROTECTED]>
> # Date 1199306048 21600
> # Node ID da73eaf107eb8800f27e3bc045a2de28c476b07d
> # Parent  bf828ac70dde1dfa4f67e4774a884669306423e6
> Fix up kvm-powerpc.h in libkvm
>
> This patch fixes up kvm-powerpc.h. Adds proper preamble and use
> kvm_page_size as opposed to defining the pages size.
>   

Applied, thanks.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Add powerpc libkvm support code

2008-01-03 Thread Avi Kivity
Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <[EMAIL PROTECTED]>
> # Date 1199304626 21600
> # Node ID 2eddb4bcae5e444ba12b2d8985e494342e505131
> # Parent  8161d444f7c37be9bdbfaac338d58301b00f2961
> Add powerpc libkvm support code
>
> This patch adds implimentation code need for powerpc libkvm support.
>
> While the kernel code has not yet made it upstream, after seeing the skeleton
> patches making it in over the holiday, I decided to send this since
> it's for the most part stable with what we are hacking away with in kernel.
>   

Applied, thanks (merged with next patch).

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] Fwd: kvm 58 and vncviewer

2008-01-03 Thread Javier Guerra
-- Forwarded message --
From: Javier Guerra <[EMAIL PROTECTED]>
Date: Jan 3, 2008 10:45 AM
Subject: Re: [kvm-devel] kvm 58 and vncviewer
To: Avi Kivity <[EMAIL PROTECTED]>


On 1/3/08, Avi Kivity <[EMAIL PROTECTED]> wrote:
> So, you are using vncviewer to view the host desktop, and there
> selecting a kvm window?
>
> Usually one connects to qemu's internal vnc server, not to the host.

i'll try to explain a little;

SDL is the inner API used by QEMU to display the window with your XP
desktop.  as an alternative, QEMU also has an internal VNC server,
which works much better for remote access.

when local, it's usually better to use SDL, so it's the default; but
when you're remote, add "-vnc 1" to the commandline.  no window will
be displayed but you can open a second VNC client and connect to the
display '1' (i guess you're already using display '0').

hope that helps

--
Javier


-- 
Javier

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Uri Lublin
Jerry Geis wrote:
> Anthony Liguori wrote:
>   
>> Jerry Geis wrote:
>> 
>>> I have kvm-amd working fine.
>>>
>>> when I am at my desktop everything works normal.
>>> However, when I vncviewer into my desktop and startup my
>>> session I mouse over the XP desktop but I cannot click in the desktop
>>> and make it active. I get the little square mouse pointer.
>>>
>>> I have to do the crl-alt to release the mouse but I cannot click into 
>>> the desktop
>>> to run anything.
>>>   
>>>   
>> vncviewer does not do mouse grab so I'm not terribly sure what you're 
>> talking about.  Are you sure you're using vncviewer and not SDL?
>>
>> Regards,
>>
>> Anthony Liguori
>>
>> 
>>> What might I be missing?
>>>
>>> jerry
>>>
>>> - 
>>>
>>>   
>
> Anthony,
>
> I dont exactly know what SDL is.
>
> All I know is when I am at my desk everything is working fine...
> Then I go home and use "vncviewer machine" to remote into my desktop.
> Everything runs normal of course but when I select my minimized kvm session,
> it maximizes but I cannot click in the XP session to give it focus. All 
> I get is the
> little square mouse pointer like you get when you move the mouse off the 
> kvm window
> and kvm has grabbed the mouse. I cannot ever select anything in the XP 
> window accessing my
> machine with vncviewer.
>
> I am using centos 5.1 and now kvm-59.
>
> Jerry
>   
What is the command line you are using ?
If there is no '-vnc' in your kvm command line, try adding '-vnc :50', 
meaning: /usr/bin/kvm -hda ... -vnc :50
And from your home machine try vncviewer :50

Another option is use F8 and mark "alt" and "ctrl" then press 1, another 
F8 and unmark "alt" and "ctrl"

Hope that helps,
Uri.


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Qemu : Add the check before reading guest firmware

2008-01-03 Thread Avi Kivity
Zhang, Xiantao wrote:
> >From 1099b09bcdde9a80c5b0383cd063af6ad9ca18e5 Mon Sep 17 00:00:00 2001
> From: Zhang Xiantao <[EMAIL PROTECTED]>
> Date: Thu, 3 Jan 2008 17:22:36 +0800
> Subject: [PATCH] kvm: qemu : Add check for guest firmware.
>
> Add the existence check before reading the image.
>   

Applied, thanks.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH]kvm/qemu

2008-01-03 Thread Avi Kivity
Zhang, Xiantao wrote:
> >From 49f958530791c3adcf2ceca922b890bffe62e848 Mon Sep 17 00:00:00 2001
> From: Zhang Xiantao <[EMAIL PROTECTED]>
> Date: Thu, 3 Jan 2008 13:42:40 +0800
> Subject: [PATCH] kvm: qemu/ia64: Set the number of max virtual processor
> to 4 for ia64
>
> Set max number of virtual processors to 4 for ia64
>   

Applied, thanks.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Avi Kivity
Jerry Geis wrote:
> I dont exactly know what SDL is.
>
> All I know is when I am at my desk everything is working fine...
> Then I go home and use "vncviewer machine" to remote into my desktop.
> Everything runs normal of course but when I select my minimized kvm session,
> it maximizes but I cannot click in the XP session to give it focus. All 
> I get is the
> little square mouse pointer like you get when you move the mouse off the 
> kvm window
> and kvm has grabbed the mouse. I cannot ever select anything in the XP 
> window accessing my
> machine with vncviewer.
>
>   

So, you are using vncviewer to view the host desktop, and there 
selecting a kvm window?

Usually one connects to qemu's internal vnc server, not to the host.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/2] Add QEMU support for extboot (v2)

2008-01-03 Thread Avi Kivity
Anthony Liguori wrote:
> This patch adds support to QEMU for extboot.  It requires that an extboot.bin
> binary be copied into the pc-bios directory or else make install will not
> function properly.
>
> To use extboot to boot from an arbitrary block device, simply append a
> ",boot=on" to the block device to boot from.  For instance, to boot from a 
> SCSI
> disk, one would use:
>
>  -drive file=/path/to/image.img,if=scsi,boot=on
>
>   

Applied, thanks.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Jerry Geis
Anthony Liguori wrote:
> Jerry Geis wrote:
>> I have kvm-amd working fine.
>>
>> when I am at my desktop everything works normal.
>> However, when I vncviewer into my desktop and startup my
>> session I mouse over the XP desktop but I cannot click in the desktop
>> and make it active. I get the little square mouse pointer.
>>
>> I have to do the crl-alt to release the mouse but I cannot click into 
>> the desktop
>> to run anything.
>>   
>
> vncviewer does not do mouse grab so I'm not terribly sure what you're 
> talking about.  Are you sure you're using vncviewer and not SDL?
>
> Regards,
>
> Anthony Liguori
>
>> What might I be missing?
>>
>> jerry
>>
>> - 
>>
>

Anthony,

I dont exactly know what SDL is.

All I know is when I am at my desk everything is working fine...
Then I go home and use "vncviewer machine" to remote into my desktop.
Everything runs normal of course but when I select my minimized kvm session,
it maximizes but I cannot click in the XP session to give it focus. All 
I get is the
little square mouse pointer like you get when you move the mouse off the 
kvm window
and kvm has grabbed the mouse. I cannot ever select anything in the XP 
window accessing my
machine with vncviewer.

I am using centos 5.1 and now kvm-59.

Jerry


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm 58 and vncviewer

2008-01-03 Thread Anthony Liguori
Jerry Geis wrote:
> I have kvm-amd working fine.
>
> when I am at my desktop everything works normal.
> However, when I vncviewer into my desktop and startup my
> session I mouse over the XP desktop but I cannot click in the desktop
> and make it active. I get the little square mouse pointer.
>
> I have to do the crl-alt to release the mouse but I cannot click into 
> the desktop
> to run anything.
>   

vncviewer does not do mouse grab so I'm not terribly sure what you're 
talking about.  Are you sure you're using vncviewer and not SDL?

Regards,

Anthony Liguori

> What might I be missing?
>
> jerry
>
> -
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>   


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] virtio module backport

2008-01-03 Thread Anthony Liguori
Avi Kivity wrote:
> Anthony Liguori wrote:
>> Hi,
>>
>> I've posted a repo that contains my initial attempt at backporting 
>> the virtio modules.  I've tested against a 2.6.22, 2.6.20, and 2.6.18 
>> kernel (although I haven't tried the block device against 2.6.18).  
>> It requires Rusty's patch queue plus the three patches I just sent to 
>> [EMAIL PROTECTED]
>>
>> The makefile supports a 'make sync LINUX=/path/to/linux' just like 
>> the kvm-userspace/kernel directory does.
>>
>> This is still rough as I haven't went through and made sure all of 
>> the #if's are right.
>>
>> http://hg.codemonkey.ws/virtio-ext-modules
>>
>>   
>
> I think that 'typedef _Bool bool' is better than unsigned int, as it 
> forces conversions to 0/1.
>
> Modern Linux uses _Bool as well.
>

Fair enough.  I've updated.

Regards,

Anthony Liguori


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 1/3] Make virtio modules GPL

2008-01-03 Thread Anthony Liguori
Dong, Eddie wrote:
> Curuious: should we consider it to be dual licensed from beginning?
>   

AFAIK, they are GPLv2+. I think Rusty was talking about dual licensing
the headers. He'll have to comment on that though.

Regards,

Anthony Liguori

> thx,eddie
>
>   
>> -Original Message-
>> From: [EMAIL PROTECTED] 
>> [mailto:[EMAIL PROTECTED] On Behalf Of 
>> Anthony Liguori
>> Sent: 2008年1月3日 5:02
>> To: [EMAIL PROTECTED]
>> Cc: kvm-devel@lists.sourceforge.net
>> Subject: [kvm-devel] [PATCH 1/3] Make virtio modules GPL
>>
>> The virtio modules do not advertise themselves as GPL but rely 
>> on exported
>> GPL symbols.  This makes them unloadable as modules.
>>
>> This patch adds the appropriate MODULE_LICENSE().
>>
>> Signed-off: Anthony Liguori <[EMAIL PROTECTED]>
>>
>> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
>> index 54a8017..8f6040d 100644
>> --- a/drivers/block/virtio_blk.c
>> +++ b/drivers/block/virtio_blk.c
>> @@ -8,6 +8,8 @@
>>
>> #define VIRTIO_MAX_SG(3+MAX_PHYS_SEGMENTS)
>>
>> +MODULE_LICENSE("GPL");
>> +
>> static unsigned char virtblk_index = 'a';
>> struct virtio_blk
>> {
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index ebe4b03..9789e68 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -28,6 +28,8 @@
>> static int napi_weight = 128;
>> module_param(napi_weight, int, 0444);
>>
>> +MODULE_LICENSE("GPL");
>> +
>> /* FIXME: MTU in config. */
>> #define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN)
>>
>> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
>> index 646f716..6e27c08 100644
>> --- a/drivers/virtio/virtio.c
>> +++ b/drivers/virtio/virtio.c
>> @@ -2,6 +2,8 @@
>> #include 
>> #include 
>>
>> +MODULE_LICENSE("GPL");
>> +
>> static ssize_t device_show(struct device *_d,
>> struct device_attribute *attr, char *buf)
>> {
>> diff --git a/drivers/virtio/virtio_ring.c 
>> b/drivers/virtio/virtio_ring.c
>> index 951e4c7..15ee2fa 100644
>> --- a/drivers/virtio/virtio_ring.c
>> +++ b/drivers/virtio/virtio_ring.c
>> @@ -20,6 +20,8 @@
>> #include 
>> #include 
>>
>> +MODULE_LICENSE("GPL");
>> +
>> #ifdef DEBUG
>> /* For development, we want to crash whenever the ring is screwed. */
>> #define BAD_RING(vq, fmt...) \
>>
>> ---
>> --
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2005.
>> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
>> ___
>> kvm-devel mailing list
>> kvm-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>>
>> 


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/2] Add extboot to kvm-userspace (v2)

2008-01-03 Thread Anthony Liguori
extboot is an x86 Option ROM that passes through int13 functions to a VMM which
allows a VMM to expose an arbitrary block device as the primary BIOS disk.  It
can be used to boot SCSI or paravirtual devices.

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

diff --git a/extboot/Makefile b/extboot/Makefile
new file mode 100644
index 000..1ea71a7
--- /dev/null
+++ b/extboot/Makefile
@@ -0,0 +1,21 @@
+OBJCOPY=objcopy
+
+CFLAGS=-Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin \
+   -fno-stack-protector
+
+all: extboot.bin
+
+%.o: %.S
+   $(CC) $(CFLAGS) -o $@ -c $<
+
+extboot.img: extboot.o
+   $(LD) --oformat binary -Ttext 0 -o $@ $<
+
+extboot.bin: extboot.img signrom
+   ./signrom extboot.img extboot.bin
+
+signrom: signrom.c
+   $(CC) -o $@ -g -Wall $^
+
+clean:
+   $(RM) *.o *.img *.bin signrom *~
diff --git a/extboot/STATUS b/extboot/STATUS
new file mode 100644
index 000..687c6d6
--- /dev/null
+++ b/extboot/STATUS
@@ -0,0 +1,6 @@
+Working
+---
+
+Ubuntu Server 7.04 (i386)
+Windows 2000 Professional (i386)
+Windows XP SP2 (i386)
diff --git a/extboot/extboot.S b/extboot/extboot.S
new file mode 100644
index 000..7b6e9b2
--- /dev/null
+++ b/extboot/extboot.S
@@ -0,0 +1,742 @@
+/*
+ * Extended Boot Option ROM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright IBM Corporation, 2007
+ *   Authors: Anthony Liguori <[EMAIL PROTECTED]>
+ */
+
+.code16
+.text
+   .global _start
+_start:
+   .short 0xaa55
+   .byte (_end - _start) / 512
+   push %ax
+   push %bx
+   push %cx
+   push %dx
+   push %ds
+
+   /* setup ds so we can access the IVT */
+   xor %ax, %ax
+   mov %ax, %ds
+
+   /* save old int 19 at int 2b */
+   mov $(0x19 * 4), %bx
+   mov 0(%bx), %ax
+   mov 2(%bx), %cx
+
+   mov $(0x2b * 4), %bx
+   mov %ax, 0(%bx)
+   mov %cx, 2(%bx)
+
+   /* install out int 19 handler */
+   mov $(0x19 * 4), %bx
+   mov $int19_handler, %ax
+   mov %ax, 0(%bx)
+   mov %cs, 2(%bx)
+
+   pop %ds 
+   pop %dx
+   pop %cx
+   pop %bx
+   pop %ax
+   lret
+
+int19_handler:
+   push %ax
+   push %bx
+   push %cx
+   push %dx
+   push %ds
+
+   movw $0x404, %dx
+   inb %dx, %al
+   cmp $1, %al
+   je 1f
+   cmp $2, %al
+   je 2f
+   jmp 3f
+
+1: /* hook int13: intb(0x404) == 1 */
+   /* setup ds to access IVT */
+   xor %ax, %ax
+   mov %ax, %ds
+
+   /* save old int 13 to int 2c */
+   mov $(0x13 * 4), %bx
+   mov 0(%bx), %ax
+   mov 2(%bx), %cx
+
+   mov $(0x2c * 4), %bx
+   mov %ax, 0(%bx)
+   mov %cx, 2(%bx)
+
+   /* install our int 13 handler */
+   mov $(0x13 * 4), %bx
+   mov $int13_handler, %ax
+
+   mov %ax, 0(%bx)
+   mov %cs, 2(%bx)
+   jmp 3f
+   
+2: /* linux boot: intb(0x404) == 2 */
+   cli
+   cld
+   mov $0x9000, %ax
+   mov %ax, %ds
+   mov %ax, %es
+   mov %ax, %fs
+   mov %ax, %gs
+   mov %ax, %ss
+   mov $0x8ffe, %sp
+   ljmp $0x9000 + 0x20, $0
+
+3: /* fall through: inb(0x404) == 0 */
+   pop %ds
+   pop %dx
+   pop %cx
+   pop %bx
+   pop %ax
+   int $0x2b
+
+#define FLAGS_CF   0x01
+   
+.macro clc
+   push %ax
+   pushf
+   pop %ax
+   and $(~FLAGS_CF), %ax
+   push %ax
+   popf
+   pop %ax
+.endm
+
+.macro stc
+   push %ax
+   pushf
+   pop %ax
+   or $(FLAGS_CF), %ax
+   push %ax
+   popf
+   pop %ax
+.endm
+
+/* we clobber %bx */
+.macro alloca size
+   push %ds
+   push %bp
+   mov %sp, %bp  /* remember the current stack position */
+   
+   mov %ss, %bx
+   mov %bx, %ds
+   
+   sub \size, %sp
+   and $(~0x0F), %sp
+   mov %sp, %bx
+   
+   push %bp
+   mov 0(%bp), %bp
+.endm
+
+/* we clobber %bp */
+.macro allocbpa size
+   mov %sp, %bp  /* remember the current stack position */
+   sub \size, %sp
+   and $(~0x0F), %sp
+   push %bp
+   mov %sp, %bp
+   add $2, %bp
+.endm
+
+.macro freea
+   pop %sp
+   add $2, %sp
+   pop %ds
+.endm
+
+.macro freebpa
+   pop %sp
+.endm
+
+.macro dump reg
+   push %ax
+  

[kvm-devel] when XP reboots I loose network

2008-01-03 Thread Jerry Geis
Dont know if this has been covered before...

When I boot XP everthing works fine.
When I reboot XP I loose my network connection. Everthing else continues 
to work.

I have a centos 5.1 host AMD X2 6400+.
I am using kvm-59.

Jerry

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/2] Add QEMU support for extboot

2008-01-03 Thread Anthony Liguori
Avi Kivity wrote:
> Anthony Liguori wrote:
>> This patch adds support to QEMU for extboot.  It requires that an 
>> extboot.bin
>> binary be copied into the pc-bios directory or else make install will 
>> not
>> function properly.
>>
>> To use extboot to boot from an arbitrary block device, simply append a
>> ",boot=on" to the block device to boot from.  For instance, to boot 
>> from a SCSI
>> disk, one would use:
>>
>>  -drive file=/path/to/image.img,if=scsi,boot=on
>>
>>   
>
> extboot.c is missing...

Sorry, just sent out a new series fixing that.

Regards,

Anthony Liguori


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/2] Add QEMU support for extboot (v2)

2008-01-03 Thread Anthony Liguori
This patch adds support to QEMU for extboot.  It requires that an extboot.bin
binary be copied into the pc-bios directory or else make install will not
function properly.

To use extboot to boot from an arbitrary block device, simply append a
",boot=on" to the block device to boot from.  For instance, to boot from a SCSI
disk, one would use:

 -drive file=/path/to/image.img,if=scsi,boot=on

v2 adds the file extboot.c.  Sorry for the mix-up.

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

diff --git a/qemu/Makefile b/qemu/Makefile
index ce76352..a3c6870 100644
--- a/qemu/Makefile
+++ b/qemu/Makefile
@@ -179,7 +179,7 @@ endif
mkdir -p "$(DESTDIR)$(datadir)"
for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
video.x openbios-sparc32 pxe-ne2k_pci.bin \
-   pxe-rtl8139.bin pxe-pcnet.bin; do \
+   pxe-rtl8139.bin pxe-pcnet.bin extboot.bin; do \
$(INSTALL) -m 644 $(SRC_PATH)/pc-bios/$$x 
"$(DESTDIR)$(datadir)"; \
done
 ifndef CONFIG_WIN32
@@ -281,6 +281,7 @@ tarbin:
 $(datadir)/pxe-ne2k_pci.bin \
$(datadir)/pxe-rtl8139.bin \
 $(datadir)/pxe-pcnet.bin \
+   $(datadir)/extboot.bin \
$(docdir)/qemu-doc.html \
$(docdir)/qemu-tech.html \
$(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 )
diff --git a/qemu/Makefile.target b/qemu/Makefile.target
index 0c5ca47..289cd18 100644
--- a/qemu/Makefile.target
+++ b/qemu/Makefile.target
@@ -471,7 +471,7 @@ ifeq ($(TARGET_BASE_ARCH), i386)
 VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o
 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 vmmouse.o vmport.o vmware_vga.o
+VL_OBJS+= usb-uhci.o vmmouse.o vmport.o vmware_vga.o extboot.o
 CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 ifeq ($(TARGET_BASE_ARCH), ia64)
diff --git a/qemu/hw/extboot.c b/qemu/hw/extboot.c
new file mode 100644
index 000..8759895
--- /dev/null
+++ b/qemu/hw/extboot.c
@@ -0,0 +1,128 @@
+/*
+ * Extended boot option ROM support.
+ *
+ * Copyright IBM, Corp. 2007
+ *
+ * Authors:
+ *  Anthony Liguori   <[EMAIL PROTECTED]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#include "hw.h"
+#include "pc.h"
+#include "isa.h"
+#include "block.h"
+
+/* Extended Boot ROM suport */
+
+union extboot_cmd
+{
+uint16_t type;
+struct {
+   uint16_t type;
+   uint16_t cylinders;
+   uint16_t heads;
+   uint16_t sectors;
+} query_geometry;
+struct {
+   uint16_t type;
+   uint16_t nb_sectors;
+   uint16_t segment;
+   uint16_t offset;
+   uint64_t sector;
+} xfer;
+};
+
+static void get_translated_chs(BlockDriverState *bs, int *c, int *h, int *s)
+{
+bdrv_get_geometry_hint(bs, c, h, s);
+
+if (*c <= 1024) {
+   *c >>= 0;
+   *h <<= 0;
+} else if (*c <= 2048) {
+   *c >>= 1;
+   *h <<= 1;
+} else if (*c <= 4096) {
+   *c >>= 2;
+   *h <<= 2;
+} else if (*c <= 8192) {
+   *c >>= 3;
+   *h <<= 3;
+} else {
+   *c >>= 4;
+   *h <<= 4;
+}
+
+/* what is the correct algorithm for this?? */
+if (*h == 256) {
+   *h = 255;
+   *c = *c + 1;
+}
+}
+
+static uint32_t extboot_read(void *opaque, uint32_t addr)
+{
+int *pcmd = opaque;
+return *pcmd;
+}
+
+static void extboot_write_cmd(void *opaque, uint32_t addr, uint32_t value)
+{
+union extboot_cmd *cmd = (void *)(phys_ram_base + ((value & 0x) << 4));
+BlockDriverState *bs = opaque;
+int cylinders, heads, sectors, err;
+
+get_translated_chs(bs, &cylinders, &heads, §ors);
+
+if (cmd->type == 0x01 || cmd->type == 0x02) {
+   target_ulong pa = cmd->xfer.segment * 16 + cmd->xfer.segment;
+
+   /* possible buffer overflow */
+   if ((pa + cmd->xfer.nb_sectors * 512) > phys_ram_size)
+   return;
+}
+
+switch (cmd->type) {
+case 0x00:
+   cmd->query_geometry.cylinders = cylinders;
+   cmd->query_geometry.heads = heads;
+   cmd->query_geometry.sectors = sectors;
+   cpu_physical_memory_set_dirty((value & 0x) << 4);
+   break;
+case 0x01:
+   err = bdrv_read(bs, cmd->xfer.sector, phys_ram_base +
+   cmd->xfer.segment * 16 + cmd->xfer.offset,
+   cmd->xfer.nb_sectors);
+   if (err)
+   printf("Read failed\n");
+   break;
+case 0x02:
+   err = bdrv_write(bs, cmd->xfer.sector, phys_ram_base +
+cmd->xfer.segment * 16 + cmd->xfer.offset,
+cmd->xfer.nb_sectors);
+   if (err)
+   printf("Write failed\n");
+
+   cpu_physical_memory_set_dirty(cmd->xfer.segment * 16 + 
cmd->xfer.offset);
+   break;
+}
+}
+
+void extboot_init(BlockDriverState *bs, int cmd)
+{
+int *pcmd;
+
+pcmd = qemu_mal

Re: [kvm-devel] [PATCH] use rtl8139 as default network adapter

2008-01-03 Thread Avi Kivity
Guido Guenther wrote:
> On Fri, Dec 28, 2007 at 10:53:53PM +0200, Izik Eidus wrote:
>   
>> Guido Guenther wrote:
>> 
> [..snip..]
>   
>>> kvm-58 doesn't show this problem, thanks! The host runs stable now. 
>>> I'm still seeing network stalls on large transfers in the guest though.
>>> Ifup/ifdown'ing the interface in the guest gets things going again until
>>> it stops again. There's nothing in dmesg of either host or guest. I still
>>> have to check with different guest kernels and qemu network adapter
>>> emulations though (current one is ne2k using a bridge on the host). The
>>>
>>>   
>>>   
>> there are known problems with ne2k, please rtl8139 and report if it work
>> 
> rtl8139 works stable with the standard etch kernel I tested as guest,
> thanks!  Given the fact that ne2k has known problems, wouldn't using
> rtl8139 as default adaptor make sense:
>
>   

Yes.  Applied, thanks.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] virtio module backport

2008-01-03 Thread Avi Kivity
Anthony Liguori wrote:
> Hi,
>
> I've posted a repo that contains my initial attempt at backporting the 
> virtio modules.  I've tested against a 2.6.22, 2.6.20, and 2.6.18 kernel 
> (although I haven't tried the block device against 2.6.18).  It requires 
> Rusty's patch queue plus the three patches I just sent to 
> [EMAIL PROTECTED]
>
> The makefile supports a 'make sync LINUX=/path/to/linux' just like the 
> kvm-userspace/kernel directory does.
>
> This is still rough as I haven't went through and made sure all of the 
> #if's are right.
>
> http://hg.codemonkey.ws/virtio-ext-modules
>
>   

I think that 'typedef _Bool bool' is better than unsigned int, as it 
forces conversions to 0/1.

Modern Linux uses _Bool as well.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] KVM-58 -- existing VM just hangs with black screen

2008-01-03 Thread Avi Kivity

Jeremy Katz wrote:

On Wed, 2008-01-02 at 19:13 +0200, Avi Kivity wrote:
  

Can you try the option '-no-kvm' both with kvm-57 and kvm-58?



-no-kvm works.  I can hit this just booting a live CD both on a 32bit
and a 64bit host.  It looks like compatibility with old kernels is
broken (the kvm package only contains the userspace bits, the kernel
bits come from the kernel which is currently 2.6.24-rc6).  Building an
updated kernel module makes things start to work on my laptop
  


Right.  I fixed this for kvm-60, see attached patch.


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

commit 6b8bb99a9cde386d72b4b7c22b92f4bdec333dab
Author: Avi Kivity <[EMAIL PROTECTED]>
Date:   Thu Jan 3 12:20:21 2008 +0200

kvm: qemu: restore IO_MEM_ROM mark to bios when registering the memory with kvm

We removed the IO_MEM_ROM mark for qemu, since the tpr optimization needs to
update the bios.  However, kvm_cpu_register_physical_memory() uses the mark
for other purposes, so keep it.  The removal broke bootstrap on older kernels.

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

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 5a1b7d4..179585f 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -865,8 +865,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
 if (kvm_allowed)
 kvm_cpu_register_physical_memory(0x10 - isa_bios_size,
  isa_bios_size,
- (bios_offset + bios_size - isa_bios_size)
-	 /* | IO_MEM_ROM */);
+ (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
 #endif
 
 
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/2] Add QEMU support for extboot

2008-01-03 Thread Avi Kivity
Anthony Liguori wrote:
> This patch adds support to QEMU for extboot.  It requires that an extboot.bin
> binary be copied into the pc-bios directory or else make install will not
> function properly.
>
> To use extboot to boot from an arbitrary block device, simply append a
> ",boot=on" to the block device to boot from.  For instance, to boot from a 
> SCSI
> disk, one would use:
>
>  -drive file=/path/to/image.img,if=scsi,boot=on
>
>   

extboot.c is missing...

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] use rtl8139 as default network adapter

2008-01-03 Thread Guido Guenther
On Fri, Dec 28, 2007 at 10:53:53PM +0200, Izik Eidus wrote:
> Guido Guenther wrote:
[..snip..]
>> kvm-58 doesn't show this problem, thanks! The host runs stable now. 
>> I'm still seeing network stalls on large transfers in the guest though.
>> Ifup/ifdown'ing the interface in the guest gets things going again until
>> it stops again. There's nothing in dmesg of either host or guest. I still
>> have to check with different guest kernels and qemu network adapter
>> emulations though (current one is ne2k using a bridge on the host). The
>>
>>   
> there are known problems with ne2k, please rtl8139 and report if it work
rtl8139 works stable with the standard etch kernel I tested as guest,
thanks!  Given the fact that ne2k has known problems, wouldn't using
rtl8139 as default adaptor make sense:

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 6c0a360..0d697cc 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -1005,7 +1005,7 @@ static void pc_init1(ram_addr_t ram_size, int 
vga_ram_size,
 nd = &nd_table[i];
 if (!nd->model) {
 if (pci_enabled) {
-nd->model = "ne2k_pci";
+nd->model = "rtl8139";
 } else {
 nd->model = "ne2k_isa";
 }

Cheers,
 -- Guido

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] New to KVM

2008-01-03 Thread Avi Kivity
Balaji Rao wrote:
> Hello  people!
>
> I am new to the KVM community. I found it really exciting and am interested 
> in 
> contributing to the project. I found a TODO list at the site and decided to 
> work on the following one.
>
> "Add a qemu interface for sharing memory between guests. Using a pci device 
> to 
> expose the shared memory is probably a good starting point."
>
> Is it already done ? Can i start working on it ?
>
>   

I'm not aware of anyone working on this.

Note that you will need a guest driver in order to access the memory.  
If you can find a similar real device that already has such a driver, 
and emulate it, then you will not need to write this driver.

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


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] Qemu : Add the check before reading guest firmware

2008-01-03 Thread Zhang, Xiantao
>From 1099b09bcdde9a80c5b0383cd063af6ad9ca18e5 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <[EMAIL PROTECTED]>
Date: Thu, 3 Jan 2008 17:22:36 +0800
Subject: [PATCH] kvm: qemu : Add check for guest firmware.

Add the existence check before reading the image.
Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]>
---
 qemu/hw/ipf.c   |3 ++-
 qemu/target-ia64/firmware.c |   18 +-
 qemu/target-ia64/firmware.h |2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c
index d8e1184..eb4cac3 100644
--- a/qemu/hw/ipf.c
+++ b/qemu/hw/ipf.c
@@ -419,7 +419,8 @@ static void ipf_init1(ram_addr_t ram_size, int
vga_ram_size,
image = read_image(buf, &image_size );
if (NULL == image || !image_size) {
fprintf(stderr, "Error when reading Guest
Firmware!\n");
-   return ;
+   fprintf(stderr, "Please check Guest firmware at
%s\n", buf);
+   exit(1);
}
fw_image_start = fw_start + GFW_SIZE - image_size;
 
diff --git a/qemu/target-ia64/firmware.c b/qemu/target-ia64/firmware.c
index 51650c8..edabd70 100644
--- a/qemu/target-ia64/firmware.c
+++ b/qemu/target-ia64/firmware.c
@@ -22,6 +22,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+
 #include "cpu.h"
 
 #include "firmware.h"
@@ -514,16 +518,17 @@ char *read_image(const char *filename, unsigned
long *size)
 if ( (filename == NULL) || (size == NULL) )
 return NULL;
 
-if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
+kernel_fd = open(filename, O_RDONLY);
+if (kernel_fd < 0)
 {
-Hob_Output("Could not open kernel image");
-goto out;
+Hob_Output("Could not open kernel image\n");
+goto out_1;
 }
 
 if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
 {
-Hob_Output("Could not allocate decompression state for state
file");
-goto out;
+Hob_Output("Could not allocate decompression state for state
file\n");
+goto out_1;
 }
 
 *size = 0;
@@ -577,6 +582,9 @@ char *read_image(const char *filename, unsigned long
*size)
 else if ( kernel_fd >= 0 )
 close(kernel_fd);
 return image;
+
+out_1: 
+return NULL;
 }
 
 /*
diff --git a/qemu/target-ia64/firmware.h b/qemu/target-ia64/firmware.h
index 1c4e534..dde8b2d 100644
--- a/qemu/target-ia64/firmware.h
+++ b/qemu/target-ia64/firmware.h
@@ -36,7 +36,7 @@
 #define HOB_OFFSET  (GFW_HOB_START-GFW_START)
 
 #define Hob_Output(s) \
-fprintf(stderr, strcat("HOB:",s))
+fprintf(stderr, s)
 
 extern int kvm_ia64_build_hob(unsigned long memsize,
 unsigned long vcpus, uint8_t* fw_start);
-- 
1.5.2


0002-kvm-qemu-Add-check-for-guest-firmware.patch
Description: 0002-kvm-qemu-Add-check-for-guest-firmware.patch
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [ANNOUNCE] kvm-59 release

2008-01-03 Thread Avi Kivity
This release greatly improves the performance of smp guests.  Desktops 
users may also enjoy support for widescreen resolutions.

Changes from kvm-58:
- merge qemu-cvs
   - -drive cache=[on|off] option
   - adds scsi passthrough
- ide lba48 support for 120GB+ disk images
- widescreen resolutions for -std-vga
- libkvm compile fixes (Carlo Marcelo Arenas Belon)
- mmu scaling (Marcelo Tosatti, me)

Notes:
  If you use the modules bundled with kvm-59, you can use any version
of Linux from 2.6.17 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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH]kvm/qemu

2008-01-03 Thread Zhang, Xiantao
>From 49f958530791c3adcf2ceca922b890bffe62e848 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <[EMAIL PROTECTED]>
Date: Thu, 3 Jan 2008 13:42:40 +0800
Subject: [PATCH] kvm: qemu/ia64: Set the number of max virtual processor
to 4 for ia64

Set max number of virtual processors to 4 for ia64
Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]>
---
 qemu/vl.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index b84ddd5..99dc03d 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -220,6 +220,8 @@ const char *vnc_display;
 #define MAX_CPUS 16
 #elif defined(TARGET_I386)
 #define MAX_CPUS 255
+#elif defined(TARGET_IA64)
+#define MAX_CPUS 4
 #else
 #define MAX_CPUS 1
 #endif
-- 
1.5.2


0001-kvm-qemu-ia64-Set-max-virtual-processor-to-4-for-i.patch
Description: 0001-kvm-qemu-ia64-Set-max-virtual-processor-to-4-for-i.patch
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel