qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/4] PPC KVM bringup patches round 2 v2
@ 2009-07-24 23:16 Alexander Graf
  2009-07-24 23:16 ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Alexander Graf
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-24 23:16 UTC (permalink / raw)
  To: qemu-devel

Thanks a lot for commiting the previous patches. I still needed these to get
a guest booted almost as broken as with TCG ;-).

Please test the dirty log patch thoroughly!

V2 changes

 - remove debug printf
 - make dirty log handling generic again (thx to Jan)
 - add patch to make -kernel reserved space bigger on ppc

Alexander Graf (4):
  Move mp_state to CPU_COMMON
  Use 64bit pointer for dirty log
  PPC: Round VGA BIOS size to page boundary
  Give the kernel more room

 cpu-defs.h        |    3 ++-
 hw/ppc_mac.h      |    4 ++--
 hw/ppc_newworld.c |    3 +++
 hw/ppc_oldworld.c |    3 +++
 kvm-all.c         |    2 +-
 target-i386/cpu.h |    1 -
 6 files changed, 11 insertions(+), 5 deletions(-)

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

* [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON
  2009-07-24 23:16 [Qemu-devel] [PATCH 0/4] PPC KVM bringup patches round 2 v2 Alexander Graf
@ 2009-07-24 23:16 ` Alexander Graf
  2009-07-24 23:16   ` [Qemu-devel] [PATCH 2/4] Use 64bit pointer for dirty log Alexander Graf
  2009-07-27 13:51   ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Anthony Liguori
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-24 23:16 UTC (permalink / raw)
  To: qemu-devel

MP State is implemented in the generic code, so let's move the variable
it accesses to generic code as well.

Unbreaks PPC w/ KVM.

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

diff --git a/cpu-defs.h b/cpu-defs.h
index d73ec0a..2482398 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -195,6 +195,7 @@ typedef struct CPUWatchpoint {
     const char *cpu_model_str;                                          \
     struct KVMState *kvm_state;                                         \
     struct kvm_run *kvm_run;                                            \
-    int kvm_fd;
+    int kvm_fd;                                                         \
+    int mp_state;
 
 #endif
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 08200ed..ce3fbc1 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -689,7 +689,6 @@ typedef struct CPUX86State {
 
     /* For KVM */
     uint64_t interrupt_bitmap[256 / 64];
-    uint32_t mp_state;
 
     /* in order to simplify APIC support, we leave this pointer to the
        user */
-- 
1.6.0.2

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

* [Qemu-devel] [PATCH 2/4] Use 64bit pointer for dirty log
  2009-07-24 23:16 ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Alexander Graf
@ 2009-07-24 23:16   ` Alexander Graf
  2009-07-24 23:16     ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Alexander Graf
  2009-07-27 13:51   ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Anthony Liguori
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-24 23:16 UTC (permalink / raw)
  To: qemu-devel

Dirty logs currently get written with native "long" size. On little endian
it doesn't matter if we use uint64_t instead though, because we'd still end
up using the right bytes.

On big endian, this does become a bigger problem, so we need to ensure that
kernel and userspace talk the same language, which means getting rid of "long"
and using a defined size instead.

So I decided to use 64 bit types at all times. This doesn't break existing
targets but will in conjunction with a patch I'll send to the KVM ML make
dirty logs work with 32 bit userspace on 64 kernel with big endian.

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 824bb4c..9d02ce3 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -357,7 +357,7 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
         for (phys_addr = mem->start_addr, addr = mem->phys_offset;
              phys_addr < mem->start_addr + mem->memory_size;
              phys_addr += TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
-            unsigned long *bitmap = (unsigned long *)d.dirty_bitmap;
+            uint64_t *bitmap = (uint64_t *)d.dirty_bitmap;
             unsigned nr = (phys_addr - mem->start_addr) >> TARGET_PAGE_BITS;
             unsigned word = nr / (sizeof(*bitmap) * 8);
             unsigned bit = nr % (sizeof(*bitmap) * 8);
-- 
1.6.0.2

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

* [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
  2009-07-24 23:16   ` [Qemu-devel] [PATCH 2/4] Use 64bit pointer for dirty log Alexander Graf
@ 2009-07-24 23:16     ` Alexander Graf
  2009-07-24 23:16       ` [Qemu-devel] [PATCH 4/4] Give the kernel more room Alexander Graf
  2009-07-25 17:15       ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Blue Swirl
  0 siblings, 2 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-24 23:16 UTC (permalink / raw)
  To: qemu-devel

When giving KVM a slot of a size not on page boundary, it chokes. So let's
just round up the VGA BIOS size so nobody complains anymore and we don't need
to implement sub-page slots.

Required for booting a PPC guest in KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

V2 removes a left over debug message
---
 hw/ppc_newworld.c |    3 +++
 hw/ppc_oldworld.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 4e5043c..b28a23d 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -179,6 +179,9 @@ static void ppc_core99_init (ram_addr_t ram_size,
         vga_bios_ptr[3] = 'V';
         cpu_to_be32w((uint32_t *)(vga_bios_ptr + 4), vga_bios_size);
         vga_bios_size += 8;
+
+        /* Round to page boundary */
+        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK;
     }
 
     if (linux_boot) {
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index b26e407..0bd6376 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -212,6 +212,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
         vga_bios_ptr[3] = 'V';
         cpu_to_be32w((uint32_t *)(vga_bios_ptr + 4), vga_bios_size);
         vga_bios_size += 8;
+
+        /* Round to page boundary */
+        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK;
     }
 
     if (linux_boot) {
-- 
1.6.0.2

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

* [Qemu-devel] [PATCH 4/4] Give the kernel more room
  2009-07-24 23:16     ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Alexander Graf
@ 2009-07-24 23:16       ` Alexander Graf
  2009-07-25 17:15       ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Blue Swirl
  1 sibling, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-24 23:16 UTC (permalink / raw)
  To: qemu-devel

My self-built PPC kernel doesn't fit in the region reserved for
the kernel, so I can't use -kernel with it.

Let's just extend the region.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/ppc_mac.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ppc_mac.h b/hw/ppc_mac.h
index dc39338..bcc4aaf 100644
--- a/hw/ppc_mac.h
+++ b/hw/ppc_mac.h
@@ -36,8 +36,8 @@
 #define PROM_ADDR         0xfff00000
 
 #define KERNEL_LOAD_ADDR 0x01000000
-#define CMDLINE_ADDR     0x017ff000
-#define INITRD_LOAD_ADDR 0x01800000
+#define CMDLINE_ADDR     0x027ff000
+#define INITRD_LOAD_ADDR 0x02800000
 
 #define ESCC_CLOCK 3686400
 
-- 
1.6.0.2

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

* Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
  2009-07-24 23:16     ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Alexander Graf
  2009-07-24 23:16       ` [Qemu-devel] [PATCH 4/4] Give the kernel more room Alexander Graf
@ 2009-07-25 17:15       ` Blue Swirl
  2009-07-25 18:12         ` Alexander Graf
  1 sibling, 1 reply; 10+ messages in thread
From: Blue Swirl @ 2009-07-25 17:15 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-devel

On Sat, Jul 25, 2009 at 2:16 AM, Alexander Graf<agraf@suse.de> wrote:
> When giving KVM a slot of a size not on page boundary, it chokes. So let's
> just round up the VGA BIOS size so nobody complains anymore and we don't need
> to implement sub-page slots.

> +
> +        /* Round to page boundary */
> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK;

> +
> +        /* Round to page boundary */
> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) & TARGET_PAGE_MASK;

This wrongly increases the size by extra TARGET_PAGE_SIZE, when
vga_bios_size mod TARGET_PAGE_SIZE == 0. Please use (vga_bios_size +
TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK.

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

* Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
  2009-07-25 17:15       ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Blue Swirl
@ 2009-07-25 18:12         ` Alexander Graf
  2009-07-27  7:22           ` Blue Swirl
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Graf @ 2009-07-25 18:12 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel


On 25.07.2009, at 19:15, Blue Swirl wrote:

> On Sat, Jul 25, 2009 at 2:16 AM, Alexander Graf<agraf@suse.de> wrote:
>> When giving KVM a slot of a size not on page boundary, it chokes.  
>> So let's
>> just round up the VGA BIOS size so nobody complains anymore and we  
>> don't need
>> to implement sub-page slots.
>
>> +
>> +        /* Round to page boundary */
>> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) &  
>> TARGET_PAGE_MASK;
>
>> +
>> +        /* Round to page boundary */
>> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) &  
>> TARGET_PAGE_MASK;
>
> This wrongly increases the size by extra TARGET_PAGE_SIZE, when
> vga_bios_size mod TARGET_PAGE_SIZE == 0. Please use (vga_bios_size +
> TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK.

Right, that's what Jan said too. Mind to change it when applying the  
patch or would you prefer me to do a respin?

Alex

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

* Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
  2009-07-25 18:12         ` Alexander Graf
@ 2009-07-27  7:22           ` Blue Swirl
  0 siblings, 0 replies; 10+ messages in thread
From: Blue Swirl @ 2009-07-27  7:22 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-devel

On Sat, Jul 25, 2009 at 9:12 PM, Alexander Graf<agraf@suse.de> wrote:
>
> On 25.07.2009, at 19:15, Blue Swirl wrote:
>
>> On Sat, Jul 25, 2009 at 2:16 AM, Alexander Graf<agraf@suse.de> wrote:
>>>
>>> When giving KVM a slot of a size not on page boundary, it chokes. So
>>> let's
>>> just round up the VGA BIOS size so nobody complains anymore and we don't
>>> need
>>> to implement sub-page slots.
>>
>>> +
>>> +        /* Round to page boundary */
>>> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) &
>>> TARGET_PAGE_MASK;
>>
>>> +
>>> +        /* Round to page boundary */
>>> +        vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) &
>>> TARGET_PAGE_MASK;
>>
>> This wrongly increases the size by extra TARGET_PAGE_SIZE, when
>> vga_bios_size mod TARGET_PAGE_SIZE == 0. Please use (vga_bios_size +
>> TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK.
>
> Right, that's what Jan said too. Mind to change it when applying the patch
> or would you prefer me to do a respin?

I changed it and applied, also applied 4/4.

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

* Re: [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON
  2009-07-24 23:16 ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Alexander Graf
  2009-07-24 23:16   ` [Qemu-devel] [PATCH 2/4] Use 64bit pointer for dirty log Alexander Graf
@ 2009-07-27 13:51   ` Anthony Liguori
  2009-07-27 13:56     ` Alexander Graf
  1 sibling, 1 reply; 10+ messages in thread
From: Anthony Liguori @ 2009-07-27 13:51 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-devel

Alexander Graf wrote:
> MP State is implemented in the generic code, so let's move the variable
> it accesses to generic code as well.
>
> Unbreaks PPC w/ KVM.
>   

And breaks the build for everyone else.

You change mp_state from a uint32_t to a int, but then there's:

target-i386/machine.c:

    qemu_put_be32s(f, &env->mp_state);

Which expects a uint32_t.

Regards,

Anthony Liguori

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

* Re: [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON
  2009-07-27 13:51   ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Anthony Liguori
@ 2009-07-27 13:56     ` Alexander Graf
  0 siblings, 0 replies; 10+ messages in thread
From: Alexander Graf @ 2009-07-27 13:56 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: qemu-devel


On 27.07.2009, at 15:51, Anthony Liguori wrote:

> Alexander Graf wrote:
>> MP State is implemented in the generic code, so let's move the  
>> variable
>> it accesses to generic code as well.
>>
>> Unbreaks PPC w/ KVM.
>>
>
> And breaks the build for everyone else.
>
> You change mp_state from a uint32_t to a int, but then there's:
>
> target-i386/machine.c:
>
>   qemu_put_be32s(f, &env->mp_state);
>
> Which expects a uint32_t.

Oh right - -Werror. I have to disable that on every machine I was on  
so far because it always breaks somewhere.

Want to do the one-liner change yourself or would you like me to send  
a new patch?

Alex

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

end of thread, other threads:[~2009-07-27 13:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-24 23:16 [Qemu-devel] [PATCH 0/4] PPC KVM bringup patches round 2 v2 Alexander Graf
2009-07-24 23:16 ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Alexander Graf
2009-07-24 23:16   ` [Qemu-devel] [PATCH 2/4] Use 64bit pointer for dirty log Alexander Graf
2009-07-24 23:16     ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Alexander Graf
2009-07-24 23:16       ` [Qemu-devel] [PATCH 4/4] Give the kernel more room Alexander Graf
2009-07-25 17:15       ` [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary Blue Swirl
2009-07-25 18:12         ` Alexander Graf
2009-07-27  7:22           ` Blue Swirl
2009-07-27 13:51   ` [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON Anthony Liguori
2009-07-27 13:56     ` 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).