qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] testing qemu svn r6082 on FreeBSD - virtio-net, hpet, vmmou


From: Juergen Lock
Subject: [Qemu-devel] testing qemu svn r6082 on FreeBSD - virtio-net, hpet, vmmouse/vga, got bsd-user to build, and an updated version of the FreeBSD -clock dynticks patch
Date: Fri, 19 Dec 2008 00:17:24 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

Hi!

 I have made another experimental FreeBSD qemu-devel port update,
        http://people.freebsd.org/~nox/qemu/qemu-devel-20081218.patch
and can report that the new aio code, hpet and virtio-net all seem
to work so far at least for the two guests I tried:
        sidux-2008-04-pontos-pre1-kde-lite-i386-200812141731.iso
and
        7.1-RC1-i386-dvd1.iso
(tho both only in livecd resp. livefs i.e. fixit->cdrom mode.)

 Also with _this_ sidux iso even vmmouse works with cirrus emulation
(and userland kqemu), the earlier vmmouse breakage I saw was in fact due
to a bug in sidux.  (it also wasn't enabled by default there for cirrus
before.)  I also was able to run this sidux iso with vmware vga emulation
after disabling HW_MOUSE_ACCEL in my version of qemu/hw/vmware_vga.c,
otherwise keeping the same patch as posted before.  (With HW_MOUSE_ACCEL
enabled my host mouse cursor still disappeared completely as soon as
the guest xserver started, and either the guest hung soon after that too
or I didn't wait long enough.)

 vmmouse as well as the vmware vga emulation itself still don't work with
-kernel-kqemu tho, but I've since been told this is a known problem
(something to do with userspace pio.)

 Oh and usb still is slow at least with sidux guests, no change there...

 Now bsd-user - I have no sparc64 guest, but the following patches
got it to at least build on FreeBSD 6.3/i386 and 7.1pre/amd64:
(the -Wl,-shared hack in qemu/Makefile.target causes the resulting
binary not to start and if I try qemu's i386.ld I get a link error with
libm iirc, so I guess at least the i386 case needs more work before
it can actually work...)

Index: qemu/cpu-exec.c
@@ -1158,6 +1158,12 @@
 # define EIP_sig(context)  (*((unsigned long*)&(context)->uc_mcontext->ss.eip))
 # define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
 # define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
+#elif defined(__FreeBSD__) 
+# include <sys/ucontext.h>
+
+# define EIP_sig(context)  (*((unsigned long*)&(context)->uc_mcontext.mc_eip))
+# define TRAP_sig(context)    ((context)->uc_mcontext.mc_trapno)
+# define ERROR_sig(context)   ((context)->uc_mcontext.mc_err)
 #else
 # define EIP_sig(context)     ((context)->uc_mcontext.gregs[REG_EIP])
 # define TRAP_sig(context)    ((context)->uc_mcontext.gregs[REG_TRAPNO])
@@ -1168,7 +1174,11 @@
                        void *puc)
 {
     siginfo_t *info = pinfo;
+#ifdef __FreeBSD__
+    ucontext_t *uc = puc;
+#else
     struct ucontext *uc = puc;
+#endif
     unsigned long pc;
     int trapno;
 
@@ -1194,6 +1204,12 @@
 
 #define QEMU_UC_MCONTEXT_GREGS(uc, reg)        (uc)->uc_mcontext.__gregs[(reg)]
 #define QEMU_UC_MACHINE_PC(uc)         _UC_MACHINE_PC(uc)
+#elif defined(__FreeBSD__) 
+# include <sys/ucontext.h>
+
+# define RIP_sig(context)  (*((unsigned long*)&(context)->uc_mcontext.mc_rip))
+# define TRAP_sig(context)    ((context)->uc_mcontext.mc_trapno)
+# define ERROR_sig(context)   ((context)->uc_mcontext.mc_err)
 #else
 #define QEMU_UC_MCONTEXT_GREGS(uc, reg)        (uc)->uc_mcontext.gregs[(reg)]
 #define QEMU_UC_MACHINE_PC(uc)         QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP)
@@ -1204,17 +1220,25 @@
 {
     siginfo_t *info = pinfo;
     unsigned long pc;
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__FreeBSD__)
     ucontext_t *uc = puc;
 #else
     struct ucontext *uc = puc;
 #endif
 
+#ifdef __FreeBSD__
+    pc = RIP_sig(uc);
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr,
+                             TRAP_sig(uc) == 0xe ?
+                             (ERROR_sig(uc) >> 1) & 1 : 0,
+                             &uc->uc_sigmask, puc);
+#else
     pc = QEMU_UC_MACHINE_PC(uc);
     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
                              QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ?
                              (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 
0,
                              &uc->uc_sigmask, puc);
