[SeaBIOS] [BROKEN RFC 5/5] make QEMU_HARDWARE mean "assume virtual hardware"

Laszlo Ersek lersek at redhat.com
Wed Feb 13 04:52:14 CET 2013


seabios:

  build     QEMU_HARDWARE    runningOnQEMU  runningOnXen  runningOnKVM
  target
  --------  ------------- +  -------------  ------------  ------------
  COREBOOT  n (forced)    |  n              n             n
  QEMU      y (forced)    |  y              n             cpuid==KVM
  CSM       n             |  n              n             n
  CSM       y             |  y              n             cpuid==KVM
  XEN       y (forced)    |  y (or panic)   y (or panic)  n

vgabios / CSM:

  build     QEMU_HARDWARE    runningOnQEMU  runningOnXen  runningOnKVM
  target
  --------  ------------- +  -------------  ------------  ------------
  COREBOOT  n (forced)    |  n              n             n
  QEMU      y (forced)    |  y              n             cpuid==KVM
  CSM       n             |  n              n             n
  CSM       y             |  y              n             cpuid==KVM
  XEN       y (forced)    |  y              cpuid==Xen    cpuid==KVM

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 src/util.h     |    7 +++----
 src/paravirt.c |    2 +-
 src/util.c     |    2 +-
 src/Kconfig    |    9 +++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/util.h b/src/util.h
index 15e7ce9..cf9b31a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -160,14 +160,13 @@ struct descloc_s {
 extern int PlatformRunningOn;
 
 static inline int runningOnQEMU(void) {
-    return CONFIG_QEMU || (
-        CONFIG_QEMU_HARDWARE && GET_GLOBAL(PlatformRunningOn) & PF_QEMU);
+    return GET_GLOBAL(PlatformRunningOn) & PF_QEMU;
 }
 static inline int runningOnXen(void) {
-    return CONFIG_XEN && GET_GLOBAL(PlatformRunningOn) & PF_XEN;
+    return GET_GLOBAL(PlatformRunningOn) & PF_XEN;
 }
 static inline int runningOnKVM(void) {
-    return CONFIG_QEMU && GET_GLOBAL(PlatformRunningOn) & PF_KVM;
+    return GET_GLOBAL(PlatformRunningOn) & PF_KVM;
 }
 
 void qemu_kvm_preinit(void);
diff --git a/src/paravirt.c b/src/paravirt.c
index 0e6bc92..ce79666 100644
--- a/src/paravirt.c
+++ b/src/paravirt.c
@@ -28,7 +28,7 @@ struct e820_reservation {
 void
 qemu_ramsize_preinit(void)
 {
-    if (!CONFIG_QEMU)
+    if (!CONFIG_QEMU_HARDWARE)
         return;
 
     qemu_kvm_preinit();
diff --git a/src/util.c b/src/util.c
index 8ba4eb0..2b66f2e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -21,7 +21,7 @@ void qemu_kvm_preinit(void)
     unsigned int eax, ebx, ecx, edx;
     char signature[13];
 
-    if (!CONFIG_QEMU)
+    if (!CONFIG_QEMU_HARDWARE)
         return;
 
     SET_FARVAR(get_global_seg(), PlatformRunningOn, PF_QEMU);
diff --git a/src/Kconfig b/src/Kconfig
index db2ecc8..e5e1cec 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -17,7 +17,8 @@ choice
         bool "Build for QEMU/KVM/Bochs"
         select QEMU_HARDWARE
         help
-            Configure for an emulated machine (QEMU, KVM, or Bochs).
+            Configure for an emulated machine (QEMU, KVM, or Bochs), and assume
+            the VM will start SeaBIOS directly.
 
     config CSM
        bool "Build as Compatibilty Support Module for EFI BIOS"
@@ -27,17 +28,17 @@ choice
 
     config XEN
         bool "Build for Xen HVM"
+        select QEMU_HARDWARE
         help
             Configure to be used by xen hvmloader, for a HVM guest.
 
 endchoice
 
     config QEMU_HARDWARE
-        bool "Support hardware found on emulators (QEMU/Xen/KVM/Bochs)" if !QEMU
+        bool "Assume hardware found on emulators (QEMU/Xen/KVM/Bochs)" if CSM
         default n
         help
-            Support virtual hardware when the code detects it is
-            running on an emulator.
+            Assume the presence of virtual hardware / being run on an emulator.
 
     config THREADS
         bool "Parallelize hardware init"
-- 
1.7.1




More information about the SeaBIOS mailing list