Skip to contentSkip to conversation

Make vapic.S into optional rom

PATCH Applied Gleb Natapov 2 participants 6 messages Oct 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make vapic.S into optional rom

Makefile +1 -0
index ea568f5..acd9108 100644
@@ -259,6 +259,7 @@ pxe-ne2k_pci.bin pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin \
 bamboo.dtb petalogix-s3adsp1800.dtb \
 multiboot.bin
 BLOBS += extboot.bin
+BLOBS += vapic.bin
 else
 BLOBS=
 endif
hw/pc.c +2 -0
index 83012a9..819b78a 100644
@@ -53,6 +53,7 @@
 #define VGABIOS_FILENAME "vgabios.bin"
 #define VGABIOS_CIRRUS_FILENAME "vgabios-cirrus.bin"
 #define EXTBOOT_FILENAME "extboot.bin"
+#define VAPIC_FILENAME "vapic.bin"
 
 #define PC_MAX_BIOS_SIZE (4 * 1024 * 1024)
 
@@ -1149,6 +1150,7 @@ static void pc_init1(ram_addr_t ram_size,
     if (extboot_drive) {
         option_rom[nb_option_roms++] = qemu_strdup(EXTBOOT_FILENAME);
     }
+    option_rom[nb_option_roms++] = qemu_strdup(VAPIC_FILENAME);
 
     option_rom_offset = qemu_ram_alloc(PC_ROM_SIZE);
     cpu_register_physical_memory(PC_ROM_MIN_VGA, PC_ROM_SIZE, option_rom_offset);
kvm-tpr-opt.c +16 -3
index 932b49b..2565d79 100644
@@ -114,6 +114,7 @@ static uint32_t bios_addr;
 static uint32_t vapic_phys;
 static uint32_t bios_enabled;
 static uint32_t vbios_desc_phys;
+static uint32_t vapic_bios_addr;
 
 static void update_vbios_real_tpr(void)
 {
@@ -187,16 +188,16 @@ static int bios_is_mapped(CPUState *env, uint64_t rip)
     struct kvm_sregs sregs;
     unsigned perms;
     uint32_t i;
-    uint32_t offset, fixup;
+    uint32_t offset, fixup, start = vapic_bios_addr ? : 0xe0000;
 
     if (bios_enabled)
 	return 1;
 
     kvm_get_sregs(env, &sregs);
 
-    probe = (rip & 0xf0000000) + 0xe0000;
+    probe = (rip & 0xf0000000) + start;
     phys = map_addr(&sregs, probe, &perms);
-    if (phys != 0xe0000)
+    if (phys != start)
 	return 0;
     bios_addr = probe;
     for (i = 0; i < 64; ++i) {
@@ -356,6 +357,17 @@ static int tpr_load(QEMUFile *f, void *s, int version_id)
     return 0;
 }
 
+static void vtpr_ioport_write16(void *opaque, uint32_t addr, uint32_t val)
+{
+    struct kvm_regs regs;
+    CPUState *env = cpu_single_env;
+    struct kvm_sregs sregs;
+    kvm_get_regs(env, &regs);
+    kvm_get_sregs(env, &sregs);
+    vapic_bios_addr = ((sregs.cs.base + regs.rip) & ~(512 - 1)) + val;
+    bios_enabled = 0;
+}
+
 static void vtpr_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 {
     CPUState *env = cpu_single_env;
@@ -386,5 +398,6 @@ void kvm_tpr_opt_setup(void)
 {
     register_savevm("kvm-tpr-opt", 0, 1, tpr_save, tpr_load, NULL);
     register_ioport_write(0x7e, 1, 1, vtpr_ioport_write, NULL);
+    register_ioport_write(0x7e, 2, 2, vtpr_ioport_write16, NULL);
 }
 
pc-bios/optionrom/Makefile +1 -1
index 73e74d8..67ecc63 100644
@@ -13,7 +13,7 @@ CFLAGS += -I$(SRC_PATH)
 CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector)
 QEMU_CFLAGS = $(CFLAGS)
 
-build-all: multiboot.bin extboot.bin
+build-all: multiboot.bin extboot.bin vapic.bin
 
 %.img: %.o
 	$(call quiet-command,$(LD) -Ttext 0 -e _start -s -o $@ $<,"  Building $(TARGET_DIR)$@")
pc-bios/optionrom/vapic.S new file +311 -0

311 lines not on this page · raw message

--
Gleb.

#1 lore raw
Quoted 1 line · Gleb Natapov

Need to remove the original implementation.

What was this tested on?

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw
Quoted 4 lines · Avi Kivity

On 10/26/2009 01:42 PM, Gleb Natapov wrote:

Need to remove the original implementation.

That's in submodule now. Different repository. May it's worth to leave it in for a while?

Quoted 2 lines

What was this tested on?

WindowsXP 32 bit boot/reboot.

--
Gleb.

#3 lore raw
Quoted 10 lines · Gleb Natapov
Quoted 5 lines · Avi Kivity

On 10/26/2009 01:42 PM, Gleb Natapov wrote:

Need to remove the original implementation.

That's in submodule now. Different repository. May it's worth to leave it in for a while?

Then we won't know which version is used. Please send an additional patch.

Quoted 5 lines
Quoted 3 lines

What was this tested on?

WindowsXP 32 bit boot/reboot.

smp?

Signature · 1 line
error compiling committee.c: too many arguments to function
#4 lore raw
Quoted 9 lines · Avi Kivity
Quoted 7 lines · Gleb Natapov
Quoted 4 lines · Avi Kivity

On 10/26/2009 01:42 PM, Gleb Natapov wrote:

Need to remove the original implementation.

That's in submodule now. Different repository. May it's worth to leave it in for a while?

Quoted 8 lines

Then we won't know which version is used. Please send an additional patch.

Quoted 3 lines
Quoted 2 lines

What was this tested on?

WindowsXP 32 bit boot/reboot.

smp?

Yes -smp 2

--
Gleb.