From 3afbf09fb03e00cc95c8d668bd33b5e0b58ad9c6 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 2 Apr 2009 03:51:08 +0000 Subject: [PATCH] support gpxe roms --- qemu-bios-bigger-roms.patch | 52 ++++++++++++++ qemu-roms-more-room.patch | 132 ++++++++++++++++++++++++++++++++++++ qemu.spec | 9 ++- 3 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 qemu-bios-bigger-roms.patch create mode 100644 qemu-roms-more-room.patch diff --git a/qemu-bios-bigger-roms.patch b/qemu-bios-bigger-roms.patch new file mode 100644 index 0000000..dc8dc89 --- /dev/null +++ b/qemu-bios-bigger-roms.patch @@ -0,0 +1,52 @@ +diff --git a/bios/rombios.c b/bios/rombios.c +index c4f6ccd..c4bfe60 100644 +--- a/bios/rombios.c ++++ b/bios/rombios.c +@@ -10196,22 +10196,43 @@ no_serial: + ret + + rom_checksum: +- push ax +- push bx +- push cx ++ pusha ++ push ds ++ + xor ax, ax + xor bx, bx + xor cx, cx ++ xor dx, dx ++ + mov ch, [2] + shl cx, #1 ++ ++ jnc checksum_loop ++ xchg dx, cx ++ dec cx ++ + checksum_loop: + add al, [bx] + inc bx + loop checksum_loop ++ ++ test dx, dx ++ je checksum_out ++ ++ add al, [bx] ++ mov cx, dx ++ mov dx, ds ++ add dh, #0x10 ++ mov ds, dx ++ xor dx, dx ++ xor bx, bx ++ ++ jmp checksum_loop ++ ++checksum_out: + and al, #0xff +- pop cx +- pop bx +- pop ax ++ pop ds ++ popa + ret diff --git a/qemu-roms-more-room.patch b/qemu-roms-more-room.patch new file mode 100644 index 0000000..9437e8d --- /dev/null +++ b/qemu-roms-more-room.patch @@ -0,0 +1,132 @@ +From 34b39c2ba6cc08239a707b52bfb2886df2aa8dec Mon Sep 17 00:00:00 2001 +From: aliguori +Date: Sat, 28 Mar 2009 17:28:45 +0000 +Subject: [PATCH] get roms more room. (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!) + +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, option rom space will begin +just after vga ends, aligned to the next 2k boundary. + +Technicaly, we could do the same with the uper space (the bios itself), +but since bochs bios is already 128 k in size, I don't see an +urgent need to do it. + +[ fix case for vgabioses smaller than 30k, by Carl-Daniel Hailfinger ] + +Signed-off-by: Glauber Costa +Signed-off-by: Anthony Liguori + + +git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6896 c046a42c-6fe2-441c-8c8c-71466251a162 +--- + hw/pc.c | 29 +++++++++++++++++++---------- + 1 files changed, 19 insertions(+), 10 deletions(-) + +Index: qemu-kvm-0.10/qemu/hw/pc.c +=================================================================== +--- qemu-kvm-0.10.orig/qemu/hw/pc.c ++++ qemu-kvm-0.10/qemu/hw/pc.c +@@ -813,7 +813,7 @@ static void pc_init1(ram_addr_t ram_size + { + char buf[1024]; + int ret, linux_boot, i; +- ram_addr_t ram_addr, vga_ram_addr, bios_offset, vga_bios_offset; ++ ram_addr_t ram_addr, vga_ram_addr, bios_offset, vga_bios_offset, option_rom_start = 0; + ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; + int bios_size, isa_bios_size, vga_bios_size; + int pci_option_rom_offset; +@@ -825,6 +825,7 @@ static void pc_init1(ram_addr_t ram_size + int index; + BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + BlockDriverState *fd[MAX_FD]; ++ int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled; + + if (ram_size >= 0xe0000000 ) { + above_4g_mem_size = ram_size - 0xe0000000; +@@ -900,7 +901,7 @@ static void pc_init1(ram_addr_t ram_size + exit(1); + } + +- if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) { ++ if (using_vga) { + /* VGA BIOS load */ + if (cirrus_vga_enabled) { + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME); +@@ -918,12 +919,21 @@ vga_bios_error: + fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf); + exit(1); + } ++ /* Round up vga bios size to the next 2k boundary */ ++ vga_bios_size = (vga_bios_size + 2047) & ~2047; ++ option_rom_start = 0xc0000 + vga_bios_size; + + /* setup basic memory access */ +- cpu_register_physical_memory(0xc0000, 0x10000, ++ cpu_register_physical_memory(0xc0000, vga_bios_size, + vga_bios_offset | IO_MEM_ROM); + } + ++ /* No point in placing option roms before this address, since bochs bios ++ * will only start looking for it at 0xc8000 */ ++ if (option_rom_start < 0xc8000) ++ option_rom_start = 0xc8000; ++ ++ + /* map the last 128KB of the BIOS in ISA space */ + isa_bios_size = bios_size; + if (isa_bios_size > (128 * 1024)) +@@ -944,14 +954,14 @@ vga_bios_error: + ram_addr_t option_rom_offset; + int size, offset; + +- offset = 0; ++ offset = option_rom_start; + if (linux_boot) { + 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(option_rom_start, TARGET_PAGE_SIZE, + option_rom_offset | IO_MEM_ROM); +- offset = TARGET_PAGE_SIZE; ++ offset += TARGET_PAGE_SIZE; + } + + for (i = 0; i < nb_option_roms; i++) { +@@ -961,13 +971,13 @@ vga_bios_error: + option_rom[i]); + exit(1); + } +- if (size > (0x10000 - offset)) ++ if (size > (0xe0000 - offset)) + goto option_rom_error; + option_rom_offset = qemu_ram_alloc(size); + ret = load_image(option_rom[i], phys_ram_base + option_rom_offset); + if (ret != size) { + option_rom_error: +- fprintf(stderr, "Too many option ROMS\n"); ++ fprintf(stderr, "Could not fit %soption roms in available space\n", using_vga ? "VGA bios and " : ""); + exit(1); + } + size = (size + 4095) & ~4095; +@@ -975,9 +985,8 @@ vga_bios_error: + initialization, and (optionally) marked readonly by the BIOS + before INT 19h. See the PNPBIOS specification, appendix B. + DDIM support is mandatory for proper PCI expansion ROM support. */ +- cpu_register_physical_memory(0xd0000 + offset, +- size, option_rom_offset /* | IO_MEM_ROM */); +- option_rom_setup_reset(0xd0000 + offset, size); ++ cpu_register_physical_memory(offset, size, option_rom_offset /* | IO_MEM_ROM */); ++ option_rom_setup_reset(offset, size); + offset += size; + } + pci_option_rom_offset = offset; diff --git a/qemu.spec b/qemu.spec index 02fb5f2..2a89c0d 100644 --- a/qemu.spec +++ b/qemu.spec @@ -1,7 +1,7 @@ Summary: QEMU is a FAST! processor emulator Name: qemu Version: 0.10 -Release: 3%{?dist} +Release: 4%{?dist} # I have mistakenly thought the revision name would be 1.0. # So 0.10 series get Epoch = 1 Epoch: 2 @@ -33,6 +33,8 @@ Patch8: 08-vnc-acl-mgmt.patch Patch9: kvm-upstream-ppc.patch Patch10: qemu-fix-debuginfo.patch Patch11: qemu-fix-gcc.patch +Patch12: qemu-roms-more-room.patch +Patch13: qemu-bios-bigger-roms.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel @@ -208,6 +210,8 @@ such as kvmtrace and kvm_stat. %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 +%patch13 -p1 %build # systems like rhel build system does not have a recent enough linker so @@ -451,6 +455,9 @@ fi %{_mandir}/man1/qemu-img.1* %changelog +* Thu Apr 02 2009 Glauber Costa - 2:0.10-4 +- Support botting gpxe roms. + * Wed Apr 01 2009 Glauber Costa - 2:0.10-2 - added missing patch. love for CVS.