Skip to contentSkip to conversation

maybe pxeboot doesnt work in kvm-28

PATCH In review Peter Skogström 4 participants 6 messages Jul 2, 2007 – Jul 3, 2007 4 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

Hi

I cant get pxeboot to work in kvm-28. I built kvm-28 on ubuntu 7.04 (feisty) and everything has worked great. But when testing pxeboot with:

/usr/local/kvm/bin/qemu -net nic,vlan=0 -net tap,vlan=0,script=/etc/qemu-ifup2,ifname=foo kvm-stuff/etch.qcow2.img -boot n

It doesnt work. It boots c instead. But with -no-kvm it works and also a separate qemu works without trouble. I can file a bug, but it would be great if some more can test pxe first to confirm the behaviour.

I use pxelinux 3.51 against a debian server (sarge).

qemu-ifup2:

#!/bin/sh
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1

Standard qemu networking with bridge.

regards

//Peter

Signature · 12 lines
bitrunner

0708-460260
Andra Långgatan 28
41327 Göteborg
Sweden

-------------------------------------------------------------------------
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/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 Fix network boot while KVM is enabled

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.

qemu/hw/pc.c +8 -2
index eda49cf..a6e4ea1 100644
@@ -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/

A message that is not in the archive (sent off-list or not yet received): 11834267632309-git-send-email-aliguori-r/[email protected]

#4 lore raw

Re: [PATCH] Fix network boot while KVM is enabled

Quoted 24 lines · 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.

qemu/hw/pc.c +2 -2
index eda49cf..a6e4ea1 100644
@@ -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);

qemu/hw/pc.c static void pc_init1(int ram_size, int vga_ram_size, int boot_device, · line 577

Quoted 10 lines
qemu/hw/pc.c +6 -0
 	}
+
+	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/

A message that is not in the archive (sent off-list or not yet received): 4689D0A1.5020400-atKUWr5tajBWk0Htik3J/[email protected]

#6 lore raw

Re: [PATCH] Fix network boot while KVM is enabled

Quoted 32 lines · Avi Kivity
Quoted 31 lines · 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.

qemu/hw/pc.c +5 -2
index eda49cf..a6e4ea1 100644
@@ -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,
Quoted 8 lines

qemu/hw/pc.c static void pc_init1(int ram_size, int vga_ram_size, int boot_device, · line 576

Quoted 6 lines
qemu/hw/pc.c +3 -0
+           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/

A message that is not in the archive (sent off-list or not yet received): 4689D167.4020800-r/[email protected]

#8 lore raw

Re: [PATCH] Fix network boot while KVM is enabled

Quoted 6 lines · Anthony Liguori
Quoted 3 lines
Quoted 1 line

#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.

Quoted 2 lines

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/

#9 lore raw
In reply to a message not in the archive
Quoted 5 lines · Peter Skogström

Hi

I cant get pxeboot to work in kvm-28. I built kvm-28 on ubuntu 7.04 (feisty) and everything has worked great. But when testing pxeboot with:

I was able to reproduce and fix your problem. Let me know if you have any problems with the patch I posted.

Regards,

Anthony Liguori

Quoted 17 lines

/usr/local/kvm/bin/qemu -net nic,vlan=0 -net tap,vlan=0,script=/etc/qemu-ifup2,ifname=foo kvm-stuff/etch.qcow2.img -boot n

It doesnt work. It boots c instead. But with -no-kvm it works and also a separate qemu works without trouble. I can file a bug, but it would be great if some more can test pxe first to confirm the behaviour.

I use pxelinux 3.51 against a debian server (sarge).

qemu-ifup2:

#!/bin/sh
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1

Quoted 6 lines

Standard qemu networking with bridge.

regards

//Peter

-------------------------------------------------------------------------
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/