From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I5mL5-0001XJ-3u for qemu-devel@nongnu.org; Tue, 03 Jul 2007 13:38:59 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I5mL3-0001Wv-Q6 for qemu-devel@nongnu.org; Tue, 03 Jul 2007 13:38:58 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I5mL3-0001WN-H3 for qemu-devel@nongnu.org; Tue, 03 Jul 2007 13:38:57 -0400 Received: from ns.suse.de ([195.135.220.2] helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I5mL2-00029x-VO for qemu-devel@nongnu.org; Tue, 03 Jul 2007 13:38:57 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id F0800122AC for ; Tue, 3 Jul 2007 19:38:53 +0200 (CEST) Message-ID: <468A8A4B.8070303@suse.de> Date: Tue, 03 Jul 2007 19:41:31 +0200 From: Alexander Graf MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050207020207040102040708" Subject: [Qemu-devel] [PATCH] no mmap for alsa Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------050207020207040102040708 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, this is the last patch necessary to get pcm alsa running for i386-apps on ppc. Alsa does some fancy magic with mmap to share information with the kernel. This is completely fine as long as we're talking about arch(kernel) == arch(userspace), which apparently is not the case when using qemu-user. As a more or less hacky workaround on that I just disabled the mmap calls alsa-lib uses to initiate communication with the kernel. If these fail, alsa reverts to other means of communication which get converted. Alex --------------050207020207040102040708 Content-Type: text/plain; name="alsa_mmap" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="alsa_mmap" Index: qemu/linux-user/mmap.c =================================================================== --- qemu.orig/linux-user/mmap.c +++ qemu/linux-user/mmap.c @@ -152,6 +152,9 @@ static int mmap_frag(target_ulong real_s return 0; } +#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000; +#define SNDRV_PCM_MMAP_OFFSET_CONTROL 0x81000000; + /* NOTE: all the constants are the HOST ones */ long target_mmap(target_ulong start, target_ulong len, int prot, int flags, int fd, target_ulong offset) @@ -192,6 +195,17 @@ long target_mmap(target_ulong start, tar } #endif + /* Alsa tries to communcate with the kernel via mmap. This usually + * is a good idea when user- and kernelspace are running on the + * same architecture but does not work out when not. To make alsa + * not to use mmap, we can just have it fail on the mmap calls that + * would initiate this. + */ + if(offset == SNDRV_PCM_MMAP_OFFSET_STATUS || offset == SNDRV_PCM_MMAP_OFFSET_CONTROL) { + errno = EINVAL; + return -1; + } + if (offset & ~TARGET_PAGE_MASK) { errno = EINVAL; return -1; --------------050207020207040102040708--