PPC KVM bringup patches round 2 v2
cover PPC KVM bringup patches round 2 v2
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(-)
PATCH 1/4 Move mp_state to CPU_COMMON
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.
--- cpu-defs.h | 3 ++- target-i386/cpu.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
cpu-defs.h +2 -1
@@ -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
target-i386/cpu.h +0 -1
@@ -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 */
Signature · 1 line
1.6.0.2
PATCH 2/4 Use 64bit pointer for dirty log
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.
--- kvm-all.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kvm-all.c +1 -1
@@ -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 );
Signature · 1 line
1.6.0.2
PATCH 3/4 PPC: Round VGA BIOS size to page boundary
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.
---
V2 removes a left over debug message
--- hw/ppc_newworld.c | 3 +++ hw/ppc_oldworld.c | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-)
hw/ppc_newworld.c +3 -0
@@ -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) {
hw/ppc_oldworld.c +3 -0
@@ -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) {
Signature · 1 line
1.6.0.2
PATCH 4/4 Give the kernel more room
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.
--- hw/ppc_mac.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ppc_mac.h +2 -2
@@ -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
Signature · 1 line
1.6.0.2
Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
In reply to Alexander Grafhw/ppc_newworld.c static void ppc_core99_init (ram_addr_t ram_size,
Quoted 11 lines · Alexander Graf
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.
hw/ppc_newworld.c +6
-0+ + /* 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.
Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
Quoted 10 lines · Blue Swirl
Quoted 8 lines · Alexander Graf
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.
hw/ppc_newworld.c +3
-0+ +/* Round to page boundary */ + vga_bios_size = (vga_bios_size + TARGET_PAGE_SIZE) &
TARGET_PAGE_MASK;
Quoted 8 lines
Quoted 4 lines
hw/ppc_newworld.c +3
-0+ +/* 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, whenvga_bios_sizemodTARGET_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
Re: [Qemu-devel] [PATCH 3/4] PPC: Round VGA BIOS size to page boundary
Quoted 21 lines · Alexander Graf
Quoted 18 lines · Blue Swirl
Quoted 16 lines · Alexander Graf
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;
Quoted 6 lines
Quoted 3 lines
This wrongly increases the size by extra
TARGET_PAGE_SIZE, whenvga_bios_sizemodTARGET_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.
Re: [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON
In reply to Alexander GrafQuoted 5 lines · Alexander Graf
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
Re: [Qemu-devel] [PATCH 1/4] Move mp_state to CPU_COMMON
Quoted 9 lines · Anthony Liguori
Quoted 5 lines · Alexander Graf
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.
Quoted 7 lines
You change
mp_statefrom auint32_tto 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