qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: qemu svn r5281 on FreeBSD - slow usb, vmwarevga, sc


From: Juergen Lock
Subject: Re: [Qemu-devel] Re: qemu svn r5281 on FreeBSD - slow usb, vmwarevga, screen updates... (now updated to r5331)
Date: Sat, 27 Sep 2008 22:47:29 +0200
User-agent: Mutt/1.5.17 (2007-11-01)

On Sat, Sep 27, 2008 at 12:04:45AM +0200, I wrote:
>[...]
>  I'll see if I can prepare another update over the weekend and then go
> thru more of the patches that have accumulated in the port...

OK, here we go :)  First the update: (at r5331 now)
        http://people.freebsd.org/~nox/qemu/qemu-devel-20080927.patch

1. FreeBSD also has clock_gettime:

Index: qemu/vl.c
@@ -541,7 +541,7 @@
 static void init_get_clock(void)
 {
     use_rt_clock = 0;
-#if defined(__linux__)
+#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
     {
         struct timespec ts;
         if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
@@ -553,7 +553,7 @@
 
 static int64_t get_clock(void)
 {
-#if defined(__linux__)
+#if defined(__linux__) || (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
     if (use_rt_clock) {
         struct timespec ts;
         clock_gettime(CLOCK_MONOTONIC, &ts);

2. open() can also return EPERM for O_RDWR on a readonly device (I think
the case where this happened was a cdrom:)

Index: qemu/block.c
@@ -381,7 +381,7 @@
     else
         open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
     ret = drv->bdrv_open(bs, filename, open_flags);
-    if (ret == -EACCES && !(flags & BDRV_O_FILE)) {
+    if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) {
         ret = drv->bdrv_open(bs, filename, BDRV_O_RDONLY);
         bs->read_only = 1;
     }

3. the following bugfix is needed at least for FreeBSD/amd64 guests:
(original patch from
        
http://www.nabble.com/-PATCH--i386-hard-interrupt-generation-bug-fix-p14921171.html
)

Index: qemu/cpu-exec.c
@@ -394,16 +394,18 @@
                                      (env->eflags & IF_MASK && 
                                       !(env->hflags & HF_INHIBIT_IRQ_MASK))))) 
{
                             int intno;
-                            svm_check_intercept(SVM_EXIT_INTR);
                             env->interrupt_request &= ~(CPU_INTERRUPT_HARD | 
CPU_INTERRUPT_VIRQ);
                             intno = cpu_get_pic_interrupt(env);
-                            if (loglevel & CPU_LOG_TB_IN_ASM) {
-                                fprintf(logfile, "Servicing hardware 
INT=0x%02x\n", intno);
+                            if (intno>=0) {
+                                svm_check_intercept(SVM_EXIT_INTR);
+                                if (loglevel & CPU_LOG_TB_IN_ASM) {
+                                    fprintf(logfile, "Servicing hardware 
INT=0x%02x\n", intno);
+                                }
+                                do_interrupt(intno, 0, 0, 0, 1);
+                                /* ensure that no TB jump will be modified as
+                                   the program flow was changed */
+                                next_tb = 0;
                             }
-                            do_interrupt(intno, 0, 0, 0, 1);
-                            /* ensure that no TB jump will be modified as
-                               the program flow was changed */
-                            next_tb = 0;
 #if !defined(CONFIG_USER_ONLY)
                         } else if ((interrupt_request & CPU_INTERRUPT_VIRQ) &&
                                    (env->eflags & IF_MASK) && 

4. this is also needed for (some?) amd64 guests on i386 hosts:

Index: qemu/exec-all.h
@@ -30,7 +30,7 @@
 struct TranslationBlock;
 
 /* XXX: make safe guess about sizes */
-#define MAX_OP_PER_INSTR 64
+#define MAX_OP_PER_INSTR 128 /* 64 */
 /* A Call op needs up to 6 + 2N parameters (N = number of arguments).  */
 #define MAX_OPC_PARAM 10
 #define OPC_BUF_SIZE 512

5. no need (?) for a dummy file on FreeBSD too: (like on OpenBSD)

Index: qemu/osdep.c
@@ -75,8 +75,10 @@
 #include <sys/types.h>
 #include <sys/mount.h>
 #else
+#ifndef __FreeBSD__
 #include <sys/vfs.h>
 #endif
+#endif
 
 #include <sys/mman.h>
 #include <fcntl.h>
@@ -87,7 +87,7 @@
     static int phys_ram_size = 0;
     void *ptr;
 
-#ifdef __OpenBSD__ /* no need (?) for a dummy file on OpenBSD */
+#if defined(__OpenBSD__) || defined(__FreeBSD__) /* no need (?) for a dummy 
file on OpenBSD/FreeBSD */
     int map_anon = MAP_ANON;
 #else
     int map_anon = 0;
@@ -154,7 +154,7 @@
     }
     size = (size + 4095) & ~4095;
     ftruncate(phys_ram_fd, phys_ram_size + size);
-#endif /* !__OpenBSD__ */
+#endif /* !(__OpenBSD__ || __FreeBSD__) */
     ptr = mmap(NULL,
                size,
                PROT_WRITE | PROT_READ, map_anon | MAP_SHARED,

6. correct lib search path on FreeBSD/amd64 hosts (tho this needs to be
conditionally applied if its to go into qemu svn:)

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: */

 I think thats it for now...  more maybe later.
        Juergen

Signed-off-by: Juergen Lock <address@hidden>




reply via email to

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