qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded
  2009-07-16 16:22 [Qemu-devel] [PATCH 0/4] Add preliminary KVM support for non-embedded PPC Alexander Graf
@ 2009-07-16 16:22 ` Alexander Graf
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 16:22 UTC (permalink / raw)
  To: qemu-devel

We now have KVM on PPC64 too and might get it on PPC32 as well, as soon
as someone writes it.

So let's enable KVM for PPC32 and PPC64 targets.
---
 configure |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index cba0c08..d832d17 100755
--- a/configure
+++ b/configure
@@ -1969,6 +1969,7 @@ target_kvm="$kvm"
 # Make sure the target and host cpus are compatible
 if test ! \( "$target_arch2" = "$cpu" -o \
   \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+  \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc"   \) -o \
   \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
   \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
   target_kvm="no"
@@ -2087,6 +2088,11 @@ case "$target_arch2" in
     echo "TARGET_ARCH=ppc" >> $config_mak
     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
+    if test "$target_kvm" = "yes" ; then
+      echo "CONFIG_KVM=y" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=32
   ;;
@@ -2110,6 +2116,11 @@ case "$target_arch2" in
     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
+    if test "$target_kvm" = "yes" ; then
+      echo "CONFIG_KVM=y" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 0/4] Add preliminary KVM support for non-embedded PPC v2
@ 2009-07-16 17:52 Alexander Graf
  2009-07-16 17:52 ` [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded Alexander Graf
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 17:52 UTC (permalink / raw)
  To: qemu-devel

With KVM support emerging for Book3S (PPC64), let's add support for it in Qemu
too, so we have a user of this awesome new infrastructure.

This patchset enabled building of Qemu on KVM, though it does not work
completely due to

 1) Brokenness of Qemu (PPC32 and PPC64 targets are broken for me atm)
 2) Brokenness in Slot management (guest breaks in Linux's PCI init code)

Nevertheless, this is a good starting point for anyone who wants to get
involved with KVM on PowerPC!

V1 -> V2

 - remove unnecessary code for MP patch
 - include SoB

Alexander Graf (4):
  Enable PPC KVM for non-embedded
  Set PVR in sregs
  Add mp_state to PPC CPU struct
  Fix warning in kvm-all.c

 configure        |   11 +++++++++++
 kvm-all.c        |    2 +-
 target-ppc/cpu.h |    4 ++++
 target-ppc/kvm.c |   11 +++++++++--
 4 files changed, 25 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded
  2009-07-16 17:52 [Qemu-devel] [PATCH 0/4] Add preliminary KVM support for non-embedded PPC v2 Alexander Graf
@ 2009-07-16 17:52 ` Alexander Graf
  2009-07-16 17:52   ` [Qemu-devel] [PATCH 2/4] Set PVR in sregs Alexander Graf
  2009-07-17  0:15   ` [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64 quintela
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 17:52 UTC (permalink / raw)
  To: qemu-devel

We now have KVM on PPC64 too and might get it on PPC32 as well, as soon
as someone writes it.

So let's enable KVM for PPC32 and PPC64 targets.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 configure |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index cba0c08..d832d17 100755
--- a/configure
+++ b/configure
@@ -1969,6 +1969,7 @@ target_kvm="$kvm"
 # Make sure the target and host cpus are compatible
 if test ! \( "$target_arch2" = "$cpu" -o \
   \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+  \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc"   \) -o \
   \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
   \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
   target_kvm="no"
@@ -2087,6 +2088,11 @@ case "$target_arch2" in
     echo "TARGET_ARCH=ppc" >> $config_mak
     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
+    if test "$target_kvm" = "yes" ; then
+      echo "CONFIG_KVM=y" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=32
   ;;
@@ -2110,6 +2116,11 @@ case "$target_arch2" in
     echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
+    if test "$target_kvm" = "yes" ; then
+      echo "CONFIG_KVM=y" >> $config_mak
+      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
+      echo "#define CONFIG_KVM 1" >> $config_h
+    fi
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64
   ;;
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 2/4] Set PVR in sregs
  2009-07-16 17:52 ` [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded Alexander Graf
@ 2009-07-16 17:52   ` Alexander Graf
  2009-07-16 17:52     ` [Qemu-devel] [PATCH 3/4] Add mp_state to PPC CPU struct Alexander Graf
  2009-07-17  0:15   ` [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64 quintela
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 17:52 UTC (permalink / raw)
  To: qemu-devel

We need to tell the kernel about some initial CPU state we don't have yet,
so let's use the "sregs" IOCTL for that and simply put the Processor Version
Register in there.

Now the kernel knows which guest CPU to virtualize.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/kvm.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index acbb1ab..24828bd 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -44,7 +44,13 @@ int kvm_arch_init(KVMState *s, int smp_cpus)
 
 int kvm_arch_init_vcpu(CPUState *cenv)
 {
-    return 0;
+    int ret = 0;
+    struct kvm_sregs sregs;
+
+    sregs.pvr = cenv->spr[SPR_PVR];
+    ret = kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs);
+
+    return ret;
 }
 
 int kvm_arch_put_registers(CPUState *env)
@@ -127,7 +133,8 @@ int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
      * interrupt, reset, etc) in PPC-specific env->irq_input_state. */
     if (run->ready_for_interrupt_injection &&
         (env->interrupt_request & CPU_INTERRUPT_HARD) &&
-        (env->irq_input_state & (1<<PPC40x_INPUT_INT)))
+//        (env->irq_input_state & (1<<PPC40x_INPUT_INT)))
+        (env->irq_input_state & (1<<PPC6xx_INPUT_INT)))
     {
         /* For now KVM disregards the 'irq' argument. However, in the
          * future KVM could cache it in-kernel to avoid a heavyweight exit
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 3/4] Add mp_state to PPC CPU struct
  2009-07-16 17:52   ` [Qemu-devel] [PATCH 2/4] Set PVR in sregs Alexander Graf
@ 2009-07-16 17:52     ` Alexander Graf
  2009-07-16 17:52       ` [Qemu-devel] [PATCH 4/4] Fix warning in kvm-all.c Alexander Graf
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 17:52 UTC (permalink / raw)
  To: qemu-devel

Some generic code tries to access env->mp_state. Let's just make
it happy and provide it.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/cpu.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 59d47d2..5582a39 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -660,6 +660,10 @@ struct CPUPPCState {
     target_ulong hreset_vector;
 #endif
 
+#ifdef CONFIG_KVM
+    uint32_t mp_state;
+#endif
+
     /* Those resources are used only during code translation */
     /* Next instruction pointer */
     target_ulong nip;
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH 4/4] Fix warning in kvm-all.c
  2009-07-16 17:52     ` [Qemu-devel] [PATCH 3/4] Add mp_state to PPC CPU struct Alexander Graf
@ 2009-07-16 17:52       ` Alexander Graf
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-16 17:52 UTC (permalink / raw)
  To: qemu-devel

This fixes a warning I stumbled across while compiling qemu on PPC64.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 kvm-all.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 8567ac9..961fa32 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -226,7 +226,7 @@ static int kvm_dirty_pages_log_change(target_phys_addr_t phys_addr,
     if (mem == NULL)  {
             fprintf(stderr, "BUG: %s: invalid parameters " TARGET_FMT_plx "-"
                     TARGET_FMT_plx "\n", __func__, phys_addr,
-                    phys_addr + size - 1);
+                    (target_phys_addr_t)(phys_addr + size - 1));
             return -EINVAL;
     }
 
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64
  2009-07-16 17:52 ` [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded Alexander Graf
  2009-07-16 17:52   ` [Qemu-devel] [PATCH 2/4] Set PVR in sregs Alexander Graf
@ 2009-07-17  0:15   ` quintela
  2009-07-17  1:22     ` Anthony Liguori
  2009-07-17 11:06     ` [Qemu-devel] " Alexander Graf
  1 sibling, 2 replies; 10+ messages in thread
From: quintela @ 2009-07-17  0:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Juan Quintela

From: Juan Quintela <quintela@redhat.com>

Hi

With new configure, patch should be like this.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 configure |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 2a6ae40..753061b 100755
--- a/configure
+++ b/configure
@@ -2016,11 +2016,12 @@ case "$target_arch2" in
     fi
 esac
 case "$target_arch2" in
-  i386|x86_64|ppcemb)
+  i386|x86_64|ppcemb|ppc|ppc64)
     # Make sure the target and host cpus are compatible
     if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
       \( "$target_arch2" = "$cpu" -o \
       \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
+      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
       \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
       \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
       echo "CONFIG_KVM=y" >> $config_mak
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64
  2009-07-17  0:15   ` [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64 quintela
@ 2009-07-17  1:22     ` Anthony Liguori
  2009-07-17  8:05       ` [Qemu-devel] " Juan Quintela
  2009-07-17 11:06     ` [Qemu-devel] " Alexander Graf
  1 sibling, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2009-07-17  1:22 UTC (permalink / raw)
  To: quintela; +Cc: qemu-devel

quintela@redhat.com wrote:
> From: Juan Quintela <quintela@redhat.com>
>
> Hi
>
> With new configure, patch should be like this.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
>   

I don't think kvm exists for ppc/ppc64 (yet).

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] Re: [PATCH] Enable kvm for ppc/ppc64
  2009-07-17  1:22     ` Anthony Liguori
@ 2009-07-17  8:05       ` Juan Quintela
  0 siblings, 0 replies; 10+ messages in thread
From: Juan Quintela @ 2009-07-17  8:05 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel

Anthony Liguori <anthony@codemonkey.ws> wrote:
> quintela@redhat.com wrote:
>> From: Juan Quintela <quintela@redhat.com>
>>
>> Hi
>>
>> With new configure, patch should be like this.
>>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>>   
>
> I don't think kvm exists for ppc/ppc64 (yet).

This one was the "correct" version of Alexander Graf patch :p
I have to improve the in-reply-to: handling.

Later, Juan.


> Regards,
>
> Anthony Liguori

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64
  2009-07-17  0:15   ` [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64 quintela
  2009-07-17  1:22     ` Anthony Liguori
@ 2009-07-17 11:06     ` Alexander Graf
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-17 11:06 UTC (permalink / raw)
  To: quintela; +Cc: qemu-devel


On 17.07.2009, at 02:15, quintela@redhat.com wrote:

> From: Juan Quintela <quintela@redhat.com>
>
> Hi
>
> With new configure, patch should be like this.

Cool, thanks :-).

I'll put this in v3.

Alex

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-17 11:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-16 17:52 [Qemu-devel] [PATCH 0/4] Add preliminary KVM support for non-embedded PPC v2 Alexander Graf
2009-07-16 17:52 ` [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded Alexander Graf
2009-07-16 17:52   ` [Qemu-devel] [PATCH 2/4] Set PVR in sregs Alexander Graf
2009-07-16 17:52     ` [Qemu-devel] [PATCH 3/4] Add mp_state to PPC CPU struct Alexander Graf
2009-07-16 17:52       ` [Qemu-devel] [PATCH 4/4] Fix warning in kvm-all.c Alexander Graf
2009-07-17  0:15   ` [Qemu-devel] [PATCH] Enable kvm for ppc/ppc64 quintela
2009-07-17  1:22     ` Anthony Liguori
2009-07-17  8:05       ` [Qemu-devel] " Juan Quintela
2009-07-17 11:06     ` [Qemu-devel] " Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2009-07-16 16:22 [Qemu-devel] [PATCH 0/4] Add preliminary KVM support for non-embedded PPC Alexander Graf
2009-07-16 16:22 ` [Qemu-devel] [PATCH 1/4] Enable PPC KVM for non-embedded Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).