All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove duplicate code
@ 2009-03-22 10:37 Gleb Natapov
  2009-03-22 11:11 ` Avi Kivity
  0 siblings, 1 reply; 6+ messages in thread
From: Gleb Natapov @ 2009-03-22 10:37 UTC (permalink / raw)
  To: avi; +Cc: kvm


svm_do_inject_vector() reimplements pop_irq().

Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1821c20..da23fd3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2344,15 +2344,7 @@ static void kvm_reput_irq(struct vcpu_svm *svm)
 
 static void svm_do_inject_vector(struct vcpu_svm *svm)
 {
-	struct kvm_vcpu *vcpu = &svm->vcpu;
-	int word_index = __ffs(vcpu->arch.irq_summary);
-	int bit_index = __ffs(vcpu->arch.irq_pending[word_index]);
-	int irq = word_index * BITS_PER_LONG + bit_index;
-
-	clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]);
-	if (!vcpu->arch.irq_pending[word_index])
-		clear_bit(word_index, &vcpu->arch.irq_summary);
-	svm_inject_irq(svm, irq);
+	svm_inject_irq(svm, pop_irq(&svm->vcpu));
 }
 
 static void do_interrupt_requests(struct kvm_vcpu *vcpu,
--
			Gleb.

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] remove duplicate code
@ 2007-10-02 20:36 Glauber de Oliveira Costa
       [not found] ` <11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-10-02 20:36 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: avi-atKUWr5tajBWk0Htik3J/w, Glauber de Oliveira Costa

This patch removes duplicate code at vl.c. Once the KVM-only
part defines how much physicall memory it wants, the rest should
be the same for everybody.

Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 qemu/vl.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..4f8cf51 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
 		    fprintf(stderr, "Could not create KVM context\n");
 		    exit(1);
 	    }
-    } else {
-	    phys_ram_base = qemu_vmalloc(phys_ram_size);
-	    if (!phys_ram_base) {
-		    fprintf(stderr, "Could not allocate physical memory\n");
-		    exit(1);
-	    }
-    }
-#else
-    phys_ram_base = qemu_vmalloc(phys_ram_size);
-    if (!phys_ram_base) {
-        fprintf(stderr, "Could not allocate physical memory\n");
-        exit(1);
-    }
+    } else
 #endif
+    {
+      phys_ram_base = qemu_vmalloc(phys_ram_size);
+      if (!phys_ram_base) {
+          fprintf(stderr, "Could not allocate physical memory\n");
+          exit(1);
+      }
+    }
 
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();
-- 
1.4.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] remove duplicate code
@ 2007-10-02 20:31 Glauber de Oliveira Costa
       [not found] ` <11913571011888-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-10-02 20:31 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: avi-atKUWr5tajBWk0Htik3J/w, Glauber de Oliveira Costa

This patch removes duplicate code at vl.c. Once the KVM-only
part defines how much physicall memory it wants, the rest should
be the same for everybody.

Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 qemu/vl.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..4f8cf51 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8246,7 +8246,7 @@ int main(int argc, char **argv)
                     help(1);
                 if (ram_size > PHYS_RAM_MAX_SIZE) {
                     fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
-                            PHYS_RAM_MAX_SIZE / (1024 * 1024));
+                            (int)PHYS_RAM_MAX_SIZE / (1024 * 1024));
                     exit(1);
                 }
                 break;
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
 		    fprintf(stderr, "Could not create KVM context\n");
 		    exit(1);
 	    }
-    } else {
-	    phys_ram_base = qemu_vmalloc(phys_ram_size);
-	    if (!phys_ram_base) {
-		    fprintf(stderr, "Could not allocate physical memory\n");
-		    exit(1);
-	    }
-    }
-#else
-    phys_ram_base = qemu_vmalloc(phys_ram_size);
-    if (!phys_ram_base) {
-        fprintf(stderr, "Could not allocate physical memory\n");
-        exit(1);
-    }
+    } else
 #endif
+    {
+      phys_ram_base = qemu_vmalloc(phys_ram_size);
+      if (!phys_ram_base) {
+          fprintf(stderr, "Could not allocate physical memory\n");
+          exit(1);
+      }
+    }
 
     /* we always create the cdrom drive, even if no disk is there */
     bdrv_init();
-- 
1.4.4.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-03-22 11:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-22 10:37 [PATCH] remove duplicate code Gleb Natapov
2009-03-22 11:11 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2007-10-02 20:36 Glauber de Oliveira Costa
     [not found] ` <11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-07 11:46   ` Avi Kivity
2007-10-02 20:31 Glauber de Oliveira Costa
     [not found] ` <11913571011888-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-02 23:21   ` Glauber de Oliveira Costa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.