From: Blue Swirl <blauwirbel@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] provide a stub version of kvm-all.c if !CONFIG_KVM
Date: Fri, 2 Apr 2010 22:04:17 +0300 [thread overview]
Message-ID: <w2yf43fc5581004021204w62027b44m2d2ba98d94d2dbe0@mail.gmail.com> (raw)
In-Reply-To: <4BB63869.9090301@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 329 bytes --]
On 4/2/10, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 04/02/2010 08:17 PM, Blue Swirl wrote:
>
> > I merged your patch and mine. Does it still look reasonable?
> >
>
> Yes, of course. I'd rather see them committed separately though.
This version is designed to be applied after your patch. I made my
patch a bit simpler.
[-- Attachment #2: 0001-Compile-vl.c-once.patch --]
[-- Type: text/x-diff, Size: 3848 bytes --]
From 1ce35cc1adc0eb54420d6647c3dfc46445788906 Mon Sep 17 00:00:00 2001
From: Blue Swirl <blauwirbel@gmail.com>
Date: Fri, 2 Apr 2010 19:00:35 +0000
Subject: [PATCH] Compile vl.c once
Remove dependency of vl.c to KVM, then we can partially revert
b33612d03540fda7fa67485f1c20395beb7a2bf0.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
Makefile.objs | 2 +-
Makefile.target | 2 +-
kvm-all.c | 3 +++
kvm.h | 4 +---
sysemu.h | 1 +
vl.c | 7 +++----
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Makefile.objs b/Makefile.objs
index 11e44a0..cb2ec2c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -128,7 +128,7 @@ user-obj-y += cutils.o cache-utils.o
# libhw
hw-obj-y =
-hw-obj-y += loader.o
+hw-obj-y += vl.o loader.o
hw-obj-y += virtio.o virtio-console.o
hw-obj-y += fw_cfg.o pci.o pci_host.o pcie_host.o
hw-obj-y += watchdog.o
diff --git a/Makefile.target b/Makefile.target
index c504617..c1bfc41 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -162,7 +162,7 @@ endif #CONFIG_BSD_USER
# System emulator target
ifdef CONFIG_SOFTMMU
-obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o vl.o
+obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o
# virtio has to be here due to weird dependency between PCI and virtio-net.
# need to fix this properly
obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-pci.o virtio-serial-bus.o
diff --git a/kvm-all.c b/kvm-all.c
index 373fd34..f6317ee 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -51,6 +51,8 @@ typedef struct KVMSlot
typedef struct kvm_dirty_log KVMDirtyLog;
+int kvm_allowed = 0;
+
struct KVMState
{
KVMSlot slots[32];
@@ -670,6 +672,7 @@ int kvm_init(int smp_cpus)
kvm_state = s;
cpu_register_phys_memory_client(&kvm_cpu_phys_memory_client);
+ kvm_allowed = 1;
return 0;
diff --git a/kvm.h b/kvm.h
index ea3c97d..ec66b2f 100644
--- a/kvm.h
+++ b/kvm.h
@@ -23,9 +23,9 @@
#include <linux/kvm.h>
#endif
+#if defined CONFIG_KVM || !defined NEED_CPU_H
extern int kvm_allowed;
-#if defined CONFIG_KVM || !defined NEED_CPU_H
#define kvm_enabled() (kvm_allowed)
#else
#define kvm_enabled() (0)
@@ -35,8 +35,6 @@ struct kvm_run;
/* external API */
-int kvm_init(int smp_cpus);
-
#ifdef NEED_CPU_H
int kvm_init_vcpu(CPUState *env);
diff --git a/sysemu.h b/sysemu.h
index d0effa0..0b423db 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -243,4 +243,5 @@ void rtc_change_mon_event(struct tm *tm);
void register_devices(void);
+int kvm_init(int smp_cpus);
#endif
diff --git a/vl.c b/vl.c
index 9fe4682..1005163 100644
--- a/vl.c
+++ b/vl.c
@@ -145,7 +145,6 @@ int main(int argc, char **argv)
#include "dma.h"
#include "audio/audio.h"
#include "migration.h"
-#include "kvm.h"
#include "balloon.h"
#include "qemu-option.h"
#include "qemu-config.h"
@@ -241,7 +240,6 @@ uint8_t qemu_uuid[16];
static QEMUBootSetHandler *boot_set_handler;
static void *boot_set_opaque;
-int kvm_allowed = 0;
uint32_t xen_domid;
enum xen_mode xen_mode = XEN_EMULATE;
@@ -2649,6 +2647,7 @@ int main(int argc, char **argv, char **envp)
#endif
int show_vnc_port = 0;
int defconfig = 1;
+ int enable_kvm = 0;
error_set_progname(argv[0]);
@@ -3235,7 +3234,7 @@ int main(int argc, char **argv, char **envp)
do_smbios_option(optarg);
break;
case QEMU_OPTION_enable_kvm:
- kvm_allowed = 1;
+ enable_kvm = 1;
break;
case QEMU_OPTION_usb:
usb_enabled = 1;
@@ -3581,7 +3580,7 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- if (kvm_allowed) {
+ if (enable_kvm) {
int ret = kvm_init(smp_cpus);
if (ret < 0) {
if (!kvm_available()) {
--
1.5.6.5
next prev parent reply other threads:[~2010-04-02 19:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-02 15:46 [Qemu-devel] [PATCH 1/2] Move KVM init to arch_init.c, compile vl.c once Blue Swirl
2010-04-02 17:05 ` [Qemu-devel] [PATCH] provide a stub version of kvm-all.c if !CONFIG_KVM Paolo Bonzini
2010-04-02 17:29 ` [Qemu-devel] " Blue Swirl
2010-04-02 17:33 ` Paolo Bonzini
2010-04-02 18:17 ` Blue Swirl
2010-04-02 18:33 ` Paolo Bonzini
2010-04-02 19:04 ` Blue Swirl [this message]
2010-04-03 9:04 ` Paolo Bonzini
2010-04-03 9:07 ` Blue Swirl
2010-04-04 7:12 ` Paolo Bonzini
2010-04-04 7:25 ` Blue Swirl
2010-04-04 18:13 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=w2yf43fc5581004021204w62027b44m2d2ba98d94d2dbe0@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).