public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix network boot while KVM is enabled
@ 2007-07-03  1:39 Anthony Liguori
       [not found] ` <11834267632309-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2007-07-03  1:39 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f; +Cc: Anthony Liguori

While QEMU can remap portions of physical ram to a higher address in
phys_ram_base, KVM requires that the memory be present where it would be in
physical memory.  Make sure to copy the option ROMs to the right space in
physical memory when KVM is enabled.

Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index eda49cf..a6e4ea1 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -558,14 +558,20 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
     
     option_rom_offset = 0;
     for (i = 0; i < nb_option_roms; i++) {
-	int offset = bios_offset + bios_size + option_rom_offset;
+	int offset = bios_size + option_rom_offset;
 	int size;
 
-	size = load_image(option_rom[i], phys_ram_base + offset);
+	size = load_image(option_rom[i], phys_ram_base + bios_offset + offset);
 	if ((size + option_rom_offset) > 0x10000) {
 	    fprintf(stderr, "Too many option ROMS\n");
 	    exit(1);
 	}
+
+	if (kvm_allowed)
+	    memcpy(phys_ram_base + 0xc0000 + offset,
+		   phys_ram_base + bios_offset + offset,
+		   size);
+
 	cpu_register_physical_memory(0xd0000 + option_rom_offset,
 				     size, offset | IO_MEM_ROM);
 	option_rom_offset += size + 2047;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [PATCH] Fix network boot while KVM is enabled
       [not found] ` <11834267632309-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2007-07-03  4:29   ` Avi Kivity
       [not found]     ` <4689D0A1.5020400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2007-07-03  4:29 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Anthony Liguori wrote:
> While QEMU can remap portions of physical ram to a higher address in
> phys_ram_base, KVM requires that the memory be present where it would be in
> physical memory.  Make sure to copy the option ROMs to the right space in
> physical memory when KVM is enabled.
>
> Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>
> diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
> index eda49cf..a6e4ea1 100644
> --- a/qemu/hw/pc.c
> +++ b/qemu/hw/pc.c
> @@ -558,14 +558,20 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device,
>      
>      option_rom_offset = 0;
>      for (i = 0; i < nb_option_roms; i++) {
> -	int offset = bios_offset + bios_size + option_rom_offset;
> +	int offset = bios_size + option_rom_offset;
>  	int size;
>  
> -	size = load_image(option_rom[i], phys_ram_base + offset);
> +	size = load_image(option_rom[i], phys_ram_base + bios_offset + offset);
>  	if ((size + option_rom_offset) > 0x10000) {
>  	    fprintf(stderr, "Too many option ROMS\n");
>  	    exit(1);
>  	}
> +
> +	if (kvm_allowed)
> +	    memcpy(phys_ram_base + 0xc0000 + offset,
> +		   phys_ram_base + bios_offset + offset,
> +		   size);
> +
>  	cpu_register_physical_memory(0xd0000 + option_rom_offset,
>  				     size, offset | IO_MEM_ROM);
>   

#ifdef USE_KVM is needed here.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [PATCH] Fix network boot while KVM is enabled
       [not found]     ` <4689D0A1.5020400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-03  4:32       ` Anthony Liguori
       [not found]         ` <4689D167.4020800-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2007-07-03  4:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Avi Kivity wrote:
> Anthony Liguori wrote:
>> While QEMU can remap portions of physical ram to a higher address in
>> phys_ram_base, KVM requires that the memory be present where it would 
>> be in
>> physical memory.  Make sure to copy the option ROMs to the right 
>> space in
>> physical memory when KVM is enabled.
>>
>> Signed-off-by: Anthony Liguori <aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>>
>> diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
>> index eda49cf..a6e4ea1 100644
>> --- a/qemu/hw/pc.c
>> +++ b/qemu/hw/pc.c
>> @@ -558,14 +558,20 @@ static void pc_init1(int ram_size, int 
>> vga_ram_size, int boot_device,
>>           option_rom_offset = 0;
>>      for (i = 0; i < nb_option_roms; i++) {
>> -    int offset = bios_offset + bios_size + option_rom_offset;
>> +    int offset = bios_size + option_rom_offset;
>>      int size;
>>  
>> -    size = load_image(option_rom[i], phys_ram_base + offset);
>> +    size = load_image(option_rom[i], phys_ram_base + bios_offset + 
>> offset);
>>      if ((size + option_rom_offset) > 0x10000) {
>>          fprintf(stderr, "Too many option ROMS\n");
>>          exit(1);
>>      }
>> +
>> +    if (kvm_allowed)
>> +        memcpy(phys_ram_base + 0xc0000 + offset,
>> +           phys_ram_base + bios_offset + offset,
>> +           size);
>> +
>>      cpu_register_physical_memory(0xd0000 + option_rom_offset,
>>                       size, offset | IO_MEM_ROM);
>>   
>
> #ifdef USE_KVM is needed here.

I thought a patch was recently submitted that made kvm_allowed not 
depend on USE_KVM?  If not, do you have a problem with one?

Regards,

Anthony Liguori



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [PATCH] Fix network boot while KVM is enabled
       [not found]         ` <4689D167.4020800-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2007-07-03  4:36           ` Avi Kivity
  0 siblings, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2007-07-03  4:36 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Anthony Liguori wrote:
>>>   
>>
>> #ifdef USE_KVM is needed here.
>
> I thought a patch was recently submitted that made kvm_allowed not 
> depend on USE_KVM?  

I must have missed it, or forgotten.

> If not, do you have a problem with one?
>


It serves as a delimiter of what code we introduced, but then, I guess a 
diff against pristine qemu does the same job better.  I guess we can do 
this to non performance critical sections (which could well be all of them).


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [PATCH] Fix network boot while KVM is enabled
@ 2007-07-03 11:01 Gregory Haskins
  0 siblings, 0 replies; 5+ messages in thread
From: Gregory Haskins @ 2007-07-03 11:01 UTC (permalink / raw)
  To: avi-atKUWr5tajBWk0Htik3J/w; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

This patch was included in my in-kernel-apic series.  I can resubmit if
its not handy.

-Greg

On Mon, 2007-07-02 at 21:36 -0700, Avi Kivity wrote:
> Anthony Liguori wrote:
> >>>   
> >>
> >> #ifdef USE_KVM is needed here.
> >
> > I thought a patch was recently submitted that made kvm_allowed not 
> > depend on USE_KVM?  
> 
> I must have missed it, or forgotten.
> 
> > If not, do you have a problem with one?
> >
> 
> 
> It serves as a delimiter of what code we introduced, but then, I guess a 
> diff against pristine qemu does the same job better.  I guess we can do 
> this to non performance critical sections (which could well be all of them).
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

end of thread, other threads:[~2007-07-03 11:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-03  1:39 [PATCH] Fix network boot while KVM is enabled Anthony Liguori
     [not found] ` <11834267632309-git-send-email-aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-03  4:29   ` Avi Kivity
     [not found]     ` <4689D0A1.5020400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-03  4:32       ` Anthony Liguori
     [not found]         ` <4689D167.4020800-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2007-07-03  4:36           ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2007-07-03 11:01 Gregory Haskins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox