From: Takashi Iwai Subject: Re: Backported sbxfi driver (UNTESTED!) Date: Thu, 23 Oct 2008 19:15:26 +0200 Message-ID: References: <48F739F4.5070303@nostalgicnetworxx.org> <48F74344.4090509@gmail.com> <5501535d0810220824o6b8bf427qd2c806783ec1e56f@mail.gmail.com> <5501535d0810220907p2102afc2t13e47ff5309c01bc@mail.gmail.com> <5501535d0810220924w66341ac6u4d4de4ed87243a7@mail.gmail.com> <48FF7E17.9080601@gmail.com> <5501535d0810230446j52de12aes885d066ea38cb240@mail.gmail.com> <4900659E.90809@jasonline.co.uk> <490071DC.6070607@jasonline.co.uk> <490088DC.7090205@jasonline.co.uk> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mail.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 07F341038D3 for ; Thu, 23 Oct 2008 17:15:46 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Jason Harvey Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Thu, 23 Oct 2008 19:07:40 +0200, I wrote: > > At Thu, 23 Oct 2008 15:23:24 +0100, > Jason Harvey wrote: > > > > Takashi Iwai wrote: > > > What is the last kernel message from sbxfi driver? > > > Usually it prints some messages (as debug=1 as default). > > > > > > > > > > I applied the patch and when trying "mplayer wn.wav" I consistently get > > the following message on the console > > > > PANIC: double fault, gdt at c13f6000 [255 bytes] > > > > nothing else, either reboots instantly or locks up. > > > > In case you might find it of use I modprobed at debug=3 and ran dmesg > > before I ran mplayer. Output attached. > > Thanks. > > The last entries are: > > > SBXFI: Setting TLB buffer page 0x1daff000 > > SBXFI: write(0) 0x13b004 = 0x1daff000 > > SBXFI: write(0) 0x13b000 = 0x0 > > Hm, this smells like a buffer handling issue. > > I updated the sbxfi driver code now, added mutex around the code > handling TLB pages. > Please give it a try. Another patch to try is the one like below (on the top of the latest code). Any change with this? thanks, Takashi diff --git a/sound/pci/sbxfi/sbxfi.c b/sound/pci/sbxfi/sbxfi.c index 458294f..cbb56eb 100644 --- a/sound/pci/sbxfi/sbxfi.c +++ b/sound/pci/sbxfi/sbxfi.c @@ -603,10 +603,6 @@ static void sbxfi_capture_start(struct sbxfi *chip, struct sbxfi_port *port) /* slave */ ctrl = ratec; sbxfi_setup_src(chip, port->src[1], start, loop, 0x80, ctrl); -#if 0 /* XXX */ - /* Enable SRC input from Audio Ring */ - sbxfi_write(chip, SRC_MASTER_CTL, 0x1); -#endif } static void sbxfi_capture_stop(struct sbxfi *chip, struct sbxfi_port *port) @@ -620,10 +616,6 @@ static void sbxfi_capture_stop(struct sbxfi *chip, struct sbxfi_port *port) val = sbxfi_read(chip, SRCCTL(port->src[1])); val &= ~0x0f; sbxfi_write(chip, SRCCTL(port->src[1]), val); -#if 0 /* XXX */ - /* Disable SRC inputs from Audio Ring */ - sbxfi_write(chip, SRC_MASTER_CTL, 0x0); -#endif } /* some sync of reset sequence */ @@ -900,6 +892,8 @@ static void sbxfi_clear_tlb(struct sbxfi *chip, struct sbxfi_port *port) port->tlb_pages = 0; port->tlb_index = -1; if (!chip->used_pages) { + /* Disable SRC inputs from Audio Ring */ + sbxfi_write(chip, SRC_MASTER_CTL, 0x0); LOG(1, "Disabling TLB buffer\n"); sbxfi_write(chip, TRANS_TLB_PHY_ADDR_LO_0, 0); sbxfi_write(chip, TRANS_TLB_PHY_ADDR_HI_0, 0); @@ -938,6 +932,8 @@ static int sbxfi_setup_tlb(struct sbxfi *chip, struct sbxfi_port *port, sbxfi_write(chip, TRANS_TLB_PHY_ADDR_LO_0, (u32)chip->tlb.addr); sbxfi_write(chip, TRANS_TLB_PHY_ADDR_HI_0, upper_32_bits(chip->tlb.addr)); + /* Enable SRC input from Audio Ring */ + sbxfi_write(chip, SRC_MASTER_CTL, 0x1); } chip->used_pages += pages; @@ -977,10 +973,6 @@ static struct sbxfi_port *sbxfi_port_alloc(struct sbxfi *chip, port->src[1] = src + 1; LOG(1, "Allocate SRC %d\n", src); spin_lock_irq(&chip->port_lock); - if (list_empty(&chip->port_list)) { - /* Enable SRC input from Audio Ring */ - sbxfi_write(chip, SRC_MASTER_CTL, 0x1); - } list_add(&port->list, &chip->port_list); spin_unlock_irq(&chip->port_lock); return port; @@ -992,10 +984,6 @@ static void sbxfi_port_free(struct sbxfi *chip, struct sbxfi_port *port) return; spin_lock_irq(&chip->port_lock); list_del(&port->list); - if (list_empty(&chip->port_list)) { - /* Disable SRC inputs from Audio Ring */ - sbxfi_write(chip, SRC_MASTER_CTL, 0x0); - } spin_unlock_irq(&chip->port_lock); LOG(1, "Release SRC %d\n", port->src[0]); bitmap_release_region(chip->src_bitmap, port->src[0], 1); @@ -1338,7 +1326,6 @@ static int sbxfi_playback_close(struct snd_pcm_substream *substream) { struct sbxfi *chip = snd_pcm_substream_chip(substream); struct sbxfi_port *port = substream->runtime->private_data; - sbxfi_cleanup_play_mapper(chip, port); sbxfi_port_free(chip, port); return 0; } @@ -1379,6 +1366,7 @@ static int sbxfi_pcm_hw_params(struct snd_pcm_substream *substream, unsigned int bytes = params_buffer_bytes(hw_params); int err; + sbxfi_cleanup_play_mapper(chip, port); sbxfi_clear_tlb(chip, port); err = snd_pcm_lib_malloc_pages(substream, bytes); if (err < 0) @@ -1396,6 +1384,7 @@ static int sbxfi_pcm_hw_free(struct snd_pcm_substream *substream) struct sbxfi *chip = snd_pcm_substream_chip(substream); struct sbxfi_port *port = substream->runtime->private_data; + sbxfi_cleanup_play_mapper(chip, port); sbxfi_clear_tlb(chip, port); return snd_pcm_lib_free_pages(substream); }