Skip to contentSkip to conversation

get roms more room.

PATCH In review Glauber Costa 3 participants 5 messages Mar 27, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get roms more room.

This patch increases by 50 % the size available for option roms. The main motivator is that some roms grew bigger than the 64k we currently allocate for them (Hey, it's 2009!)

One example is the gpxe project, that produces some roms with 69k, 70k, etc. The space proposed by this patch actually makes it as big as 84k. Probably still a fit for some time.

But there is no free lunch. This space must come from somewhere, and we take it from vga rom space. Currently, our vga roms are around 35k in size. With this patch, they will be limited to 44k, instead of 64k, which seems reasonable to me.

---
 hw/pc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
hw/pc.c +4 -4
index 69f25f3..f66bfdd 100644
@@ -876,7 +876,7 @@ vga_bios_error:
         }
 
         /* setup basic memory access */
-        cpu_register_physical_memory(0xc0000, 0x10000,
+        cpu_register_physical_memory(0xc0000, 0xb000,
                                      vga_bios_offset | IO_MEM_ROM);
     }
 
@@ -897,7 +897,7 @@ vga_bios_error:
             option_rom_offset = qemu_ram_alloc(TARGET_PAGE_SIZE);
             load_linux(phys_ram_base + option_rom_offset,
                        kernel_filename, initrd_filename, kernel_cmdline);
-            cpu_register_physical_memory(0xd0000, TARGET_PAGE_SIZE,
+            cpu_register_physical_memory(0xcb000, TARGET_PAGE_SIZE,
                                          option_rom_offset | IO_MEM_ROM);
             offset = TARGET_PAGE_SIZE;
         }
@@ -909,7 +909,7 @@ vga_bios_error:
                         option_rom[i]);
                 exit(1);
             }
-            if (size > (0x10000 - offset))
+            if (size > (0x15000 - offset))
                 goto option_rom_error;
             option_rom_offset = qemu_ram_alloc(size);
             ret = load_image(option_rom[i], phys_ram_base + option_rom_offset);
@@ -919,7 +919,7 @@ vga_bios_error:
                 exit(1);
             }
             size = (size + 4095) & ~4095;
-            cpu_register_physical_memory(0xd0000 + offset,
+            cpu_register_physical_memory(0xcb000 + offset,
                                          size, option_rom_offset | IO_MEM_ROM);
             offset += size;
         }
Signature · 1 line
1.6.2
#1 lore raw
Quoted 4 lines · Glauber Costa

