Skip to contentSkip to conversation

misc qemu-kvm cleanups

PATCH In review Marcelo Tosatti 2 participants 9 messages Aug 1, 2011 – Aug 2, 2011 KVM

lore
Share & tools
lore
#0 lore raw

cover misc qemu-kvm cleanups

See individual patches for details.

#1 lore raw

PATCH 1/5 qemu-kvm: remove hpagesize variable declaration

sysemu.h +0 -1
Index: qemu-kvm/sysemu.h
===================================================================
@@ -123,7 +123,6 @@ extern int semihosting_enabled;
 extern int old_param;
 extern int boot_menu;
 extern QEMUClock *rtc_clock;
-extern long hpagesize;
 
 #define MAX_NODES 64
 extern int nb_numa_nodes;
#3 lore raw

PATCH 3/5 qemu-kvm: remove unused kvm_nested variable

In reply to Marcelo Tosatti
qemu-kvm.c +0 -1
Index: qemu-kvm/qemu-kvm.c
===================================================================
@@ -31,7 +31,6 @@
 int kvm_irqchip = 1;
 int kvm_pit = 1;
 int kvm_pit_reinject = 1;
-int kvm_nested = 0;
 
 #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
 
#4 lore raw

PATCH 4/5 pc: drop unnecessary memory un-assignment

In reply to Marcelo Tosatti

As noted by the original commit. Probably kept in qemu-kvm due to a mismerge.

commit 7d0adcd6d57149d4e9ec66f3a1c171df2bea2775

Author: aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Date:   Fri Oct 24 13:12:42 2008 +0000

hw/pc: don't register the memory hole as unassigned twice

Since revision 5228, we don't register the memory hole (0xa00000 to 0xfffff) anymore. As a consequence, we don't need to register it again as unassigned.