+#endif
 }
 
 #elif defined(__powerpc__)
Index: qemu/Makefile.target
@@ -472,7 +472,7 @@
 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
 # that the kernel ELF loader considers as an executable. I think this
 # is the simplest way to make it self virtualizable!
-LDFLAGS+=-Wl,-shared
+#LDFLAGS+=-Wl,-shared
 endif
 endif
 
Index: qemu/x86_64.ld
@@ -2,7 +2,7 @@
 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
 OUTPUT_ARCH(i386:x86-64)
 ENTRY(_start)
-SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/local/lib64");
+SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/local/lib");
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
@@ -59,8 +59,6 @@
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
   .rodata1        : { *(.rodata1) }
   .eh_frame_hdr : { *(.eh_frame_hdr) }
-  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
-  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table) }
   /* Adjust the address for the data segment.  We want to adjust up to
      the same address within the page on the next page up.  */
   . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = 
DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -86,8 +84,8 @@
   .data1          : { *(.data1) }
   .tdata         : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
   .tbss                  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
-  .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
-  .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table) }
+  .eh_frame       : { KEEP (*(.eh_frame)) }
+  .gcc_except_table   : { *(.gcc_except_table) }
   .dynamic        : { *(.dynamic) }
   .ctors          :
   {

 And finally the updated dynticks patch:

Index: qemu/configure
@@ -1025,11 +1025,26 @@
   rt=yes
 fi
 
+##########################################
+# posix timer probe
+cat > $TMPC <<EOF
+#include <time.h>
+int main(void) { timer_create(CLOCK_REALTIME, (struct sigevent *)NULL, 
(timer_t *)NULL); return 0; }
+EOF
+posixtimer=no
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+  posixtimer=yes
+elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt 2> /dev/null ; then
+  posixtimer=yes
+  rt=yes
+fi
+
 if test "$rt" = "yes" ; then
   # Hack, we should have a general purpose LIBS for this sort of thing
   AIOLIBS="$AIOLIBS -lrt"
 fi
 
+
 if test "$mingw32" = "yes" ; then
   if test -z "$prefix" ; then
       prefix="c:\\\\Program Files\\\\Qemu"
@@ -1403,6 +1418,9 @@
   echo "#define HAVE_FDT 1" >> $config_h
   echo "FDT_LIBS=-lfdt" >> $config_mak
 fi
+if test "$posixtimer" = "yes" ; then
+  echo "#define HAVE_POSIX_TIMER 1" >> $config_h
+fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
Index: qemu/vl.c
@@ -918,12 +918,16 @@
 static int unix_start_timer(struct qemu_alarm_timer *t);
 static void unix_stop_timer(struct qemu_alarm_timer *t);
 
-#ifdef __linux__
+#ifdef HAVE_POSIX_TIMER
 
 static int dynticks_start_timer(struct qemu_alarm_timer *t);
 static void dynticks_stop_timer(struct qemu_alarm_timer *t);
 static void dynticks_rearm_timer(struct qemu_alarm_timer *t);
 
+#endif
+
+#ifdef __linux__
+
 static int hpet_start_timer(struct qemu_alarm_timer *t);
 static void hpet_stop_timer(struct qemu_alarm_timer *t);
 
@@ -1001,9 +1005,11 @@
 
 static struct qemu_alarm_timer alarm_timers[] = {
 #ifndef _WIN32
-#ifdef __linux__
+#ifdef HAVE_POSIX_TIMER
     {"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer,
      dynticks_stop_timer, dynticks_rearm_timer, NULL},
+#endif
+#ifdef __linux__
     /* HPET - if available - is preferred */
     {"hpet", 0, hpet_start_timer, hpet_stop_timer, NULL, NULL},
     /* ...otherwise try RTC */
@@ -1361,7 +1367,7 @@
     return delta;
 }
 
-#if defined(__linux__) || defined(_WIN32)
+#if defined(HAVE_POSIX_TIMER) || defined(_WIN32)
 static uint64_t qemu_next_deadline_dyntick(void)
 {
     int64_t delta;
@@ -1506,6 +1512,10 @@
     close(rtc_fd);
 }
 
+#endif /* defined(__linux__) */
+
+#ifdef HAVE_POSIX_TIMER
+
 static int dynticks_start_timer(struct qemu_alarm_timer *t)
 {
     struct sigevent ev;
@@ -1577,7 +1587,7 @@
     }
 }
 
-#endif /* defined(__linux__) */
+#endif /* defined(HAVE_POSIX_TIMER) */
 
 static int unix_start_timer(struct qemu_alarm_timer *t)
 {

 Thanx,
        Juergen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]