This patch increases by 50 % the size available for option roms. The main motivator is that some roms grew bigger than the 64k we currently allocate for them (Hey, it's 2009!)

Quoted 9 lines

One example is the gpxe project, that produces some roms with 69k, 70k, etc. The space proposed by this patch actually makes it as big as 84k. Probably still a fit for some time.

But there is no free lunch. This space must come from somewhere, and we take it from vga rom space. Currently, our vga roms are around 35k in size. With this patch, they will be limited to 44k, instead of 64k, which seems reasonable to me.

As a firmware developer, I have to speak up here. Although I agree that option ROMs may be bigger than 64k, replacing one hardcoded magic limit with another hardcoded magic limit seems to be a bit questionable.

If you really want to hardcode this instead of calculating it dynamically, please use at least some symbolic constants and tell the user to change the symbolic constants and recompile Qemu if he hits the size limit.

This patch reduces the room for the VGA option ROM without checking for its size. If we perform option ROM size checks, we may as well not exclude the VGA option ROM from that check.

AFAICS resuming an image created with the old memory layout will change option ROM location and may lead to crashes, but I'm not so sure about that.

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#2 lore raw
Quoted 19 lines · Carl-Daniel Hailfinger
Quoted 4 lines · Glauber Costa

This patch increases by 50 % the size available for option roms. The main motivator is that some roms grew bigger than the 64k we currently allocate for them (Hey, it's 2009!)

Quoted 9 lines

One example is the gpxe project, that produces some roms with 69k, 70k, etc. The space proposed by this patch actually makes it as big as 84k. Probably still a fit for some time.

But there is no free lunch. This space must come from somewhere, and we take it from vga rom space. Currently, our vga roms are around 35k in size. With this patch, they will be limited to 44k, instead of 64k, which seems reasonable to me.

As a firmware developer, I have to speak up here. Although I agree that option ROMs may be bigger than 64k, replacing one hardcoded magic limit with another hardcoded magic limit seems to be a bit questionable.

Quoted 8 lines

If you really want to hardcode this instead of calculating it dynamically, please use at least some symbolic constants and tell the user to change the symbolic constants and recompile Qemu if he hits the size limit.

This patch reduces the room for the VGA option ROM without checking for its size. If we perform option ROM size checks, we may as well not exclude the VGA option ROM from that check.

We load the VGA rom before loading any option roms. Would you be okay with an approach that loads the vga rom, round up its size to the next boundary, and assign the remaining space to option roms?

Quoted 13 lines

AFAICS resuming an image created with the old memory layout will change option ROM location and may lead to crashes, but I'm not so sure about that.

Regards,
Carl-Daniel

--
http://www.hailfinger.org/

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."
#3 lore raw
Quoted 28 lines · Glauber Costa
Quoted 25 lines · Carl-Daniel Hailfinger
Quoted 4 lines · Glauber Costa

This patch increases by 50 % the size available for option roms. The main motivator is that some roms grew bigger than the 64k we currently allocate for them (Hey, it's 2009!)

Quoted 10 lines

One example is the gpxe project, that produces some roms with 69k, 70k, etc. The space proposed by this patch actually makes it as big as 84k. Probably still a fit for some time.

But there is no free lunch. This space must come from somewhere, and we take it from vga rom space. Currently, our vga roms are around 35k in size. With this patch, they will be limited to 44k, instead of 64k, which seems reasonable to me.

As a firmware developer, I have to speak up here. Although I agree that option ROMs may be bigger than 64k, replacing one hardcoded magic limit with another hardcoded magic limit seems to be a bit questionable.

If you really want to hardcode this instead of calculating it dynamically, please use at least some symbolic constants and tell the user to change the symbolic constants and recompile Qemu if he hits the size limit.

Quoted 9 lines
Quoted 4 lines

This patch reduces the room for the VGA option ROM without checking for its size. If we perform option ROM size checks, we may as well not exclude the VGA option ROM from that check.

We load the VGA rom before loading any option roms. Would you be okay with an approach that loads the vga rom, round up its size to the next boundary, and assign the remaining space to option roms?

Excellent idea.
Could you please change the error message to tell the user that VGA+other option ROMs may not exceed a total size?
A check for VGA ROM size to be less than the total allowed size may be useful to prevent underflows in calculations of the remaining space for other option ROMs.

Regards,
Carl-Daniel

Signature · 1 line
http://www.hailfinger.org/
#4 lore raw
Quoted 39 lines · Carl-Daniel Hailfinger
Quoted 28 lines · Glauber Costa
Quoted 25 lines · Carl-Daniel Hailfinger
Quoted 4 lines · Glauber Costa

This patch increases by 50 % the size available for option roms. The main motivator is that some roms grew bigger than the 64k we currently allocate for them (Hey, it's 2009!)

Quoted 10 lines

One example is the gpxe project, that produces some roms with 69k, 70k, etc. The space proposed by this patch actually makes it as big as 84k. Probably still a fit for some time.

But there is no free lunch. This space must come from somewhere, and we take it from vga rom space. Currently, our vga roms are around 35k in size. With this patch, they will be limited to 44k, instead of 64k, which seems reasonable to me.

As a firmware developer, I have to speak up here. Although I agree that option ROMs may be bigger than 64k, replacing one hardcoded magic limit with another hardcoded magic limit seems to be a bit questionable.

If you really want to hardcode this instead of calculating it dynamically, please use at least some symbolic constants and tell the user to change the symbolic constants and recompile Qemu if he hits the size limit.

Quoted 9 lines
Quoted 4 lines

This patch reduces the room for the VGA option ROM without checking for its size. If we perform option ROM size checks, we may as well not exclude the VGA option ROM from that check.

We load the VGA rom before loading any option roms. Would you be okay with an approach that loads the vga rom, round up its size to the next boundary, and assign the remaining space to option roms?

Quoted 6 lines

Excellent idea.
Could you please change the error message to tell the user that VGA+other option ROMs may not exceed a total size?
A check for VGA ROM size to be less than the total allowed size may be useful to prevent underflows in calculations of the remaining space for other option ROMs.

Such a check already exists.

Signature · 5 lines
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."