hw/pc.c +0 -2
Index: qemu-kvm/hw/pc.c
===================================================================
@@ -1013,8 +1013,6 @@ void pc_memory_init(const char *kernel_f
     isa_bios_size = bios_size;
     if (isa_bios_size > (128 * 1024))
         isa_bios_size = 128 * 1024;
-    cpu_register_physical_memory(0xd0000, (192 * 1024) - isa_bios_size,
-                                 IO_MEM_UNASSIGNED);
     cpu_register_physical_memory(0x100000 - isa_bios_size,
                                  isa_bios_size,
                                  (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
#5 lore raw

Re: [patch 4/5] pc: drop unnecessary memory un-assignment

Quoted 24 lines · Marcelo Tosatti

As noted by the original commit. Probably kept in qemu-kvm due to a mismerge.

commit 7d0adcd6d57149d4e9ec66f3a1c171df2bea2775

Author: aurel32<aurel32@c046a42c-6fe2-441c-8c8c-71466251a162>
Date:   Fri Oct 24 13:12:42 2008 +0000

hw/pc: don't register the memory hole as unassigned twice

Since revision 5228, we don't register the memory hole (0xa00000 to 0xfffff) anymore. As a consequence, we don't need to register it again as unassigned.

Index: qemu-kvm/hw/pc.c
===================================================================

hw/pc.c void pc_memory_init(const char *kernel_f · line 1018

Quoted 8 lines
hw/pc.c +0 -2
@@ -1013,8 +1013,6 @@ void pc_memory_init(const char *kernel_f
      isa_bios_size = bios_size;
      if (isa_bios_size>  (128 * 1024))
          isa_bios_size = 128 * 1024;
-    cpu_register_physical_memory(0xd0000, (192 * 1024) - isa_bios_size,
-                                 IO_MEM_UNASSIGNED);
      cpu_register_physical_memory(0x100000 - isa_bios_size,
                                   isa_bios_size,
                                   (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);

I noticed the same thing on the large upstream merge - this code is now gone.

Signature · 1 line
error compiling committee.c: too many arguments to function
#6 lore raw

Re: [patch 4/5] pc: drop unnecessary memory un-assignment

Quoted 3 lines · Avi Kivity

I noticed the same thing on the large upstream merge - this code is now gone.

last upstream merge.

Signature · 1 line
error compiling committee.c: too many arguments to function
#7 lore raw

PATCH 5/5 kvm-tpr-opt: delete CPUState field

In reply to Marcelo Tosatti

The information can be inferred from CPU_PUT_FULL_STATE and bios_enabled.

kvm-tpr-opt.c +10 -11
Index: qemu-kvm/kvm-tpr-opt.c
===================================================================
@@ -218,7 +218,7 @@ static int get_pcr_cpu(CPUState *env)
     return (int)b;
 }
 
-int kvm_tpr_enable_vapic(CPUState *env)
+static int tpr_enable_vapic(CPUState *env)
 {
     static uint8_t one = 1;
     int pcr_cpu = get_pcr_cpu(env);
@@ -228,11 +228,17 @@ int kvm_tpr_enable_vapic(CPUState *env)
 
     kvm_enable_vapic(env, vapic_phys + (pcr_cpu << 7));
     cpu_physical_memory_write_rom(vapic_phys + (pcr_cpu << 7) + 4, &one, 1);
-    env->kvm_vcpu_update_vapic = 0;
     bios_enabled = 1;
     return 1;
 }
 
+void kvm_tpr_enable_vapic(CPUState *env)
+{
+    if (!bios_enabled)
+        return;
+    tpr_enable_vapic(env);
+}
+
 static void patch_call(CPUState *env, uint64_t rip, uint32_t target)
 {
     uint32_t offset;
@@ -293,7 +299,7 @@ void kvm_tpr_access_report(CPUState *env
 	return;
     if (!bios_is_mapped(env, rip))
 	return;
-    if (!kvm_tpr_enable_vapic(env))
+    if (!tpr_enable_vapic(env))
 	return;
     patch_instruction(env, rip);
 }
@@ -326,13 +332,6 @@ static int tpr_load(QEMUFile *f, void *s
     qemu_get_be32s(f, &vapic_phys);
     qemu_get_be32s(f, &vbios_desc_phys);
   
-    if (bios_enabled) {
-        CPUState *env = first_cpu->next_cpu;
-
-        for (env = first_cpu; env != NULL; env = env->next_cpu)
-            env->kvm_vcpu_update_vapic = 1;
-    }
-
     return 0;
 }
 
@@ -367,7 +366,7 @@ static void vtpr_ioport_write(void *opaq
 	}
     bios_enabled = 1;
     update_vbios_real_tpr();
-    kvm_tpr_enable_vapic(env);
+    tpr_enable_vapic(env);
 }
 
 static void kvm_tpr_opt_setup(void)
qemu-kvm.h +1 -1
Index: qemu-kvm/qemu-kvm.h
===================================================================
@@ -265,6 +265,6 @@ extern int kvm_pit_reinject;
 extern unsigned int kvm_shadow_memory;
 
 int kvm_handle_tpr_access(CPUState *env);
-int kvm_tpr_enable_vapic(CPUState *env);
+void kvm_tpr_enable_vapic(CPUState *env);
 
 #endif
target-i386/cpu.h +0 -2
Index: qemu-kvm/target-i386/cpu.h
===================================================================
@@ -759,8 +759,6 @@ typedef struct CPUX86State {
     uint16_t fptag_vmstate;
     uint16_t fpregs_format_vmstate;
 
-    int kvm_vcpu_update_vapic;
-
     uint64_t xstate_bv;
     XMMReg ymmh_regs[CPU_NB_REGS];
 
target-i386/kvm.c +1 -3
Index: qemu-kvm/target-i386/kvm.c
===================================================================
@@ -1451,9 +1451,7 @@ int kvm_arch_put_registers(CPUState *env
         return ret;
     }
     if (level == KVM_PUT_FULL_STATE) {
-        if (env->kvm_vcpu_update_vapic) {
-            kvm_tpr_enable_vapic(env);
-        }
+        kvm_tpr_enable_vapic(env);
     }
     /* must be last */
     ret = kvm_guest_debug_workarounds(env);
#8 lore raw

Re: [patch 5/5] kvm-tpr-opt: delete CPUState field

Quoted 3 lines · Marcelo Tosatti

The information can be inferred from CPU_PUT_FULL_STATE and bios_enabled.

Looks good.

Signature · 1 line
error compiling committee.c: too many arguments to function