[PATCH 0/2] kvm/i386: Some code refactoring and cleanups for kvm_arch_init

Ani Sinha posted 2 patches 2 months, 3 weeks ago
target/i386/kvm/kvm.c | 339 ++++++++++++++++++++++++++----------------
1 file changed, 212 insertions(+), 127 deletions(-)
[PATCH 0/2] kvm/i386: Some code refactoring and cleanups for kvm_arch_init
Posted by Ani Sinha 2 months, 3 weeks ago
Some cleanups. Should be no functional impact.

CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Marcelo Tosatti <mtosatti@redhat.com>
CC: kvm@vger.kernel.org
CC: qemu-devel@nongnu.org

Ani Sinha (2):
  kvm/i386: refactor kvm_arch_init and split it into smaller functions
  kvm/i386: do not initialize identity_base variable

 target/i386/kvm/kvm.c | 339 ++++++++++++++++++++++++++----------------
 1 file changed, 212 insertions(+), 127 deletions(-)

-- 
2.42.0
Re: [PATCH 0/2] kvm/i386: Some code refactoring and cleanups for kvm_arch_init
Posted by Paolo Bonzini 2 months, 2 weeks ago
Queued patch 1 with just a small change:

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 599faf0ac6e..023af31ba3e 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -3064,10 +3064,9 @@ static int kvm_vm_set_nr_mmu_pages(KVMState *s)
     return ret;
 }

-static int kvm_vm_set_tss_addr(KVMState *s, uint64_t identity_base)
+static int kvm_vm_set_tss_addr(KVMState *s, uint64_t tss_base)
 {
-    /* Set TSS base one page after EPT identity map. */
-    return kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, identity_base);
+    return kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, tss_base);
 }

 static int kvm_vm_enable_disable_exits(KVMState *s)
@@ -3268,6 +3267,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
         return ret;
     }

+    /* Set TSS base one page after EPT identity map. */
     ret = kvm_vm_set_tss_addr(s, identity_base + 0x1000);
     if (ret < 0) {
         return ret;


For patch 2, it's better to remove the variable completely and make
it a constant.  I'll send a patch.

Paolo