Enable QEMU to handle more than 2GB with Xen.
cover Enable QEMU to handle more than 2GB with Xen.
Hi all,
Xen is not limited by the QEMU's virtual address space for the allocation of the guest RAM. So even with a QEMU 32bits, a Xen guest can have more than 4 GB of RAM.
With this serie, we will be able to run a guest with more than 4GB. The main point is to change ram_addr_t from ulong to uin64 when QEMU is configure with Xen. The second point is better register the memory in QEMU.
Regards,
Anthony PERARD (5):
xen: Fix xen_enabled().
exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).
cpu-common: Have a ram_addr_t of uint64 with Xen.
xen: Fix the memory registration to reflect of what is done by Xen. vl.c: Check the asked ram_size later.
cpu-common.h | 8 ++++++++ exec.c | 13 +++++++------ hw/xen.h | 2 +- vl.c | 14 ++++++++------ xen-all.c | 23 +++++++++++++++-------- 5 files changed, 39 insertions(+), 21 deletions(-)
Signature · 1 line
Anthony PERARD
PATCH 1/5 xen: Fix xen_enabled().
Use the "host" CONFIG_ define instead of the "target" one.
--- hw/xen.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/xen.h +1 -1
@@ -24,7 +24,7 @@ extern int xen_allowed;static inline int xen_enabled (void ) { -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_BACKEND return xen_allowed;#else return 0 ;
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 1/5] xen: Fix xen_enabled().
Quoted 12 lines · Anthony PERARD
Use the "host"
CONFIG_define instead of the "target" one.Signed-off-by Anthony PERARD<[email protected]>--- hw/xen.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)hw/xen.h +0
-0
hw/xen.h extern int xen_allowed; · line 30
Quoted 8 lines
hw/xen.h +1
-1@@ -24,7 +24,7 @@ extern int xen_allowed;static inline int xen_enabled (void ) { -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_BACKEND return xen_allowed;#else return 0 ;
Paolo
Re: [Qemu-devel] [PATCH 1/5] xen: Fix xen_enabled().
In reply to Anthony PERARDQuoted 12 lines · Anthony Perard
Use the "host"
CONFIG_define instead of the "target" one.Signed-off-by Anthony PERARD <[email protected]>---
hw/xen.h| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)hw/xen.h +0
-0
hw/xen.h extern int xen_allowed; · line 27
Quoted 5 lines
hw/xen.h +1
-1@@ -24,7 +24,7 @@ extern int xen_allowed;static inline int xen_enabled (void ) { -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_BACKEND
is there any way to get this one more clever? The current patch fixes it for your use case, sure, but I'd prefer that if you do:
./configure --enable-xen --target-list=alpha-softmmu
I'll get xen_enabled to be inline exterminated and not slow down the alpha target. How about something like
#ifdef CONFIG_NO_XEN
return 0;
#elif defined(CONFIG_XEN_BACKEND)
return xen_allowed;
#else
return 0;#endif
That way code that is compiled per-target won't get slowed down just because we have the xen option on.
Alex
PATCH 2/5 exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).
In reply to Anthony PERARDAs the variable pd and addr1 inside the function cpu_physical_memory_rw are mean to handle a RAM address, they should be of the ram_addr_t type instead of unsigned long.
--- exec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
exec.c +2 -2
@@ -3858,7 +3858,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,uint8_t *ptr;uint32_t val;target_phys_addr_t page; -unsigned long pd; +ram_addr_t pd;PhysPageDesc *p;while (len >0 ) {
@@ -3898,7 +3898,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, l =1 ; } }else { -unsigned long addr1; +ram_addr_t addr1; addr1 = (pd &TARGET_PAGE_MASK ) + (addr & ~TARGET_PAGE_MASK );/* RAM case */ ptr =qemu_get_ram_ptr (addr1);
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 2/5] exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).
Quoted 23 lines · Anthony PERARD
As the variable pd and addr1 inside the function
cpu_physical_memory_rware mean to handle a RAM address, they should be of theram_addr_ttype instead of unsigned long.Signed-off-by Anthony PERARD<[email protected]>--- exec.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)exec.c +1
-1@@ -3858,7 +3858,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,uint8_t *ptr;uint32_t val;target_phys_addr_t page; -unsigned long pd; +ram_addr_t pd;PhysPageDesc *p;while (len>0 ) {
exec.c void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, · line 3904
Quoted 8 lines
exec.c +1
-1@@ -3898,7 +3898,7 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf, l =1 ; } }else { -unsigned long addr1; +ram_addr_t addr1; addr1 = (pd&TARGET_PAGE_MASK ) + (addr& ~TARGET_PAGE_MASK );/* RAM case */ ptr =qemu_get_ram_ptr (addr1);
Paolo
PATCH 3/5 cpu-common: Have a ram_addr_t of uint64 with Xen.
In reply to Anthony PERARDIn Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits.
--- cpu-common.h | 8 ++++++++ exec.c | 9 +++++---- xen-all.c | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-)
cpu-common.h +8 -0
@@ -27,7 +27,15 @@ enum device_endian { };/* address in the RAM (different from a physical address) */ +#ifndef CONFIG_XEN_BACKEND typedef unsigned long ram_addr_t ; +# define RAM_ADDR_MAX ULONG_MAX +# define RAM_ADDR_FMT "%lx" +#else +typedef uint64_t ram_addr_t ; +# define RAM_ADDR_MAX UINT64_MAX +# define RAM_ADDR_FMT "%" PRIx64 +#endif /* memory API */
exec.c +5 -4
@@ -2863,13 +2863,13 @@ static void *file_ram_alloc(RAMBlock *block,static ram_addr_t find_ram_offset (ram_addr_t size) {RAMBlock *block, *next_block; -ram_addr_t offset =0 , mingap =ULONG_MAX ; +ram_addr_t offset =0 , mingap =RAM_ADDR_MAX ;if (QLIST_EMPTY (&ram_list.blocks))return 0 ; QLIST_FOREACH(block, &ram_list.blocks, next) { -ram_addr_t end, next =ULONG_MAX ; +ram_addr_t end, next =RAM_ADDR_MAX ; end = block->offset + block->length;
@@ -3081,7 +3081,8 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t length)#endif }if (area != vaddr) { -fprintf (stderr,"Could not remap addr: %lx@%lx\n" , +fprintf (stderr,"Could not remap addr: " +RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n" , length, addr);exit (1 ); }
@@ -4052,7 +4053,7 @@ void *cpu_physical_memory_map(target_phys_addr_t addr,target_phys_addr_t page;unsigned long pd;PhysPageDesc *p; -ram_addr_t raddr =ULONG_MAX ; +ram_addr_t raddr =RAM_ADDR_MAX ;ram_addr_t rlen;void *ret;
xen-all.c +1 -1
@@ -184,7 +184,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size) }if (xc_domain_populate_physmap_exact (xen_xc, xen_domid, nr_pfn,0 ,0 , pfn_list)) { -hw_error ("xen: failed to populate ram at %lx" , ram_addr); +hw_error ("xen: failed to populate ram at " RAM_ADDR_FMT , ram_addr); }qemu_free (pfn_list);
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 3/5] cpu-common: Have a ram_addr_t of uint64 with Xen.
Quoted 15 lines · Anthony Perard
In Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits.
Signed-off-by Anthony PERARD <[email protected]>---
cpu-common.h | 8 ++++++++ exec.c | 9 +++++---- xen-all.c | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-)cpu-common.h +0
-0
cpu-common.h enum device_endian { · line 31
Quoted 5 lines
cpu-common.h +1
-0@@ -27,7 +27,15 @@ enum device_endian { };/* address in the RAM (different from a physical address) */ +#ifndef CONFIG_XEN_BACKEND typedef unsigned long ram_addr_t ;
Do we really want to depend this on _BACKEND? ram_addr_t is target dependent, no?
Alex
Re: [Qemu-devel] [Xen-devel] Re: [PATCH 3/5] cpu-common: Have a ram_addr_t of uint64 with Xen.
Quoted 20 lines · Alexander Graf
Quoted 17 lines · Anthony Perard
In Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits.
Signed-off-by Anthony PERARD <[email protected]>---
cpu-common.h| 8 ++++++++exec.c| 9 +++++----xen-all.c| 2 +-3 files changed, 14 insertions(+), 5 deletions(-)cpu-common.h +0
-0@@ -27,7 +27,15 @@ enum device_endian { };
Quoted 5 lines
cpu-common.h enum device_endian { · line 31
Quoted 3 lines
cpu-common.h +1
-0/* address in the RAM (different from a physical address) */ +#ifndef CONFIG_XEN_BACKEND typedef unsigned long ram_addr_t ;Do we really want to depend this on
_BACKEND?ram_addr_tis target dependent, no?
:(, indeed, it's seams to be target dependent, I did not check that carefully enough. So CONFIG_XEN is enough.
Thanks,
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [Xen-devel] Re: [PATCH 3/5] cpu-common: Have a ram_addr_t of uint64 with Xen.
Quoted 21 lines · Anthony PERARD
Quoted 20 lines · Alexander Graf
Quoted 17 lines · Anthony Perard
In Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits.
Signed-off-by Anthony PERARD <[email protected]>---
cpu-common.h| 8 ++++++++exec.c| 9 +++++----xen-all.c| 2 +-3 files changed, 14 insertions(+), 5 deletions(-)cpu-common.h +0
-0@@ -27,7 +27,15 @@ enum device_endian { };
Quoted 8 lines
Quoted 5 lines
cpu-common.h enum device_endian { · line 31
Quoted 3 lines
cpu-common.h +1
-0/* address in the RAM (different from a physical address) */ +#ifndef CONFIG_XEN_BACKEND typedef unsigned long ram_addr_t ;Do we really want to depend this on
_BACKEND?ram_addr_tis target dependent, no?:(, indeed, it's seams to be target dependent, I did not check that carefully enough. So
CONFIG_XENis enough.
Actually, this does not work because it is used in libhw64 (like target_phys_addr_t).
So I am thinking about eithier introduce a new config variable in ./configure (ram_addr_bits), or just have
#if defined(CONFIG_XEN_BACKEND) && TARGET_PHYS_ADDR_BITS == 64
So, libhw64 with xen activated will be compiled with a ram_addr of 64b, and the libhw32 will stay with a "unsigned long".
Signature · 1 line
Anthony PERARD
PATCH 4/5 xen: Fix the memory registration to reflect of what is done by Xen.
In reply to Anthony PERARDA Xen guest memory is allocated by libxc. But this memory is not allocated continuously, instead, it leaves the VGA IO memory space not allocated, same for the MMIO space (at HVM_BELOW_4G_MMIO_START of size HVM_BELOW_4G_MMIO_LENGTH).
So to reflect that, we do not register the physical memory for this two holes. But we still keep only one RAMBlock for the all RAM as it is more easier than have two separate blocks (1 above 4G). Also this prevent QEMU from use the MMIO space for a ROM.
--- xen-all.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
xen-all.c +14 -7
@@ -144,6 +144,12 @@ static void xen_ram_init(ram_addr_t ram_size) new_block->host =NULL ; new_block->offset =0 ; new_block->length = ram_size; +if (ram_size >=HVM_BELOW_4G_RAM_END ) { +/* Xen does not allocate the memory continuously, and keep a hole at +* HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH +*/ + new_block->length +=HVM_BELOW_4G_MMIO_LENGTH ; + }QLIST_INSERT_HEAD (&ram_list.blocks, new_block, next);
@@ -152,20 +158,21 @@ static void xen_ram_init(ram_addr_t ram_size)memset (ram_list.phys_dirty + (new_block->offset >>TARGET_PAGE_BITS ),0xff , new_block->length >>TARGET_PAGE_BITS ); -if (ram_size >=0xe0000000 ) { - above_4g_mem_size = ram_size -0xe0000000 ; - below_4g_mem_size =0xe0000000 ; +if (ram_size >=HVM_BELOW_4G_RAM_END ) { + above_4g_mem_size = ram_size -HVM_BELOW_4G_RAM_END ; + below_4g_mem_size =HVM_BELOW_4G_RAM_END ; }else { below_4g_mem_size = ram_size; } -cpu_register_physical_memory (0 , below_4g_mem_size, new_block->offset); -#if TARGET_PHYS_ADDR_BITS >32 +cpu_register_physical_memory (0 ,0xa0000 ,0 ); +/* Skip of the VGA IO memory space */ +cpu_register_physical_memory (0xc0000 , below_4g_mem_size -0xc0000 , +0xc0000 );if (above_4g_mem_size >0 ) {cpu_register_physical_memory (0x100000000ULL , above_4g_mem_size, - new_block->offset + below_4g_mem_size); +0x100000000ULL ); } -#endif }void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size)
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
Quoted 51 lines · Anthony PERARD
A Xen guest memory is allocated by libxc. But this memory is not allocated continuously, instead, it leaves the VGA IO memory space not allocated, same for the MMIO space (at
HVM_BELOW_4G_MMIO_STARTof sizeHVM_BELOW_4G_MMIO_LENGTH).So to reflect that, we do not register the physical memory for this two holes. But we still keep only one RAMBlock for the all RAM as it is more easier than have two separate blocks (1 above 4G). Also this prevent QEMU from use the MMIO space for a ROM.
Signed-off-by Anthony PERARD<[email protected]>--- xen-all.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)xen-all.c +12
-5@@ -144,6 +144,12 @@ static void xen_ram_init(ram_addr_t ram_size) new_block->host =NULL ; new_block->offset =0 ; new_block->length = ram_size; +if (ram_size>=HVM_BELOW_4G_RAM_END ) { +/* Xen does not allocate the memory continuously, and keep a hole at +* HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH +*/ + new_block->length +=HVM_BELOW_4G_MMIO_LENGTH ; + }QLIST_INSERT_HEAD (&ram_list.blocks, new_block, next);@@ -152,20 +158,21 @@ static void xen_ram_init(ram_addr_t ram_size)memset (ram_list.phys_dirty + (new_block->offset>>TARGET_PAGE_BITS ),0xff , new_block->length>>TARGET_PAGE_BITS ); -if (ram_size>=0xe0000000 ) { - above_4g_mem_size = ram_size -0xe0000000 ; - below_4g_mem_size =0xe0000000 ; +if (ram_size>=HVM_BELOW_4G_RAM_END ) { + above_4g_mem_size = ram_size -HVM_BELOW_4G_RAM_END ; + below_4g_mem_size =HVM_BELOW_4G_RAM_END ; }else { below_4g_mem_size = ram_size; } -cpu_register_physical_memory (0 , below_4g_mem_size, new_block->offset); -#if TARGET_PHYS_ADDR_BITS >32 +cpu_register_physical_memory (0 ,0xa0000 ,0 ); +/* Skip of the VGA IO memory space */ + cpu_register_physical_memory(0xc0000, below_4g_mem_size - 0xc0000,
xen-all.c static void xen_ram_init(ram_addr_t ram_size) · line 178
Quoted 10 lines
xen-all.c +2
-2+ 0xc0000);if (above_4g_mem_size>0 ) {cpu_register_physical_memory (0x100000000ULL , above_4g_mem_size, - new_block->offset + below_4g_mem_size); +0x100000000ULL ); } -#endif }void xen_ram_alloc (ram_addr_t ram_addr,ram_addr_t size)
Paolo
Re: [Qemu-devel] [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
In reply to Anthony PERARDQuoted 42 lines · Anthony PERARD
A Xen guest memory is allocated by libxc. But this memory is not allocated continuously, instead, it leaves the VGA IO memory space not allocated, same for the MMIO space (at
HVM_BELOW_4G_MMIO_STARTof sizeHVM_BELOW_4G_MMIO_LENGTH).So to reflect that, we do not register the physical memory for this two holes. But we still keep only one RAMBlock for the all RAM as it is more easier than have two separate blocks (1 above 4G). Also this prevent QEMU from use the MMIO space for a ROM.
Signed-off-by Anthony PERARD <[email protected]>--- xen-all.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)xen-all.c +9
-3@@ -144,6 +144,12 @@ static void xen_ram_init(ram_addr_t ram_size) new_block->host =NULL ; new_block->offset =0 ; new_block->length = ram_size; +if (ram_size >=HVM_BELOW_4G_RAM_END ) { +/* Xen does not allocate the memory continuously, and keep a hole at +* HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH +*/ + new_block->length +=HVM_BELOW_4G_MMIO_LENGTH ; + }QLIST_INSERT_HEAD (&ram_list.blocks, new_block, next);@@ -152,20 +158,21 @@ static void xen_ram_init(ram_addr_t ram_size)memset (ram_list.phys_dirty + (new_block->offset >>TARGET_PAGE_BITS ),0xff , new_block->length >>TARGET_PAGE_BITS ); -if (ram_size >=0xe0000000 ) { - above_4g_mem_size = ram_size -0xe0000000 ; - below_4g_mem_size =0xe0000000 ; +if (ram_size >=HVM_BELOW_4G_RAM_END ) { + above_4g_mem_size = ram_size -HVM_BELOW_4G_RAM_END ; + below_4g_mem_size =HVM_BELOW_4G_RAM_END ;
xen-all.c static void xen_ram_init(ram_addr_t ram_size) · line 171
Quoted 10 lines
xen-all.c +4
-2}else { below_4g_mem_size = ram_size; } -cpu_register_physical_memory (0 , below_4g_mem_size, new_block->offset); -#if TARGET_PHYS_ADDR_BITS >32 +cpu_register_physical_memory (0 ,0xa0000 ,0 ); +/* Skip of the VGA IO memory space */ +cpu_register_physical_memory (0xc0000 , below_4g_mem_size -0xc0000 , +0xc0000 );
Shouldn't we avoid registering any memory for the whole video ram area? I mean:
0xa0000 - 0x100000
Re: [Qemu-devel] [Xen-devel] Re: [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
Quoted 4 lines · Stefano Stabellini
Shouldn't we avoid registering any memory for the whole video ram area? I mean:
0xa0000-0x100000
No, because SeaBIOS load the Options ROM (VGA Bios, PXE) to the area between 0xc0000 and 0x100000, and this go through QEMU.
The area between 0xa0000 and 0xc0000 is registred later by the cirrus_vga bits, as IO.
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [Xen-devel] Re: [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
Quoted 5 lines · Anthony PERARD
Quoted 3 lines · Stefano Stabellini
Shouldn't we avoid registering any memory for the whole video ram area? I mean:
Quoted 7 lines
Quoted 1 line
0xa0000-0x100000No, because SeaBIOS load the Options ROM (VGA Bios, PXE) to the area between
0xc0000and0x100000, and this go through QEMU.The area between
0xa0000and0xc0000is registred later by thecirrus_vgabits, as IO.
OK. Can you please expand your comment in the code with the same explanation?
Re: [Qemu-devel] [Xen-devel] Re: [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
Quoted 8 lines · Stefano Stabellini
Quoted 7 lines · Anthony PERARD
Quoted 4 lines · Stefano Stabellini
Shouldn't we avoid registering any memory for the whole video ram area? I mean:
0xa0000-0x100000
Quoted 8 lines
Quoted 5 lines
No, because SeaBIOS load the Options ROM (VGA Bios, PXE) to the area between
0xc0000and0x100000, and this go through QEMU.The area between
0xa0000and0xc0000is registred later by thecirrus_vgabits, as IO.OK. Can you please expand your comment in the code with the same explanation?
Yes, I will do that.
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 4/5] xen: Fix the memory registration to reflect of what is done by Xen.
In reply to Anthony PERARDQuoted 4 lines · Anthony PERARD
A Xen guest memory is allocated by libxc. But this memory is not allocated continuously, instead, it leaves the VGA IO memory space not allocated, same for the MMIO space (at
HVM_BELOW_4G_MMIO_STARTof sizeHVM_BELOW_4G_MMIO_LENGTH).
I realized now that you started using HVM_BELOW_4G_MMIO_START and HVM_BELOW_4G_MMIO_LENGTH without including xen/hvm/e820.h. It fails to compile on the latest xen-unstable.
PATCH 5/5 vl.c: Check the asked ram_size later.
In reply to Anthony PERARDAs a Xen guest can have more than 2GB of RAM on a 32bit host, we move the conditions after than we now if we run one Xen or not.
--- vl.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
vl.c +8 -6
@@ -2433,11 +2433,6 @@ int main(int argc, char **argv, char **envp)exit (1 ); } -/* On 32-bit hosts, QEMU is limited by virtual address space */ -if (value > (2047 <<20 ) &&HOST_LONG_BITS ==32 ) { -fprintf (stderr,"qemu: at most 2047 MB RAM can be simulated\n" ); -exit (1 ); - }if (value != (uint64_t )(ram_addr_t )value) {fprintf (stderr,"qemu: ram size too large\n" );exit (1 );
@@ -3091,8 +3086,15 @@ int main(int argc, char **argv, char **envp)exit (1 );/* init the memory */ -if (ram_size ==0 ) +if (ram_size ==0 ) { ram_size =DEFAULT_RAM_SIZE *1024 *1024 ; + }else if (!xen_enabled ()) { +/* On 32-bit hosts, QEMU is limited by virtual address space */ +if (ram_size > (2047 <<20 ) &&HOST_LONG_BITS ==32 ) { +fprintf (stderr,"qemu: at most 2047 MB RAM can be simulated\n" ); +exit (1 ); + } + }/* init the dynamic translator */ cpu_exec_init_all (tb_size *1024 *1024 );
Signature · 1 line
Anthony PERARD
Re: [Qemu-devel] [PATCH 5/5] vl.c: Check the asked ram_size later.
Quoted 31 lines · Anthony PERARD
As a Xen guest can have more than 2GB of RAM on a 32bit host, we move the conditions after than we now if we run one Xen or not.
Signed-off-by Anthony PERARD<[email protected]>--- vl.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)vl.c +1
-6@@ -2433,11 +2433,6 @@ int main(int argc, char **argv, char **envp)exit (1 ); } -/* On 32-bit hosts, QEMU is limited by virtual address space */ -if (value> (2047 <<20 )&&HOST_LONG_BITS ==32 ) { -fprintf (stderr,"qemu: at most 2047 MB RAM can be simulated\n" ); -exit (1 ); - }if (value != (uint64_t )(ram_addr_t )value) {fprintf (stderr,"qemu: ram size too large\n" );exit (1 );@@ -3091,8 +3086,15 @@ int main(int argc, char **argv, char **envp)exit (1 );/* init the memory */ -if (ram_size ==0 ) +if (ram_size ==0 ) { ram_size =DEFAULT_RAM_SIZE *1024 *1024 ;
vl.c int main(int argc, char **argv, char **envp) · line 3100
Quoted 10 lines
vl.c +7
-0+ }else if (!xen_enabled ()) { +/* On 32-bit hosts, QEMU is limited by virtual address space */ +if (ram_size> (2047 <<20 )&&HOST_LONG_BITS ==32 ) { +fprintf (stderr,"qemu: at most 2047 MB RAM can be simulated\n" ); +exit (1 ); + } + }/* init the dynamic translator */ cpu_exec_init_all (tb_size *1024 *1024 );
Paolo
Quoted 20 lines · Anthony PERARD
Hi all,
Xen is not limited by the QEMU's virtual address space for the allocation of the guest RAM. So even with a QEMU 32bits, a Xen guest can have more than 4 GB of RAM.
With this serie, we will be able to run a guest with more than 4GB. The main point is to change
ram_addr_tfrom ulong to uin64 when QEMU is configure with Xen. The second point is better register the memory in QEMU.Regards,
Anthony PERARD (5):
xen: Fixxen_enabled().
exec.c: Useram_addr_tincpu_physical_memory_rw(...).
cpu-common: Have aram_addr_tof uint64 with Xen.
xen: Fix the memory registration to reflect of what is done by Xen.vl.c: Check the askedram_sizelater.
Quoted 6 lines
cpu-common.h | 8 ++++++++ exec.c | 13 +++++++------ hw/xen.h | 2 +- vl.c | 14 ++++++++------ xen-all.c | 23 +++++++++++++++-------- 5 files changed, 39 insertions(+), 21 deletions(-)
All the patches look good to me, just a comment on the 4th patch.
Quoted 21 lines · Stefano Stabellini
Quoted 20 lines · Anthony PERARD
Hi all,
Xen is not limited by the QEMU's virtual address space for the allocation of the guest RAM. So even with a QEMU 32bits, a Xen guest can have more than 4 GB of RAM.
With this serie, we will be able to run a guest with more than 4GB. The main point is to change
ram_addr_tfrom ulong to uin64 when QEMU is configure with Xen. The second point is better register the memory in QEMU.Regards,
Anthony PERARD (5):
xen: Fixxen_enabled().
exec.c: Useram_addr_tincpu_physical_memory_rw(...).
cpu-common: Have aram_addr_tof uint64 with Xen.
xen: Fix the memory registration to reflect of what is done by Xen.vl.c: Check the askedram_sizelater.
Quoted 8 lines
Quoted 6 lines
cpu-common.h | 8 ++++++++ exec.c | 13 +++++++------ hw/xen.h | 2 +- vl.c | 14 ++++++++------ xen-all.c | 23 +++++++++++++++-------- 5 files changed, 39 insertions(+), 21 deletions(-)All the patches look good to me, just a comment on the 4th patch.
I included patches 1 and 2 in xen-next. 3 and 4 are in discussion and 5 should only be applied when the others are in :)
Alex
Hi Anthony,
I have questions on CONFIG_XEN_BACKEND in the patches.
Where to define the CONFIG_XEN_BACKEND option? Due to lacking ofCONFIG_XEN_BACKEND option, the xen_enabled() returns 0 in the phase of initial qemu machine. How to avoid this problem?
I am working on qemu-dm-v15 branch, and I wonder if I could apply these
patches without switching branches.
Thanks!
Jiageng Yu.
--
View this message in context: http://xen.1045712.n5.nabble.com/PATCH-0-5-Enable-QEMU-to-handle-more-than-2GB-with-Xen-tp4590909p4622050.html
Sent from the Xen - Dev mailing list archive at Nabble.com.
Quoted 8 lines · jiageng_yu
I have questions on
CONFIG_XEN_BACKENDin the patches.Where to define the
CONFIG_XEN_BACKENDoption? Due to lacking ofCONFIG_XEN_BACKENDoption, thexen_enabled()returns 0 in the phase of initial qemu machine. How to avoid this problem?I am working on qemu-dm-v15 branch, and I wonder if I could apply these patches without switching branches.
This branch is a little bit old and will never been updated. You can maybe use this branch:git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen-next That have recent patches.
Othewise, to apply these patches on your current branch, you can skip the first patch about xen_enabled as it is just a fix of recent patches, and try to apply all the other.
You can also replace CONFIG_XEN_BACKEND by CONFIG_XEN on this old branch.
Regards,
Signature · 1 line
Anthony PERARD