From owner-freebsd-emulation@FreeBSD.ORG Sun Sep 28 04:26:08 2008 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75402106568E for ; Sun, 28 Sep 2008 04:26:08 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.185]) by mx1.freebsd.org (Postfix) with ESMTP id F3D8C8FC1A for ; Sun, 28 Sep 2008 04:26:07 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fk-out-0910.google.com with SMTP id k31so1596844fkk.11 for ; Sat, 27 Sep 2008 21:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=WKcyP+C5DF+eSDCtzZt83Mjvy4oGSM3xZ7BlJpAjYWI=; b=Nh2JdqViMRZ4QKDOrJadNXdMkHDAFTZ+OPKTkJqL+qLYW94Xvaedsnyni3PYYg4cq0 ionHLg7Up8bSxcUQagof0GVK0cFSjkXg4GaWYe4G/Ngt60DUoplzntw27JP4eo3bdtrn bvx8PmjBxCIi87mrXlw+YoUjIuHCaO9GKqCwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=SoaYiC92w6nL+EpQP0HlaA/SIZEAKVxi+voL3fSqA7x0evH+VzLtf98MZbvHAkX27v 4BlFeI/jq9S9WbYBq50HsL3ALt+1QNUSAMQg7NyEH78Pi+lCSAs9B8ui4dztMs6XSw5j jH+FrWZGrkiDvg7COKX5wQia2qJsNB4UJ/d5I= Received: by 10.103.244.10 with SMTP id w10mr2443096mur.67.1222574699513; Sat, 27 Sep 2008 21:04:59 -0700 (PDT) Received: by 10.103.231.14 with HTTP; Sat, 27 Sep 2008 21:04:59 -0700 (PDT) Message-ID: Date: Sun, 28 Sep 2008 01:04:59 -0300 From: "Carlos A. M. dos Santos" To: qemu-devel@nongnu.org, "Anthony Liguori" , freebsd-emulation@freebsd.org In-Reply-To: <20080927204729.GA52209@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080921204025.GA81055@saturn.kn-bremen.de> <200809242210.m8OMAcSZ021572@saturn.kn-bremen.de> <48DCF9FC.2070708@codemonkey.ws> <20080926220445.GA13099@saturn.kn-bremen.de> <20080927204729.GA52209@saturn.kn-bremen.de> Cc: Subject: Re: [Qemu-devel] Re: qemu svn r5281 on FreeBSD - slow usb, vmwarevga, screen updates... (now updated to r5331) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Sep 2008 04:26:08 -0000 On Sat, Sep 27, 2008 at 5:47 PM, Juergen Lock wrote: > 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 > #include > #else > +#ifndef __FreeBSD__ > #include > #endif > +#endif > > #include > #include > @@ -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 I suggest applying the following patch (on top of yours). It includes options to build additional sound emulators. --- Makefile.orig 2008-09-28 00:11:29.000000000 -0300 +++ Makefile 2008-09-28 00:53:03.000000000 -0300 @@ -38,6 +38,10 @@ GNUTLS "gnutls dependency (vnc encryption)" On \ PCAP "pcap dependency (networking with bpf)" On \ CDROM_DMA "IDE CDROM DMA" On \ + AC97 "Intel 82801AA AC97 sound card" Off \ + ADLIB "Adlib card with Yamaha YM3812 (OPL2) chip" Off \ + CS4231A "CS4231A sound card (Windows Sound System)" Off \ + GUS "Gravis Ultrasound GF1 sound card" Off \ ALL_TARGETS "Also build dyngen targets (requires gcc34)" On .include @@ -76,6 +80,35 @@ CONFIGURE_ARGS+= --enable-pcap .endif +.if defined(WITH_AC97) +AUDIO_CARD_LIST= ac97 +.endif + +.if defined(WITH_ADLIB) +.if defined(AUDIO_CARD_LIST) +AUDIO_CARD_LIST+= , +.endif +AUDIO_CARD_LIST+= adlib +.endif + +.if defined(WITH_CS4231A) +.if defined(AUDIO_CARD_LIST) +AUDIO_CARD_LIST+= , +.endif +AUDIO_CARD_LIST+= cs4231a +.endif + +.if defined(WITH_GUS) +.if defined(AUDIO_CARD_LIST) +AUDIO_CARD_LIST+= , +.endif +AUDIO_CARD_LIST+= gus +.endif + +.if defined(AUDIO_CARD_LIST) +CONFIGURE_ARGS+= --audio-card-list="${AUDIO_CARD_LIST}" +.endif + .if defined(WITH_SAMBA) RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba3 .endif Signed-off-by: Carlos Santos -- cd /usr/ports/sysutils/life make clean